:root {
  --primary: #1a6fc4;
  --primary-dark: #145699;
  --primary-light: #e8f2fb;
  --accent: #f59e0b;
  --text: #1f2937;
  --text-light: #6b7280;
  --border: #e5e7eb;
  --bg: #f8fafc;
  --white: #ffffff;
  --shadow: 0 4px 12px rgba(0, 0, 0, 0.06);
  --radius: 8px;
}

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

html { scroll-behavior: smooth; }

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  color: var(--text);
  background: var(--bg);
  line-height: 1.6;
}

a { color: var(--primary); text-decoration: none; }
a:hover { color: var(--primary-dark); }

.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 20px;
}

img { max-width: 100%; display: block; }

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 10px 20px;
  border-radius: var(--radius);
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  border: 1px solid transparent;
  transition: all 0.2s;
}

.btn-primary {
  background: var(--primary);
  color: var(--white);
  border-color: var(--primary);
}
.btn-primary:hover { background: var(--primary-dark); color: var(--white); }

.btn-outline {
  background: transparent;
  color: var(--primary);
  border-color: var(--primary);
}
.btn-outline:hover { background: var(--primary-light); }

.btn-block { width: 100%; }

.badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 12px;
  font-size: 12px;
  background: var(--primary-light);
  color: var(--primary);
}

/* Header */
#site-header {
  background: var(--white);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 100;
}

.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 64px;
}

.logo {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-size: 20px;
  font-weight: 700;
  color: var(--primary);
  text-decoration: none;
}

.logo-icon {
  width: 36px;
  height: 36px;
  flex-shrink: 0;
}

.main-nav {
  display: flex;
  gap: 28px;
}

.main-nav a {
  color: var(--text);
  font-size: 15px;
  font-weight: 500;
}

.main-nav a:hover { color: var(--primary); }

.mobile-menu-toggle {
  display: none;
  background: none;
  border: none;
  font-size: 14px;
  color: var(--text);
  cursor: pointer;
  padding: 8px;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}

.cart-link {
  position: relative;
  display: flex;
  align-items: center;
  color: var(--text);
  font-size: 14px;
  margin-right: 8px;
}

.cart-badge {
  position: absolute;
  top: -8px;
  right: -10px;
  background: var(--accent);
  color: var(--white);
  font-size: 11px;
  min-width: 18px;
  height: 18px;
  border-radius: 9px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 4px;
}

.user-menu {
  position: relative;
  cursor: pointer;
}

.user-name {
  font-size: 14px;
  color: var(--text);
  font-weight: 500;
}

.user-dropdown {
  display: none;
  position: absolute;
  right: 0;
  top: 28px;
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  min-width: 120px;
  overflow: hidden;
}

.user-menu:hover .user-dropdown { display: block; }

.user-dropdown a {
  display: block;
  padding: 10px 16px;
  color: var(--text);
  font-size: 14px;
}

.user-dropdown a:hover { background: var(--bg); color: var(--primary); }

/* Hero */
.hero {
  background: linear-gradient(135deg, #e8f2fb 0%, #d6e8f8 100%);
  padding: 80px 0;
  text-align: center;
}

.hero h1 {
  font-size: 40px;
  color: var(--text);
  margin-bottom: 16px;
  font-weight: 700;
}

.hero p {
  font-size: 18px;
  color: var(--text-light);
  margin-bottom: 32px;
  max-width: 700px;
  margin-left: auto;
  margin-right: auto;
}

.hero-actions { display: flex; gap: 16px; justify-content: center; }

/* Section */
.section { padding: 60px 0; }
.section-title {
  font-size: 28px;
  margin-bottom: 8px;
  text-align: center;
}
.section-subtitle {
  color: var(--text-light);
  text-align: center;
  margin-bottom: 36px;
}

/* Module cards on home */
.module-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: 24px;
}

.module-card {
  background: var(--white);
  border-radius: var(--radius);
  padding: 32px;
  box-shadow: var(--shadow);
  text-align: center;
}

.module-card h3 { font-size: 22px; margin-bottom: 12px; }
.module-card p { color: var(--text-light); margin-bottom: 20px; }

/* Filter bar */
.filter-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-bottom: 24px;
  align-items: center;
}

.filter-bar input[type="text"] {
  flex: 1;
  min-width: 200px;
  padding: 10px 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-size: 14px;
}

.filter-btn {
  padding: 8px 16px;
  border: 1px solid var(--border);
  background: var(--white);
  border-radius: var(--radius);
  cursor: pointer;
  font-size: 14px;
}

.filter-btn.active {
  background: var(--primary);
  color: var(--white);
  border-color: var(--primary);
}

/* Product grid */
.product-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 20px;
}

.product-card {
  background: var(--white);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow);
  transition: transform 0.2s;
  display: flex;
  flex-direction: column;
}

.product-card:hover { transform: translateY(-4px); }

.product-card .cover {
  aspect-ratio: 1 / 1;
  object-fit: cover;
  width: 100%;
}

.product-card .body {
  padding: 16px;
  display: flex;
  flex-direction: column;
  flex: 1;
}

.product-card .title {
  font-size: 16px;
  font-weight: 600;
  margin-bottom: 6px;
  color: var(--text);
}

.product-card .merchant {
  font-size: 13px;
  color: var(--text-light);
  margin-bottom: 10px;
}

.product-card .tags {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  margin-bottom: 12px;
}

.product-card .price-row {
  margin-top: auto;
  display: flex;
  align-items: baseline;
  gap: 8px;
}

.product-card .price { font-size: 18px; color: #d93025; font-weight: 700; }
.product-card .original { font-size: 13px; color: var(--text-light); text-decoration: line-through; }

.product-card .actions {
  display: flex;
  gap: 8px;
  margin-top: 12px;
}

.product-card .actions .btn { flex: 1; padding: 8px; font-size: 13px; }

/* Product detail */
.product-detail {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 40px;
  background: var(--white);
  padding: 32px;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.gallery-main {
  border-radius: var(--radius);
  overflow: hidden;
  border: 1px solid var(--border);
  margin-bottom: 12px;
}

.gallery-main img { width: 100%; aspect-ratio: 1 / 1; object-fit: cover; }

.gallery-thumbs { display: flex; gap: 10px; }
.gallery-thumbs img {
  width: 70px;
  height: 70px;
  object-fit: cover;
  border-radius: 4px;
  border: 2px solid transparent;
  cursor: pointer;
}
.gallery-thumbs img.active { border-color: var(--primary); }

.product-info h1 { font-size: 26px; margin-bottom: 12px; }
.product-info .meta { color: var(--text-light); margin-bottom: 16px; }
.product-info .price { font-size: 32px; color: #d93025; font-weight: 700; margin-bottom: 20px; }
.product-info .specs { margin-bottom: 20px; }
.product-info .specs li { list-style: none; padding: 8px 0; border-bottom: 1px dashed var(--border); }

.qty-row {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 20px;
}

.qty-row input {
  width: 70px;
  padding: 8px;
  border: 1px solid var(--border);
  border-radius: 4px;
  text-align: center;
}

.product-info .detail-content {
  margin-top: 24px;
  padding-top: 24px;
  border-top: 1px solid var(--border);
  color: var(--text-light);
  line-height: 1.8;
}

/* Cart */
.cart-table {
  width: 100%;
  background: var(--white);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
  margin-bottom: 20px;
}

.cart-table th, .cart-table td {
  padding: 16px;
  text-align: left;
  border-bottom: 1px solid var(--border);
}

.cart-table th { background: var(--bg); font-weight: 600; }

.cart-item-info { display: flex; gap: 12px; align-items: center; }
.cart-item-info img { width: 60px; height: 60px; object-fit: cover; border-radius: 4px; }

.cart-qty {
  width: 70px;
  padding: 6px;
  border: 1px solid var(--border);
  border-radius: 4px;
  text-align: center;
}

.cart-summary {
  background: var(--white);
  padding: 24px;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  max-width: 360px;
  margin-left: auto;
}

.cart-summary .row {
  display: flex;
  justify-content: space-between;
  margin-bottom: 12px;
}

.cart-summary .total {
  font-size: 20px;
  font-weight: 700;
  color: #d93025;
  border-top: 1px solid var(--border);
  padding-top: 12px;
}

.empty-state {
  text-align: center;
  padding: 60px 20px;
  color: var(--text-light);
}

/* Info list */
.info-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 20px;
}

.info-card {
  background: var(--white);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
}

.info-card img { width: 100%; height: 180px; object-fit: cover; }
.info-card .body { padding: 16px; flex: 1; display: flex; flex-direction: column; }
.info-card .title { font-size: 16px; font-weight: 600; margin-bottom: 8px; }
.info-card .summary { font-size: 14px; color: var(--text-light); margin-bottom: 12px; flex: 1; }
.info-card .meta { font-size: 13px; color: var(--text-light); margin-bottom: 12px; }
.info-card .publisher { display: flex; justify-content: space-between; align-items: center; }
.info-card .phone { color: var(--primary); font-weight: 500; }

/* Info detail */
.info-detail {
  display: grid;
  grid-template-columns: 1fr 340px;
  gap: 24px;
}

.info-detail-main {
  background: var(--white);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 32px;
}

.info-detail-main img {
  width: 100%;
  max-height: 420px;
  object-fit: cover;
  border-radius: var(--radius);
  margin-bottom: 24px;
}

.info-detail-main h1 { font-size: 24px; margin-bottom: 12px; }
.info-detail-main .meta { color: var(--text-light); margin-bottom: 20px; }
.info-detail-main .content { line-height: 1.8; color: var(--text); }

.contact-card {
  background: var(--white);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 24px;
  height: fit-content;
}

.contact-card h3 { font-size: 18px; margin-bottom: 16px; }
.contact-card .row { margin-bottom: 12px; font-size: 14px; }
.contact-card .row strong { display: block; color: var(--text-light); font-weight: 500; margin-bottom: 2px; }
.contact-card .phone { font-size: 20px; color: var(--primary); font-weight: 700; }

.login-tip {
  background: var(--primary-light);
  padding: 12px;
  border-radius: var(--radius);
  font-size: 13px;
  margin-top: 12px;
}

/* Forms */
.auth-box {
  max-width: 440px;
  margin: 40px auto;
  background: var(--white);
  padding: 32px;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.auth-box h1 { font-size: 24px; margin-bottom: 24px; text-align: center; }

.form-group { margin-bottom: 18px; }
.form-group label { display: block; margin-bottom: 6px; font-size: 14px; font-weight: 500; }
.form-group input[type="text"],
.form-group input[type="tel"],
.form-group input[type="password"],
.form-group input[type="number"],
.form-group textarea,
.form-group select {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-size: 14px;
}

.form-group textarea { min-height: 120px; resize: vertical; }

.checkbox-group {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  margin-bottom: 12px;
  font-size: 13px;
}

.checkbox-group input { margin-top: 3px; }

.error-msg { color: #d93025; font-size: 13px; margin-top: 6px; }

/* About */
.about-content {
  background: var(--white);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 40px;
}

.about-content h1 { font-size: 28px; margin-bottom: 20px; }
.about-content p { margin-bottom: 16px; color: var(--text-light); line-height: 1.8; }

.info-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 16px; margin-top: 24px; }
.info-list .item { background: var(--bg); padding: 16px; border-radius: var(--radius); }
.info-list .item strong { display: block; color: var(--text-light); font-size: 13px; margin-bottom: 4px; }

/* Footer */
#site-footer {
  background: #1a202c;
  color: #cbd5e1;
  padding: 48px 0 24px;
  margin-top: 40px;
}

.footer-inner { display: grid; grid-template-columns: 1.2fr 2fr; gap: 40px; }
.footer-brand strong { color: var(--white); font-size: 18px; display: block; margin-bottom: 12px; }
.footer-brand p { color: #94a3b8; font-size: 14px; line-height: 1.6; }
.footer-links { display: grid; grid-template-columns: repeat(3, 1fr); gap: 24px; }
.footer-links h4 { color: var(--white); font-size: 15px; margin-bottom: 12px; }
.footer-links a, .footer-links p { display: block; color: #94a3b8; font-size: 14px; margin-bottom: 8px; }
.footer-links a:hover { color: var(--white); }
.footer-bottom { grid-column: 1 / -1; text-align: center; padding-top: 24px; border-top: 1px solid #334155; font-size: 13px; color: #94a3b8; }

/* Policy page */
.policy-content { max-width: 800px; margin: 0 auto; background: var(--white); padding: 40px; border-radius: var(--radius); box-shadow: var(--shadow); }
.policy-content h1 { font-size: 26px; margin-bottom: 20px; }
.policy-content h2 { font-size: 18px; margin: 24px 0 10px; }
.policy-content p { margin-bottom: 12px; color: var(--text-light); line-height: 1.8; }

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

/* Responsive */
@media (max-width: 900px) {
  .product-detail { grid-template-columns: 1fr; }
  .info-detail { grid-template-columns: 1fr; }
  .footer-inner { grid-template-columns: 1fr; }
}

@media (max-width: 768px) {
  .mobile-menu-toggle { display: block; }
  .main-nav {
    display: none;
    position: absolute;
    top: 64px;
    left: 0;
    right: 0;
    background: var(--white);
    flex-direction: column;
    padding: 16px 20px;
    border-bottom: 1px solid var(--border);
    box-shadow: var(--shadow);
  }
  .main-nav.open { display: flex; }
  .hero h1 { font-size: 28px; }
  .hero p { font-size: 16px; }
  .header-actions .btn { padding: 6px 12px; font-size: 13px; }
  .footer-links { grid-template-columns: 1fr; }
}
