/* ====== 全局重置 ====== */
* { margin: 0; padding: 0; box-sizing: border-box; }
body {
  font-family: -apple-system, "PingFang SC", "Microsoft YaHei", "Helvetica Neue", Arial, sans-serif;
  background: #f5f6fa;
  color: #303133;
  font-size: 14px;
  line-height: 1.6;
}
a { color: #1890ff; text-decoration: none; }
a:hover { color: #40a9ff; }
img { max-width: 100%; display: block; }
button { cursor: pointer; font-family: inherit; }
ul, ol { list-style: none; }

/* ====== 容器 ====== */
.container { width: 1200px; max-width: 96%; margin: 0 auto; }

/* ====== 顶部导航 ====== */
.topbar {
  background: #fafafa;
  border-bottom: 1px solid #eaeaea;
  height: 34px;
  line-height: 34px;
  font-size: 12px;
  color: #909399;
}
.topbar .container { display: flex; justify-content: space-between; }
.topbar a { color: #606266; margin: 0 6px; }

/* ====== 主导航 ====== */
.header {
  background: #fff;
  border-bottom: 1px solid #eaeaea;
}
.header-inner {
  display: flex; align-items: center; height: 70px;
}
.logo { font-size: 22px; font-weight: 700; color: #1890ff; margin-right: 40px; }
.logo span { color: #303133; }
.nav { display: flex; gap: 8px; flex: 1; }
.nav a {
  padding: 0 18px; line-height: 70px; color: #303133; font-size: 15px;
  border-bottom: 2px solid transparent; white-space: nowrap;
}
.nav a:hover, .nav a.active { color: #1890ff; border-bottom-color: #1890ff; }

/* 分类下拉菜单 */
.nav-dropdown { position: relative; display: inline-block; }
.nav-drop-trigger { cursor: pointer; }
.nav-drop-trigger.active { color: #1890ff; border-bottom-color: transparent; }
.nav-drop-menu {
  display: none; position: absolute; top: 70px; left: 0; z-index: 100;
  background: #fff; min-width: 160px; box-shadow: 0 4px 12px rgba(0,0,0,.12);
  border: 1px solid #ebeef5; border-top: 2px solid #1890ff;
}
.nav-drop-menu a {
  display: block; padding: 0 20px; line-height: 42px; color: #303133;
  font-size: 14px; border-bottom: 1px solid #f5f5f5; white-space: nowrap;
  border-bottom-color: #f5f5f5;
}
.nav-drop-menu a:last-child { border-bottom: none; }
.nav-drop-menu a:hover { background: #f0f7ff; color: #1890ff; }
.nav-drop-menu a.active { background: #1890ff; color: #fff; }
.nav-dropdown:hover .nav-drop-menu { display: block; }
.header-actions { display: flex; align-items: center; gap: 12px; }

/* ====== 搜索框 ====== */
.search {
  display: flex; width: 320px; border: 2px solid #1890ff; border-radius: 2px;
}
.search input {
  flex: 1; border: 0; padding: 8px 12px; outline: none; font-size: 13px;
}
.search button {
  background: #1890ff; color: #fff; border: 0; padding: 0 18px; font-size: 14px;
}

/* ====== 主内容区 ====== */
.main { padding: 20px 0 40px; }

/* ====== 卡片 ====== */
.card {
  background: #fff; border-radius: 4px; padding: 20px;
  box-shadow: 0 1px 4px rgba(0,0,0,.04);
}
.card-title {
  font-size: 16px; font-weight: 600; padding-bottom: 14px;
  margin-bottom: 16px; border-bottom: 1px solid #ebeef5;
}

/* ====== 商品网格 ====== */
.product-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 16px;
}
.product-card {
  background: #fff; border-radius: 4px; overflow: hidden;
  border: 1px solid #ebeef5; transition: box-shadow .2s;
}
.product-card:hover { box-shadow: 0 4px 16px rgba(0,0,0,.08); }
.product-card .thumb {
  height: 160px; background: #f5f7fa; display: flex; align-items: center;
  justify-content: center; color: #c0c4cc; font-size: 12px; overflow: hidden;
}
.product-card .thumb img { width: 100%; height: 100%; object-fit: cover; }
.product-card .pname {
  padding: 10px 12px 4px; font-size: 13px; color: #303133;
  height: 40px; overflow: hidden; line-height: 1.4;
}
.product-card .price {
  padding: 0 12px 10px; color: #f5222d; font-size: 18px; font-weight: 700;
}
.product-card .price small { font-size: 12px; }
.product-card .meta {
  padding: 0 12px 12px; font-size: 12px; color: #909399;
  display: flex; justify-content: space-between;
}

/* ====== 表单 ====== */
.form-group { margin-bottom: 18px; }
.form-group label { display: block; margin-bottom: 6px; color: #606266; font-size: 13px; }
.form-group input, .form-group textarea, .form-group select {
  width: 100%; padding: 8px 12px; border: 1px solid #dcdfe6; border-radius: 4px;
  font-size: 14px; outline: none; transition: border-color .2s;
}
.form-group input:focus, .form-group textarea:focus, .form-group select:focus {
  border-color: #1890ff;
}
.btn {
  display: inline-block; padding: 8px 20px; border-radius: 4px; border: 1px solid #dcdfe6;
  background: #fff; color: #606266; font-size: 14px; text-align: center; cursor: pointer;
}
.btn-primary { background: #1890ff; color: #fff; border-color: #1890ff; }
.btn-primary:hover { background: #40a9ff; border-color: #40a9ff; color: #fff; }
.btn-danger { background: #f5222d; color: #fff; border-color: #f5222d; }
.btn-danger:hover { background: #ff4d4f; border-color: #ff4d4f; color: #fff; }
.btn-success { background: #52c41a; color: #fff; border-color: #52c41a; }
.btn-warning { background: #faad14; color: #fff; border-color: #faad14; }
.btn-sm { padding: 4px 12px; font-size: 12px; }
.btn-lg { padding: 12px 36px; font-size: 16px; }

/* ====== 表格 ====== */
.table { width: 100%; border-collapse: collapse; font-size: 13px; }
.table th, .table td { padding: 12px 10px; text-align: left; border-bottom: 1px solid #ebeef5; }
.table th { background: #fafafa; color: #606266; font-weight: 600; }
.table tr:hover td { background: #f5f7fa; }

/* ====== 徽章 ====== */
.badge {
  display: inline-block; padding: 2px 8px; border-radius: 10px; font-size: 12px; color: #fff;
}

/* ====== 提示 ====== */
.alert { padding: 12px 16px; border-radius: 4px; margin-bottom: 16px; font-size: 13px; }
.alert-info { background: #e6f7ff; border: 1px solid #91d5ff; color: #0050b3; }
.alert-success { background: #f6ffed; border: 1px solid #b7eb8f; color: #389e0d; }
.alert-warning { background: #fffbe6; border: 1px solid #ffe58f; color: #d48806; }
.alert-error { background: #fff1f0; border: 1px solid #ffa39e; color: #cf1322; }

/* ====== 分页 ====== */
.pagination { text-align: center; margin-top: 20px; }
.pagination a, .pagination span {
  display: inline-block; padding: 6px 12px; margin: 0 3px; border: 1px solid #dcdfe6;
  border-radius: 4px; color: #606266;
}
.pagination .current { background: #1890ff; color: #fff; border-color: #1890ff; }

/* ====== 底部 ====== */
.footer {
  background: #fff; border-top: 1px solid #eaeaea; padding: 30px 0;
  margin-top: 40px; color: #909399; font-size: 13px; text-align: center;
}
.footer a { color: #606266; margin: 0 10px; }
.footer .icp { margin-top: 10px; color: #909399; }

/* ====== 商品详情 ====== */
.product-detail { display: grid; grid-template-columns: 400px 1fr; gap: 30px; }
.product-detail .thumb {
  height: 400px; background: #f5f7fa; border-radius: 4px; display: flex;
  align-items: center; justify-content: center; color: #c0c4cc;
}
.product-detail .info .name { font-size: 22px; margin-bottom: 10px; }
.product-detail .info .desc { color: #909399; margin: 16px 0; line-height: 1.8; }
.product-detail .price-box { background: #fff7f7; padding: 20px; border-radius: 4px; margin: 16px 0; }
.product-detail .price-box .p { color: #f5222d; font-size: 30px; font-weight: 700; }
.product-detail .price-box .p small { font-size: 16px; }
.product-detail .price-box .o { color: #909399; text-decoration: line-through; margin-left: 12px; }

/* ====== 登录/注册 ====== */
.auth-box { width: 380px; margin: 50px auto; }
.auth-box .card-title { text-align: center; font-size: 20px; }

/* ====== 订单确认 ====== */
.order-confirm { max-width: 900px; margin: 0 auto; }
.order-row { display: flex; justify-content: space-between; padding: 12px 0; border-bottom: 1px dashed #eee; }

/* ====== 卡密展示 ====== */
.cardkey-box {
  background: #f6ffed; border: 1px dashed #b7eb8f; padding: 20px; border-radius: 4px;
  margin: 16px 0;
}
.cardkey-box .label { color: #52c41a; font-size: 13px; margin-bottom: 8px; }
.cardkey-box code {
  display: block; background: #fff; padding: 12px; border-radius: 4px; font-size: 16px;
  letter-spacing: 1px; word-break: break-all; color: #303133; border: 1px solid #eaeaea;
}

/* ====== 响应式 ====== */
@media (max-width: 900px) {
  .product-grid { grid-template-columns: repeat(2, 1fr); }
  .product-detail { grid-template-columns: 1fr; }
  .header-inner { flex-wrap: wrap; height: auto; padding: 10px 0; }
  .nav { width: 100%; }
  .nav a { line-height: 40px; }
  .search { width: 100%; }
}
