/* =========================================
   Store Layout & Design (JD / 1688 Inspired)
   ========================================= */

body {
  margin: 0;
  font-family: "Inter", "SongTi", sans-serif;
  background-color: #f5f6f8;
  color: #333;
}

/* 顶部间距 (补偿 fixed header) */
.store-main {
  padding-top: 80px;
  max-width: 1400px;
  margin: 0 auto;
  padding-left: 20px;
  padding-right: 20px;
}

/* ================= Hero Section ================= */
.store-hero {
  display: flex;
  gap: 20px;
  margin-top: 20px;
  height: 460px;
}

/* 左侧分类导航 (JD 风格) */
.hero-sidebar {
  width: 240px;
  background: rgba(255, 255, 255, 0.8);
  backdrop-filter: blur(10px);
  border-radius: 12px;
  padding: 20px 0;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.05);
  display: flex;
  flex-direction: column;
}

.hero-sidebar h3 {
  padding: 0 20px;
  margin-bottom: 15px;
  font-size: 18px;
  color: #222;
}

#category-list {
  list-style: none;
  padding: 0;
  margin: 0;
  overflow-y: auto;
}

#category-list li {
  padding: 12px 20px;
  cursor: pointer;
  font-size: 15px;
  color: #555;
  transition: all 0.2s ease;
  position: relative;
}

#category-list li:hover {
  background: rgba(0, 0, 0, 0.03);
  color: hsl(240, 56%, 48%);
  padding-left: 24px;
}

#category-list li.active {
  color: hsl(240, 56%, 48%);
  font-weight: 600;
  background: rgba(0, 0, 0, 0.05);
}

#category-list li.active::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 4px;
  background-color: hsl(240, 56%, 48%);
  border-radius: 0 4px 4px 0;
}

/* 右侧 Hero Banner */
.hero-banner {
  flex: 1;
  border-radius: 12px;
  /* background: linear-gradient(135deg, rgba(0,0,0,0.2) 0%, rgba(0,0,0,0.6) 100%), url("tupian/logo_backup.png") center/cover; */
  position: relative;
  overflow: hidden;
  display: flex;
  align-items: center;
  padding: 60px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
}

.banner-content {
  color: white;
  z-index: 2;
  max-width: 500px;
}

.banner-content h1 {
  font-size: 48px;
  margin-bottom: 16px;
  text-shadow: 0 2px 10px rgba(0, 0, 0, 0.3);
}

.banner-content p {
  font-size: 20px;
  margin-bottom: 30px;
  opacity: 0.9;
}

.btn-primary {
  background: hsl(240, 56%, 48%);
  color: white;
  border: none;
  padding: 14px 32px;
  font-size: 16px;
  font-weight: 600;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.3s ease;
  box-shadow: 0 4px 15px rgba(0, 0, 255, 0.2);
}

.btn-primary:hover {
  background: hsl(240, 60%, 55%);
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(0, 0, 255, 0.3);
}

.btn-secondary {
  background: transparent;
  color: white;
  border: 2px solid white;
  padding: 12px 30px;
  font-size: 16px;
  font-weight: 600;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.3s ease;
}

.btn-secondary:hover {
  background: rgba(255, 255, 255, 0.15);
  transform: translateY(-2px);
}

/* ================= Toolbar (Search & Sort) ================= */
.store-toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin: 40px 0 20px;
  background: white;
  padding: 16px 24px;
  border-radius: 12px;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.03);
}

.search-box {
  display: flex;
  width: 400px;
  background: #f0f2f5;
  border-radius: 24px;
  overflow: hidden;
  border: 1px solid transparent;
  transition: border 0.3s;
}

.search-box:focus-within {
  border-color: hsl(240, 56%, 48%);
  background: white;
}

.search-box input {
  flex: 1;
  border: none;
  background: transparent;
  padding: 12px 20px;
  font-size: 15px;
  outline: none;
}

.search-box button {
  background: transparent;
  border: none;
  padding: 0 20px;
  cursor: pointer;
  font-size: 16px;
  color: #666;
}

.filter-box select {
  padding: 8px 16px;
  border-radius: 6px;
  border: 1px solid #ddd;
  outline: none;
  font-size: 14px;
  cursor: pointer;
}

/* ================= Product Grid (1688/JD style) ================= */
.products-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 20px;
  margin-bottom: 60px;
}

.product-card {
  background: white;
  border-radius: 12px;
  overflow: hidden;
  transition: all 0.3s ease;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
  position: relative;
  text-decoration: none;
  color: inherit;
  display: flex;
  flex-direction: column;
}

.product-card:hover {
  transform: translateY(-5px);
  box-shadow: 0 12px 24px rgba(0, 0, 0, 0.12);
}

.product-img-wrapper {
  position: relative;
  width: 100%;
  padding-top: 100%;
  /* 1:1 Aspect Ratio */
  background: #f8f9fa;
  overflow: hidden;
}

.product-img {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.5s ease;
}

.product-card:hover .product-img {
  transform: scale(1.05);
}

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

.product-title {
  font-size: 15px;
  line-height: 1.4;
  margin: 0 0 12px;
  color: #333;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  height: 42px;
  /* fallback */
}

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

.price-symbol {
  font-size: 14px;
  color: #e4393c;
  /* JD Red */
  font-weight: 600;
}

.price-value {
  font-size: 22px;
  color: #e4393c;
  font-weight: 700;
}

.price-original {
  font-size: 13px;
  color: #999;
  text-decoration: line-through;
}

.stock-tag {
  font-size: 12px;
  color: #666;
  background: #f0f2f5;
  padding: 2px 6px;
  border-radius: 4px;
  margin-top: 10px;
  align-self: flex-start;
}

/* ================= Micro-animations & Utils ================= */
.loading-spinner {
  text-align: center;
  padding: 40px;
  color: #999;
  grid-column: 1 / -1;
}

.badge {
  background: #e4393c;
  color: white;
  border-radius: 50%;
  padding: 2px 6px;
  font-size: 12px;
  margin-left: 4px;
  vertical-align: top;
}


/* Responsive */
@media (max-width: 1024px) {
  .hero-sidebar {
    display: none;
  }
}

@media (max-width: 768px) {
  .store-main {
    padding-top: 50px;
    padding-left: 12px;
    padding-right: 12px;
  }

  .store-hero {
    height: 220px;
    margin-top: 12px;
  }

  .hero-banner {
    padding: 24px;
    border-radius: 8px;
  }

  .banner-content h1 {
    font-size: 26px;
    margin-bottom: 10px;
  }

  .banner-content p {
    font-size: 14px;
    margin-bottom: 16px;
  }

  .btn-primary,
  .btn-secondary {
    padding: 10px 20px;
    font-size: 14px;
  }

  .store-toolbar {
    flex-direction: column;
    gap: 12px;
    padding: 12px 16px;
    margin: 20px 0 16px;
  }

  .search-box {
    width: 100%;
  }

  .products-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
  }

  .product-info {
    padding: 10px;
  }

  .product-title {
    font-size: 13px;
    height: auto;
    -webkit-line-clamp: 2;
  }

  .price-value {
    font-size: 18px;
  }

  .price-symbol {
    font-size: 12px;
  }

  .price-original {
    font-size: 11px;
  }
}

/* ================= Toast Notification ================= */
.toast-container {
  position: fixed;
  top: 20px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 10px;
  pointer-events: none;
}

.toast {
  background: white;
  color: #333;
  padding: 14px 24px;
  border-radius: 8px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
  font-size: 15px;
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: 12px;
  transform: translateY(-20px);
  opacity: 0;
  transition: all 0.3s cubic-bezier(0.68, -0.55, 0.265, 1.55);
}

.toast.show {
  transform: translateY(0);
  opacity: 1;
}

.toast.success { border-left: 4px solid #4CAF50; }
.toast.error { border-left: 4px solid #f44336; }

/* ================= Cart UI Elements ================= */
.qty-control {
  display: inline-flex;
  align-items: center;
  border: 1px solid #ddd;
  border-radius: 6px;
  overflow: hidden;
  background: #fff;
}

.qty-btn {
  background: #f8f9fa;
  border: none;
  width: 32px;
  height: 32px;
  font-size: 18px;
  cursor: pointer;
  color: #555;
  transition: background 0.2s;
  display: flex;
  align-items: center;
  justify-content: center;
}

.qty-btn:hover {
  background: #e2e6ea;
  color: #333;
}

.qty-input {
  width: 40px;
  height: 32px;
  border: none;
  border-left: 1px solid #ddd;
  border-right: 1px solid #ddd;
  text-align: center;
  font-size: 14px;
  color: #333;
  outline: none;
}

/* Chrome, Safari, Edge, Opera - hide arrows in number input */
.qty-input::-webkit-outer-spin-button,
.qty-input::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}
.qty-input[type=number] {
  -moz-appearance: textfield;
}

.empty-cart-svg {
  width: 160px;
  height: 160px;
  margin: 0 auto 20px;
  opacity: 0.8;
}

/* ================= Dark Mode Overrides ================= */
html[data-theme="dark"] .store-toolbar {
  background: #1a1a1a;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.4);
}

html[data-theme="dark"] .search-box {
  background: #2a2a2a;
}

html[data-theme="dark"] .search-box input {
  color: #fff;
}

html[data-theme="dark"] .search-box button {
  color: #aaa;
}

html[data-theme="dark"] .filter-box select {
  background: #2a2a2a;
  color: #fff;
  border-color: #444;
}

html[data-theme="dark"] .products-grid .loading-spinner {
  color: #aaa;
}

html[data-theme="dark"] .product-card {
  background: #1a1a1a;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.4);
}

html[data-theme="dark"] .product-card:hover {
  box-shadow: 0 12px 24px rgba(0, 0, 0, 0.6);
}

html[data-theme="dark"] .product-img-wrapper {
  background: #222;
}

html[data-theme="dark"] .product-title {
  color: #eee;
}

html[data-theme="dark"] .stock-tag {
  background: #2a2a2a;
  color: #aaa;
}

html[data-theme="dark"] .price-original {
  color: #777;
}

/* Cart UI Dark Mode Overrides (if present) */
html[data-theme="dark"] .qty-control {
  border-color: #444;
  background: #1a1a1a;
}
html[data-theme="dark"] .qty-btn {
  background: #2a2a2a;
  color: #ccc;
}
html[data-theme="dark"] .qty-btn:hover {
  background: #333;
  color: #fff;
}
html[data-theme="dark"] .qty-input {
  border-color: #444;
  color: #eee;
  background: #1a1a1a;
}