/* 托米外贸童装 - 官网样式 */
:root {
  --bg: #F5F0EB;
  --primary: #4A9B6F;
  --primary-dark: #3d8560;
  --accent: #5BB5E8;
  --text: #333;
  --text-light: #666;
  --text-muted: #999;
  --price: #E74C3C;
  --white: #fff;
  --radius: 12px;
  --shadow: 0 2px 12px rgba(0,0,0,0.06);
  --max-w: 1200px;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'PingFang SC', sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  min-height: 100vh;
}

a { color: inherit; text-decoration: none; }

img { max-width: 100%; display: block; }

.container { max-width: var(--max-w); margin: 0 auto; padding: 0 20px; }

/* Header */
.header {
  background: var(--white);
  box-shadow: var(--shadow);
  position: sticky;
  top: 0;
  z-index: 100;
}

.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 64px;
  max-width: var(--max-w);
  margin: 0 auto;
  padding: 0 20px;
}

.logo {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 20px;
  font-weight: 700;
  color: var(--primary);
}

.logo img { width: 40px; height: 40px; border-radius: 8px; object-fit: cover; }

.nav { display: flex; gap: 28px; }

.nav a {
  font-size: 15px;
  color: var(--text-light);
  transition: color .2s;
}

.nav a:hover, .nav a.active { color: var(--primary); font-weight: 600; }

.header-actions { display: flex; align-items: center; gap: 16px; }

.cart-btn {
  position: relative;
  background: none;
  border: none;
  cursor: pointer;
  font-size: 22px;
  padding: 4px;
}

.cart-badge {
  position: absolute;
  top: -4px;
  right: -8px;
  background: var(--price);
  color: #fff;
  font-size: 11px;
  min-width: 18px;
  height: 18px;
  border-radius: 9px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 4px;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 10px 24px;
  border-radius: 24px;
  border: none;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: all .2s;
}

.btn-primary {
  background: linear-gradient(135deg, var(--primary), #5BB5A0);
  color: #fff;
}

.btn-primary:hover { opacity: .9; transform: translateY(-1px); }

.btn-outline {
  background: transparent;
  border: 2px solid var(--primary);
  color: var(--primary);
}

.btn-block { width: 100%; }

/* Hero Banner */
.banner {
  position: relative;
  border-radius: var(--radius);
  overflow: hidden;
  margin: 24px 0;
  height: 360px;
  background: #ddd;
}

.banner img { width: 100%; height: 100%; object-fit: cover; }

.banner-dots {
  position: absolute;
  bottom: 16px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  gap: 8px;
}

.banner-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: rgba(255,255,255,.5);
  cursor: pointer;
}

.banner-dot.active { background: #fff; width: 24px; border-radius: 4px; }

/* Categories */
.section { margin: 32px 0; }

.section-title {
  font-size: 22px;
  font-weight: 700;
  margin-bottom: 20px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.category-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 16px;
}

.category-card {
  background: var(--white);
  border-radius: var(--radius);
  padding: 20px;
  text-align: center;
  box-shadow: var(--shadow);
  transition: transform .2s;
  cursor: pointer;
}

.category-card:hover { transform: translateY(-4px); }

.category-icon { font-size: 36px; margin-bottom: 8px; }

.category-name { font-size: 14px; color: var(--text-light); }

/* Product Grid */
.product-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 20px;
}

.product-card {
  background: var(--white);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow);
  transition: transform .2s;
  cursor: pointer;
}

.product-card:hover { transform: translateY(-4px); }

.product-img {
  width: 100%;
  aspect-ratio: 1;
  object-fit: cover;
  background: #eee;
}

.product-info { padding: 14px 16px 18px; }

.product-name {
  font-size: 14px;
  line-height: 1.4;
  height: 40px;
  overflow: hidden;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}

.product-tags { margin: 8px 0; display: flex; gap: 6px; flex-wrap: wrap; }

.tag {
  font-size: 11px;
  padding: 2px 8px;
  border-radius: 4px;
}

.tag-hot { background: #FFF0ED; color: var(--price); }
.tag-new { background: #EDF7F2; color: var(--primary); }

.product-bottom {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  margin-top: 10px;
}

.price { color: var(--price); font-weight: 700; font-size: 18px; }
.price small { font-size: 12px; }
.original-price { color: var(--text-muted); font-size: 12px; text-decoration: line-through; margin-left: 4px; }
.sales { font-size: 12px; color: var(--text-muted); }

/* Footer */
.footer {
  background: #2c3e50;
  color: rgba(255,255,255,.8);
  padding: 40px 0 24px;
  margin-top: 60px;
}

.footer-grid {
  display: grid;
  grid-template-columns: 2fr 1fr 1fr;
  gap: 40px;
  max-width: var(--max-w);
  margin: 0 auto;
  padding: 0 20px;
}

.footer h4 { color: #fff; margin-bottom: 12px; }

.footer p, .footer a { font-size: 14px; line-height: 2; color: rgba(255,255,255,.7); }

.footer a:hover { color: #fff; }

.footer-bottom {
  text-align: center;
  margin-top: 32px;
  padding-top: 20px;
  border-top: 1px solid rgba(255,255,255,.1);
  font-size: 13px;
  color: rgba(255,255,255,.5);
}

/* Product Detail */
.product-detail { display: grid; grid-template-columns: 1fr 1fr; gap: 40px; padding: 32px 0; }

.product-gallery { border-radius: var(--radius); overflow: hidden; background: #fff; }
.product-gallery img { width: 100%; aspect-ratio: 1; object-fit: cover; }

.product-meta h1 { font-size: 24px; margin-bottom: 12px; }
.product-desc { color: var(--text-light); margin: 16px 0; line-height: 1.8; }

.spec-group { margin: 20px 0; }
.spec-label { font-weight: 600; margin-bottom: 10px; display: block; }

.spec-options { display: flex; flex-wrap: wrap; gap: 10px; }

.spec-opt {
  padding: 8px 20px;
  border: 2px solid #e0e0e0;
  border-radius: 8px;
  cursor: pointer;
  font-size: 14px;
  transition: all .2s;
}

.spec-opt.active { border-color: var(--primary); color: var(--primary); background: #EDF7F2; }

.qty-control {
  display: inline-flex;
  align-items: center;
  border: 2px solid #e0e0e0;
  border-radius: 8px;
  overflow: hidden;
}

.qty-btn {
  width: 36px;
  height: 36px;
  border: none;
  background: #f5f5f5;
  cursor: pointer;
  font-size: 18px;
}

.qty-num { width: 48px; text-align: center; font-size: 16px; }

.detail-actions { display: flex; gap: 12px; margin-top: 28px; }
.detail-actions .btn { flex: 1; padding: 14px; font-size: 16px; }

/* Cart */
.cart-layout { display: grid; grid-template-columns: 1fr 320px; gap: 24px; padding: 32px 0; }

.cart-item {
  display: flex;
  gap: 16px;
  background: var(--white);
  border-radius: var(--radius);
  padding: 16px;
  margin-bottom: 12px;
  box-shadow: var(--shadow);
}

.cart-item img { width: 100px; height: 100px; border-radius: 8px; object-fit: cover; }
.cart-item-info { flex: 1; }
.cart-item-name { font-weight: 600; margin-bottom: 4px; }
.cart-item-spec { font-size: 13px; color: var(--text-muted); }

.cart-summary {
  background: var(--white);
  border-radius: var(--radius);
  padding: 24px;
  box-shadow: var(--shadow);
  height: fit-content;
  position: sticky;
  top: 88px;
}

.cart-summary h3 { margin-bottom: 16px; }
.summary-row { display: flex; justify-content: space-between; padding: 8px 0; font-size: 14px; color: var(--text-light); }
.summary-row.total { border-top: 2px solid #f0f0f0; margin-top: 8px; padding-top: 16px; font-size: 18px; font-weight: 700; color: var(--text); }

.empty-state {
  text-align: center;
  padding: 80px 20px;
  color: var(--text-muted);
}

.empty-state .icon { font-size: 64px; margin-bottom: 16px; }

/* Modal */
.modal-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.5);
  z-index: 200;
  align-items: center;
  justify-content: center;
}

.modal-overlay.show { display: flex; }

.modal {
  background: var(--white);
  border-radius: var(--radius);
  padding: 32px;
  width: 400px;
  max-width: 90vw;
}

.modal h3 { margin-bottom: 20px; text-align: center; }

.form-group { margin-bottom: 16px; }
.form-group label { display: block; font-size: 14px; margin-bottom: 6px; color: var(--text-light); }
.form-group input, .form-group select, .form-group textarea {
  width: 100%;
  padding: 10px 14px;
  border: 2px solid #e0e0e0;
  border-radius: 8px;
  font-size: 14px;
}
.form-group input:focus { outline: none; border-color: var(--primary); }

.toast {
  position: fixed;
  top: 80px;
  left: 50%;
  transform: translateX(-50%) translateY(-20px);
  background: #333;
  color: #fff;
  padding: 12px 24px;
  border-radius: 8px;
  font-size: 14px;
  opacity: 0;
  transition: all .3s;
  z-index: 300;
  pointer-events: none;
}

.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

/* 骨架屏 */
@keyframes shimmer { 0% { background-position: -200px 0; } 100% { background-position: 200px 0; } }
.skeleton {
  background: linear-gradient(90deg, #eee 25%, #f5f5f5 50%, #eee 75%);
  background-size: 400px 100%;
  animation: shimmer 1.2s infinite;
  border-radius: 8px;
}
.skeleton-banner { height: 200px; border-radius: 12px; margin-bottom: 24px; }
.skeleton-cat { height: 80px; border-radius: 12px; }
.skeleton-card { background: #fff; border-radius: 12px; padding: 12px; box-shadow: var(--shadow); }
.skeleton-img { height: 140px; margin-bottom: 10px; }
.skeleton-line { height: 14px; margin-bottom: 8px; }
.skeleton-line.short { width: 60%; }

/* 限时秒杀 */
.flash-section { margin-bottom: 32px; }
.flash-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 12px; }
.flash-card { background: #fff; border-radius: 12px; overflow: hidden; box-shadow: var(--shadow); cursor: pointer; border: 2px solid #E74C3C22; }
.flash-card img { width: 100%; height: 140px; object-fit: cover; }
.flash-info { padding: 12px; }
.flash-name { font-size: 14px; margin-bottom: 6px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.flash-bar { height: 6px; background: #f0f0f0; border-radius: 3px; margin: 8px 0 4px; overflow: hidden; }
.flash-bar div { height: 100%; background: linear-gradient(90deg, #E74C3C, #F5C842); border-radius: 3px; }
.promo-banner { background: linear-gradient(135deg, #E74C3C, #F5C842); color: #fff; padding: 12px 16px; border-radius: 12px; margin-bottom: 20px; font-size: 14px; }
.group-btn { background: #FF6B35; color: #fff; border: none; padding: 14px; border-radius: 8px; cursor: pointer; flex: 1; font-size: 16px; }

/* 客服悬浮按钮 */
.service-float {
  position: fixed;
  right: 16px;
  bottom: 80px;
  width: 52px;
  height: 52px;
  border-radius: 50%;
  background: linear-gradient(135deg, #4A9B6F, #5BB5A0);
  color: #fff;
  border: none;
  font-size: 24px;
  box-shadow: 0 4px 16px rgba(74,155,111,.4);
  cursor: pointer;
  z-index: 150;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform .2s;
}
.service-float:hover { transform: scale(1.08); }
.service-modal { max-width: 400px; width: 92vw; }
.service-quick { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-bottom: 12px; }
.service-action {
  display: flex; flex-direction: column; align-items: center; gap: 6px;
  padding: 16px 12px; background: #EDF7F2; border-radius: 12px;
  border: none; cursor: pointer; text-decoration: none; color: #4A9B6F; font-size: 13px;
}
.service-action span { font-size: 28px; }
.service-time { font-size: 13px; color: #999; text-align: center; }

@media (min-width: 769px) {
  .service-float { bottom: 32px; right: 32px; }
}

/* Mobile */
.menu-toggle { display: none; background: none; border: none; font-size: 24px; cursor: pointer; }

/* Mobile bottom tab bar - 客户端 */
.mobile-tabbar {
  display: none;
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background: var(--white);
  border-top: 1px solid #eee;
  z-index: 100;
  padding-bottom: env(safe-area-inset-bottom);
  box-shadow: 0 -2px 12px rgba(0,0,0,.06);
}

.mobile-tabbar a {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 8px 0 10px;
  font-size: 11px;
  color: var(--text-muted);
  text-decoration: none;
}

.mobile-tabbar a.active { color: var(--primary); font-weight: 600; }
.mobile-tabbar a .tab-icon { font-size: 22px; margin-bottom: 2px; }

@media (max-width: 768px) {
  body { padding-bottom: 60px; }
  .mobile-tabbar { display: flex; }
  .header-inner { height: 56px; padding: 0 16px; }
  .logo span:not(.client-badge) { font-size: 16px; }
  .nav, .header-actions .btn-outline { display: none !important; }
  .header-actions .cart-btn { display: block !important; }
  .container { padding: 0 12px; }
  .banner { height: 180px; margin: 12px 0; border-radius: 12px; }
  .section { margin: 20px 0; }
  .section-title { font-size: 18px; }
  .category-grid { grid-template-columns: repeat(3, 1fr); gap: 10px; }
  .category-card { padding: 14px 8px; }
  .category-icon { font-size: 28px; }
  .product-grid { grid-template-columns: repeat(2, 1fr); gap: 10px; }
  .product-detail { grid-template-columns: 1fr; gap: 20px; padding: 16px 0; }
  .product-meta h1 { font-size: 20px; }
  .detail-actions { position: fixed; bottom: 60px; left: 0; right: 0; background: var(--white); padding: 12px 16px; box-shadow: 0 -2px 12px rgba(0,0,0,.08); z-index: 99; margin: 0; }
  .detail-actions .btn { padding: 12px; font-size: 15px; }
  body:has(.detail-actions) { padding-bottom: 130px; }
  .cart-layout { grid-template-columns: 1fr; padding: 16px 0; }
  .cart-summary { position: fixed; bottom: 60px; left: 0; right: 0; border-radius: 16px 16px 0 0; z-index: 99; box-shadow: 0 -4px 20px rgba(0,0,0,.1); }
  body:has(.cart-summary) { padding-bottom: 200px; }
  .cart-item img { width: 80px; height: 80px; }
  .footer { margin-top: 32px; padding: 32px 0 20px; }
  .footer-grid { gap: 24px; }
  .modal { width: 92vw; padding: 24px; }
  .toast { top: auto; bottom: 80px; }
}
