/* Design Tokens & Styles for Roujan Bale Mini App */
@font-face {
  font-family: 'Vazirmatn';
  font-style: normal;
  font-weight: 100 900;
  font-display: swap;
  src: local('Vazirmatn'), local('Vazir'), local('IRANSans'), local('Segoe UI'), system-ui, -apple-system;
}

:root {
  /* Colors */
  --primary: #216e53;
  --primary-dark: #164e3a;
  --primary-light: #e8f5ef;
  --primary-subtle: #d1ebd9;
  --accent: #b89332;
  --accent-light: #fef8e7;
  --mint: #2f9470;
  --mint-light: #edf7f2;
  --sage: #4d7a68;
  --sage-light: #e8f0ec;
  --bg: #f3f7f4;
  --surface: #ffffff;
  --surface-subtle: #ebf2ee;
  --text: #162a22;
  --text-muted: #53695e;
  --text-light: #8ca296;
  --border: #cee0d6;
  --border-light: #e4eee8;
  --danger: #d93838;
  --danger-light: #fde8e8;

  /* Typography & Layout */
  --font: 'Vazirmatn', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  --radius-sm: 8px;
  --radius-md: 14px;
  --radius-lg: 20px;
  --radius-full: 9999px;

  /* Shadows */
  --shadow-sm: 0 2px 6px rgba(22, 42, 34, 0.05);
  --shadow-md: 0 4px 16px rgba(22, 42, 34, 0.08);
  --shadow-lg: 0 10px 30px rgba(22, 42, 34, 0.12);

  /* Touch Targets & Minimums */
  --min-touch-target: 44px;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-tap-highlight-color: transparent;
  font-family: var(--font);
}

html, body {
  width: 100%;
  height: 100%;
  direction: rtl;
  text-align: right;
  background-color: #0f1c16;
  color: var(--text);
  margin: 0;
  padding: 0;
}

body {
  display: flex;
  justify-content: center;
  align-items: stretch;
}

/* App container */
.app-container {
  width: 100%;
  max-width: 430px;
  background: var(--bg);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  position: relative;
  overflow-x: hidden;
  box-shadow: 0 0 40px rgba(0, 0, 0, 0.5);
}

/* Header */
.app-header {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  padding: 10px 14px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  position: sticky;
  top: 0;
  z-index: 90;
  height: 58px;
}

.brand-slot {
  display: flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
  text-decoration: none;
  color: inherit;
}

.logo-badge {
  width: 38px;
  height: 38px;
  border-radius: 10px;
  background: linear-gradient(135deg, var(--primary), var(--sage));
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 900;
  font-size: 18px;
  box-shadow: var(--shadow-sm);
}

.brand-info h1 {
  font-size: 14px;
  font-weight: 800;
  color: var(--text);
  line-height: 1.2;
}

.brand-info p {
  font-size: 11px;
  color: var(--text-muted);
}

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

.icon-btn {
  background: var(--surface-subtle);
  border: 1px solid var(--border);
  width: 38px;
  height: 38px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: var(--text);
  font-size: 16px;
  position: relative;
  min-width: var(--min-touch-target);
  min-height: var(--min-touch-target);
}

.icon-btn:hover, .icon-btn:focus-visible {
  background: var(--primary-light);
  border-color: var(--primary);
  outline: none;
}

.cart-badge {
  position: absolute;
  top: -2px;
  left: -2px;
  background: var(--primary);
  color: #fff;
  font-size: 10px;
  font-weight: 800;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 2px solid var(--surface);
}

/* Main Viewport Content */
.view-content {
  flex: 1;
  min-height: 0; /* Prevent flex child from overflowing parent */
  padding-bottom: 74px; /* Space for sticky bottom navigation */
  overflow-y: auto;
  overflow-x: hidden;
  position: relative;
  width: 100%;
}

/* Home View Container — layout wrapper for home page sections */
.home-view-container {
  width: 100%;
  display: flex;
  flex-direction: column;
  overflow-x: hidden;
  min-height: 0;
}

/* Bottom Navigation Bar */
.bottom-nav {
  position: fixed;
  bottom: 0;
  width: 100%;
  max-width: 430px;
  background: var(--surface);
  border-top: 1px solid var(--border);
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  padding: 6px 4px calc(6px + env(safe-area-inset-bottom, 0px));
  z-index: 80;
  height: 64px;
}

.nav-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  background: transparent;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 4px 0;
  font-size: 11px;
  font-weight: 600;
  text-decoration: none;
  min-height: var(--min-touch-target);
}

.nav-item .nav-icon {
  font-size: 18px;
  line-height: 1;
}

.nav-item.active {
  color: var(--primary);
  font-weight: 800;
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  font-weight: 700;
  border-radius: var(--radius-md);
  padding: 10px 18px;
  border: none;
  cursor: pointer;
  min-height: var(--min-touch-target);
  transition: background-color 0.2s, transform 0.1s;
}

.btn:active {
  transform: scale(0.98);
}

.btn-primary {
  background: var(--primary);
  color: #fff;
}

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

.btn-secondary {
  background: var(--surface-subtle);
  color: var(--text);
  border: 1px solid var(--border);
}

.btn-secondary:hover {
  background: var(--border-light);
}

/* Drawer / Layer Modal Stack */
.layer-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  z-index: 100;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.25s ease, visibility 0.25s ease;
  display: flex;
  align-items: flex-end;
  justify-content: center;
}

.layer-backdrop.open {
  opacity: 1;
  visibility: visible;
}

.layer-sheet {
  width: 100%;
  max-width: 430px;
  background: var(--surface);
  border-radius: var(--radius-lg) var(--radius-lg) 0 0;
  padding: 16px;
  max-height: 90vh;
  overflow-y: auto;
  transform: translateY(100%);
  transition: transform 0.25s cubic-bezier(0.16, 1, 0.3, 1);
  display: flex;
  flex-direction: column;
}

.layer-backdrop.open .layer-sheet {
  transform: translateY(0);
}

.sheet-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--border-light);
}

.sheet-title {
  font-size: 15px;
  font-weight: 800;
  color: var(--text);
}

.close-btn {
  background: transparent;
  border: none;
  font-size: 20px;
  cursor: pointer;
  color: var(--text-muted);
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  min-width: var(--min-touch-target);
  min-height: var(--min-touch-target);
}

/* -------------------------------------------------------------
 * 1. HERO CAROUSEL (16:10 Promotional Manual Slider)
 * ------------------------------------------------------------- */
.hero-banner-section {
  padding: 12px 14px 6px;
}

.smart-carousel {
  position: relative;
  width: 100%;
  overflow: hidden;
}

.carousel-track-container {
  width: 100%;
  overflow: hidden;
  border-radius: var(--radius-lg);
}

.carousel-track {
  display: flex;
  width: 100%;
  transition: transform 0.35s cubic-bezier(0.16, 1, 0.3, 1);
}

.carousel-slide {
  flex: 0 0 100%;
  width: 100%;
}

.hero-banner-slide {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 10;
  min-height: 180px;
  max-height: 240px;
  border-radius: var(--radius-lg);
  overflow: hidden;
  cursor: pointer;
  display: flex;
  align-items: flex-end;
}

.hero-banner-overlay {
  position: absolute;
  inset: 0;
  background: linear-gradient(0deg, rgba(15,28,22,0.92) 0%, rgba(15,28,22,0.3) 60%, transparent 100%);
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  padding: 16px;
  color: #fff;
}

.hero-tag {
  display: inline-block;
  align-self: flex-start;
  background: var(--primary);
  color: #fff;
  font-size: 10px;
  font-weight: 800;
  padding: 3px 8px;
  border-radius: var(--radius-full);
  margin-bottom: 6px;
}

.hero-tag.gold {
  background: var(--accent);
  color: #000;
}

.hero-tag.sage {
  background: var(--sage);
  color: #fff;
}

.hero-title {
  font-size: 14px;
  font-weight: 800;
  line-height: 1.35;
  margin-bottom: 4px;
  text-shadow: 0 1px 3px rgba(0,0,0,0.5);
}

.hero-subtitle {
  font-size: 11px;
  opacity: 0.9;
  line-height: 1.4;
}

.carousel-nav-bar {
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 8px 4px 0;
}

.carousel-dots {
  display: flex;
  align-items: center;
  gap: 6px;
}

.carousel-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--border);
  border: none;
  cursor: pointer;
  transition: all 0.2s ease;
  padding: 0;
}

.carousel-dot.active {
  width: 22px;
  border-radius: 10px;
  background: var(--primary);
}

/* -------------------------------------------------------------
 * 2. CATEGORY SHORTCUTS
 * ------------------------------------------------------------- */
.category-shortcuts-section {
  padding: 8px 14px 14px;
}

.category-shortcuts-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
}

.category-shortcut-card {
  background: var(--surface);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-md);
  padding: 10px 4px;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 6px;
  text-decoration: none;
  color: var(--text);
  box-shadow: var(--shadow-sm);
  transition: transform 0.15s ease, border-color 0.15s ease;
}

.category-shortcut-card:hover {
  border-color: var(--primary);
  transform: translateY(-2px);
}

.category-shortcut-card .cat-icon {
  font-size: 22px;
}

.category-shortcut-card .cat-name {
  font-size: 11px;
  font-weight: 700;
  line-height: 1.2;
}

/* -------------------------------------------------------------
 * 3. PRODUCT RAILS (Exact 8 items: 7 items + 1 View All)
 * ------------------------------------------------------------- */
.home-rail-section {
  padding: 8px 0 16px;
}

.rail-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0 14px 10px;
}

.rail-header-title {
  display: flex;
  align-items: center;
  gap: 6px;
}

.rail-header-title h3 {
  font-size: 15px;
  font-weight: 800;
  color: var(--text);
}

.rail-header-more {
  font-size: 12px;
  font-weight: 700;
  color: var(--primary);
  text-decoration: none;
}

.rail-track-container {
  overflow-x: auto;
  padding: 4px 14px 10px;
  scrollbar-width: none;
  -webkit-overflow-scrolling: touch;
}

.rail-track-container::-webkit-scrollbar {
  display: none;
}

.rail-track {
  display: flex;
  gap: 10px;
  width: max-content;
}

.rail-product-card {
  width: 140px;
  background: var(--surface);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-md);
  overflow: hidden;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  box-shadow: var(--shadow-sm);
  transition: transform 0.15s ease;
}

.rail-product-card:hover {
  transform: translateY(-2px);
  border-color: var(--primary-subtle);
}

.rail-card-img-wrap {
  position: relative;
  width: 100%;
  aspect-ratio: 1 / 1;
  background: var(--surface-subtle);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

.rail-card-img {
  width: 82%;
  height: 82%;
  object-fit: contain;
}

.rail-img-icon {
  font-size: 28px;
}

.rail-badge {
  position: absolute;
  top: 6px;
  right: 6px;
  font-size: 9px;
  font-weight: 800;
  padding: 2px 6px;
  border-radius: var(--radius-full);
}

.rail-badge.discount {
  background: var(--danger);
  color: #fff;
}

.rail-badge.out-of-stock {
  background: rgba(22, 42, 34, 0.7);
  color: #fff;
}

.rail-card-body {
  padding: 8px 10px 10px;
  display: flex;
  flex-direction: column;
  flex: 1;
}

.rail-card-brand {
  font-size: 10px;
  color: var(--text-muted);
  margin-bottom: 2px;
}

.rail-card-title {
  font-size: 11px;
  font-weight: 700;
  color: var(--text);
  line-height: 1.35;
  height: 30px;
  overflow: hidden;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  margin-bottom: 6px;
}

.rail-price-box {
  margin-top: auto;
  display: flex;
  flex-direction: column;
}

.rail-price-final {
  font-size: 12px;
  font-weight: 800;
  color: var(--primary-dark);
}

.rail-price-old {
  font-size: 10px;
  color: var(--text-light);
  text-decoration: line-through;
}

/* 8th Rail Card: View All */
.rail-view-all-card {
  width: 120px;
  background: var(--primary-light);
  border: 1px dashed var(--primary);
  border-radius: var(--radius-md);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 16px 8px;
  text-align: center;
  cursor: pointer;
  gap: 8px;
  min-height: 190px;
}

.rail-view-all-circle {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: var(--primary);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  font-weight: 800;
}

.rail-view-all-text {
  font-size: 12px;
  font-weight: 800;
  color: var(--primary-dark);
}

.rail-view-all-sub {
  font-size: 10px;
  color: var(--sage);
}

/* -------------------------------------------------------------
 * 4. ADVISOR PROMO BANNER
 * ------------------------------------------------------------- */
.advisor-banner-section {
  padding: 4px 14px 16px;
}

.advisor-promo-card {
  background: linear-gradient(135deg, #164e3a 0%, #2f9470 100%);
  border-radius: var(--radius-lg);
  padding: 18px 16px;
  color: #fff;
  cursor: pointer;
  box-shadow: var(--shadow-md);
}

.advisor-badge {
  display: inline-block;
  background: rgba(255, 255, 255, 0.2);
  backdrop-filter: blur(4px);
  padding: 3px 10px;
  border-radius: var(--radius-full);
  font-size: 10px;
  font-weight: 800;
  margin-bottom: 8px;
}

.advisor-promo-title {
  font-size: 14px;
  font-weight: 800;
  margin-bottom: 6px;
  line-height: 1.35;
}

.advisor-promo-desc {
  font-size: 11px;
  opacity: 0.9;
  line-height: 1.5;
  margin-bottom: 12px;
}

.advisor-promo-action {
  font-size: 12px;
  font-weight: 800;
  color: var(--accent-light);
  display: flex;
  align-items: center;
  gap: 4px;
}

/* -------------------------------------------------------------
 * 5. SEARCH & FILTERS BAR
 * ------------------------------------------------------------- */
.catalog-header-sticky {
  position: sticky;
  top: 58px;
  background: var(--bg);
  z-index: 85;
  padding: 10px 14px 4px;
  border-bottom: 1px solid var(--border-light);
}

.search-bar-wrap {
  display: flex;
  gap: 8px;
  align-items: center;
}

.search-input-box {
  flex: 1;
  position: relative;
  display: flex;
  align-items: center;
}

.search-icon {
  position: absolute;
  right: 12px;
  font-size: 14px;
  color: var(--text-muted);
  pointer-events: none;
}

.search-input {
  width: 100%;
  height: 42px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-full);
  padding: 0 36px 0 36px;
  font-size: 12px;
  color: var(--text);
  outline: none;
  transition: border-color 0.2s;
}

.search-input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-light);
}

.search-clear-btn {
  position: absolute;
  left: 8px;
  width: 32px;
  height: 32px;
  min-width: 32px;
  min-height: 32px;
  border-radius: 50%;
  background: var(--surface-subtle);
  border: none;
  color: var(--text-muted);
  font-size: 14px;
  cursor: pointer;
  display: none;
  align-items: center;
  justify-content: center;
}

.search-clear-btn.visible {
  display: flex;
}

.filter-toggle-btn {
  background: var(--surface);
  border: 1px solid var(--border);
  width: 42px;
  height: 42px;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  position: relative;
  min-width: var(--min-touch-target);
  min-height: var(--min-touch-target);
}

.filter-icon {
  font-size: 16px;
}

.filter-badge {
  position: absolute;
  top: -4px;
  left: -4px;
  background: var(--primary);
  color: #fff;
  font-size: 9px;
  font-weight: 800;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* Categories Horizontal Pills */
.catalog-categories-bar {
  padding: 8px 0 4px;
  overflow-x: auto;
  scrollbar-width: none;
}

.catalog-categories-bar::-webkit-scrollbar {
  display: none;
}

.catalog-cat-scroll {
  display: flex;
  gap: 6px;
  width: max-content;
}

.catalog-cat-pill {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-full);
  padding: 5px 12px;
  font-size: 11px;
  font-weight: 600;
  color: var(--text);
  cursor: pointer;
  white-space: nowrap;
}

.catalog-cat-pill.active {
  background: var(--primary);
  color: #fff;
  border-color: var(--primary);
}

/* Active Chips Bar */
.active-chips-bar {
  padding: 6px 0;
  overflow-x: auto;
  scrollbar-width: none;
}

.active-chips-bar::-webkit-scrollbar {
  display: none;
}

.active-chips-scroll {
  display: flex;
  gap: 6px;
  align-items: center;
  width: max-content;
}

.active-filter-chip {
  background: var(--primary-light);
  border: 1px solid var(--primary-subtle);
  color: var(--primary-dark);
  border-radius: var(--radius-full);
  padding: 3px 8px 3px 4px;
  font-size: 11px;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 4px;
}

.btn-remove-chip {
  background: transparent;
  border: none;
  color: var(--primary-dark);
  cursor: pointer;
  font-size: 13px;
  width: 24px;
  height: 24px;
  min-width: 24px;
  min-height: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
}

.btn-clear-all-chips {
  background: transparent;
  border: none;
  color: var(--danger);
  font-size: 11px;
  font-weight: 700;
  cursor: pointer;
  padding: 2px 6px;
}

/* -------------------------------------------------------------
 * 6. PRODUCT GRID (Responsive 2-Column Grid)
 * ------------------------------------------------------------- */
.catalog-content-area {
  padding: 10px 14px 20px;
}

.catalog-results-info {
  font-size: 11px;
  color: var(--text-muted);
  margin-bottom: 10px;
  font-weight: 600;
}

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

.product-grid-card {
  background: var(--surface);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-md);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  cursor: pointer;
  box-shadow: var(--shadow-sm);
  transition: transform 0.15s ease, border-color 0.15s ease;
}

.product-grid-card:hover {
  transform: translateY(-2px);
  border-color: var(--primary);
}

.product-card-img-wrap {
  position: relative;
  width: 100%;
  aspect-ratio: 1 / 1;
  background: var(--surface-subtle);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

.product-img-frame {
  width: 82%;
  height: 82%;
  display: flex;
  align-items: center;
  justify-content: center;
}

.product-img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.product-img-placeholder-icon {
  font-size: 32px;
}

.product-img-fallback,
.rail-img-fallback {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 100%;
  background: #f5f0eb;
  border-radius: var(--radius-sm);
}

.product-badge {
  position: absolute;
  top: 6px;
  right: 6px;
  font-size: 9px;
  font-weight: 800;
  padding: 2px 6px;
  border-radius: var(--radius-full);
}

.product-badge.discount {
  background: var(--danger);
  color: #fff;
}

.product-badge.out-of-stock {
  background: rgba(22, 42, 34, 0.7);
  color: #fff;
}

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

.product-card-brand {
  font-size: 10px;
  color: var(--text-muted);
  margin-bottom: 2px;
}

.product-card-name {
  font-size: 12px;
  font-weight: 700;
  color: var(--text);
  line-height: 1.35;
  height: 32px;
  overflow: hidden;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  margin-bottom: 8px;
}

.product-price-box {
  margin-top: auto;
  display: flex;
  flex-direction: column;
}

.product-price-final {
  font-size: 13px;
  font-weight: 800;
  color: var(--primary-dark);
}

.product-price-old {
  font-size: 10px;
  color: var(--text-light);
  text-decoration: line-through;
}

/* -------------------------------------------------------------
 * 7. SHIMMER & STATES
 * ------------------------------------------------------------- */
.shimmer-card {
  border-color: var(--border-light);
}

.shimmer-img {
  width: 100%;
  aspect-ratio: 1 / 1;
  background: var(--border-light);
}

.shimmer-body {
  padding: 10px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.shimmer-line {
  height: 10px;
  background: var(--border-light);
  border-radius: var(--radius-sm);
}

.shimmer-line.short { width: 40%; }
.shimmer-line.medium { width: 70%; }
.shimmer-line.full { width: 90%; }

.shimmer-animated {
  animation: shimmerPulse 1.4s infinite ease-in-out;
}

@keyframes shimmerPulse {
  0% { opacity: 0.5; }
  50% { opacity: 1; }
  100% { opacity: 0.5; }
}

.empty-state-box, .error-state-box {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 32px 16px;
  text-align: center;
  margin: 16px 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
}

.empty-icon, .error-icon {
  font-size: 36px;
  margin-bottom: 4px;
}

.empty-title, .error-title {
  font-size: 14px;
  font-weight: 800;
  color: var(--text);
}

.empty-desc, .error-desc {
  font-size: 12px;
  color: var(--text-muted);
  line-height: 1.5;
  max-width: 280px;
  margin-bottom: 8px;
}

/* -------------------------------------------------------------
 * 8. FILTER DRAWER INTERNALS
 * ------------------------------------------------------------- */
.filter-sheet {
  max-height: 85vh;
}

.filter-drawer-body {
  display: flex;
  flex-direction: column;
  gap: 16px;
  padding: 8px 0;
}

.filter-group {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.filter-group-title {
  font-size: 13px;
  font-weight: 800;
  color: var(--text);
}

.filter-chips-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.filter-chip-select {
  background: var(--surface-subtle);
  border: 1px solid var(--border);
  border-radius: var(--radius-full);
  padding: 6px 12px;
  font-size: 11px;
  font-weight: 600;
  color: var(--text);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.filter-chip-select.active {
  background: var(--primary-light);
  border-color: var(--primary);
  color: var(--primary-dark);
  font-weight: 800;
}

.chip-count {
  font-size: 10px;
  opacity: 0.7;
}

.filter-toggle-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 4px 0;
}

.toggle-control {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
}

.toggle-control input {
  display: none;
}

.toggle-switch {
  width: 40px;
  height: 22px;
  background: var(--border);
  border-radius: var(--radius-full);
  position: relative;
  transition: background-color 0.2s;
}

.toggle-switch::after {
  content: '';
  position: absolute;
  top: 2px;
  right: 2px;
  width: 18px;
  height: 18px;
  background: #fff;
  border-radius: 50%;
  transition: transform 0.2s;
}

.toggle-control input:checked + .toggle-switch {
  background: var(--primary);
}

.toggle-control input:checked + .toggle-switch::after {
  transform: translateX(-18px);
}

.sort-select-box {
  width: 100%;
}

.sort-select {
  width: 100%;
  height: 40px;
  background: var(--surface-subtle);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 0 12px;
  font-size: 12px;
  color: var(--text);
  outline: none;
}

.filter-drawer-footer {
  display: grid;
  grid-template-columns: 1fr 2fr;
  gap: 8px;
  padding-top: 12px;
  border-top: 1px solid var(--border-light);
  margin-top: 8px;
}

/* Placeholder card for R4.3-R4.5 views */
.placeholder-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 24px 16px;
  margin: 16px 12px;
  text-align: center;
  box-shadow: var(--shadow-sm);
}

.placeholder-card h2 {
  font-size: 16px;
  font-weight: 800;
  color: var(--primary);
  margin-bottom: 8px;
}

.placeholder-card p {
  font-size: 13px;
  color: var(--text-muted);
  line-height: 1.6;
}

/* -------------------------------------------------------------
 * 9. PRODUCT DETAIL PAGE (PDP) STYLES (R4.3)
 * ------------------------------------------------------------- */
.pdp-view-container {
  display: flex;
  flex-direction: column;
  min-height: calc(100vh - 60px);
  background: var(--bg);
  position: relative;
  padding-bottom: 84px; /* Space for sticky buy bar */
}

.pdp-top-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 14px;
  background: var(--surface);
  border-bottom: 1px solid var(--border-light);
  position: sticky;
  top: 58px;
  z-index: 80;
}

.btn-pdp-back {
  background: transparent;
  border: none;
  font-size: 13px;
  font-weight: 700;
  color: var(--primary);
  display: inline-flex;
  align-items: center;
  gap: 4px;
  cursor: pointer;
  padding: 4px 6px;
}

.pdp-top-brand {
  font-size: 13px;
  font-weight: 800;
  color: var(--text);
}

.btn-pdp-action {
  background: var(--surface-subtle);
  border: 1px solid var(--border);
  border-radius: 50%;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 14px;
}

.pdp-scrollable-body {
  flex: 1;
  padding: 12px 14px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

/* 1. Compliant Media Gallery (Max 5 images / 1 video <=15s, 1:1 ratio, contain <=82%) */
.pdp-gallery-container {
  width: 100%;
}

.pdp-media-gallery {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.pdp-main-media-frame {
  width: 100%;
  aspect-ratio: 1 / 1;
  background: var(--surface);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-lg);
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
}

.pdp-img-contain-box {
  width: 82%;
  height: 82%;
  max-width: 82%;
  max-height: 82%;
  display: flex;
  align-items: center;
  justify-content: center;
}

.pdp-main-img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
}

.pdp-placeholder-icon {
  font-size: 64px;
}

.pdp-video-wrapper {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #000;
}

.pdp-video-player {
  width: 100%;
  height: 100%;
  max-height: 100%;
  object-fit: contain;
}

.pdp-gallery-thumbs {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding-bottom: 4px;
  scrollbar-width: none;
}

.pdp-gallery-thumbs::-webkit-scrollbar {
  display: none;
}

.pdp-thumb-item {
  width: 54px;
  height: 54px;
  flex-shrink: 0;
  border-radius: var(--radius-sm);
  border: 1.5px solid var(--border-light);
  background: var(--surface);
  overflow: hidden;
  padding: 2px;
  cursor: pointer;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
}

.pdp-thumb-item.active {
  border-color: var(--primary);
  box-shadow: 0 0 0 2px var(--primary-light);
}

.pdp-thumb-item img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.thumb-video-badge {
  position: absolute;
  bottom: 2px;
  right: 2px;
  background: rgba(0,0,0,0.7);
  color: #fff;
  font-size: 8px;
  padding: 1px 3px;
  border-radius: var(--radius-xs);
}

/* 2. Product Header & Metadata */
.pdp-header-section {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.pdp-brand-tag {
  font-size: 11px;
  font-weight: 700;
  color: var(--text-muted);
}

.pdp-title-fa {
  font-size: 16px;
  font-weight: 800;
  color: var(--text);
  line-height: 1.4;
}

.pdp-title-en {
  font-size: 11.5px;
  color: var(--text-muted);
  font-weight: 500;
  direction: ltr;
  text-align: right;
}

.pdp-meta-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 6px;
  padding-top: 8px;
  border-top: 1px dashed var(--border-light);
}

.pdp-rating-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 11.5px;
  font-weight: 700;
  color: var(--text);
}

.pdp-rating-badge .star-icon.filled {
  color: #f59e0b;
}

.pdp-rating-badge .rating-count {
  font-size: 10.5px;
  color: var(--text-muted);
}

.pdp-stock-status {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 11px;
  font-weight: 700;
}

.pdp-stock-status.in-stock {
  color: var(--primary);
}

.pdp-stock-status.out-of-stock {
  color: var(--danger);
}

.status-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: currentColor;
}

/* 3. Variant Selector */
.pdp-variants-section {
  display: flex;
  flex-direction: column;
  gap: 8px;
  background: var(--surface);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-md);
  padding: 12px;
}

.pdp-variants-header {
  font-size: 12px;
  font-weight: 700;
  color: var(--text);
}

.pdp-variants-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.pdp-variant-btn {
  background: var(--surface-subtle);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-full);
  padding: 6px 12px;
  font-size: 11px;
  font-weight: 600;
  color: var(--text);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: all 0.15s ease;
}

.pdp-variant-btn.selected {
  border-color: var(--primary);
  background: var(--primary-light);
  color: var(--primary-dark);
  font-weight: 800;
}

.pdp-variant-btn.out-of-stock {
  opacity: 0.6;
  border-style: dashed;
}

.pdp-swatch {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background-size: cover;
  border: 1px solid var(--border);
}

.pdp-variant-stock-tag {
  font-size: 9px;
  color: var(--danger);
}

/* 4. Specifications Card */
.pdp-specs-card {
  background: var(--surface);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-md);
  padding: 14px;
}

.pdp-section-heading {
  font-size: 13.5px;
  font-weight: 800;
  color: var(--text);
  margin-bottom: 10px;
}

.pdp-specs-grid {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.pdp-spec-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 11.5px;
  padding-bottom: 6px;
  border-bottom: 1px solid var(--border-light);
}

.pdp-spec-row:last-child {
  border-bottom: none;
  padding-bottom: 0;
}

.spec-label {
  color: var(--text-muted);
}

.spec-value {
  font-weight: 700;
  color: var(--text);
}

/* 5. Accordions */
.pdp-accordions-group {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.pdp-accordion-item {
  background: var(--surface);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-md);
  overflow: hidden;
}

.pdp-accordion-trigger {
  width: 100%;
  background: transparent;
  border: none;
  padding: 12px 14px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 12.5px;
  font-weight: 700;
  color: var(--text);
  cursor: pointer;
  text-align: right;
}

.accordion-arrow {
  font-size: 10px;
  color: var(--text-muted);
  transition: transform 0.2s ease;
}

.pdp-accordion-item.open .accordion-arrow {
  transform: rotate(180deg);
}

.pdp-accordion-content {
  display: none;
  padding: 0 14px 14px;
  font-size: 11.5px;
  line-height: 1.6;
  color: var(--text-muted);
}

.pdp-accordion-item.open .pdp-accordion-content {
  display: block;
}

/* 6. Approved Reviews & Summary */
.pdp-reviews-section {
  background: var(--surface);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-md);
  padding: 14px;
}

.pdp-empty-reviews-notice {
  text-align: center;
  padding: 18px 10px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
}

.empty-reviews-icon {
  font-size: 28px;
}

.empty-reviews-text {
  font-size: 12px;
  color: var(--text-muted);
  line-height: 1.6;
}

.pdp-reviews-summary {
  display: grid;
  grid-template-columns: 100px 1fr;
  gap: 12px;
  align-items: center;
  padding-bottom: 14px;
  margin-bottom: 14px;
  border-bottom: 1px solid var(--border-light);
}

.pdp-rating-score-box {
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
}

.pdp-rating-number {
  font-size: 26px;
  font-weight: 900;
  color: var(--primary-dark);
}

.pdp-rating-stars {
  font-size: 13px;
  color: #f59e0b;
}

.pdp-rating-total {
  font-size: 10px;
  color: var(--text-muted);
}

.pdp-rating-breakdown {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.pdp-rating-bar-row {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 10px;
}

.bar-label {
  width: 40px;
  color: var(--text-muted);
}

.bar-track {
  flex: 1;
  height: 6px;
  background: var(--surface-subtle);
  border-radius: var(--radius-full);
  overflow: hidden;
}

.bar-fill {
  height: 100%;
  background: #f59e0b;
}

.bar-count {
  width: 20px;
  text-align: left;
  color: var(--text-muted);
}

.pdp-reviews-feed {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.pdp-review-card {
  padding: 10px;
  background: var(--surface-subtle);
  border-radius: var(--radius-sm);
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.pdp-review-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.review-author {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 11px;
  font-weight: 700;
  color: var(--text);
}

.buyer-badge {
  font-size: 9px;
  background: var(--primary-light);
  color: var(--primary-dark);
  padding: 1px 4px;
  border-radius: var(--radius-xs);
}

.review-rating-stars {
  font-size: 10px;
  color: #f59e0b;
}

.review-comment-body {
  font-size: 11.5px;
  color: var(--text);
  line-height: 1.5;
}

/* 7. Sticky Buy Bar */
.pdp-sticky-buy-bar {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background: var(--surface);
  border-top: 1px solid var(--border);
  box-shadow: var(--shadow-lg);
  padding: 10px 14px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  z-index: 100;
}

.pdp-buy-price-wrap {
  display: flex;
  flex-direction: column;
}

.pdp-buy-label {
  font-size: 9.5px;
  color: var(--text-muted);
}

.pdp-buy-price {
  font-size: 15px;
  font-weight: 900;
  color: var(--primary-dark);
}

.pdp-buy-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.pdp-qty-stepper {
  display: flex;
  align-items: center;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface-subtle);
  overflow: hidden;
}

.btn-qty-minus, .btn-qty-plus {
  background: transparent;
  border: none;
  width: 28px;
  height: 32px;
  font-size: 14px;
  font-weight: 800;
  color: var(--text);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}

.qty-display {
  width: 24px;
  text-align: center;
  font-size: 12px;
  font-weight: 700;
}

.btn-pdp-add-cart {
  height: 36px;
  padding: 0 16px;
  font-size: 12px;
  font-weight: 800;
  border-radius: var(--radius-md);
  white-space: nowrap;
}

.btn-pdp-add-cart.added {
  background: var(--mint);
  border-color: var(--mint);
}

/* -------------------------------------------------------------
 * 10. ADVISOR & ROUTINE DASHBOARD STYLES (R4.4)
 * ------------------------------------------------------------- */
.advisor-main-page {
  padding: 12px 14px 24px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.advisor-top-banner {
  background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
  color: #fff;
  border-radius: var(--radius-lg);
  padding: 16px;
  box-shadow: var(--shadow-sm);
}

.advisor-top-banner h1 {
  font-size: 16px;
  font-weight: 800;
  margin-bottom: 4px;
}

.advisor-top-banner p {
  font-size: 12px;
  opacity: 0.9;
  line-height: 1.5;
}

.advisor-loading-wrap, .advisor-empty-state {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 32px 16px;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  box-shadow: var(--shadow-sm);
}

.advisor-icon, .advisor-spinner {
  font-size: 36px;
}

.advisor-empty-state h3 {
  font-size: 15px;
  font-weight: 800;
  color: var(--text);
}

.advisor-empty-state p {
  font-size: 12px;
  color: var(--text-muted);
  max-width: 280px;
  line-height: 1.6;
}

.btn-start-quiz {
  margin-top: 6px;
  padding: 8px 24px;
  font-weight: 800;
}

/* Routine Dashboard Components */
.routine-dashboard-container {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.advisor-analysis-card {
  background: var(--surface);
  border: 1px solid var(--primary-subtle);
  border-radius: var(--radius-lg);
  padding: 14px;
  box-shadow: var(--shadow-sm);
}

.analysis-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
}

.analysis-badge {
  font-size: 11px;
  font-weight: 800;
  color: var(--primary);
  background: var(--primary-light);
  padding: 2px 8px;
  border-radius: var(--radius-full);
}

.analysis-quota {
  font-size: 10.5px;
  color: var(--text-muted);
}

.analysis-title {
  font-size: 14px;
  font-weight: 800;
  color: var(--text);
  margin-bottom: 6px;
}

.analysis-personalized-tip {
  font-size: 11.5px;
  color: var(--text-muted);
  background: var(--surface-subtle);
  padding: 8px 10px;
  border-radius: var(--radius-sm);
  border-right: 3px solid var(--primary);
  line-height: 1.5;
}

/* Routine Bundle Card */
.routine-bundle-card {
  background: var(--surface);
  border: 1.5px solid var(--primary);
  border-radius: var(--radius-lg);
  padding: 14px;
  box-shadow: var(--shadow-md);
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.bundle-header {
  border-bottom: 1px solid var(--border-light);
  padding-bottom: 10px;
}

.bundle-title-group {
  display: flex;
  align-items: center;
  gap: 10px;
}

.bundle-icon {
  font-size: 24px;
}

.bundle-title {
  font-size: 13.5px;
  font-weight: 800;
  color: var(--text);
}

.bundle-discount-badge {
  display: inline-block;
  font-size: 10.5px;
  font-weight: 800;
  color: #b45309;
  background: #fef3c7;
  padding: 1px 6px;
  border-radius: var(--radius-xs);
  margin-top: 3px;
}

.bundle-items-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.bundle-item-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  background: var(--surface-subtle);
  border-radius: var(--radius-md);
  border: 1px solid var(--border-light);
  text-decoration: none;
  color: var(--text);
  transition: all 0.15s ease;
}

.bundle-item-row:hover {
  background: var(--primary-light);
  border-color: var(--primary-subtle);
}

.bundle-step-tag {
  font-size: 10.5px;
  font-weight: 800;
  color: var(--primary-dark);
  background: #fff;
  padding: 3px 6px;
  border-radius: var(--radius-xs);
  white-space: nowrap;
  border: 1px solid var(--border-light);
}

.bundle-item-content {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.bundle-item-name {
  font-size: 12px;
  font-weight: 700;
  line-height: 1.4;
}

.bundle-item-price {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-muted);
}

.bundle-item-arrow {
  font-size: 14px;
  color: var(--primary);
  font-weight: 800;
}

/* Bundle Financial Breakdown */
.bundle-pricing-summary {
  background: var(--bg);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  border: 1px dashed var(--border);
}

.bundle-price-row {
  display: flex;
  justify-content: space-between;
  font-size: 11.5px;
  color: var(--text-muted);
}

.bundle-price-row.discount-row {
  color: var(--danger);
  font-weight: 700;
}

.bundle-price-row.total-row {
  font-size: 13px;
  font-weight: 800;
  color: var(--text);
  border-top: 1px solid var(--border-light);
  padding-top: 6px;
  margin-top: 2px;
}

.bundle-final-price {
  color: var(--primary);
}

.strikethrough {
  text-decoration: line-through;
  opacity: 0.7;
}

.bundle-actions-group {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.btn-add-bundle {
  width: 100%;
  padding: 10px;
  font-size: 13px;
  font-weight: 800;
}

.bundle-added-feedback {
  background: var(--primary-light);
  border: 1px solid var(--primary-subtle);
  border-radius: var(--radius-sm);
  padding: 8px 12px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 11.5px;
  font-weight: 700;
  color: var(--primary-dark);
}

.bundle-added-feedback.hidden {
  display: none;
}

.btn-view-cart-cta {
  font-size: 11px;
  padding: 4px 10px;
  border-radius: var(--radius-sm);
}

/* Routine Timeline Cards */
.routine-steps-card {
  background: var(--surface);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-lg);
  padding: 14px;
}

.routine-steps-heading {
  font-size: 13px;
  font-weight: 800;
  color: var(--text);
  margin-bottom: 12px;
}

.routine-timeline-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 12px;
}

.timeline-column {
  background: var(--surface-subtle);
  border-radius: var(--radius-md);
  padding: 12px;
  border: 1px solid var(--border-light);
}

.timeline-column-header {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 8px;
}

.timeline-column-header h4 {
  font-size: 12px;
  font-weight: 800;
  color: var(--text);
}

.timeline-step-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.timeline-step-item {
  font-size: 11.5px;
  color: var(--text);
  line-height: 1.5;
}

.retake-quiz-box {
  text-align: center;
  padding: 6px 0;
}

.btn-retake-quiz {
  width: 100%;
  font-size: 12px;
  padding: 8px;
}

/* -------------------------------------------------------------
 * 11. 4-STEP QUIZ MODAL STYLES (R4.4)
 * ------------------------------------------------------------- */
.quiz-sheet {
  max-height: 85vh;
}

.quiz-header-info {
  display: flex;
  align-items: center;
  gap: 8px;
}

.quiz-step-badge {
  font-size: 10px;
  font-weight: 800;
  background: var(--primary-light);
  color: var(--primary-dark);
  padding: 2px 6px;
  border-radius: var(--radius-full);
}

.quiz-progress-bar {
  width: 100%;
  height: 4px;
  background: var(--surface-subtle);
  border-radius: var(--radius-full);
  overflow: hidden;
  margin-bottom: 14px;
}

.quiz-progress-fill {
  height: 100%;
  background: var(--primary);
  transition: width 0.2s ease;
}

.quiz-step-title {
  font-size: 14px;
  font-weight: 800;
  color: var(--text);
  margin-bottom: 4px;
}

.quiz-step-subtitle {
  font-size: 11.5px;
  color: var(--text-muted);
  margin-bottom: 12px;
}

.quiz-options-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.quiz-option-card {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  background: var(--surface-subtle);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-md);
  cursor: pointer;
  text-align: right;
  transition: all 0.15s ease;
  min-height: var(--min-touch-target);
}

.quiz-option-card:hover {
  background: var(--surface);
  border-color: var(--primary-subtle);
}

.quiz-option-card.selected {
  background: var(--primary-light);
  border-color: var(--primary);
}

.quiz-opt-icon {
  font-size: 20px;
}

.quiz-opt-text {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.quiz-opt-text strong {
  font-size: 12.5px;
  color: var(--text);
}

.quiz-opt-text small {
  font-size: 10.5px;
  color: var(--text-muted);
}

.quiz-textarea-wrapper {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.quiz-textarea {
  width: 100%;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-md);
  padding: 10px;
  font-family: inherit;
  font-size: 12px;
  resize: vertical;
  background: var(--surface-subtle);
  color: var(--text);
  outline: none;
}

.quiz-textarea:focus {
  border-color: var(--primary);
  background: #fff;
}

.quiz-char-counter {
  font-size: 10.5px;
  color: var(--text-muted);
  text-align: left;
}

.quiz-footer {
  margin-top: 14px;
  padding-top: 12px;
  border-top: 1px solid var(--border-light);
}

.quiz-btn-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.btn-quiz-prev {
  font-size: 11.5px;
  padding: 6px 14px;
}

.btn-quiz-next, .btn-quiz-submit {
  font-size: 12px;
  padding: 8px 18px;
  font-weight: 800;
}

/* -------------------------------------------------------------
 * 12. CART VIEW & DRAWER STYLES (R4.4)
 * ------------------------------------------------------------- */
.cart-view-container, .cart-page-mount {
  padding: 12px 14px 24px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.cart-view-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid var(--border-light);
  padding-bottom: 10px;
}

.cart-view-header h2 {
  font-size: 16px;
  font-weight: 800;
  color: var(--text);
}

.cart-items-counter {
  font-size: 11.5px;
  color: var(--text-muted);
}

.cart-empty-state {
  background: var(--surface);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-lg);
  padding: 32px 16px;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
}

.cart-empty-icon {
  font-size: 40px;
}

.cart-items-wrapper {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.cart-item-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  box-shadow: var(--shadow-sm);
}

.cart-item-card.out-of-stock-card {
  border-color: var(--danger);
  background: #fef2f2;
}

.cart-item-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 8px;
}

.cart-item-title {
  font-size: 12.5px;
  font-weight: 700;
  color: var(--text);
  text-decoration: none;
  line-height: 1.4;
  flex: 1;
}

.btn-remove-item {
  background: transparent;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 15px;
  width: 36px;
  height: 36px;
  min-width: 36px;
  min-height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-sm);
}

.btn-remove-item:hover {
  color: var(--danger);
}

.cart-bundle-tag {
  font-size: 10px;
  font-weight: 800;
  color: #b45309;
  background: #fef3c7;
  padding: 2px 6px;
  border-radius: var(--radius-xs);
  width: fit-content;
}

.cart-variant-tag {
  font-size: 10.5px;
  color: var(--text-muted);
}

.cart-item-warning {
  font-size: 11px;
  font-weight: 700;
  color: var(--danger);
}

.cart-item-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-top: 1px solid var(--border-light);
  padding-top: 8px;
  margin-top: 2px;
}

.cart-item-price-unit {
  font-size: 11px;
  color: var(--text-muted);
}

.cart-qty-control {
  display: flex;
  align-items: center;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface-subtle);
  overflow: hidden;
  min-height: 36px;
}

.btn-cart-qty-minus, .btn-cart-qty-plus {
  background: transparent;
  border: none;
  width: 36px;
  height: 36px;
  min-width: 36px;
  min-height: 36px;
  font-size: 15px;
  font-weight: 800;
  color: var(--text);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}

.cart-qty-val {
  min-width: 24px;
  text-align: center;
  font-size: 12px;
  font-weight: 700;
}

.cart-item-total {
  font-size: 12px;
  color: var(--text);
}

/* Server-Authoritative Financial Card */
.cart-financial-card {
  background: var(--surface);
  border: 1.5px solid var(--primary-subtle);
  border-radius: var(--radius-md);
  padding: 14px;
  box-shadow: var(--shadow-sm);
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.cart-financial-title {
  font-size: 13px;
  font-weight: 800;
  color: var(--text);
  margin-bottom: 4px;
}

.fin-row {
  display: flex;
  justify-content: space-between;
  font-size: 12px;
  color: var(--text);
}

.fin-row.discount-text {
  color: var(--danger);
}

.fin-row.advisor-discount-row {
  color: #b45309;
  background: #fef3c7;
  padding: 4px 8px;
  border-radius: var(--radius-xs);
  font-weight: 700;
}

.fin-row.coupon-discount-row {
  color: var(--primary-dark);
  background: var(--primary-light);
  padding: 4px 8px;
  border-radius: var(--radius-xs);
  font-weight: 700;
}

.fin-divider {
  border-bottom: 1px solid var(--border);
  margin: 4px 0;
}

.fin-row.fin-grand-total {
  font-size: 14px;
  font-weight: 800;
  color: var(--primary-dark);
}

.grand-total-price {
  font-size: 15px;
  color: var(--primary);
}

/* AI Routine Guidance (STRICTLY BENEATH FINANCES) */
.cart-routine-guidance-card {
  background: var(--surface);
  border: 1px solid var(--primary-subtle);
  border-radius: var(--radius-md);
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.routine-guidance-header {
  display: flex;
  align-items: center;
  gap: 6px;
}

.guidance-icon {
  font-size: 16px;
}

.routine-guidance-header h4 {
  font-size: 12px;
  font-weight: 800;
  color: var(--primary-dark);
}

.guidance-subtitle {
  font-size: 10.5px;
  color: var(--text-muted);
}

.compact-timeline-container {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-top: 2px;
}

.compact-time-block {
  font-size: 11px;
  background: var(--surface-subtle);
  padding: 6px 8px;
  border-radius: var(--radius-xs);
  display: flex;
  align-items: center;
  gap: 6px;
}

.compact-time-tag {
  font-weight: 800;
  color: var(--text);
  white-space: nowrap;
}

.compact-steps-text {
  color: var(--text-muted);
}

.compact-tip-box {
  font-size: 10.5px;
  color: var(--text-muted);
  background: var(--primary-light);
  padding: 6px 8px;
  border-radius: var(--radius-xs);
  line-height: 1.4;
}

.cart-checkout-action-bar {
  position: sticky;
  bottom: 60px;
  padding: 8px 0;
  background: var(--bg);
  z-index: 50;
}

.btn-checkout-action {
  width: 100%;
  padding: 12px;
  font-size: 13.5px;
  font-weight: 800;
  box-shadow: var(--shadow-md);
}

/* -------------------------------------------------------------
 * 13. CHECKOUT & PAYMENT STATUS STYLES (R4.5)
 * ------------------------------------------------------------- */
.checkout-page-container {
  padding: 12px 14px 28px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.checkout-header-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid var(--border-light);
  padding-bottom: 10px;
}

.btn-checkout-back {
  background: transparent;
  border: none;
  font-size: 12.5px;
  font-weight: 700;
  color: var(--primary);
  cursor: pointer;
  padding: 4px 6px;
}

.checkout-title {
  font-size: 15px;
  font-weight: 800;
  color: var(--text);
}

.checkout-timer-banner {
  background: #fef3c7;
  border: 1px solid #fde68a;
  color: #92400e;
  padding: 10px 14px;
  border-radius: var(--radius-md);
  text-align: center;
  font-size: 12px;
  font-weight: 700;
  margin-bottom: 10px;
}

.timer-expired {
  color: var(--danger);
  font-weight: 800;
}

.checkout-order-summary-card {
  background: var(--surface);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-md);
  padding: 12px 14px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  font-size: 12px;
  margin-bottom: 12px;
}

.checkout-form {
  background: var(--surface);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-lg);
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  box-shadow: var(--shadow-sm);
}

.form-section-title {
  font-size: 13.5px;
  font-weight: 800;
  color: var(--text);
  margin-bottom: 4px;
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.form-group label, .radio-label-title {
  font-size: 11px;
  font-weight: 700;
  color: var(--text-muted);
}

.form-input {
  width: 100%;
  padding: 10px 12px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  font-family: inherit;
  font-size: 12.5px;
  color: var(--text);
  background: var(--surface-subtle);
  outline: none;
  transition: border-color 0.2s ease, background-color 0.2s ease;
}

.form-input:focus {
  border-color: var(--primary);
  background: #fff;
}

.form-textarea {
  resize: vertical;
}

.form-hint {
  font-size: 10px;
  color: var(--text-muted);
}

.form-row-2col {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.radio-group {
  display: flex;
  gap: 14px;
  margin-top: 4px;
}

.radio-option {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 11.5px;
  font-weight: 600;
  cursor: pointer;
}

.form-error-banner {
  background: #fef2f2;
  border: 1px solid #fecaca;
  color: var(--danger);
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  font-size: 11.5px;
  font-weight: 700;
  line-height: 1.4;
}

.form-error-banner.hidden {
  display: none;
}

.btn-submit-checkout {
  width: 100%;
  padding: 12px;
  font-size: 13px;
  font-weight: 800;
  margin-top: 4px;
}

.checkout-state-card {
  background: var(--surface);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-lg);
  padding: 32px 16px;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  box-shadow: var(--shadow-sm);
}

.state-icon {
  font-size: 44px;
}

.checkout-state-card h3 {
  font-size: 15px;
  font-weight: 800;
  color: var(--text);
}

.checkout-state-card p {
  font-size: 12px;
  color: var(--text-muted);
  line-height: 1.6;
  max-width: 320px;
}

.state-actions {
  display: flex;
  flex-direction: column;
  gap: 8px;
  width: 100%;
  max-width: 260px;
  margin-top: 6px;
}

.checkout-loading-box {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 48px 16px;
  gap: 12px;
  color: var(--text-muted);
  font-size: 12.5px;
}

.spinner {
  width: 28px;
  height: 28px;
  border: 3px solid var(--border);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* Payment Status Page */
.payment-status-page {
  padding: 24px 16px;
  display: flex;
  justify-content: center;
}

.payment-status-card {
  width: 100%;
  max-width: 400px;
  background: var(--surface);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-lg);
  padding: 28px 18px;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  box-shadow: var(--shadow-md);
}

.status-title {
  font-size: 15px;
  font-weight: 800;
  color: var(--text);
}

.status-desc {
  font-size: 12px;
  color: var(--text-muted);
  line-height: 1.6;
}

.status-details-box {
  width: 100%;
  background: var(--surface-subtle);
  border-radius: var(--radius-md);
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin: 6px 0;
}

.status-detail-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 11.5px;
}

.status-badge-inline {
  font-size: 10.5px;
  font-weight: 800;
  color: var(--primary-dark);
  background: var(--primary-light);
  padding: 2px 8px;
  border-radius: var(--radius-full);
}

/* -------------------------------------------------------------
 * Login Modal
 * ------------------------------------------------------------- */
.login-modal-backdrop {
  z-index: 1000;
}
.login-sheet {
  max-width: 420px;
  max-height: 90vh;
  overflow-y: auto;
}
.login-body {
  display: flex;
  flex-direction: column;
  gap: 16px;
  padding: 20px 16px 28px;
}
.login-icon-wrap {
  text-align: center;
}
.login-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 64px;
  height: 64px;
  border-radius: 50%;
  background: var(--primary-light);
  font-size: 28px;
}
.login-subtitle {
  text-align: center;
  font-size: 13px;
  color: var(--text-muted);
  line-height: 1.7;
  margin: 0;
}
.login-form {
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.login-form .form-group {
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.login-form label {
  font-size: 12px;
  font-weight: 600;
  color: var(--text);
}
.login-form .form-input {
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-family: var(--font);
  background: var(--surface);
  transition: border-color 0.15s;
}
.login-form .form-input:focus {
  border-color: var(--primary);
  outline: none;
  box-shadow: 0 0 0 3px var(--primary-light);
}
.login-form .form-hint {
  font-size: 11px;
  color: var(--text-light);
}
.login-error-banner {
  background: var(--danger-light);
  color: var(--danger);
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  font-size: 12px;
  text-align: center;
}
.login-error-banner.hidden {
  display: none;
}
.btn-login-submit {
  width: 100%;
  padding: 12px;
  font-size: 14px;
  font-weight: 700;
  border: none;
  border-radius: var(--radius-sm);
  background: var(--primary);
  color: #fff;
  cursor: pointer;
  transition: background 0.15s;
  font-family: var(--font);
}
.btn-login-submit:hover {
  background: var(--primary-dark);
}
.btn-login-submit:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}
.login-privacy-note {
  text-align: center;
  font-size: 10px;
  color: var(--text-light);
  margin: 0;
  line-height: 1.6;
}

/* Header login button for web users */
.btn-header-login {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 6px 12px;
  border: 1px solid var(--primary);
  border-radius: var(--radius-full);
  background: transparent;
  color: var(--primary);
  font-size: 11px;
  font-weight: 700;
  font-family: var(--font);
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.15s, color 0.15s;
}
.btn-header-login:hover {
  background: var(--primary);
  color: #fff;
}
.btn-header-user {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 10px;
  border-radius: var(--radius-full);
  background: var(--primary-light);
  color: var(--primary);
  font-size: 11px;
  font-weight: 600;
  font-family: var(--font);
  border: none;
  cursor: pointer;
}

/* Review submission form on PDP */
.pdp-review-submit-section {
  margin-top: 16px;
  padding: 16px;
  background: var(--surface);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-md);
}
.pdp-review-submit-section h4 {
  font-size: 14px;
  font-weight: 700;
  margin: 0 0 12px;
  color: var(--text);
}
.review-star-selector {
  display: flex;
  gap: 4px;
  margin-bottom: 10px;
  direction: ltr;
}
.review-star-selector .star-btn {
  background: none;
  border: none;
  font-size: 24px;
  cursor: pointer;
  color: var(--border);
  padding: 2px;
  transition: color 0.15s;
}
.review-star-selector .star-btn.active {
  color: var(--accent);
}
.review-star-selector .star-btn:hover {
  color: var(--accent);
}
.review-textarea {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-family: var(--font);
  resize: vertical;
  min-height: 80px;
  direction: rtl;
}
.review-textarea:focus {
  border-color: var(--primary);
  outline: none;
  box-shadow: 0 0 0 3px var(--primary-light);
}
.btn-submit-review {
  margin-top: 8px;
  padding: 10px 20px;
  font-size: 13px;
  font-weight: 700;
  border: none;
  border-radius: var(--radius-sm);
  background: var(--primary);
  color: #fff;
  cursor: pointer;
  font-family: var(--font);
  transition: background 0.15s;
}
.btn-submit-review:hover {
  background: var(--primary-dark);
}
.btn-submit-review:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}
.review-submit-msg {
  margin-top: 8px;
  font-size: 12px;
  padding: 6px 10px;
  border-radius: var(--radius-sm);
}
.review-submit-msg.success {
  background: var(--primary-light);
  color: var(--primary);
}
.review-submit-msg.error {
  background: var(--danger-light);
  color: var(--danger);
}

/* -------------------------------------------------------------
 * 14. ACCESSIBILITY, FOCUS VISIBLE, REDUCED MOTION & A11Y LIVE
 * ------------------------------------------------------------- */
@media (prefers-reduced-motion: reduce) {
  *, ::before, ::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}

:focus-visible {
  outline: 2px solid var(--primary) !important;
  outline-offset: 2px !important;
}

/* Visually Hidden Helper for Screen Readers */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* Live region helpers */
[aria-live="polite"], [aria-live="assertive"] {
  min-height: 0;
}



