/* ============================================================
   Blitz Mall — Layer 0 Design System
   Brand: Brick-orange primary, deep blue-gray accent
   Principles: No gradients, no card borders, 4px grid,
               shadow for elevation, pure-white navbar
   ============================================================ */

/* ============================================================
   1. CSS Variables — Design Tokens
   ============================================================ */
:root {
  /* Surface */
  --bg:            #F7F7F7;
  --surface:       #FFFFFF;
  --surface-hover: #FAFAFA;

  /* Brand */
  --primary:       #E85D2C;
  --primary-dark:  #D04A1A;
  --primary-bg:    #FDF2ED;
  --accent:        #2C3E50;
  --accent-light:  #F0F3F5;

  /* Text */
  --text:          #1A1A1A;
  --text-secondary:#595959;
  --text-muted:    #999999;

  /* Border */
  --border:        #E8E8E8;
  --border-light:  #F0F0F0;

  /* Semantic */
  --success:       #16A34A;
  --success-bg:    #DCFCE7;
  --warning:       #F59E0B;
  --warning-bg:    #FEF9E7;
  --danger:        #DC2626;
  --danger-bg:     #FEE2E2;
  --info:          #2563EB;
  --info-bg:       #DBEAFE;

  /* Shadows — elevation only, no decoration */
  --shadow-card:   0 1px 3px rgba(0,0,0,0.04);
  --shadow-hover:  0 4px 16px rgba(0,0,0,0.08);
  --shadow-modal:  0 8px 32px rgba(0,0,0,0.12);
  --shadow-nav:    0 1px 0 rgba(0,0,0,0.06);

  /* Spacing — 4px grid */
  --space-xs:  4px;
  --space-sm:  8px;
  --space-md:  16px;
  --space-lg:  24px;
  --space-xl:  32px;
  --space-2xl: 48px;

  /* Radius */
  --radius-sm:   4px;
  --radius-md:   8px;
  --radius-lg:   12px;
  --radius-xl:   16px;
  --radius-full: 999px;

  /* Typography — 6-level strict hierarchy */
  --font: -apple-system, BlinkMacSystemFont, 'PingFang SC', 'Microsoft YaHei', sans-serif;
  --font-mono: 'SF Mono', 'Fira Code', 'Consolas', monospace;
  --fs-display:  28px;
  --fs-title:    22px;
  --fs-subtitle: 18px;
  --fs-body:     15px;
  --fs-caption:  13px;
  --fs-small:    11px;

  /* Layout */
  --navbar-height: 56px;
  --max-width:     1240px;
  --sidebar-width: 240px;
}

/* ============================================================
   2. Reset & Base
   ============================================================ */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html {
  font-family: var(--font); font-size: var(--fs-body); color: var(--text);
  background: var(--bg); -webkit-font-smoothing: antialiased;
  -webkit-text-size-adjust: 100%; line-height: 1.5;
}
body { min-height: 100vh; display: flex; flex-direction: column; }
a { color: var(--primary); text-decoration: none; -webkit-tap-highlight-color: transparent; }
a:hover { text-decoration: underline; }
img { max-width: 100%; display: block; }
button { cursor: pointer; font-family: inherit; border: none; background: none; }
input, select, textarea { font-family: inherit; font-size: inherit; color: inherit; }
ul, ol { list-style: none; }

/* ============================================================
   3. Navbar — Pure white, 56px, no backdrop-filter
   ============================================================ */
.blitz-navbar {
  position: sticky; top: 0; z-index: 1000;
  height: var(--navbar-height);
  background: var(--surface);
  box-shadow: var(--shadow-nav);
  display: flex; align-items: center;
}
.nav-inner {
  width: 100%; margin: 0;
  padding: 0 var(--space-xl);
  display: flex; align-items: center; gap: var(--space-md);
}
.nav-brand {
  font-size: var(--fs-subtitle); font-weight: 800; letter-spacing: -0.5px;
  color: var(--text);
  white-space: nowrap; display: flex; align-items: center; gap: var(--space-sm);
  flex-shrink: 0; text-decoration: none;
}
.nav-brand:hover { text-decoration: none; color: var(--primary); }
.nav-brand .brand-icon {
  width: 32px; height: 32px; border-radius: var(--radius-sm);
  background: var(--primary);
  display: flex; align-items: center; justify-content: center;
  color: #fff; font-size: 1rem;
}

/* Search — pill shape, gray bg, orange focus */
.nav-search {
  flex: 1; max-width: 560px; position: relative;
  display: flex; align-items: center;
  background: #F5F5F5; border: 1.5px solid transparent;
  border-radius: var(--radius-full);
  transition: all 0.2s;
}
.nav-search:focus-within {
  border-color: var(--primary); background: var(--surface);
  box-shadow: 0 2px 12px rgba(232,93,44,0.10);
}
.nav-search input {
  flex: 1; border: none; background: transparent;
  outline: none; padding: 10px var(--space-md); font-size: var(--fs-caption);
  color: var(--text); min-width: 0;
}
.nav-search input::placeholder { color: var(--text-muted); }
.nav-search button {
  background: var(--primary); color: #fff; border: none;
  padding: 10px 20px; font-size: 1rem;
  cursor: pointer; transition: background 0.2s;
  display: flex; align-items: center; justify-content: center;
  min-width: 48px; min-height: 44px;
}
.nav-search button:hover { background: var(--primary-dark); }

/* Nav icons */
.nav-icons {
  display: flex; align-items: center; gap: var(--space-xs);
  white-space: nowrap; flex-shrink: 0;
}
.nav-icons a, .nav-icons .nav-btn {
  display: flex; align-items: center; gap: var(--space-xs);
  padding: var(--space-sm) 12px; border-radius: var(--radius-full);
  font-size: var(--fs-caption); color: var(--text-secondary);
  transition: all 0.15s; font-weight: 500;
  border: none; background: none; cursor: pointer;
}
.nav-icons a:hover, .nav-icons .nav-btn:hover,
.nav-icons a.active { color: var(--primary); background: var(--primary-bg); }
.nav-icons .cart-badge { position: relative; }
.nav-icons .cart-badge .badge-count {
  position: absolute; top: -2px; right: -4px;
  min-width: 16px; height: 16px; border-radius: 8px;
  background: var(--danger); color: #fff;
  font-size: var(--fs-small); font-weight: 700;
  display: flex; align-items: center; justify-content: center;
  padding: 0 4px;
}
.nav-user-info { display: flex; align-items: center; gap: 6px; font-size: var(--fs-caption); }
.nav-user-info .user-avatar {
  width: 30px; height: 30px; border-radius: 50%;
  background: var(--primary); color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 0.8rem;
}

/* Nav secondary — category bar */
.nav-secondary {
  background: var(--surface); border-bottom: 1px solid var(--border);
}
.nav-secondary .nav-inner { gap: 0; }
.nav-secondary a {
  display: block; padding: 10px 18px; font-size: var(--fs-caption);
  color: var(--text-secondary); font-weight: 500;
  transition: color 0.15s; position: relative;
}
.nav-secondary a:hover, .nav-secondary a.active { color: var(--primary); }
.nav-secondary a.active::after {
  content: ''; position: absolute; bottom: 0; left: 18px; right: 18px;
  height: 2px; background: var(--primary); border-radius: 1px 1px 0 0;
}

/* ============================================================
   4. Main Content
   ============================================================ */
.main-content {
  flex: 1;
  max-width: var(--max-width);
  width: 100%; margin: 0 auto;
  padding: var(--space-lg) 20px;
}

/* ============================================================
   5. Buttons — solid colors, no gradients, min-height 40px
   ============================================================ */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  padding: 8px 20px; border-radius: var(--radius-md);
  font-size: var(--fs-caption); font-weight: 600; transition: all 0.2s;
  white-space: nowrap; line-height: 1.4;
  min-height: 40px; cursor: pointer; border: 1.5px solid transparent;
}
.btn-primary {
  background: var(--primary); color: #fff;
}
.btn-primary:hover:not(:disabled) {
  background: var(--primary-dark);
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(232,93,44,0.25);
}
.btn-primary:active:not(:disabled) { transform: translateY(0); }
.btn-danger {
  background: var(--danger); color: #fff;
}
.btn-danger:hover:not(:disabled) { background: #B91C1C; }
.btn-outline {
  background: var(--surface); color: var(--text-secondary);
  border: 1.5px solid var(--border);
}
.btn-outline:hover { border-color: var(--primary); color: var(--primary); background: var(--primary-bg); }
.btn-accent { background: var(--accent); color: #fff; }
.btn-accent:hover:not(:disabled) { background: #1B2A38; }
.btn-success { background: var(--success); color: #fff; }
.btn-success:hover:not(:disabled) { background: #15803D; }
.btn-sm { padding: 4px 12px; font-size: var(--fs-small); min-height: 44px; }
.btn-lg { padding: 12px 28px; font-size: var(--fs-body); min-height: 44px; }
.btn-xl { padding: 14px 36px; font-size: 1.05rem; min-height: 48px; }
.btn-block { width: 100%; justify-content: center; }
.btn:disabled { opacity: 0.4; cursor: not-allowed; transform: none !important; box-shadow: none !important; }
.btn-icon { width: 40px; height: 40px; padding: 0; border-radius: 50%; }

/* ============================================================
   6. Product Card — white, shadow, no border
   ============================================================ */
.product-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: var(--space-md);
}
.product-card {
  background: var(--surface);
  border-radius: var(--radius-md);
  overflow: hidden;
  cursor: pointer;
  transition: all 0.25s;
  box-shadow: var(--shadow-card);
  position: relative;
  border: none;
}
.product-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-hover);
}
.product-card .card-img {
  aspect-ratio: 1;
  background: #FAFAFA;
  display: flex; align-items: center; justify-content: center;
  position: relative; overflow: hidden;
}
.product-card .card-img img {
  width: 100%; height: 100%; object-fit: cover;
  transition: transform 0.3s;
}
.product-card:hover .card-img img { transform: scale(1.05); }
.product-card .card-img .img-placeholder {
  width: 100%; height: 100%;
  display: flex; align-items: center; justify-content: center;
  font-size: 3rem;
  background: linear-gradient(135deg, #f8f9fb 0%, #eef0f4 100%);
  color: #cdd5df;
}
/* Category-colored variants — set via data-cat attribute on card */
.product-card[data-cat="1"] .card-img, .product-card[data-cat="4"] .card-img { background: linear-gradient(135deg, #e3f2fd, #bbdefb); }
.product-card[data-cat="2"] .card-img { background: linear-gradient(135deg, #fce4ec, #f8bbd0); }
.product-card[data-cat="3"] .card-img { background: linear-gradient(135deg, #e8f5e9, #c8e6c9); }
.product-card[data-cat="8"] .card-img { background: linear-gradient(135deg, #fff3e0, #ffe0b2); }
.product-card[data-cat="9"] .card-img { background: linear-gradient(135deg, #f3e5f5, #e1bee7); }
.product-card[data-cat="16"] .card-img { background: linear-gradient(135deg, #e8eaf6, #c5cae9); }
.product-card[data-cat="20"] .card-img { background: linear-gradient(135deg, #fce4ec, #f48fb1); }
.product-card[data-cat="24"] .card-img { background: linear-gradient(135deg, #e0f2f1, #80cbc4); }
.product-card[data-cat="28"] .card-img { background: linear-gradient(135deg, #eceff1, #b0bec5); }

/* Quick-view overlay on hover */
.product-card .card-img .qv-overlay {
  position: absolute; inset: 0;
  background: rgba(0, 0, 0, 0.45);
  display: flex; align-items: center; justify-content: center;
  opacity: 0; transition: opacity 0.25s;
  z-index: 2;
}
.product-card:hover .card-img .qv-overlay { opacity: 1; }
.product-card .card-img .qv-overlay .qv-btn {
  background: #fff; color: var(--text);
  padding: 8px 20px; border-radius: var(--radius-md);
  font-size: var(--fs-caption); font-weight: 600;
  cursor: pointer; text-decoration: none;
  min-height: 44px; display: inline-flex;
  align-items: center; justify-content: center;
  transition: transform 0.15s;
}
.product-card .card-img .qv-overlay .qv-btn:hover { transform: scale(1.05); }

.product-card .card-tag {
  position: absolute; top: var(--space-sm); left: 42px;
  padding: 2px 8px; border-radius: var(--radius-sm);
  font-size: var(--fs-small); font-weight: 700; z-index: 1;
  color: #fff;
}
.card-tag.seckill { background: var(--danger); }
.card-tag.new { background: var(--success); }
.card-tag.hot { background: var(--warning); color: var(--text); }
.product-card .card-body { padding: 12px; }
.product-card .card-name {
  font-size: var(--fs-caption); font-weight: 500; color: var(--text);
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical;
  overflow: hidden; margin-bottom: var(--space-sm); line-height: 1.4; min-height: 2.5em;
}
.product-card .card-price-row {
  display: flex; align-items: baseline; gap: 6px; margin-bottom: var(--space-xs);
}
.product-card .card-price {
  font-size: 1.2rem; font-weight: 800; color: var(--danger);
  font-variant-numeric: tabular-nums;
}
.product-card .card-price .original,
.product-card .card-price-row .original {
  font-size: 0.85em; color: var(--text-muted);
  text-decoration: line-through; margin-left: 6px; font-weight: 400;
}
.product-card .card-meta {
  display: flex; align-items: center; justify-content: space-between;
  font-size: var(--fs-small); color: var(--text-muted);
}
.product-card .card-shop {
  color: var(--text-muted); font-size: var(--fs-small);
}
.product-card .card-rating {
  display: flex; align-items: center; gap: 2px; color: var(--warning); font-size: var(--fs-small);
}

/* ============================================================
   7. Category Sidebar
   ============================================================ */
.category-sidebar {
  width: 220px; flex-shrink: 0;
  background: var(--surface); border-radius: var(--radius-md);
  box-shadow: var(--shadow-card);
  overflow: visible; position: relative; z-index: 10;
}
.category-sidebar .cat-item {
  display: flex; align-items: center; justify-content: space-between;
  padding: 10px 14px; font-size: var(--fs-caption); color: var(--text);
  cursor: pointer; transition: all 0.15s;
  border-bottom: 1px solid var(--border-light);
  position: relative;
}
.category-sidebar .cat-item:last-child { border-bottom: none; }
.category-sidebar .cat-item:hover,
.category-sidebar .cat-item.active {
  background: var(--primary-bg); color: var(--primary); font-weight: 600;
}
.category-sidebar .cat-item .cat-link {
  display: flex; align-items: center; gap: var(--space-sm);
  flex: 1; color: inherit; text-decoration: none; cursor: pointer;
}
.category-sidebar .cat-item .cat-link:hover { text-decoration: none; }
.category-sidebar .cat-item .arrow { font-size: 0.7rem; color: var(--text-muted); }
.category-sidebar .cat-item .cat-icon { font-size: 1rem; }

/* Sub-menu popup on hover */
.category-sidebar .cat-item:hover .cat-sub,
.category-sidebar .cat-item.active .cat-sub { display: grid; }
.category-sidebar .cat-sub {
  display: none;
  position: absolute; left: 100%; top: 0;
  min-width: 500px;
  background: var(--surface);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-hover);
  padding: var(--space-md);
  z-index: 100;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--space-sm) var(--space-md);
}
.category-sidebar .cat-sub a {
  display: block; padding: 6px 10px; font-size: var(--fs-caption);
  color: var(--text-secondary); border-radius: var(--radius-sm);
  transition: all 0.15s;
}
.category-sidebar .cat-sub a:hover {
  background: var(--primary-bg); color: var(--primary);
}
.category-sidebar .cat-sub .sub-title {
  grid-column: 1 / -1; font-weight: 700; font-size: var(--fs-caption);
  color: var(--text); padding-bottom: var(--space-xs);
  border-bottom: 1px solid var(--border-light);
  margin-bottom: var(--space-xs);
}

/* ============================================================
   8. Banner Carousel — solid backgrounds
   ============================================================ */
.banner-carousel {
  border-radius: var(--radius-md); overflow: hidden;
  position: relative; height: 360px;
  background: var(--primary);
}
.banner-slide {
  position: absolute; inset: 0;
  display: flex; align-items: center; padding: 50px;
  opacity: 0; transition: opacity 0.6s;
  color: #fff;
}
.banner-slide.active { opacity: 1; }
.banner-slide .banner-text { max-width: 460px; }
.banner-slide .banner-tag {
  display: inline-block; background: rgba(255,255,255,0.2);
  padding: 3px 12px; border-radius: var(--radius-full);
  font-size: var(--fs-small); font-weight: 600; margin-bottom: 12px;
  backdrop-filter: blur(4px); letter-spacing: 1px; text-transform: uppercase;
}
.banner-slide h2 { font-size: 2.4rem; font-weight: 900; margin-bottom: 10px; letter-spacing: -1px; line-height: 1.2; }
.banner-slide p { font-size: 1.05rem; opacity: 0.9; line-height: 1.6; margin-bottom: 24px; }
.banner-slide .banner-visual {
  position: absolute; right: 60px; top: 50%; transform: translateY(-50%);
  font-size: 8rem; opacity: 0.15; pointer-events: none;
}
.banner-slide .btn-white {
  display: inline-block;
  background: #fff; color: #333; padding: 12px 32px;
  border-radius: var(--radius-full); font-weight: 700; font-size: 1rem;
  transition: transform 0.2s, box-shadow 0.2s; text-decoration: none;
  box-shadow: 0 4px 16px rgba(0,0,0,0.15);
}
.banner-slide .btn-white:hover { transform: translateY(-2px); box-shadow: 0 6px 24px rgba(0,0,0,0.25); text-decoration: none; }
.banner-dots {
  position: absolute; bottom: var(--space-md); left: 50%; transform: translateX(-50%);
  display: flex; gap: var(--space-sm); z-index: 2;
}
.banner-dots .dot {
  width: 8px; height: 8px; border-radius: 50%;
  background: rgba(255,255,255,0.4); cursor: pointer;
  transition: all 0.3s;
}
.banner-dots .dot.active { background: #fff; width: 24px; border-radius: 4px; }

/* ============================================================
   9. Quick Entry Icons
   ============================================================ */
.quick-entries {
  display: grid; grid-template-columns: repeat(5, 1fr);
  gap: 12px; margin: 20px 0;
}
.quick-entry {
  background: var(--surface); border-radius: var(--radius-md);
  padding: var(--space-md) var(--space-sm); text-align: center;
  cursor: pointer; transition: all 0.2s;
  box-shadow: var(--shadow-card);
  text-decoration: none; color: inherit;
}
.quick-entry:hover { box-shadow: var(--shadow-hover); transform: translateY(-2px); text-decoration: none; }
.quick-entry .qe-icon { font-size: 2.2rem; margin-bottom: 6px; }
.quick-entry .qe-label { font-size: 0.88rem; color: var(--text); font-weight: 600; }
.quick-entry .qe-desc { font-size: var(--fs-small); color: var(--text-muted); margin-top: 2px; }

/* ============================================================
   10. Section Headers
   ============================================================ */
.section-header {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 14px; margin-top: 28px;
}
.section-header h2 {
  font-size: var(--fs-title); font-weight: 700;
  display: flex; align-items: center; gap: var(--space-sm);
}
.section-header .more {
  font-size: var(--fs-caption); color: var(--text-muted);
  display: flex; align-items: center; gap: var(--space-xs);
}
.section-header .more:hover { color: var(--primary); text-decoration: none; }

/* ============================================================
   11. Scene Row — horizontal scroll
   ============================================================ */
.scene-row {
  display: flex; gap: 12px; overflow-x: auto;
  padding-bottom: var(--space-sm);
  scroll-snap-type: x mandatory;
}
.scene-row::-webkit-scrollbar { height: 4px; }
.scene-row::-webkit-scrollbar-thumb { background: var(--border); border-radius: 4px; }
.scene-row .product-card {
  min-width: 210px; scroll-snap-align: start; flex-shrink: 0;
}

/* ============================================================
   12. Filter Bar
   ============================================================ */
.filter-bar {
  display: flex; align-items: center; gap: 10px;
  margin-bottom: var(--space-md); flex-wrap: wrap;
  padding: 12px var(--space-md); background: var(--surface);
  border-radius: var(--radius-md); box-shadow: var(--shadow-card);
}
.filter-bar .filter-label {
  font-size: var(--fs-caption); color: var(--text-secondary);
  font-weight: 500; flex-shrink: 0;
}
.category-pill {
  padding: 5px 14px; border-radius: var(--radius-full);
  font-size: var(--fs-caption); font-weight: 500; cursor: pointer;
  border: 1.5px solid var(--border); background: var(--surface);
  color: var(--text-secondary); transition: all 0.15s;
  white-space: nowrap; min-height: 44px;
}
.category-pill:hover { border-color: var(--primary); color: var(--primary); }
.category-pill.active {
  background: var(--primary); color: #fff; border-color: var(--primary);
}

/* ============================================================
   13. Forms — gray resting, white+orange on focus
   ============================================================ */
.form-group { margin-bottom: var(--space-md); }
.form-label {
  display: block; font-size: var(--fs-caption); font-weight: 600;
  margin-bottom: 6px; color: var(--text);
}
.form-label .required { color: var(--danger); margin-left: 2px; }
.form-input {
  width: 100%; padding: 10px 14px;
  border: 1.5px solid transparent; border-radius: 6px;
  font-size: var(--fs-caption); transition: all 0.2s;
  background: #F5F5F5; color: var(--text);
  outline: none;
}
.form-input:focus {
  border-color: var(--primary); background: var(--surface);
  box-shadow: 0 0 0 3px rgba(232,93,44,0.08);
}
.form-input.input-error { border-color: var(--danger); background: #FFF5F5; }
.form-input.input-error:focus { box-shadow: 0 0 0 3px rgba(220,38,38,0.08); }
.form-input::placeholder { color: var(--text-muted); }
textarea.form-input { resize: vertical; min-height: 80px; }
select.form-input {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath d='M6 8L1 3h10z' fill='%23999'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 12px center;
  padding-right: 36px; background-color: #F5F5F5;
}
select.form-input:focus { background-color: var(--surface); }

/* Form card — login/register */
.form-card {
  max-width: 420px; margin: var(--space-lg) auto;
  background: var(--surface); border-radius: var(--radius-lg);
  padding: var(--space-xl); box-shadow: var(--shadow-hover);
}
.form-card h2 {
  font-size: var(--fs-title); font-weight: 700; margin-bottom: 6px;
}
.form-card .form-subtitle {
  color: var(--text-muted); font-size: var(--fs-caption);
  margin-bottom: var(--space-lg);
}
.form-hint {
  margin-top: 14px; padding: 10px 14px;
  background: var(--info-bg); border-radius: var(--radius-md);
  font-size: var(--fs-small); color: var(--info);
}

/* Form tabs — Login/Register switch */
.form-tabs { display: flex; gap: 0; margin-bottom: var(--space-lg); border-bottom: 2px solid var(--border-light); }
.form-tab {
  flex: 1; padding: 10px 0; font-size: var(--fs-body);
  border: none; background: transparent; cursor: pointer;
  color: var(--text-muted); font-weight: 600;
  transition: all 0.2s; position: relative;
}
.form-tab.active { color: var(--primary); }
.form-tab.active::after {
  content: ''; position: absolute; bottom: -2px; left: 20%; right: 20%;
  height: 2px; background: var(--primary); border-radius: 1px;
}

/* Toggle switch */
.toggle-switch {
  position: relative; display: inline-block; width: 44px; height: 24px;
}
.toggle-switch input { display: none; }
.toggle-slider {
  position: absolute; inset: 0; background: var(--border);
  border-radius: 12px; cursor: pointer; transition: 0.2s;
}
.toggle-slider::before {
  content: ''; position: absolute; left: 2px; top: 2px;
  width: 20px; height: 20px; background: #fff;
  border-radius: 50%; transition: 0.2s;
}
.toggle-switch input:checked + .toggle-slider { background: var(--primary); }
.toggle-switch input:checked + .toggle-slider::before { transform: translateX(20px); }

/* ============================================================
   14. Breadcrumb
   ============================================================ */
.breadcrumb {
  display: flex; align-items: center; gap: 6px;
  font-size: var(--fs-caption); color: var(--text-muted); margin-bottom: var(--space-md);
  flex-wrap: wrap;
}
.breadcrumb a { color: var(--text-secondary); }
.breadcrumb a:hover { color: var(--primary); }
.breadcrumb .sep { color: var(--text-muted); font-size: 0.7rem; }

/* ============================================================
   15. Pagination
   ============================================================ */
.pagination {
  display: flex; align-items: center; justify-content: center;
  gap: var(--space-xs); margin-top: var(--space-lg);
}
.pagination button {
  min-width: 44px; min-height: 44px; border-radius: var(--radius-md);
  border: 1.5px solid var(--border); background: var(--surface);
  font-size: var(--fs-caption); color: var(--text); cursor: pointer;
  transition: all 0.15s; padding: 0 8px;
}
.pagination button:hover:not(:disabled):not(.active) { border-color: var(--primary); color: var(--primary); }
.pagination button.active { background: var(--primary); color: #fff; border-color: var(--primary); }
.pagination button:disabled { opacity: 0.3; cursor: not-allowed; }

/* ============================================================
   16. Detail Page Layout
   ============================================================ */
.detail-layout {
  display: grid; grid-template-columns: 1fr 1fr; gap: var(--space-xl);
}
.detail-image-wrap {
  background: var(--surface); border-radius: var(--radius-md);
  box-shadow: var(--shadow-card);
  overflow: hidden; position: relative;
}
.detail-main-img {
  aspect-ratio: 1;
  display: flex; align-items: center; justify-content: center;
  background: #FAFAFA;
}
.detail-main-img.placeholder-img {
  display: flex; align-items: center; justify-content: center;
  color: var(--text-muted); font-size: 64px;
  background: #F3F4F6; aspect-ratio: 1; border-radius: var(--radius-lg);
  user-select: none;
}
.detail-main-img img { width: 100%; height: 100%; object-fit: contain; }
.detail-thumbs {
  display: flex; gap: var(--space-sm); padding: 12px;
  overflow-x: auto;
}
.detail-thumb {
  width: 56px; height: 56px; border-radius: var(--radius-sm);
  border: 2px solid transparent; cursor: pointer;
  overflow: hidden; flex-shrink: 0;
  transition: border-color 0.15s;
  background: #FAFAFA; object-fit: cover;
  display: flex; align-items: center; justify-content: center;
}
.detail-thumb img { width: 100%; height: 100%; object-fit: cover; }
.detail-thumb.active, .detail-thumb:hover { border-color: var(--primary); }
.detail-info h1 { font-size: var(--fs-title); font-weight: 700; margin-bottom: 6px; line-height: 1.4; }
.detail-info .detail-subtitle { color: var(--danger); font-size: var(--fs-caption); font-weight: 600; margin-bottom: 12px; }

/* Price box — solid light background */
.detail-price-box {
  background: var(--primary-bg);
  border-radius: var(--radius-md); padding: var(--space-md) 20px; margin-bottom: var(--space-md);
}
.detail-price-box .detail-price-current {
  font-size: 32px; font-weight: 800; color: var(--danger);
  font-variant-numeric: tabular-nums;
}
.detail-price-box .detail-price-current .yen { font-size: 20px; }
.detail-price-box .detail-price-original {
  font-size: var(--fs-caption); color: var(--text-muted); text-decoration: line-through;
}
.detail-price-row { display: flex; align-items: baseline; gap: 12px; }
.detail-price {
  font-size: 2rem; font-weight: 800; color: var(--danger);
  font-variant-numeric: tabular-nums;
}
.detail-price .unit { font-size: var(--fs-body); font-weight: 400; }
.detail-original {
  font-size: var(--fs-body); color: var(--text-muted); text-decoration: line-through;
}
.detail-discount-tag {
  display: inline-block; background: var(--danger); color: #fff;
  padding: 2px 8px; border-radius: var(--radius-sm); font-size: var(--fs-small);
  font-weight: 600; margin-left: var(--space-sm);
}
.detail-info .detail-meta {
  display: flex; flex-wrap: wrap; gap: var(--space-md);
  margin: 12px 0; padding: 10px 0; border-top: 1px dashed var(--border);
  font-size: var(--fs-caption); color: var(--text-secondary);
}
.detail-info .detail-meta span { display: flex; align-items: center; gap: var(--space-xs); }
.detail-info .detail-meta .meta-value { color: var(--text); font-weight: 600; }

/* SKU selector */
.sku-group { margin-bottom: var(--space-md); }
.sku-group .sku-label {
  font-size: var(--fs-caption); font-weight: 600;
  margin-bottom: var(--space-sm); color: var(--text-secondary);
}
.sku-options { display: flex; gap: var(--space-sm); flex-wrap: wrap; }
.sku-option {
  padding: 8px var(--space-md); border-radius: var(--radius-full);
  border: 1.5px solid var(--border); background: var(--surface);
  font-size: var(--fs-caption); cursor: pointer; transition: all 0.15s;
  min-height: 44px; display: flex; align-items: center;
  color: var(--text);
}
.sku-option:hover { border-color: var(--primary); color: var(--primary); }
.sku-option.active, .sku-option.selected {
  border-color: var(--primary); background: var(--primary-bg);
  color: var(--primary); font-weight: 600;
}
.sku-option:disabled { opacity: 0.4; cursor: not-allowed; text-decoration: line-through; }

/* Quantity control */
.qty-row { display: flex; align-items: center; gap: var(--space-md); margin-bottom: var(--space-md); }
.qty-control {
  display: inline-flex; align-items: center; border: 1.5px solid var(--border);
  border-radius: var(--radius-md); overflow: hidden;
}
.qty-control button {
  min-width: 44px; min-height: 44px; border: none; background: var(--bg);
  font-size: 1.1rem; cursor: pointer; display: flex; align-items: center;
  justify-content: center; color: var(--text); transition: background 0.15s;
}
.qty-control button:hover { background: var(--border); }
.qty-control button:disabled { color: var(--text-muted); cursor: not-allowed; }
.qty-control input {
  width: 48px; text-align: center; border: none; border-left: 1px solid var(--border);
  border-right: 1px solid var(--border); font-size: var(--fs-caption);
  font-weight: 600; outline: none; background: var(--surface);
  -moz-appearance: textfield;
}
.qty-control input::-webkit-outer-spin-button,
.qty-control input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }

/* Detail actions */
.detail-actions { display: flex; gap: 10px; margin-top: 20px; margin-bottom: var(--space-lg); }
.detail-actions .btn { flex: 1; min-height: 46px; font-size: var(--fs-body); }

/* ============================================================
   17. Shop Card
   ============================================================ */
.shop-card {
  background: var(--surface); border-radius: var(--radius-md);
  box-shadow: var(--shadow-card);
  padding: var(--space-md);
  display: flex; align-items: center; gap: 12px;
  margin-top: var(--space-md);
}
.shop-card img {
  width: 48px; height: 48px; border-radius: 50%;
  object-fit: cover; border: 1px solid var(--border-light);
  background: var(--bg);
}
.shop-card .shop-logo {
  width: 44px; height: 44px; border-radius: 50%;
  background: var(--primary-bg); display: flex; align-items: center;
  justify-content: center; font-weight: 700; color: var(--primary);
  flex-shrink: 0;
}
.shop-card .shop-info { flex: 1; }
.shop-card .shop-name { font-weight: 600; font-size: var(--fs-body); color: var(--text); }
.shop-card .shop-stats { font-size: var(--fs-small); color: var(--text-muted); margin-top: 2px; }
.shop-card .shop-stats span { margin-right: 12px; }
.shop-card .btn { flex-shrink: 0; }
.shop-card .btn-shop {
  margin-left: auto; padding: 8px 20px;
  border: 1.5px solid var(--primary); border-radius: var(--radius-full);
  color: var(--primary); font-size: var(--fs-caption);
  background: var(--surface); cursor: pointer; white-space: nowrap;
  transition: all 0.2s;
}
.shop-card .btn-shop:hover { background: var(--primary-bg); }

/* ============================================================
   18. Review System
   ============================================================ */
.review-section { margin-top: var(--space-xl); }
.review-summary {
  display: flex; gap: var(--space-xl); padding: 20px;
  background: var(--surface); border-radius: var(--radius-md);
  box-shadow: var(--shadow-card); margin-bottom: var(--space-md);
}
.review-score { text-align: center; min-width: 100px; }
.review-score .score-number { font-size: 2.5rem; font-weight: 800; color: var(--warning); line-height: 1; }
.review-score .score-stars { font-size: 1.1rem; color: var(--warning); margin: var(--space-xs) 0; }
.review-score .score-total { font-size: var(--fs-small); color: var(--text-muted); }
.review-bars { flex: 1; display: flex; flex-direction: column; gap: 4px; justify-content: center; }
.review-bar-row { display: flex; align-items: center; gap: var(--space-sm); font-size: var(--fs-small); }
.review-bar-row .bar-label { width: 32px; text-align: right; color: var(--text-secondary); }
.review-bar-row .bar-track { flex: 1; height: 6px; background: var(--bg); border-radius: 3px; overflow: hidden; }
.review-bar-row .bar-fill { height: 100%; background: var(--warning); border-radius: 3px; transition: width 0.5s; }
.review-bar-row .bar-pct { width: 30px; color: var(--text-muted); }

/* Review item */
.review-item {
  background: var(--surface); border-radius: var(--radius-md);
  box-shadow: var(--shadow-card); padding: var(--space-md);
  margin-bottom: 12px;
}
.review-item .review-header { display: flex; align-items: center; gap: 10px; margin-bottom: var(--space-sm); }
.review-item .review-avatar {
  width: 32px; height: 32px; border-radius: 50%;
  background: var(--primary-bg); color: var(--primary);
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: var(--fs-small);
}
.review-item .review-user { font-weight: 600; font-size: var(--fs-caption); }
.review-item .review-stars { color: var(--warning); font-size: var(--fs-small); }
.review-item .review-date { color: var(--text-muted); font-size: var(--fs-small); margin-left: auto; }
.review-item .review-sku { color: var(--text-muted); font-size: var(--fs-small); }
.review-item .review-body { font-size: var(--fs-caption); line-height: 1.6; margin-bottom: var(--space-sm); }
.review-item .review-images { display: flex; gap: var(--space-sm); flex-wrap: wrap; margin-bottom: var(--space-sm); }
.review-item .review-images img {
  width: 80px; height: 80px; object-fit: cover;
  border-radius: var(--radius-sm); cursor: pointer;
  border: 1px solid var(--border-light);
}
.review-item .review-footer { display: flex; gap: var(--space-md); font-size: var(--fs-small); color: var(--text-muted); }
.review-item .review-footer button { color: var(--text-muted); cursor: pointer; }
.review-item .review-footer button:hover { color: var(--primary); }

/* Review form */
.review-form {
  background: var(--surface); border-radius: var(--radius-md);
  box-shadow: var(--shadow-card); padding: 20px; margin-bottom: var(--space-md);
}
.review-form h3, .review-form h4 { font-size: var(--fs-subtitle); font-weight: 700; margin-bottom: 12px; color: var(--text); }
.review-form textarea {
  width: 100%; height: 100px; border: 1.5px solid transparent;
  border-radius: 6px; padding: 10px 12px; font-size: var(--fs-caption);
  resize: vertical; outline: none; margin-top: 12px;
  font-family: inherit; background: #F5F5F5;
  transition: all 0.2s;
}
.review-form textarea:focus { border-color: var(--primary); background: var(--surface); }

/* Star rating */
.star-rating { display: inline-flex; gap: var(--space-xs); margin-bottom: 12px; }
.star-rating .star {
  font-size: 1.5rem; cursor: pointer; color: var(--border);
  transition: color 0.1s; user-select: none;
}
.star-rating .star.active { color: var(--warning); }
.star-rating.interactive .star:hover { color: var(--warning); }

/* Upload */
.upload-previews { display: flex; gap: var(--space-sm); flex-wrap: wrap; margin-top: var(--space-sm); }
.upload-preview {
  width: 80px; height: 80px; border-radius: var(--radius-sm);
  border: 1px solid var(--border); position: relative;
  display: flex; align-items: center; justify-content: center;
  overflow: hidden;
}
.upload-preview img { width: 100%; height: 100%; object-fit: cover; }
.upload-preview .remove-btn {
  position: absolute; top: 2px; right: 2px;
  width: 18px; height: 18px; border-radius: 50%;
  background: rgba(0,0,0,0.5); color: #fff;
  font-size: 0.65rem; display: flex; align-items: center; justify-content: center;
  cursor: pointer;
}
.upload-add {
  width: 80px; height: 80px; border-radius: var(--radius-sm);
  border: 2px dashed var(--border); cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  font-size: 1.5rem; color: var(--text-muted);
  transition: border-color 0.15s;
}
.upload-add:hover { border-color: var(--primary); color: var(--primary); }

/* ============================================================
   19. Cart
   ============================================================ */
.cart-shop-group {
  background: var(--surface); border-radius: var(--radius-md);
  box-shadow: var(--shadow-card); margin-bottom: 12px;
  overflow: hidden;
}
.cart-shop-header {
  display: flex; align-items: center; gap: 10px;
  padding: 12px var(--space-md); background: var(--bg);
  font-weight: 600; font-size: var(--fs-caption);
}
.cart-shop-header .checkbox-wrap { margin-right: var(--space-xs); }
.cart-item {
  display: flex; align-items: center; gap: 12px;
  padding: 14px var(--space-md); border-bottom: 1px solid var(--border-light);
}
.cart-item:last-child { border-bottom: none; }
.cart-item .checkbox-wrap { flex-shrink: 0; }
.cart-item .cart-item-img {
  width: 80px; height: 80px; border-radius: var(--radius-md);
  overflow: hidden; flex-shrink: 0;
  background: #FAFAFA; display: flex; align-items: center; justify-content: center;
}
.cart-item .cart-item-img img { width: 100%; height: 100%; object-fit: cover; }
.cart-item .cart-item-info { flex: 1; min-width: 0; }
.cart-item .cart-item-name {
  font-weight: 500; font-size: var(--fs-body);
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
  margin-bottom: var(--space-xs);
}
.cart-item .cart-item-sku { font-size: var(--fs-small); color: var(--text-muted); }
.cart-item .cart-item-price {
  font-weight: 800; color: var(--danger); font-size: var(--fs-body);
  font-variant-numeric: tabular-nums;
}
.cart-item .cart-item-subtotal {
  font-weight: 800; color: var(--danger); font-size: var(--fs-body);
  font-variant-numeric: tabular-nums;
  min-width: 80px; text-align: right;
}
.cart-item .cart-item-del {
  color: var(--text-muted); cursor: pointer; padding: var(--space-xs);
  font-size: 1.1rem; flex-shrink: 0;
}
.cart-item .cart-item-del:hover { color: var(--danger); }

/* Cart footer */
.cart-footer {
  position: sticky; bottom: 0; z-index: 50;
  background: var(--surface);
  padding: 12px 20px; margin-top: var(--space-md);
  display: flex; align-items: center; gap: var(--space-md);
  border-radius: var(--radius-md) var(--radius-md) 0 0;
  box-shadow: 0 -2px 12px rgba(0,0,0,0.06);
}
.cart-footer .total-price {
  font-size: var(--fs-title); font-weight: 800; color: var(--danger);
  font-variant-numeric: tabular-nums;
}
.cart-footer .total-hint { font-size: var(--fs-small); color: var(--text-muted); }

/* Checkbox */
.checkbox-wrap {
  display: inline-flex; align-items: center; justify-content: center;
  cursor: pointer;
}
.checkbox-wrap input[type="checkbox"] {
  width: 18px; height: 18px; accent-color: var(--primary); cursor: pointer;
}

/* ============================================================
   20. Checkout
   ============================================================ */
.checkout-section {
  background: var(--surface); border-radius: var(--radius-md);
  box-shadow: var(--shadow-card); padding: 20px; margin-bottom: 14px;
}
.checkout-section h3 { font-size: var(--fs-subtitle); font-weight: 700; margin-bottom: 14px; }
.address-card {
  border: 2px solid var(--border-light); border-radius: var(--radius-md);
  padding: 14px; cursor: pointer; transition: border-color 0.15s;
  margin-bottom: var(--space-sm); background: var(--surface);
}
.address-card:hover, .address-card.selected { border-color: var(--primary); }
.address-card.selected { background: var(--primary-bg); }
.address-card .addr-name { font-weight: 600; margin-bottom: var(--space-xs); font-size: var(--fs-body); }
.address-card .addr-detail { font-size: var(--fs-caption); color: var(--text-secondary); }
.address-card .addr-phone { font-size: var(--fs-caption); color: var(--text-muted); }

/* ============================================================
   21. Payment
   ============================================================ */
.payment-card {
  max-width: 480px; margin: 60px auto;
  background: var(--surface); border-radius: var(--radius-lg);
  box-shadow: var(--shadow-modal); padding: var(--space-xl); text-align: center;
}
.payment-card .pay-amount {
  font-size: 2.5rem; font-weight: 800; color: var(--danger);
  font-variant-numeric: tabular-nums; margin: var(--space-md) 0;
}
.payment-card .pay-amount .unit { font-size: 1rem; }
.payment-methods { display: flex; gap: 10px; margin: 20px 0; flex-wrap: wrap; justify-content: center; }
.payment-method {
  width: 100px; padding: 14px 8px; border-radius: var(--radius-md);
  border: 2px solid var(--border); text-align: center;
  cursor: pointer; transition: all 0.2s;
  display: flex; flex-direction: column; align-items: center; gap: 6px;
  background: var(--surface);
}
.payment-method:hover, .payment-method.selected {
  border-color: var(--primary); background: var(--primary-bg);
}
.payment-method .pm-icon { font-size: 1.8rem; }
.payment-method .pm-name { font-size: var(--fs-small); font-weight: 500; }
.pay-result { padding: 40px 20px; }
.pay-result .result-icon { font-size: 4rem; margin-bottom: 12px; }
.pay-result .result-title { font-size: var(--fs-title); font-weight: 700; margin-bottom: 6px; }
.pay-result .result-desc { color: var(--text-secondary); font-size: var(--fs-body); }

/* ============================================================
   22. Toast
   ============================================================ */
.toast-container {
  position: fixed; top: 80px; right: 20px; z-index: 10000;
  display: flex; flex-direction: column; gap: var(--space-sm);
  pointer-events: none;
}
.toast {
  padding: 12px 20px; border-radius: var(--radius-md);
  color: #fff; font-weight: 500; font-size: var(--fs-caption);
  box-shadow: var(--shadow-modal);
  animation: toastIn 0.3s ease;
  max-width: 360px; pointer-events: auto;
}
.toast-success { background: var(--success); }
.toast-error { background: var(--danger); }
.toast-warning { background: var(--warning); color: var(--text); }
.toast-info { background: var(--info); }
@keyframes toastIn { from { opacity: 0; transform: translateX(100%); } to { opacity: 1; transform: translateX(0); } }

/* ============================================================
   23. Table
   ============================================================ */
.table-wrap {
  overflow-x: auto; border-radius: var(--radius-md);
  background: var(--surface); box-shadow: var(--shadow-card);
}
table { width: 100%; border-collapse: collapse; }
th, td { padding: 10px 14px; text-align: left; font-size: var(--fs-caption); }
th {
  background: var(--bg); font-weight: 600; color: var(--text-secondary);
  font-size: var(--fs-small); white-space: nowrap; border-bottom: 2px solid var(--border);
}
td { border-bottom: 1px solid var(--border-light); }
tr:last-child td { border-bottom: none; }
tr:hover td { background: var(--surface-hover); }

/* Status badges */
.status-badge {
  display: inline-block; padding: 2px 10px; border-radius: var(--radius-full);
  font-size: var(--fs-small); font-weight: 700; white-space: nowrap;
}
.status-PENDING, .status-PENDING_PAYMENT { background: var(--warning-bg); color: #B06000; }
.status-PAID { background: var(--info-bg); color: #0050b3; }
.status-SHIPPED { background: #E6E6FF; color: #333399; }
.status-RECEIVED, .status-COMPLETED { background: var(--success-bg); color: #006633; }
.status-CANCELLED { background: var(--danger-bg); color: #991B1B; }
.status-REFUNDED { background: #F0F0F0; color: #666; }

/* ============================================================
   24. Stats Cards
   ============================================================ */
.stats-grid {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: var(--space-md); margin-bottom: var(--space-lg);
}
.stat-card {
  background: var(--surface); border-radius: var(--radius-md);
  box-shadow: var(--shadow-card); padding: 20px;
  transition: box-shadow 0.2s;
}
.stat-card:hover { box-shadow: var(--shadow-hover); }
.stat-card .stat-header {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: var(--space-sm);
}
.stat-card .stat-icon {
  width: 44px; height: 44px; border-radius: var(--radius-md);
  display: flex; align-items: center; justify-content: center;
  font-size: 1.3rem;
}
.stat-card .stat-trend { font-size: var(--fs-small); font-weight: 600; }
.stat-card .stat-trend.up { color: var(--success); }
.stat-card .stat-trend.down { color: var(--danger); }
.stat-card .stat-value { font-size: 1.8rem; font-weight: 800; color: var(--text); line-height: 1.2; }
.stat-card .stat-label { font-size: var(--fs-caption); color: var(--text-muted); margin-top: 2px; }

/* ============================================================
   25. Dashboard Layout
   ============================================================ */
.dashboard-layout {
  display: flex; min-height: calc(100vh - var(--navbar-height) - 60px); gap: 0;
}
.dashboard-sidebar {
  width: var(--sidebar-width); flex-shrink: 0;
  background: var(--surface); border-right: 1px solid var(--border-light);
  padding: 12px 0; overflow-y: auto;
}
.dashboard-sidebar .sidebar-section-title {
  padding: 8px 20px 12px; font-size: var(--fs-small); font-weight: 700;
  color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.5px;
}
.dashboard-sidebar .sidebar-link {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 20px; cursor: pointer; transition: all 0.15s;
  font-size: var(--fs-caption); color: var(--text-secondary); border-left: 3px solid transparent;
}
.dashboard-sidebar .sidebar-link:hover { background: var(--bg); color: var(--text); }
.dashboard-sidebar .sidebar-link.active {
  background: var(--primary-bg); color: var(--primary);
  border-left-color: var(--primary); font-weight: 600;
}
.dashboard-sidebar .sidebar-link .nav-icon { font-size: 1.1rem; min-width: 22px; text-align: center; }
.dashboard-main { flex: 1; padding: var(--space-lg); overflow-x: hidden; min-width: 0; }

/* ============================================================
   26. Chart Containers
   ============================================================ */
.chart-card {
  background: var(--surface); border-radius: var(--radius-md);
  box-shadow: var(--shadow-card); padding: 20px; margin-bottom: var(--space-md);
}
.chart-card h3 { font-size: var(--fs-body); font-weight: 700; margin-bottom: var(--space-md); }
.chart-container { position: relative; width: 100%; }
.chart-container canvas { width: 100%; height: 100%; }

/* ============================================================
   27. Modal
   ============================================================ */
.modal-overlay {
  display: none; position: fixed; inset: 0;
  background: rgba(0,0,0,0.45); z-index: 2000;
  align-items: center; justify-content: center;
}
.modal-overlay.active { display: flex; }
.modal {
  background: var(--surface); border-radius: var(--radius-lg);
  padding: 28px; width: 90%; max-width: 560px; max-height: 85vh;
  overflow-y: auto; box-shadow: var(--shadow-modal);
  animation: modalIn 0.2s ease;
}
@keyframes modalIn { from { opacity: 0; transform: scale(0.95); } to { opacity: 1; transform: scale(1); } }
.modal h4 { font-size: var(--fs-subtitle); font-weight: 700; margin-bottom: var(--space-md); }
.modal .btn-row { display: flex; gap: 10px; justify-content: flex-end; margin-top: var(--space-md); }

/* ============================================================
   28. Empty State
   ============================================================ */
.empty-state { text-align: center; padding: 60px 20px; }
.empty-state .empty-icon { font-size: 3.5rem; margin-bottom: 12px; opacity: 0.5; }
.empty-state h3 { font-size: var(--fs-subtitle); color: var(--text-secondary); margin-bottom: 6px; }
.empty-state p { color: var(--text-muted); font-size: var(--fs-body); }

/* ============================================================
   29. Spinner
   ============================================================ */
.spinner {
  width: 36px; height: 36px; border: 3px solid var(--border);
  border-top-color: var(--primary); border-radius: 50%;
  animation: spin 0.7s linear infinite; margin: 30px auto;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ============================================================
   30. Seckill — solid dark background, no gradient
   ============================================================ */
.seckill-hero {
  background: #1E1B2E;
  border-radius: var(--radius-lg); padding: 28px var(--space-xl);
  color: #fff; margin-bottom: 20px;
}
.seckill-hero .seckill-header { display: flex; align-items: center; gap: var(--space-md); margin-bottom: 18px; flex-wrap: wrap; }
.seckill-hero .seckill-title { font-size: var(--fs-title); font-weight: 800; }
.seckill-timer { display: flex; align-items: center; gap: 6px; }
.seckill-timer .timer-block {
  background: var(--danger); padding: 5px 10px; border-radius: 6px;
  font-size: 1.2rem; font-weight: 800; font-variant-numeric: tabular-nums;
  min-width: 36px; text-align: center;
}
.seckill-timer .timer-sep { font-size: 1rem; font-weight: 600; }
.seckill-featured {
  display: flex; align-items: center; gap: 20px;
  background: rgba(255,255,255,0.06); border-radius: var(--radius-md);
  padding: var(--space-md) 20px; flex-wrap: wrap;
}
.seckill-featured .sf-img {
  width: 100px; height: 100px; border-radius: var(--radius-md);
  background: rgba(255,255,255,0.1); display: flex; align-items: center;
  justify-content: center; font-size: 2.5rem; flex-shrink: 0; overflow: hidden;
}
.seckill-featured .sf-img img { width: 100%; height: 100%; object-fit: cover; border-radius: var(--radius-md); }
.seckill-featured .sf-info { flex: 1; min-width: 200px; }
.seckill-featured .sf-name { font-size: var(--fs-subtitle); font-weight: 700; margin-bottom: var(--space-xs); }
.seckill-featured .sf-desc { font-size: var(--fs-caption); opacity: 0.6; margin-bottom: var(--space-sm); }
.seckill-featured .sf-price {
  font-size: 1.4rem; font-weight: 800; color: var(--danger);
  font-variant-numeric: tabular-nums;
}
.seckill-featured .sf-price .original {
  font-size: 0.8rem; opacity: 0.4; text-decoration: line-through;
  margin-left: var(--space-sm); font-weight: 400;
}
.seckill-btn {
  background: var(--danger); color: #fff; padding: 12px 32px;
  border-radius: var(--radius-md); font-size: var(--fs-subtitle);
  font-weight: 700; letter-spacing: 0.5px;
  transition: all 0.2s; white-space: nowrap; min-height: 48px;
  cursor: pointer; border: none;
}
.seckill-btn:hover:not(:disabled) { background: #B91C1C; transform: scale(1.02); }
.seckill-btn:disabled { background: #666; cursor: not-allowed; }
.seckill-result {
  margin-top: 10px; padding: 10px var(--space-md); border-radius: var(--radius-md);
  font-weight: 600; text-align: center; font-size: var(--fs-caption);
}
.seckill-result.success { background: var(--success-bg); color: #065F46; }
.seckill-result.pending { background: var(--warning-bg); color: #92400E; }
.seckill-result.fail { background: var(--danger-bg); color: #991B1B; }

/* ============================================================
   31. Tabs
   ============================================================ */
.tab-bar {
  display: flex; gap: 0; border-bottom: 2px solid var(--border-light); margin-bottom: var(--space-md);
  overflow-x: auto;
}
.tab-item {
  padding: 10px 20px; font-size: var(--fs-caption); font-weight: 500;
  color: var(--text-secondary); cursor: pointer;
  border-bottom: 2px solid transparent; margin-bottom: -2px;
  white-space: nowrap; transition: all 0.15s;
}
.tab-item:hover { color: var(--primary); }
.tab-item.active {
  color: var(--primary); font-weight: 700;
  border-bottom-color: var(--primary);
}
.tab-panel { display: none; }
.tab-panel.active { display: block; }

/* ============================================================
   32. Order Timeline
   ============================================================ */
.order-timeline { display: flex; gap: 0; margin: var(--space-md) 0; }
.order-timeline .timeline-step {
  flex: 1; text-align: center; position: relative;
  padding-top: 20px; font-size: var(--fs-caption); color: var(--text-muted);
}
.order-timeline .timeline-step::before {
  content: ''; position: absolute; top: 6px; left: 50%; transform: translateX(-50%);
  width: 12px; height: 12px; border-radius: 50%; background: var(--border);
  z-index: 1;
}
.order-timeline .timeline-step.done { color: var(--success); }
.order-timeline .timeline-step.done::before { background: var(--success); }
.order-timeline .timeline-step.active { color: var(--primary); font-weight: 600; }
.order-timeline .timeline-step.active::before { background: var(--primary); box-shadow: 0 0 0 4px rgba(232,93,44,0.2); }
.order-timeline .timeline-step::after {
  content: ''; position: absolute; top: 12px; left: 50%; right: -50%;
  height: 2px; background: var(--border); z-index: 0;
}
.order-timeline .timeline-step:last-child::after { display: none; }

/* ============================================================
   33. User Layout
   ============================================================ */
.user-layout {
  display: flex; gap: var(--space-lg); min-height: calc(100vh - 200px);
}
.user-sidebar {
  width: 200px; flex-shrink: 0;
  background: var(--surface); border-radius: var(--radius-md);
  box-shadow: var(--shadow-card); padding: 12px 0;
}
.user-sidebar .user-card {
  padding: var(--space-md); text-align: center; border-bottom: 1px solid var(--border-light);
}
.user-sidebar .user-card .avatar {
  width: 56px; height: 56px; border-radius: 50%;
  background: var(--primary); color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-weight: 800; font-size: 1.3rem; margin: 0 auto var(--space-sm);
}
.user-sidebar .user-card .uname { font-weight: 700; font-size: var(--fs-body); }
.user-sidebar .user-card .ubadge { font-size: var(--fs-small); color: var(--text-muted); }
.user-sidebar .user-menu-link {
  display: flex; align-items: center; gap: var(--space-sm);
  padding: 12px 20px; font-size: var(--fs-caption); color: var(--text-secondary);
  cursor: pointer; transition: all 0.15s;
}
.user-sidebar .user-menu-link:hover, .user-sidebar .user-menu-link.active {
  background: var(--primary-bg); color: var(--primary); font-weight: 600;
}
.user-main { flex: 1; min-width: 0; }

/* ============================================================
   34. SKU Row (in modals/forms)
   ============================================================ */
.sku-row {
  display: flex; gap: var(--space-sm); align-items: center; margin-bottom: var(--space-sm); flex-wrap: wrap;
}
.sku-row input { flex: 1; min-width: 70px; }

/* ============================================================
   35. Footer
   ============================================================ */
.blitz-footer {
  background: var(--accent); color: #ccc;
  padding: var(--space-lg) 20px; margin-top: auto;
}
.footer-inner {
  max-width: var(--max-width); margin: 0 auto;
  display: grid; grid-template-columns: repeat(4, 1fr); gap: var(--space-xl);
}
.footer-col h4 { font-size: var(--fs-body); font-weight: 700; margin-bottom: 10px; color: #fff; }
.footer-col a { display: block; font-size: var(--fs-caption); color: #aaa; padding: 3px 0; text-decoration: none; }
.footer-col a:hover { color: var(--primary); text-decoration: none; }
.footer-bottom {
  text-align: center; padding: var(--space-md) 20px;
  color: #999; font-size: var(--fs-small);
  border-top: 1px solid rgba(255,255,255,0.1); max-width: var(--max-width); margin: 0 auto;
}
.blitz-footer > p { text-align: center; padding: var(--space-sm) 20px; color: #999; font-size: var(--fs-small); }

/* ============================================================
   36. Search Highlight
   ============================================================ */
.keyword-highlight { color: var(--primary); font-weight: 600; }

/* ============================================================
   37. Mobile: Hamburger Button
   ============================================================ */
.hamburger-btn {
  display: none;
  background: none; border: none;
  font-size: 1.5rem; cursor: pointer;
  padding: var(--space-sm); color: var(--text);
  min-width: 44px; min-height: 44px;
  align-items: center; justify-content: center;
  line-height: 1;
}

/* ============================================================
   38. Mobile: Navigation Drawer
   ============================================================ */
.mobile-nav-overlay {
  display: none;
  position: fixed; inset: 0; background: rgba(0,0,0,0.35);
  z-index: 9999; opacity: 0; transition: opacity 0.25s ease;
  pointer-events: none;
}
.mobile-nav-overlay.show { opacity: 1; pointer-events: auto; }

.mobile-nav-drawer {
  position: fixed; top: 0; left: 0;
  width: 280px; max-width: 82vw;
  height: 100vh; height: 100dvh;
  background: var(--surface); z-index: 10000;
  overflow-y: auto;
  transform: translateX(-100%);
  transition: transform 0.28s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: 2px 0 24px rgba(0,0,0,0.12);
}
.mobile-nav-drawer.open { transform: translateX(0); }
.mobile-nav-drawer .drawer-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: var(--space-md) 20px; border-bottom: 1px solid var(--border-light);
}
.drawer-header .drawer-brand {
  font-size: var(--fs-subtitle); font-weight: 800; color: var(--primary);
}
.drawer-close {
  background: none; border: none; font-size: 1.3rem;
  cursor: pointer; padding: var(--space-sm); color: var(--text-muted);
  min-width: 44px; min-height: 44px;
  display: flex; align-items: center; justify-content: center;
}
.drawer-section { padding: 12px 20px; }
.drawer-section-title {
  font-size: var(--fs-small); color: var(--text-muted);
  text-transform: uppercase; letter-spacing: 0.5px;
  margin-bottom: var(--space-sm); padding: 0 4px;
}
.drawer-link {
  display: flex; align-items: center; gap: 10px;
  padding: 12px 4px; font-size: var(--fs-body);
  color: var(--text); border-radius: var(--radius-md);
  transition: background 0.15s; min-height: 44px;
  cursor: pointer; text-decoration: none;
}
.drawer-link:hover, .drawer-link.active { background: var(--primary-bg); color: var(--primary); font-weight: 600; }
.drawer-link .drawer-icon { font-size: 1.1rem; width: 24px; text-align: center; }

/* ============================================================
   39. Mobile: Bottom Tab Bar — pure white, no backdrop-filter
   ============================================================ */
.mobile-tab-bar {
  display: none;
  position: fixed; bottom: 0; left: 0; right: 0; height: 56px;
  background: var(--surface);
  border-top: 1px solid var(--border-light);
  z-index: 1000; padding-bottom: env(safe-area-inset-bottom, 0);
}
.mobile-tab-bar .tab-inner { display: flex; height: 100%; max-width: 500px; margin: 0 auto; }
.mobile-tab-bar .tab-item {
  flex: 1; display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  font-size: var(--fs-small); color: var(--text-muted);
  text-decoration: none; gap: 2px; min-height: 44px;
  transition: color 0.15s;
  -webkit-tap-highlight-color: transparent;
}
.mobile-tab-bar .tab-item .tab-icon { font-size: 1.2rem; line-height: 1; }
.mobile-tab-bar .tab-item.active { color: var(--primary); font-weight: 600; }

/* ============================================================
   40. Mobile: Category Bottom Sheet
   ============================================================ */
.mobile-cat-overlay {
  display: none;
  position: fixed; inset: 0; background: rgba(0,0,0,0.35);
  z-index: 9999; opacity: 0; transition: opacity 0.25s ease;
  pointer-events: none;
}
.mobile-cat-overlay.show { opacity: 1; pointer-events: auto; }
.mobile-cat-sheet {
  position: fixed; bottom: 0; left: 0; right: 0;
  max-height: 60vh; max-height: 60dvh;
  background: var(--surface); z-index: 10000;
  border-radius: var(--radius-lg) var(--radius-lg) 0 0;
  transform: translateY(100%);
  transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  overflow-y: auto; padding-bottom: env(safe-area-inset-bottom, 0);
}
.mobile-cat-sheet.open { transform: translateY(0); }
.mobile-cat-sheet .sheet-handle {
  width: 36px; height: 4px; background: var(--border);
  border-radius: 2px; margin: 10px auto;
}
.mobile-cat-sheet .sheet-title {
  font-size: var(--fs-body); font-weight: 700;
  padding: 0 20px 12px; text-align: center;
}
.mobile-cat-sheet .sheet-cat-item {
  display: flex; align-items: center; gap: 10px;
  padding: 13px 20px; font-size: var(--fs-body);
  color: var(--text); border-bottom: 1px solid var(--border-light);
  cursor: pointer; min-height: 48px;
  transition: background 0.15s;
}
.mobile-cat-sheet .sheet-cat-item:active { background: var(--primary-bg); }

/* ============================================================
   41. Sticky Bottom Bar
   ============================================================ */
.sticky-bottom-bar {
  display: none;
  position: fixed; bottom: 0; left: 0; right: 0;
  background: var(--surface); border-top: 1px solid var(--border-light);
  padding: 10px var(--space-md); z-index: 99;
  padding-bottom: calc(10px + env(safe-area-inset-bottom, 0));
  box-shadow: 0 -2px 12px rgba(0,0,0,0.06);
}

/* ============================================================
   42. Responsive — Tablet / Small Laptop (<=1024px)
   ============================================================ */
@media (max-width: 1024px) {
  :root { --max-width: 100%; --sidebar-width: 200px; }
  .main-content { padding: var(--space-md); }
  .nav-inner { padding: 0 14px; gap: 14px; }
  .nav-search { max-width: 360px; }
  .category-sidebar { width: 180px; }
  .category-sidebar .cat-sub {
    min-width: 360px; grid-template-columns: repeat(2, 1fr);
  }
  .banner-carousel { height: 280px; }
  .banner-slide h2 { font-size: 1.6rem; }
  .banner-slide { padding: 40px; }
  .product-grid { grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 12px; }
  .detail-layout { gap: var(--space-lg); }
  .dashboard-sidebar { width: 180px; }
  .dashboard-sidebar .sidebar-link { padding: 8px 14px; font-size: var(--fs-caption); }
  .quick-entries { grid-template-columns: repeat(5, 1fr); gap: var(--space-sm); }
  .footer-inner { gap: 20px; }
  .user-sidebar { width: 170px; }
}

/* ============================================================
   43. Responsive — Tablet Portrait / Large Phone (<=768px)
   ============================================================ */
@media (max-width: 768px) {
  :root {
    --navbar-height: 52px;
    --max-width: 100%;
    --sidebar-width: 100%;
  }

  /* Show hamburger, simplify nav */
  .hamburger-btn { display: flex; }
  .nav-inner { gap: var(--space-sm); padding: 0 var(--space-sm); }
  .nav-brand { font-size: var(--fs-subtitle); }
  .nav-search { flex: 1; max-width: none; }
  .nav-search input { padding: 8px 10px; font-size: var(--fs-caption); }
  .nav-secondary { display: none; }
  .nav-icons > a[href="/"],
  .nav-icons > a[href="/products.html"],
  .nav-icons > a[href="/seckill.html"],
  .nav-icons > .nav-btn[data-page="products"],
  .nav-icons > .nav-btn[data-page="seckill"] { display: none; }
  .nav-icons { gap: var(--space-xs); }
  .nav-icons a, .nav-icons .nav-btn { font-size: var(--fs-small); padding: 5px 8px; }

  /* Mobile overlays */
  .mobile-nav-overlay, .mobile-nav-drawer { display: block; }
  .mobile-tab-bar { display: block; }
  body { padding-bottom: 56px; }

  /* Sidebar hidden */
  .category-sidebar { display: none; }

  /* Banner */
  .banner-carousel { height: 160px; border-radius: var(--radius-md); }
  .banner-slide { padding: 20px; }
  .banner-slide h2 { font-size: 1.15rem; }
  .banner-slide p { font-size: var(--fs-caption); margin-bottom: 10px; }
  .banner-slide .btn-white { padding: 6px 14px; font-size: var(--fs-small); }

  /* Quick entries */
  .quick-entries { grid-template-columns: repeat(4, 1fr); gap: 6px; }
  .quick-entry { padding: 12px 6px; }
  .quick-entry .qe-icon { font-size: 1.5rem; }
  .quick-entry .qe-label { font-size: var(--fs-small); }

  /* Product grid: 2 cols */
  .product-grid { grid-template-columns: repeat(2, 1fr); gap: var(--space-sm); }
  .product-card .card-img { aspect-ratio: 1; }
  .product-card .card-body { padding: 8px 10px; }
  .product-card .card-name { font-size: var(--fs-caption); }
  .product-card .card-price { font-size: 1rem; }
  .product-card .card-meta { font-size: var(--fs-small); }

  /* Scene rows */
  .scene-row .product-card { min-width: 150px; }
  .scene-row { gap: var(--space-sm); }

  /* Detail: stack vertically */
  .detail-layout { grid-template-columns: 1fr; gap: var(--space-md); }
  .detail-info h1 { font-size: var(--fs-subtitle); }
  .detail-info .detail-price { font-size: 1.4rem; }
  .detail-actions { display: none; }

  /* Seckill */
  .seckill-hero { padding: 14px; border-radius: var(--radius-md); }
  .seckill-hero .seckill-title { font-size: var(--fs-subtitle); }
  .seckill-featured { flex-direction: column; text-align: center; gap: 10px; padding: 14px; }
  .seckill-featured .sf-img { width: 80px; height: 80px; }
  .seckill-btn { width: 100%; min-height: 48px; }

  /* Forms */
  .form-card { max-width: 100%; margin: 10px 0; padding: 20px var(--space-md); }
  .form-input, .btn, button[type="submit"] { min-height: 44px; }

  /* Filter: horizontal scroll */
  .filter-bar { flex-wrap: nowrap; overflow-x: auto; gap: var(--space-sm); padding-bottom: 4px; -webkit-overflow-scrolling: touch; scrollbar-width: none; }
  .filter-bar::-webkit-scrollbar { display: none; }
  .category-pill { flex-shrink: 0; padding: 5px 12px; font-size: var(--fs-small); min-height: 44px; }

  /* Pagination */
  .pagination { gap: 2px; }
  .pagination button { min-width: 44px; min-height: 44px; font-size: var(--fs-small); }

  /* Tables -> cards */
  .table-wrap { box-shadow: none; overflow: visible; }
  table, thead, tbody, th, td, tr { display: block; }
  thead { display: none; }
  tr {
    background: var(--surface); border-radius: var(--radius-md);
    box-shadow: var(--shadow-card); margin-bottom: 10px;
    padding: 10px 14px;
  }
  td {
    display: flex; justify-content: space-between; align-items: center;
    padding: 5px 0; border-bottom: none; font-size: var(--fs-caption);
  }
  td::before {
    content: attr(data-label); font-weight: 600;
    color: var(--text-secondary); font-size: var(--fs-small);
    flex-shrink: 0; margin-right: 12px;
  }
  tr:hover td { background: transparent; }

  /* Stats: 2 cols */
  .stats-grid { grid-template-columns: repeat(2, 1fr); gap: var(--space-sm); }
  .stat-card { padding: 14px; }
  .stat-card .stat-value { font-size: 1.4rem; }

  /* Dashboard layout: stack */
  .dashboard-layout { flex-direction: column; }
  .dashboard-sidebar {
    width: 100%; display: flex; overflow-x: auto;
    padding: var(--space-sm); border-right: none; border-bottom: 1px solid var(--border-light);
    flex-shrink: 0;
  }
  .dashboard-sidebar .sidebar-section-title { display: none; }
  .dashboard-sidebar .sidebar-link {
    white-space: nowrap; border-left: none; border-bottom: 2px solid transparent;
    padding: 8px 12px; font-size: var(--fs-caption);
  }
  .dashboard-sidebar .sidebar-link.active { border-left: none; border-bottom-color: var(--primary); }
  .dashboard-main { padding: 14px; }

  /* User layout: stack */
  .user-layout { flex-direction: column; }
  .user-sidebar { width: 100%; }
  .user-sidebar .user-card { display: flex; align-items: center; gap: 10px; text-align: left; padding: 12px; }
  .user-sidebar .user-card .avatar { width: 40px; height: 40px; font-size: 1rem; margin: 0; }
  .user-sidebar .user-menu-link { display: inline-block; }

  /* Review summary */
  .review-summary { flex-direction: column; align-items: center; gap: var(--space-md); }

  /* Cart */
  .cart-item { flex-wrap: wrap; }
  .cart-item .cart-item-img { width: 64px; height: 64px; }
  .cart-item .cart-item-subtotal { min-width: auto; }

  /* Footer */
  .footer-inner { grid-template-columns: 1fr 1fr; gap: var(--space-md); }
  .blitz-footer { margin-bottom: 56px; }
  .main-content { padding: 10px var(--space-sm); }
  .empty-state { padding: 40px var(--space-md); }

  /* Toast */
  .toast-container { top: 60px; right: 10px; left: 10px; }
  .toast { max-width: 100%; text-align: center; font-size: var(--fs-caption); }

  /* Sticky bottom bar */
  .sticky-bottom-bar { display: flex; gap: 10px; }
}

/* ============================================================
   44. Responsive — Small Phone (<=480px)
   ============================================================ */
@media (max-width: 480px) {
  :root { --navbar-height: 48px; }
  .nav-brand { font-size: var(--fs-subtitle); }
  .nav-search { padding: 0; }
  .nav-search input { font-size: var(--fs-small); }
  .banner-carousel { height: 140px; }
  .banner-slide { padding: 14px; }
  .banner-slide h2 { font-size: var(--fs-subtitle); }
  .banner-slide p { font-size: var(--fs-small); }
  .product-grid { gap: 6px; }
  .product-card .card-name { font-size: var(--fs-small); }
  .product-card .card-price { font-size: var(--fs-body); }
  .detail-info .detail-price { font-size: var(--fs-title); }
  .detail-actions { flex-direction: column; }
  .detail-actions .btn { width: 100%; }
  .seckill-hero .seckill-title { font-size: var(--fs-subtitle); }
  .seckill-timer .timer-block { padding: 4px 6px; font-size: 0.85rem; min-width: 26px; }
  .form-card { padding: var(--space-md) 12px; }
  .stats-grid { grid-template-columns: 1fr 1fr; gap: 6px; }
  .stat-card .stat-value { font-size: 1.2rem; }
  .quick-entries { grid-template-columns: repeat(3, 1fr); }
  .footer-inner { grid-template-columns: 1fr; }
  .mobile-tab-bar .tab-item { font-size: var(--fs-small); }
  .mobile-tab-bar .tab-item .tab-icon { font-size: 1rem; }
}

/* ============================================================
   45. Touch Optimization
   ============================================================ */
@media (hover: none) and (pointer: coarse) {
  .product-card:hover { transform: none; box-shadow: var(--shadow-card); }
  .product-card:active { transform: scale(0.98); }
  .product-card:hover .card-img img { transform: none; }
  .btn-primary:hover, .seckill-btn:hover { transform: none; }
  .btn-primary:active, .seckill-btn:active { transform: scale(0.97); }
  a, button, .category-pill, .sku-option, .product-card, .sidebar-link {
    -webkit-tap-highlight-color: transparent;
  }
}

/* ============================================================
   46. Reduced Motion
   ============================================================ */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

/* ============================================================
   46. AI Chat Widget — floating button + slide-up panel
   ============================================================ */
.ai-chat-fab {
  position: fixed; bottom: 24px; right: 24px; z-index: 9000;
  width: 56px; height: 56px; border-radius: 50%;
  background: var(--primary); color: #fff;
  font-size: 1.5rem; display: flex; align-items: center;
  justify-content: center; cursor: pointer;
  box-shadow: 0 4px 16px rgba(232,93,44,0.30);
  transition: transform 0.2s, box-shadow 0.2s;
  border: none; user-select: none;
}
.ai-chat-fab:hover { transform: scale(1.08); box-shadow: 0 6px 24px rgba(232,93,44,0.40); }
.ai-chat-fab .fab-badge {
  position: absolute; top: -2px; right: -2px;
  width: 10px; height: 10px; border-radius: 50%;
  background: var(--success); border: 2px solid #fff;
  animation: fabPulse 2s infinite;
}
@keyframes fabPulse { 0%,100%{opacity:1} 50%{opacity:0.5} }

.ai-chat-panel {
  position: fixed; bottom: 92px; right: 24px; z-index: 9001;
  width: 380px; max-width: calc(100vw - 32px);
  height: 520px; max-height: calc(100vh - 120px);
  background: var(--surface); border-radius: var(--radius-lg);
  box-shadow: var(--shadow-modal);
  display: flex; flex-direction: column;
  transform: translateY(16px) scale(0.95);
  opacity: 0; pointer-events: none;
  transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  overflow: hidden;
}
.ai-chat-panel.open {
  transform: translateY(0) scale(1); opacity: 1; pointer-events: auto;
}
.ai-chat-panel .chat-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 18px; background: var(--primary); color: #fff;
  border-radius: var(--radius-lg) var(--radius-lg) 0 0;
}
.ai-chat-panel .chat-header h4 {
  font-size: var(--fs-body); font-weight: 700;
  display: flex; align-items: center; gap: var(--space-sm);
}
.ai-chat-panel .chat-header .chat-close {
  background: rgba(255,255,255,0.2); color: #fff;
  border: none; width: 28px; height: 28px; border-radius: 50%;
  cursor: pointer; font-size: 1rem; display: flex; align-items: center;
  justify-content: center; transition: background 0.15s;
}
.ai-chat-panel .chat-header .chat-close:hover { background: rgba(255,255,255,0.35); }
.ai-chat-panel .chat-header .chat-status {
  font-size: var(--fs-small); opacity: 0.85; font-weight: 400;
}
.ai-chat-panel .chat-messages {
  flex: 1; overflow-y: auto; padding: 14px;
  display: flex; flex-direction: column; gap: 10px;
  background: var(--bg);
}
.ai-chat-panel .chat-msg {
  max-width: 85%; padding: 10px 14px; border-radius: var(--radius-md);
  font-size: var(--fs-caption); line-height: 1.55; word-break: break-word;
}
.ai-chat-panel .chat-msg.user {
  align-self: flex-end; background: var(--primary); color: #fff;
  border-radius: var(--radius-md) var(--radius-md) 4px var(--radius-md);
}
.ai-chat-panel .chat-msg.ai {
  align-self: flex-start; background: var(--surface); color: var(--text);
  border-radius: var(--radius-md) var(--radius-md) var(--radius-md) 4px;
  box-shadow: var(--shadow-card);
}
.ai-chat-panel .chat-msg.ai.streaming { border-left: 3px solid var(--primary); }
.ai-chat-panel .chat-msg.ai .msg-typing {
  display: flex; gap: 4px; padding: 4px 0;
}
.ai-chat-panel .chat-msg.ai .msg-typing span {
  width: 6px; height: 6px; border-radius: 50%;
  background: var(--text-muted); animation: typingDot 1.2s infinite;
}
.ai-chat-panel .chat-msg.ai .msg-typing span:nth-child(2) { animation-delay: 0.15s; }
.ai-chat-panel .chat-msg.ai .msg-typing span:nth-child(3) { animation-delay: 0.3s; }
@keyframes typingDot {
  0%,60%,100%{opacity:0.3;transform:translateY(0)}
  30%{opacity:1;transform:translateY(-4px)}
}
.ai-chat-panel .chat-input-wrap {
  display: flex; gap: var(--space-sm); padding: 12px 14px;
  border-top: 1px solid var(--border-light); background: var(--surface);
}
.ai-chat-panel .chat-input-wrap input {
  flex: 1; border: none; background: #F5F5F5;
  border-radius: var(--radius-full); padding: 10px 16px;
  font-size: var(--fs-caption); outline: none;
  transition: background 0.2s;
}
.ai-chat-panel .chat-input-wrap input:focus {
  background: var(--surface); box-shadow: 0 0 0 2px rgba(232,93,44,0.15);
}
.ai-chat-panel .chat-input-wrap button {
  width: 40px; height: 40px; border-radius: 50%;
  background: var(--primary); color: #fff;
  border: none; cursor: pointer; font-size: 1rem;
  display: flex; align-items: center; justify-content: center;
  transition: background 0.15s; flex-shrink: 0;
}
.ai-chat-panel .chat-input-wrap button:hover { background: var(--primary-dark); }
.ai-chat-panel .chat-input-wrap button:disabled { opacity: 0.5; cursor: not-allowed; }
.ai-chat-panel .chat-quick-qs {
  display: flex; flex-wrap: wrap; gap: 6px; padding: 4px 14px 10px;
}
.ai-chat-panel .chat-quick-q {
  padding: 5px 12px; border-radius: var(--radius-full);
  background: var(--primary-bg); color: var(--primary);
  font-size: var(--fs-small); cursor: pointer; border: none;
  transition: background 0.15s; white-space: nowrap;
}
.ai-chat-panel .chat-quick-q:hover { background: #FDE0D0; }

/* Favorites heart */
.card-fav {
  position: absolute; top: 8px; right: 8px; z-index: 2;
  width: 32px; height: 32px; border-radius: 50%;
  background: rgba(255,255,255,0.85); border: none;
  font-size: 1rem; cursor: pointer; display: flex;
  align-items: center; justify-content: center;
  transition: transform 0.15s; box-shadow: 0 1px 4px rgba(0,0,0,0.08);
}
.card-fav:hover { transform: scale(1.15); }
.card-fav.faved { color: var(--danger); }

/* ============================================================
   Compare — checkbox on card, floating bar, comparison table
   ============================================================ */
.compare-check {
  position: absolute; top: 8px; left: 8px; z-index: 3;
  width: 28px; height: 28px; border-radius: 4px;
  background: rgba(255,255,255,0.85); border: 1.5px solid var(--border);
  cursor: pointer; display: flex; align-items: center; justify-content: center;
  transition: all 0.15s; box-shadow: 0 1px 4px rgba(0,0,0,0.08);
}
.compare-check:hover { border-color: var(--primary); background: var(--primary-bg); }
.compare-check input[type="checkbox"] {
  width: 15px; height: 15px; accent-color: var(--primary); cursor: pointer; margin: 0;
}

.compare-bar {
  position: fixed; bottom: 0; left: 0; right: 0; z-index: 500;
  background: var(--surface); box-shadow: 0 -2px 12px rgba(0,0,0,0.10);
  padding: 10px var(--space-lg); display: flex; align-items: center; gap: var(--space-md);
  justify-content: center;
}
.compare-bar-text { font-size: var(--fs-caption); font-weight: 600; color: var(--text); }

/* Vertical comparison table: first column = attribute names */
.compare-table { width: 100%; border-collapse: collapse; }
.compare-table th, .compare-table td {
  padding: 10px 14px; text-align: center; font-size: var(--fs-caption);
  border-bottom: 1px solid var(--border-light); vertical-align: middle;
}
.compare-table th {
  background: var(--bg); font-weight: 600; color: var(--text-secondary);
  font-size: var(--fs-small); white-space: nowrap;
}
.compare-table .compare-label {
  text-align: left; font-weight: 600; color: var(--text-secondary);
  background: var(--bg); white-space: nowrap; width: 80px;
}
.compare-table .compare-img {
  width: 100px; height: 100px; object-fit: cover; border-radius: var(--radius-md);
}

@media (max-width: 768px) {
  .compare-bar { bottom: 56px; padding: 8px 12px; gap: var(--space-sm); }
  .compare-bar-text { font-size: var(--fs-small); }
  .compare-table .compare-img { width: 64px; height: 64px; }
}

@media (max-width: 768px) {
  .ai-chat-fab { bottom: 72px; right: 14px; width: 48px; height: 48px; font-size: 1.3rem; }
  .ai-chat-panel { bottom: 132px; right: 8px; width: calc(100vw - 32px); height: 420px; }
}

/* Search Autocomplete Dropdown */
.search-dropdown {
  position: absolute; top: 100%; left: 0; right: 0;
  background: var(--surface); border-radius: 0 0 var(--radius-md) var(--radius-md);
  box-shadow: var(--shadow-modal); max-height: 360px; overflow-y: auto;
  z-index: 500; display: none;
}
.search-dropdown.show { display: block; }
.search-dropdown .sd-item {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 16px; cursor: pointer; transition: background 0.1s;
  font-size: var(--fs-caption); border-bottom: 1px solid var(--border-light);
}
.search-dropdown .sd-item:hover { background: var(--primary-bg); }
.search-dropdown .sd-item .sd-img {
  width: 36px; height: 36px; border-radius: var(--radius-xs);
  background: #FAFAFA; flex-shrink: 0; display: flex; align-items: center; justify-content: center;
}
.search-dropdown .sd-item .sd-img img { width: 100%; height: 100%; object-fit: cover; border-radius: var(--radius-xs); }
.search-dropdown .sd-item .sd-info { flex: 1; min-width: 0; }
.search-dropdown .sd-item .sd-name { font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.search-dropdown .sd-item .sd-price { color: var(--danger); font-weight: 700; font-size: var(--fs-small); }
.search-dropdown .sd-empty { padding: 20px; text-align: center; color: var(--text-muted); }
.nav-search { position: relative; }

/* ============================================================
   Login Page
   ============================================================ */
.login-page { display: flex; min-height: 100vh; }
.login-left {
  flex: 1; background: var(--accent);
  display: flex; align-items: center; justify-content: center;
  padding: 60px 40px; color: #fff;
}
.login-left .brand-content { max-width: 400px; text-align: center; }
.login-left .brand-logo { font-size: 4rem; margin-bottom: 16px; }
.login-left .brand-name { font-size: 2rem; font-weight: 800; margin-bottom: 12px; }
.login-left .brand-tagline { font-size: 1rem; opacity: 0.8; line-height: 1.7; margin-bottom: 32px; }
.login-left .brand-features {
  display: grid; grid-template-columns: 1fr 1fr; gap: 16px;
}
.login-left .brand-feature {
  display: flex; align-items: center; gap: 8px;
  background: rgba(255,255,255,0.1); padding: 12px 16px;
  border-radius: var(--radius-md); font-size: 0.9rem;
}
.login-left .brand-feature .feat-icon { font-size: 1.2rem; }
.login-right {
  flex: 1; display: flex; align-items: center; justify-content: center;
  padding: 40px; background: var(--bg);
}
.login-right .form-card { width: 100%; max-width: 420px; margin: 0; }
.switch-link { text-align: center; margin-top: 16px; font-size: 0.88rem; color: var(--text-muted); }
.switch-link span { color: var(--primary); font-weight: 600; cursor: pointer; }
.switch-link span:hover { text-decoration: underline; }
.form-error {
  font-size: var(--fs-small); color: var(--danger); margin-top: 4px;
  min-height: 0; display: none;
}
.form-error.show { display: block; }
@media (max-width: 768px) {
  .login-page { flex-direction: column; }
  .login-left { padding: 40px 20px; min-height: auto; }
  .login-left .brand-logo { font-size: 2.5rem; }
  .login-left .brand-name { font-size: 1.4rem; }
  .login-left .brand-features { grid-template-columns: 1fr 1fr; gap: 8px; }
  .login-right { padding: 20px 16px; }
}

/* Coupon card */
.coupon-card {
  background: linear-gradient(135deg, #FFF5F0, #FFF); border: 1px dashed var(--primary);
  border-radius: var(--radius-md); padding: 14px; position: relative; overflow: hidden;
  display: flex; gap: 12px; cursor: pointer; transition: all 0.2s;
}
.coupon-card:hover { box-shadow: var(--shadow-hover); }
.coupon-card.used { opacity: 0.5; pointer-events: none; border-color: var(--border); }
.coupon-card .cp-amount { font-size: 1.6rem; font-weight: 900; color: var(--primary); min-width: 70px; text-align: center; }
.coupon-card .cp-amount .cp-unit { font-size: 0.8rem; font-weight: 400; }
.coupon-card .cp-info { flex: 1; }
.coupon-card .cp-name { font-weight: 700; margin-bottom: 4px; }
.coupon-card .cp-cond { font-size: var(--fs-small); color: var(--text-muted); }
.coupon-card .cp-expire { font-size: var(--fs-small); color: var(--text-muted); }
.coupon-card .cp-btn { font-size: var(--fs-small); color: var(--primary); font-weight: 600; flex-shrink: 0; align-self: center; }
/* Coupon selection on checkout */
.coupon-select { padding: 8px 14px; border: 1px dashed var(--primary); border-radius: var(--radius-sm); cursor: pointer; font-size: var(--fs-caption); color: var(--primary); background: var(--primary-bg); }
.coupon-select:hover { background: #FDE0D0; }

/* Skeleton loading */
.skeleton {
  background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
  background-size: 200% 100%; animation: skeletonShine 1.5s infinite;
  border-radius: var(--radius-sm);
}
@keyframes skeletonShine { 0%{background-position:200% 0} 100%{background-position:-200% 0} }
.skeleton-card { aspect-ratio: 1; }
.skeleton-text { height: 14px; margin-bottom: 8px; }
.skeleton-text.short { width: 60%; }
.skeleton-price { height: 20px; width: 40%; }
/* Back to top */
.back-to-top {
  position: fixed; bottom: 88px; right: 24px; z-index: 8999;
  width: 40px; height: 40px; border-radius: 50%;
  background: var(--surface); color: var(--text-secondary);
  font-size: 1.2rem; display: flex; align-items: center; justify-content: center;
  cursor: pointer; border: 1px solid var(--border); box-shadow: var(--shadow-card);
  opacity: 0; pointer-events: none; transition: opacity 0.3s;
}
.back-to-top.visible { opacity: 1; pointer-events: auto; }
.back-to-top:hover { color: var(--primary); border-color: var(--primary); }
/* Image zoom lens on detail page */
.detail-main-img { position: relative; overflow: hidden; cursor: crosshair; }
.detail-main-img .zoom-lens {
  position: absolute; width: 120px; height: 120px;
  border: 2px solid var(--primary); background: rgba(255,255,255,0.3);
  pointer-events: none; display: none; z-index: 2;
}
.detail-main-img .zoom-result {
  position: absolute; top: 0; left: calc(100% + 10px);
  width: 360px; height: 360px; background-repeat: no-repeat;
  border: 1px solid var(--border); border-radius: var(--radius-md);
  box-shadow: var(--shadow-modal); z-index: 10; display: none;
}
@media (max-width: 768px) {
  .back-to-top { bottom: 144px; right: 12px; }
  .detail-main-img .zoom-result { display: none !important; }
}

/* ============================================================
   47. Utility Classes
   ============================================================ */
.text-center { text-align: center; }
.text-right { text-align: right; }
.text-muted { color: var(--text-muted); }
.text-primary { color: var(--primary); }
.text-accent { color: var(--accent); }
.text-success { color: var(--success); }
.text-danger { color: var(--danger); }
.text-sm { font-size: var(--fs-caption); }
.text-xs { font-size: var(--fs-small); }
.font-bold { font-weight: 700; }
.font-extrabold { font-weight: 800; }
.mt-4 { margin-top: var(--space-xs); }
.mt-8 { margin-top: var(--space-sm); }
.mt-12 { margin-top: 12px; }
.mt-16 { margin-top: var(--space-md); }
.mt-24 { margin-top: var(--space-lg); }
.mt-32 { margin-top: var(--space-xl); }
.mb-4 { margin-bottom: var(--space-xs); }
.mb-8 { margin-bottom: var(--space-sm); }
.mb-12 { margin-bottom: 12px; }
.mb-16 { margin-bottom: var(--space-md); }
.mb-24 { margin-bottom: var(--space-lg); }
.ml-8 { margin-left: var(--space-sm); }
.mr-8 { margin-right: var(--space-sm); }
.p-12 { padding: 12px; }
.p-16 { padding: var(--space-md); }
.p-20 { padding: 20px; }
.p-24 { padding: var(--space-lg); }
.hidden { display: none !important; }
.flex { display: flex; }
.flex-1 { flex: 1; }
.flex-col { flex-direction: column; }
.flex-wrap { flex-wrap: wrap; }
.gap-4 { gap: var(--space-xs); }
.gap-8 { gap: var(--space-sm); }
.gap-12 { gap: 12px; }
.gap-16 { gap: var(--space-md); }
.gap-20 { gap: 20px; }
.items-center { align-items: center; }
.items-start { align-items: flex-start; }
.justify-center { justify-content: center; }
.justify-between { justify-content: space-between; }
.w-full { width: 100%; }
.rounded { border-radius: var(--radius-md); }
.shadow { box-shadow: var(--shadow-card); }
.bg-surface { background: var(--surface); }
.border { border: 1px solid var(--border-light); }
.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
