/* ===== 全局样式 ===== */
* { box-sizing: border-box; margin: 0; padding: 0; }
body { font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'PingFang SC', 'Hiragino Sans GB', 'Microsoft YaHei', sans-serif; color: #1a1a2e; background: #f8f9fa; min-height: 100vh; }
a { text-decoration: none; color: inherit; }
img { max-width: 100%; }

/* ===== 颜色变量 ===== */
:root {
  --primary: #ff4757;
  --primary-dark: #e8354a;
  --primary-light: #fff0f2;
  --accent: #2d3a8c;
  --text: #1a1a2e;
  --text-secondary: #6b7280;
  --border: #e5e7eb;
  --bg: #f8f9fa;
  --white: #ffffff;
  --success: #10b981;
  --warning: #f59e0b;
  --danger: #ef4444;
  --shadow: 0 2px 12px rgba(0,0,0,.08);
  --radius: 12px;
}

/* ===== 导航栏 ===== */
.navbar {
  background: linear-gradient(135deg, #1a1a2e 0%, #16213e 50%, #0f3460 100%);
  padding: 0 24px;
  position: sticky; top: 0; z-index: 1000;
  box-shadow: 0 2px 20px rgba(0,0,0,.3);
}
.navbar-inner {
  max-width: 1280px; margin: 0 auto;
  display: flex; align-items: center; height: 64px; gap: 24px;
}
.logo {
  font-size: 22px; font-weight: 800; color: var(--white);
  display: flex; align-items: center; gap: 8px; white-space: nowrap;
}
.logo span { color: var(--primary); }
.search-bar {
  flex: 1; max-width: 480px;
  display: flex; background: rgba(255,255,255,.12); border-radius: 24px; overflow: hidden;
  border: 1px solid rgba(255,255,255,.2); transition: all .3s;
}
.search-bar:focus-within { background: rgba(255,255,255,.2); border-color: var(--primary); }
.search-bar input {
  flex: 1; border: none; background: transparent; padding: 10px 16px;
  color: var(--white); font-size: 14px; outline: none;
}
.search-bar input::placeholder { color: rgba(255,255,255,.5); }
.search-bar button {
  background: var(--primary); border: none; padding: 10px 20px;
  color: var(--white); cursor: pointer; font-size: 16px; transition: background .2s;
}
.search-bar button:hover { background: var(--primary-dark); }
.nav-links { display: flex; align-items: center; gap: 20px; margin-left: auto; }
.nav-links a { color: rgba(255,255,255,.85); font-size: 14px; transition: color .2s; white-space: nowrap; }
.nav-links a:hover { color: var(--white); }
.cart-link { position: relative; }
.cart-badge {
  position: absolute; top: -8px; right: -10px;
  background: var(--primary); color: var(--white); font-size: 11px;
  border-radius: 10px; padding: 1px 5px; min-width: 18px; text-align: center;
}
.nav-avatar { width: 28px; height: 28px; border-radius: 50%; object-fit: cover; vertical-align: middle; margin-right: 4px; }
.nav-user { display: flex; align-items: center; }

/* ===== 分类导航条 ===== */
.category-bar {
  background: var(--white); border-bottom: 1px solid var(--border);
  padding: 0 24px;
}
.category-bar-inner {
  max-width: 1280px; margin: 0 auto;
  display: flex; gap: 8px; overflow-x: auto; scrollbar-width: none;
}
.category-bar-inner::-webkit-scrollbar { display: none; }
.category-bar a {
  white-space: nowrap; padding: 12px 16px; font-size: 14px; color: var(--text-secondary);
  border-bottom: 2px solid transparent; transition: all .2s; font-weight: 500;
}
.category-bar a:hover, .category-bar a.active { color: var(--primary); border-bottom-color: var(--primary); }

/* ===== 容器 ===== */
.container { max-width: 1280px; margin: 0 auto; padding: 0 24px; }

/* ===== 商品卡片 ===== */
.products-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 20px; padding: 20px 0;
}
.product-card {
  background: var(--white); border-radius: var(--radius);
  overflow: hidden; box-shadow: var(--shadow); transition: all .3s; cursor: pointer;
  border: 1px solid var(--border);
}
.product-card:hover {
  transform: translateY(-4px); box-shadow: 0 12px 32px rgba(0,0,0,.12);
  border-color: var(--primary);
}
.product-card img {
  width: 100%; height: 200px; object-fit: cover; transition: transform .4s;
}
.product-card:hover img { transform: scale(1.05); }
.product-info { padding: 14px; }
.product-name { font-size: 14px; font-weight: 600; color: var(--text); line-height: 1.4; margin-bottom: 6px; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.product-sub { font-size: 12px; color: var(--text-secondary); margin-bottom: 10px; display: -webkit-box; -webkit-line-clamp: 1; -webkit-box-orient: vertical; overflow: hidden; }
.product-price { display: flex; align-items: baseline; gap: 8px; margin-bottom: 10px; }
.price-current { font-size: 20px; font-weight: 700; color: var(--primary); }
.price-original { font-size: 13px; color: var(--text-secondary); text-decoration: line-through; }
.btn-cart {
  width: 100%; padding: 8px; background: var(--primary); color: var(--white);
  border: none; border-radius: 8px; cursor: pointer; font-size: 13px; font-weight: 600;
  transition: background .2s;
}
.btn-cart:hover { background: var(--primary-dark); }
.badge-tag {
  display: inline-block; font-size: 11px; padding: 2px 6px; border-radius: 4px;
  font-weight: 600; margin-bottom: 6px;
}
.badge-hot { background: #fff0f0; color: var(--primary); }
.badge-new { background: #f0fff4; color: var(--success); }

/* ===== Banner ===== */
.banner { width: 100%; height: 420px; position: relative; overflow: hidden; border-radius: 0; }
.banner-slide { position: absolute; width: 100%; height: 100%; transition: opacity .6s; opacity: 0; }
.banner-slide.active { opacity: 1; }
.banner-slide img { width: 100%; height: 100%; object-fit: cover; }
.banner-slide .caption {
  position: absolute; bottom: 0; left: 0; right: 0;
  background: linear-gradient(transparent, rgba(0,0,0,.6));
  padding: 40px 60px 30px; color: var(--white);
}
.caption h2 { font-size: 32px; margin-bottom: 8px; }
.caption p { font-size: 16px; opacity: .85; }
.banner-dots {
  position: absolute; bottom: 20px; right: 30px;
  display: flex; gap: 8px;
}
.banner-dot {
  width: 8px; height: 8px; border-radius: 50%;
  background: rgba(255,255,255,.5); cursor: pointer; transition: all .3s;
}
.banner-dot.active { background: var(--white); width: 24px; border-radius: 4px; }

/* ===== 区块标题 ===== */
.section { padding: 32px 0; }
.section-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 20px; }
.section-title { font-size: 22px; font-weight: 700; color: var(--text); display: flex; align-items: center; gap: 10px; }
.section-title::before { content: ''; width: 4px; height: 22px; background: var(--primary); border-radius: 2px; display: block; }
.section-more { color: var(--primary); font-size: 14px; }

/* ===== 按钮 ===== */
.btn { padding: 10px 24px; border-radius: 8px; border: none; cursor: pointer; font-size: 14px; font-weight: 600; transition: all .2s; display: inline-flex; align-items: center; gap: 6px; }
.btn-primary { background: var(--primary); color: var(--white); }
.btn-primary:hover { background: var(--primary-dark); transform: translateY(-1px); }
.btn-outline { background: transparent; color: var(--primary); border: 1.5px solid var(--primary); }
.btn-outline:hover { background: var(--primary-light); }
.btn-lg { padding: 14px 36px; font-size: 16px; border-radius: 10px; }
.btn-block { width: 100%; justify-content: center; }
.btn-sm { padding: 6px 16px; font-size: 13px; }
.btn-gray { background: #f3f4f6; color: var(--text-secondary); }
.btn-gray:hover { background: #e5e7eb; }
.btn-danger { background: var(--danger); color: var(--white); }

/* ===== 表单 ===== */
.form-group { margin-bottom: 18px; }
.form-label { display: block; font-size: 14px; font-weight: 600; color: var(--text); margin-bottom: 6px; }
.form-input {
  width: 100%; padding: 12px 16px; border: 1.5px solid var(--border);
  border-radius: 10px; font-size: 14px; outline: none; transition: border .2s; background: var(--white);
}
.form-input:focus { border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-light); }
.form-input::placeholder { color: #9ca3af; }

/* ===== Toast ===== */
.toast {
  position: fixed; top: 80px; left: 50%; transform: translateX(-50%) translateY(-20px);
  background: #1a1a2e; color: var(--white); padding: 12px 24px; border-radius: 10px;
  font-size: 14px; z-index: 9999; opacity: 0; transition: all .3s; white-space: nowrap;
  box-shadow: 0 8px 24px rgba(0,0,0,.2);
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
.toast.toast-error { background: var(--danger); }
.toast.toast-success { background: var(--success); }
.toast.toast-warning { background: var(--warning); }

/* ===== 分页 ===== */
.pagination { display: flex; gap: 8px; justify-content: center; padding: 24px 0; flex-wrap: wrap; }
.page-btn {
  width: 36px; height: 36px; border-radius: 8px; border: 1.5px solid var(--border);
  background: var(--white); cursor: pointer; font-size: 14px; transition: all .2s;
  display: flex; align-items: center; justify-content: center;
}
.page-btn:hover, .page-btn.active { background: var(--primary); color: var(--white); border-color: var(--primary); }

/* ===== 徽章 ===== */
.status-badge {
  display: inline-block; padding: 3px 10px; border-radius: 20px; font-size: 12px; font-weight: 600;
}
.status-0 { background: #fff7ed; color: #f59e0b; }
.status-1 { background: #eff6ff; color: #3b82f6; }
.status-2 { background: #f0fdf4; color: #10b981; }
.status-3 { background: #f3f4f6; color: #6b7280; }
.status-4 { background: #fef2f2; color: #ef4444; }
.status-5 { background: #fdf4ff; color: #a855f7; }

/* ===== 空状态 ===== */
.empty-state { text-align: center; padding: 60px 24px; color: var(--text-secondary); }
.empty-state .icon { font-size: 64px; margin-bottom: 16px; display: block; }
.empty-state p { font-size: 16px; margin-bottom: 20px; }

/* ===== 卡片 ===== */
.card { background: var(--white); border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden; }
.card-header { padding: 16px 20px; border-bottom: 1px solid var(--border); font-weight: 700; font-size: 16px; }
.card-body { padding: 20px; }

/* ===== Skeleton 加载动画 ===== */
.skeleton { background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%); background-size: 200% 100%; animation: skeleton 1.5s infinite; border-radius: 4px; }
@keyframes skeleton { 0% { background-position: 200% 0; } 100% { background-position: -200% 0; } }

/* ===== 响应式 ===== */
@media (max-width: 768px) {
  .search-bar { display: none; }
  .products-grid { grid-template-columns: repeat(2, 1fr); gap: 12px; }
  .banner { height: 220px; }
  .caption h2 { font-size: 20px; }
  .container { padding: 0 12px; }
  .navbar { padding: 0 12px; }
  .navbar-inner { gap: 12px; }
}
