/* ========== 全局变量 & 基础 ========== */
:root {
  --primary: #e74c3c;
  --primary-dark: #c0392b;
  --primary-light: #ff6b6b;
  --green: #27ae60;
  --green-dark: #1e8449;
  --orange: #f39c12;
  --gold: #f1c40f;
  --bg: #f5f5f5;
  --card-bg: #ffffff;
  --text: #333333;
  --text-light: #999999;
  --text-dark: #1a1a1a;
  --border: #e8e8e8;
  --shadow: 0 2px 12px rgba(0,0,0,0.08);
  --shadow-lg: 0 8px 30px rgba(0,0,0,0.12);
  --radius: 12px;
  --radius-sm: 8px;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

body {
  font-family: 'Noto Sans SC', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  background: var(--bg);
  color: var(--text);
  -webkit-font-smoothing: antialiased;
  padding-bottom: 70px;
}

/* ========== 顶部 ========== */
.header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 100;
  background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
}
.header-content { max-width: 768px; margin: 0 auto; }
.header-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
}
.logo {
  color: white;
  font-size: 20px;
  font-weight: 700;
}
.cart-btn {
  background: rgba(255,255,255,0.2);
  border: none;
  color: white;
  font-size: 22px;
  padding: 6px 12px;
  border-radius: 20px;
  cursor: pointer;
  position: relative;
  backdrop-filter: blur(10px);
}
.cart-badge {
  position: absolute;
  top: -4px;
  right: -4px;
  background: var(--gold);
  color: var(--text-dark);
  font-size: 11px;
  font-weight: 700;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
}
.search-bar {
  display: flex;
  align-items: center;
  background: rgba(255,255,255,0.2);
  margin: 0 16px 12px;
  padding: 8px 16px;
  border-radius: 20px;
  backdrop-filter: blur(10px);
}
.search-icon { margin-right: 8px; }
.search-bar input {
  border: none;
  background: transparent;
  color: white;
  font-size: 14px;
  flex: 1;
  outline: none;
}
.search-bar input::placeholder { color: rgba(255,255,255,0.7); }

/* ========== Banner ========== */
.banner-section {
  margin-top: 110px;
  position: relative;
  overflow: hidden;
  height: 220px;
}
.banner-slider {
  display: flex;
  transition: transform 0.5s ease;
  height: 100%;
}
.banner-slide {
  min-width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 30px;
  position: relative;
}
.banner-text {
  color: white;
  text-align: left;
  max-width: 55%;
  z-index: 2;
}
.banner-tag {
  display: inline-block;
  background: rgba(255,255,255,0.25);
  padding: 4px 12px;
  border-radius: 12px;
  font-size: 12px;
  margin-bottom: 12px;
  backdrop-filter: blur(10px);
}
.banner-text h1 {
  font-size: 28px;
  line-height: 1.3;
  margin-bottom: 10px;
  text-shadow: 0 2px 10px rgba(0,0,0,0.2);
}
.banner-text p {
  font-size: 14px;
  opacity: 0.9;
  margin-bottom: 16px;
}
.banner-cta {
  background: white;
  color: var(--primary);
  border: none;
  padding: 10px 24px;
  border-radius: 20px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  box-shadow: 0 4px 15px rgba(0,0,0,0.2);
}
.banner-image {
  font-size: 100px;
  position: absolute;
  right: 30px;
  opacity: 0.3;
}
.banner-dots {
  position: absolute;
  bottom: 12px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  gap: 8px;
}
.banner-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: rgba(255,255,255,0.4);
  cursor: pointer;
}
.banner-dot.active {
  background: white;
  width: 24px;
  border-radius: 4px;
}

/* ========== 分类导航 ========== */
.category-nav {
  background: white;
  padding: 12px 0;
  position: sticky;
  top: 110px;
  z-index: 50;
  box-shadow: 0 2px 8px rgba(0,0,0,0.04);
}
.category-scroll {
  display: flex;
  overflow-x: auto;
  gap: 8px;
  padding: 0 16px;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}
.category-scroll::-webkit-scrollbar { display: none; }
.category-item {
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 8px 12px;
  border-radius: 12px;
  cursor: pointer;
  transition: all 0.3s;
  min-width: 64px;
}
.category-item.active {
  background: linear-gradient(135deg, var(--primary), var(--primary-light));
}
.category-item.active span { color: white; }
.cat-icon { font-size: 24px; margin-bottom: 4px; }
.category-item span { font-size: 11px; color: var(--text-light); white-space: nowrap; }

/* ========== 限时特惠 ========== */
.flash-sale {
  margin: 16px;
  background: linear-gradient(135deg, #fff5f5 0%, #ffe8e8 100%);
  border-radius: var(--radius);
  padding: 16px;
}
.section-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
}
.header-left { display: flex; align-items: center; gap: 8px; }
.flash-icon { font-size: 20px; }
.section-header h2 { font-size: 18px; color: var(--primary); }
.countdown {
  display: flex;
  align-items: center;
  gap: 6px;
  background: var(--primary);
  color: white;
  padding: 4px 10px;
  border-radius: 12px;
  font-size: 12px;
}
.cd-time { font-weight: 700; font-variant-numeric: tabular-nums; }
.flash-products {
  display: flex;
  overflow-x: auto;
  gap: 12px;
  padding-bottom: 8px;
  scrollbar-width: none;
}
.flash-products::-webkit-scrollbar { display: none; }
.flash-card {
  flex-shrink: 0;
  width: 140px;
  background: white;
  border-radius: var(--radius-sm);
  overflow: hidden;
  box-shadow: var(--shadow);
}
.flash-img {
  height: 140px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 60px;
  background: #fafafa;
  position: relative;
}
.flash-tag {
  position: absolute;
  top: 8px;
  left: 8px;
  background: var(--primary);
  color: white;
  font-size: 10px;
  padding: 2px 8px;
  border-radius: 8px;
}
.flash-info { padding: 8px; }
.flash-name { font-size: 12px; margin-bottom: 4px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.flash-price { color: var(--primary); font-weight: 700; font-size: 16px; }
.flash-original { color: var(--text-light); font-size: 11px; text-decoration: line-through; margin-left: 4px; }

/* ========== 商品列表 ========== */
.products-section { padding: 0 16px; }
.products-section .section-header {
  margin-bottom: 16px;
  background: white;
  padding: 16px;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}
.sort-options { display: flex; gap: 8px; }
.sort-btn {
  border: 1px solid var(--border);
  background: white;
  padding: 4px 12px;
  border-radius: 16px;
  font-size: 12px;
  cursor: pointer;
  transition: all 0.3s;
}
.sort-btn.active {
  background: var(--primary);
  color: white;
  border-color: var(--primary);
}
.products-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
  padding-bottom: 16px;
}

/* ========== 商品卡片 ========== */
.product-card {
  background: white;
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow);
  cursor: pointer;
  transition: transform 0.3s, box-shadow 0.3s;
  position: relative;
}
.product-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-lg);
}
.product-img {
  height: 160px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 72px;
  background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
  position: relative;
}
.product-tag {
  position: absolute;
  top: 8px;
  right: 8px;
  background: linear-gradient(135deg, var(--primary), var(--primary-light));
  color: white;
  font-size: 10px;
  padding: 3px 8px;
  border-radius: 8px;
  font-weight: 600;
}
.product-info { padding: 10px; }
.product-name {
  font-size: 14px;
  font-weight: 500;
  margin-bottom: 4px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  line-height: 1.4;
}
.product-tags {
  display: flex;
  gap: 4px;
  margin-bottom: 6px;
  flex-wrap: wrap;
}
.product-tag-item {
  font-size: 10px;
  color: var(--primary);
  background: #fff0f0;
  padding: 1px 6px;
  border-radius: 4px;
}
.product-bottom {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
}
.product-price {
  color: var(--primary);
  font-weight: 700;
  font-size: 20px;
  line-height: 1;
}
.product-price .yen { font-size: 13px; }
.product-original-price {
  font-size: 11px;
  color: var(--text-light);
  text-decoration: line-through;
}
.product-sales {
  font-size: 10px;
  color: var(--text-light);
  text-align: right;
}
.add-cart-btn {
  position: absolute;
  bottom: 10px;
  right: 10px;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--primary), var(--primary-light));
  color: white;
  border: none;
  font-size: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  box-shadow: 0 2px 8px rgba(231,76,60,0.4);
  transition: transform 0.2s;
}
.add-cart-btn:active { transform: scale(0.9); }

/* ========== 关于我们 ========== */
.about-section {
  margin: 20px 16px;
  background: white;
  border-radius: var(--radius);
  padding: 20px 16px;
  box-shadow: var(--shadow);
}
.about-header h2 { font-size: 18px; text-align: center; margin-bottom: 16px; }
.about-content {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
}
.about-card {
  background: #f8f9fa;
  border-radius: var(--radius-sm);
  padding: 16px 12px;
  text-align: center;
}
.about-icon { font-size: 36px; margin-bottom: 8px; }
.about-card h3 { font-size: 14px; margin-bottom: 6px; color: var(--primary); }
.about-card p { font-size: 12px; color: var(--text-light); line-height: 1.6; }

/* ========== 底部 ========== */
.footer {
  background: var(--text-dark);
  color: rgba(255,255,255,0.6);
  text-align: center;
  padding: 30px 16px;
}
.footer-links {
  display: flex;
  justify-content: center;
  gap: 20px;
  margin-bottom: 12px;
}
.footer-links a { color: rgba(255,255,255,0.7); text-decoration: none; font-size: 13px; }
.footer p { font-size: 12px; margin-bottom: 4px; }
.footer-sub { font-size: 11px; }

/* ========== 弹窗 ========== */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0,0,0,0.5);
  z-index: 200;
  display: none;
  align-items: center;
  justify-content: center;
  backdrop-filter: blur(4px);
}
.modal-overlay.active { display: flex; }
.modal-content {
  background: white;
  border-radius: 16px;
  width: 92%;
  max-width: 500px;
  max-height: 85vh;
  overflow-y: auto;
  position: relative;
  animation: modalIn 0.3s ease;
}
@keyframes modalIn {
  from { transform: scale(0.9); opacity: 0; }
  to { transform: scale(1); opacity: 1; }
}
.modal-close {
  position: absolute;
  top: 12px;
  right: 12px;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: #f0f0f0;
  border: none;
  font-size: 16px;
  cursor: pointer;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* 商品详情 */
#modalBody { padding: 20px; }
.detail-img {
  height: 250px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 120px;
  background: linear-gradient(135deg, #f8f9fa, #e9ecef);
  border-radius: var(--radius);
  margin-bottom: 16px;
}
.detail-name { font-size: 20px; font-weight: 700; margin-bottom: 8px; }
.detail-desc { font-size: 14px; color: var(--text-light); line-height: 1.6; margin-bottom: 12px; }
.detail-price-row { display: flex; align-items: baseline; gap: 12px; margin-bottom: 16px; }
.detail-price { color: var(--primary); font-size: 28px; font-weight: 700; }
.detail-original { color: var(--text-light); text-decoration: line-through; font-size: 16px; }
.detail-discount {
  background: var(--primary);
  color: white;
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 12px;
}
.detail-specs { margin-bottom: 16px; }
.spec-row {
  display: flex;
  padding: 8px 0;
  border-bottom: 1px solid var(--border);
  font-size: 13px;
}
.spec-label { color: var(--text-light); width: 80px; flex-shrink: 0; }
.detail-qty {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-bottom: 16px;
}
.qty-btn {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: 1px solid var(--border);
  background: white;
  font-size: 18px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}
.qty-num { font-size: 18px; font-weight: 600; min-width: 30px; text-align: center; }
.detail-actions { display: flex; gap: 12px; margin-top: 16px; }
.detail-actions .btn-buy {
  flex: 1;
  padding: 14px;
  border: none;
  border-radius: 24px;
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
}
.btn-cart {
  background: linear-gradient(135deg, var(--orange), #e67e22);
  color: white;
}
.btn-buy-now {
  background: linear-gradient(135deg, var(--primary), var(--primary-light));
  color: white;
}

/* 购物车 */
.cart-modal { max-width: 420px; }
.cart-header { padding: 16px 20px; border-bottom: 1px solid var(--border); }
.cart-header h3 { font-size: 18px; }
.cart-body { padding: 16px 20px; min-height: 100px; }
.cart-item {
  display: flex;
  gap: 12px;
  padding: 12px 0;
  border-bottom: 1px solid var(--border);
}
.cart-item-img {
  width: 64px;
  height: 64px;
  border-radius: 8px;
  background: #f5f5f5;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 36px;
  flex-shrink: 0;
}
.cart-item-info { flex: 1; }
.cart-item-name { font-size: 14px; font-weight: 500; margin-bottom: 4px; }
.cart-item-price { color: var(--primary); font-weight: 700; }
.cart-item-controls { display: flex; align-items: center; gap: 12px; margin-top: 8px; }
.cart-qty-btn {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  border: 1px solid var(--border);
  background: white;
  font-size: 16px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}
.cart-qty { font-weight: 600; }
.cart-empty {
  text-align: center;
  padding: 40px 20px;
  color: var(--text-light);
}
.cart-empty-icon { font-size: 60px; margin-bottom: 12px; }
.cart-footer {
  padding: 16px 20px;
  border-top: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.cart-total { font-size: 14px; }
.cart-total-price { font-size: 24px; color: var(--primary); font-weight: 700; }
.checkout-btn {
  padding: 12px 32px;
  background: linear-gradient(135deg, var(--primary), var(--primary-light));
  color: white;
  border: none;
  border-radius: 24px;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
}

/* 结算 */
.checkout-modal { max-width: 440px; }
.checkout-header { padding: 16px 20px; border-bottom: 1px solid var(--border); }
.checkout-body { padding: 20px; }
.form-group { margin-bottom: 16px; }
.form-group label { display: block; font-size: 14px; font-weight: 500; margin-bottom: 6px; }
.form-group input, .form-group textarea {
  width: 100%;
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 14px;
  outline: none;
  transition: border-color 0.3s;
}
.form-group input:focus, .form-group textarea:focus { border-color: var(--primary); }
.payment-options h4 { font-size: 14px; margin-bottom: 10px; }
.payment-option {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  margin-bottom: 8px;
  cursor: pointer;
  transition: all 0.3s;
}
.payment-option:has(input:checked) {
  border-color: var(--primary);
  background: #fff5f5;
}
.payment-option input { display: none; }
.pay-icon { font-size: 20px; }
.order-summary {
  background: #f8f9fa;
  padding: 16px;
  border-radius: var(--radius-sm);
  margin-bottom: 16px;
}
.summary-row {
  display: flex;
  justify-content: space-between;
  padding: 4px 0;
  font-size: 13px;
}
.summary-total {
  display: flex;
  justify-content: space-between;
  padding-top: 8px;
  margin-top: 8px;
  border-top: 1px solid var(--border);
  font-weight: 700;
  font-size: 16px;
}
.summary-total .amount { color: var(--primary); font-size: 22px; }
.pay-btn {
  width: 100%;
  padding: 16px;
  background: linear-gradient(135deg, var(--green), var(--green-dark));
  color: white;
  border: none;
  border-radius: 24px;
  font-size: 17px;
  font-weight: 600;
  cursor: pointer;
  box-shadow: 0 4px 15px rgba(39,174,96,0.4);
}

/* 订单成功 */
.success-modal { text-align: center; padding: 40px 30px; }
.success-icon { font-size: 60px; margin-bottom: 16px; }
.success-modal h3 { font-size: 20px; margin-bottom: 8px; color: var(--green); }
.order-no { font-size: 16px; color: var(--text-light); margin-bottom: 8px; }
.success-tip { font-size: 14px; color: var(--text-light); margin-bottom: 20px; }
.confirm-btn {
  padding: 12px 40px;
  background: var(--green);
  color: white;
  border: none;
  border-radius: 24px;
  font-size: 15px;
  cursor: pointer;
}

/* Toast */
.toast {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  background: rgba(0,0,0,0.75);
  color: white;
  padding: 12px 24px;
  border-radius: 24px;
  font-size: 14px;
  z-index: 999;
  opacity: 0;
  transition: opacity 0.3s;
  pointer-events: none;
}
.toast.show { opacity: 1; }

/* Loading */
.loading {
  grid-column: 1 / -1;
  text-align: center;
  padding: 40px;
  color: var(--text-light);
}
.spinner {
  width: 36px;
  height: 36px;
  border: 3px solid var(--border);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  margin: 0 auto 12px;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* 响应式 */
@media (min-width: 768px) {
  .products-grid { grid-template-columns: repeat(3, 1fr); }
  .about-content { grid-template-columns: repeat(4, 1fr); }
}
@media (min-width: 1024px) {
  .products-grid { grid-template-columns: repeat(4, 1fr); }
}
