/* ═══════════════════════════════════════════
   WHIEDA Mini App — Luxury Chinese Wellness
   Dual theme: Dark & Light with Glassmorphism
   Gold (#C8A84E), Cinnabar (#C0392B)
   ═══════════════════════════════════════════ */

:root {
  /* Fonts */
  --font-body: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --font-display: 'Cormorant Garamond', Georgia, serif;

  /* Type Scale */
  --text-xs:   clamp(0.6875rem, 0.65rem + 0.15vw, 0.75rem);
  --text-sm:   clamp(0.8125rem, 0.78rem + 0.15vw, 0.875rem);
  --text-base: clamp(0.875rem, 0.85rem + 0.15vw, 0.9375rem);
  --text-lg:   clamp(1rem, 0.95rem + 0.25vw, 1.125rem);
  --text-xl:   clamp(1.25rem, 1.1rem + 0.5vw, 1.5rem);
  --text-2xl:  clamp(1.5rem, 1.2rem + 1vw, 2rem);

  /* Spacing */
  --space-1:  0.25rem;
  --space-2:  0.5rem;
  --space-3:  0.75rem;
  --space-4:  1rem;
  --space-5:  1.25rem;
  --space-6:  1.5rem;
  --space-8:  2rem;
  --space-10: 2.5rem;
  --space-12: 3rem;

  /* Brand colors — constant across themes */
  --gold:         #C8A84E;
  --gold-light:   #D4BA6A;
  --gold-dim:     #8B7535;
  --cinnabar:     #C0392B;
  --cinnabar-dim: #8B2920;

  /* Radius */
  --radius-sm: 0.375rem;
  --radius-md: 0.625rem;
  --radius-lg: 0.875rem;
  --radius-xl: 1.25rem;
  --radius-full: 9999px;

  /* Layout */
  --header-h: 56px;
  --bottom-nav-h: 64px;
  --safe-bottom: env(safe-area-inset-bottom, 0px);

  /* Theme transition */
  --theme-transition: background 350ms cubic-bezier(0.16, 1, 0.3, 1),
                      color 350ms cubic-bezier(0.16, 1, 0.3, 1),
                      border-color 350ms cubic-bezier(0.16, 1, 0.3, 1),
                      box-shadow 350ms cubic-bezier(0.16, 1, 0.3, 1);
}


/* ═══════════════════════════════
   DARK THEME (default)
   ═══════════════════════════════ */
[data-theme="dark"] {
  --color-bg:           #0E0E0E;
  --color-surface:      #161616;
  --color-surface-2:    #1C1C1C;
  --color-surface-3:    #222222;
  --color-border:       #2A2A2A;
  --color-border-light: #333333;

  --color-text:         #E8E6E1;
  --color-text-muted:   #8A8780;
  --color-text-faint:   #5A5854;

  /* Shadows */
  --shadow-sm: 0 1px 3px rgba(0,0,0,0.4);
  --shadow-md: 0 4px 16px rgba(0,0,0,0.5);
  --shadow-lg: 0 8px 32px rgba(0,0,0,0.6);
  --shadow-gold: 0 0 20px rgba(200,168,78,0.15);

  /* Glass effect */
  --glass-bg:       rgba(22,22,22,0.65);
  --glass-bg-dense: rgba(14,14,14,0.82);
  --glass-border:   rgba(255,255,255,0.06);
  --glass-shadow:   0 8px 32px rgba(0,0,0,0.4);
  --glass-highlight: linear-gradient(135deg, rgba(255,255,255,0.05) 0%, transparent 50%);

  /* Button-specific */
  --ai-fab-text:    #0E0E0E;
  --pd-btn-ai-text: #0E0E0E;
  --user-bubble-text: #0E0E0E;
  --chat-send-text: #0E0E0E;

  color-scheme: dark;
}


/* ═══════════════════════════════
   LIGHT THEME
   ═══════════════════════════════ */
[data-theme="light"] {
  --color-bg:           #F5F3EE;
  --color-surface:      rgba(255,255,255,0.72);
  --color-surface-2:    rgba(245,243,240,0.8);
  --color-surface-3:    rgba(235,232,226,0.7);
  --color-border:       rgba(200,168,78,0.15);
  --color-border-light: rgba(200,168,78,0.1);

  --color-text:         #1A1814;
  --color-text-muted:   #6B665C;
  --color-text-faint:   #9A958A;

  /* Shadows — softer for light */
  --shadow-sm: 0 1px 4px rgba(0,0,0,0.06);
  --shadow-md: 0 4px 16px rgba(0,0,0,0.08);
  --shadow-lg: 0 8px 32px rgba(0,0,0,0.1);
  --shadow-gold: 0 0 24px rgba(200,168,78,0.12);

  /* Glass effect — light mode */
  --glass-bg:       rgba(255,255,255,0.55);
  --glass-bg-dense: rgba(245,243,238,0.78);
  --glass-border:   rgba(255,255,255,0.6);
  --glass-shadow:   0 8px 32px rgba(0,0,0,0.06), inset 0 1px 0 rgba(255,255,255,0.8);
  --glass-highlight: linear-gradient(135deg, rgba(255,255,255,0.7) 0%, transparent 50%);

  /* Button-specific */
  --ai-fab-text:    #FFFFFF;
  --pd-btn-ai-text: #FFFFFF;
  --user-bubble-text: #FFFFFF;
  --chat-send-text: #FFFFFF;

  /* Override gold for light mode readability */
  --gold:         #9A7B2E;
  --gold-light:   #B8963E;
  --gold-dim:     #7A6224;

  color-scheme: light;
}


/* ─── Theme transition ─── */
#app, .app-header, .bottom-nav, .search-box, .category-card,
.product-card, .chat-input-box, .chat-bubble, .quick-prompt,
.pd-meta-item, .pd-usage, .cta-banner, .nav-item {
  transition: var(--theme-transition);
}


/* ═══════════════════════════════
   GLASSMORPHISM UTILITIES
   ═══════════════════════════════ */
.glass {
  background: var(--glass-bg);
  backdrop-filter: blur(20px) saturate(180%);
  -webkit-backdrop-filter: blur(20px) saturate(180%);
  border: 1px solid var(--glass-border);
  box-shadow: var(--glass-shadow);
}

.glass::before {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background: var(--glass-highlight);
  pointer-events: none;
  z-index: 1;
}

.glass-dense {
  background: var(--glass-bg-dense);
  backdrop-filter: blur(24px) saturate(180%);
  -webkit-backdrop-filter: blur(24px) saturate(180%);
  border: 1px solid var(--glass-border);
}


/* ═══════════════════════════════
   APP SHELL
   ═══════════════════════════════ */
#app {
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  background: var(--color-bg);
  position: relative;
}

.app-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: var(--glass-bg-dense);
  backdrop-filter: blur(24px) saturate(180%);
  -webkit-backdrop-filter: blur(24px) saturate(180%);
  border-bottom: 1px solid var(--glass-border);
  height: var(--header-h);
}

.header-inner {
  max-width: 600px;
  margin: 0 auto;
  padding: 0 var(--space-4);
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.logo-area {
  display: flex;
  align-items: center;
  gap: var(--space-2);
}

.logo-img {
  width: 34px;
  height: 34px;
  object-fit: contain;
  flex-shrink: 0;
  border-radius: 4px;
}

.logo-text {
  font-family: var(--font-display);
  font-size: var(--text-xl);
  font-weight: 600;
  color: var(--gold);
  letter-spacing: 0.15em;
}

/* Header right controls */
.header-controls {
  display: flex;
  align-items: center;
  gap: var(--space-2);
}

/* Theme toggle */
.theme-toggle {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--glass-bg);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid var(--glass-border);
  color: var(--gold);
  transition: transform 350ms cubic-bezier(0.34, 1.56, 0.64, 1),
              background 250ms ease;
}

.theme-toggle:active {
  transform: scale(0.88) rotate(15deg);
}

.theme-toggle svg {
  width: 18px;
  height: 18px;
  transition: transform 350ms cubic-bezier(0.34, 1.56, 0.64, 1);
}

[data-theme="dark"] .theme-icon-sun { display: none; }
[data-theme="dark"] .theme-icon-moon { display: block; }
[data-theme="light"] .theme-icon-sun { display: block; }
[data-theme="light"] .theme-icon-moon { display: none; }

.ai-fab {
  display: flex;
  align-items: center;
  gap: var(--space-1);
  padding: var(--space-2) var(--space-3);
  background: linear-gradient(135deg, var(--gold-dim) 0%, var(--gold) 100%);
  color: var(--ai-fab-text);
  border-radius: var(--radius-full);
  font-size: var(--text-xs);
  font-weight: 600;
  letter-spacing: 0.05em;
}

.ai-fab:active {
  transform: scale(0.95);
}

.ai-fab-label {
  line-height: 1;
}


/* ═══════════════════════════════
   MAIN CONTENT
   ═══════════════════════════════ */
.main-content {
  flex: 1;
  max-width: 600px;
  margin: 0 auto;
  width: 100%;
  padding-bottom: calc(var(--bottom-nav-h) + var(--safe-bottom) + var(--space-4) + 28px);
}

.screen {
  display: none;
  padding: var(--space-4);
  animation: fadeIn 250ms ease-out;
}

.screen.active {
  display: block;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes slideUp {
  from { opacity: 0; transform: translateY(20px); }
  to { opacity: 1; transform: translateY(0); }
}


/* ═══════════════════════════════
   SEARCH
   ═══════════════════════════════ */
.search-wrap {
  margin-bottom: var(--space-5);
}

.search-box {
  position: relative;
  display: flex;
  align-items: center;
  background: var(--glass-bg);
  backdrop-filter: blur(16px) saturate(180%);
  -webkit-backdrop-filter: blur(16px) saturate(180%);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-lg);
  padding: 0 var(--space-3);
  transition: border-color 200ms, box-shadow 200ms;
  overflow: hidden;
}

.search-box::before {
  content: '';
  position: absolute;
  inset: 0;
  background: var(--glass-highlight);
  pointer-events: none;
  border-radius: inherit;
}

.search-box:focus-within {
  border-color: var(--gold-dim);
  box-shadow: 0 0 0 3px rgba(200,168,78,0.1);
}

.search-icon {
  flex-shrink: 0;
  color: var(--color-text-muted);
  position: relative;
  z-index: 2;
}

.search-box input {
  flex: 1;
  background: transparent;
  border: none;
  outline: none;
  padding: var(--space-3) var(--space-2);
  font-size: var(--text-base);
  color: var(--color-text);
  position: relative;
  z-index: 2;
}

.search-box input::placeholder {
  color: var(--color-text-faint);
}

.search-clear {
  color: var(--color-text-muted);
  font-size: 1.25rem;
  padding: var(--space-1);
  line-height: 1;
  position: relative;
  z-index: 2;
}

.hidden {
  display: none !important;
}


/* ═══════════════════════════════
   CATEGORIES GRID — Glass Cards
   ═══════════════════════════════ */
.categories-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: var(--space-3);
  margin-bottom: var(--space-6);
}

.category-card {
  position: relative;
  overflow: hidden;
  background: var(--glass-bg);
  backdrop-filter: blur(16px) saturate(180%);
  -webkit-backdrop-filter: blur(16px) saturate(180%);
  border: 1px solid var(--glass-border);
  box-shadow: var(--glass-shadow);
  border-radius: var(--radius-lg);
  padding: var(--space-4) var(--space-3);
  text-align: center;
  cursor: pointer;
}

.category-card::before {
  content: '';
  position: absolute;
  inset: 0;
  background: var(--glass-highlight);
  pointer-events: none;
  border-radius: inherit;
  z-index: 1;
}

.category-card::after {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 2px;
  background: linear-gradient(90deg, transparent, var(--gold), transparent);
  opacity: 0;
  transition: opacity 300ms;
  z-index: 2;
}

.category-card:active {
  transform: scale(0.97);
}

.category-card:active::after,
.category-card:hover::after {
  opacity: 1;
}

.category-emoji {
  font-size: 1.75rem;
  margin-bottom: var(--space-2);
  line-height: 1;
  position: relative;
  z-index: 2;
}

.category-name {
  font-size: var(--text-sm);
  font-weight: 500;
  color: var(--color-text);
  line-height: 1.3;
  margin-bottom: var(--space-1);
  position: relative;
  z-index: 2;
}

.category-count {
  font-size: var(--text-xs);
  color: var(--color-text-muted);
  position: relative;
  z-index: 2;
}


/* ═══════════════════════════════
   SECTION TITLE
   ═══════════════════════════════ */
.section-title {
  font-family: var(--font-display);
  font-size: var(--text-lg);
  font-weight: 600;
  color: var(--gold);
  margin-bottom: var(--space-4);
  letter-spacing: 0.03em;
}


/* ═══════════════════════════════
   BACK BUTTON
   ═══════════════════════════════ */
.back-btn {
  display: inline-flex;
  align-items: center;
  gap: var(--space-1);
  color: var(--gold);
  font-size: var(--text-sm);
  font-weight: 500;
  padding: var(--space-2) 0;
  margin-bottom: var(--space-3);
}

.back-btn:active {
  opacity: 0.7;
}


/* ═══════════════════════════════
   PRODUCT CARD — Glass
   ═══════════════════════════════ */
.products-list {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
}

.product-card {
  display: flex;
  gap: var(--space-3);
  position: relative;
  overflow: hidden;
  background: var(--glass-bg);
  backdrop-filter: blur(16px) saturate(180%);
  -webkit-backdrop-filter: blur(16px) saturate(180%);
  border: 1px solid var(--glass-border);
  box-shadow: var(--glass-shadow);
  border-radius: var(--radius-lg);
  padding: var(--space-3);
  cursor: pointer;
}

.product-card::before {
  content: '';
  position: absolute;
  inset: 0;
  background: var(--glass-highlight);
  pointer-events: none;
  border-radius: inherit;
}

.product-card:active {
  background: var(--color-surface-2);
  transform: scale(0.99);
}

.product-card-img {
  width: 80px;
  height: 80px;
  border-radius: var(--radius-md);
  object-fit: cover;
  background: var(--color-surface-2);
  flex-shrink: 0;
  position: relative;
  z-index: 2;
}

.product-card-info {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  justify-content: center;
  position: relative;
  z-index: 2;
}

.product-card-name {
  font-size: var(--text-sm);
  font-weight: 600;
  color: var(--color-text);
  margin-bottom: var(--space-1);
  line-height: 1.3;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.product-card-short {
  font-size: var(--text-xs);
  color: var(--color-text-muted);
  margin-bottom: var(--space-2);
  line-height: 1.4;
  display: -webkit-box;
  -webkit-line-clamp: 1;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.product-card-price {
  font-size: var(--text-sm);
  font-weight: 600;
  color: var(--gold);
}


/* ═══════════════════════════════
   PRODUCT DETAIL
   ═══════════════════════════════ */
.product-detail {
  animation: slideUp 300ms ease-out;
}

.pd-image-wrap {
  position: relative;
  border-radius: var(--radius-xl);
  overflow: hidden;
  margin-bottom: var(--space-5);
  background: var(--color-surface);
  aspect-ratio: 1;
  display: flex;
  align-items: center;
  justify-content: center;
}

.pd-image {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.pd-price-badge {
  position: absolute;
  bottom: var(--space-3);
  right: var(--space-3);
  background: var(--glass-bg-dense);
  backdrop-filter: blur(16px) saturate(180%);
  -webkit-backdrop-filter: blur(16px) saturate(180%);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-full);
  padding: var(--space-2) var(--space-4);
  font-weight: 600;
  color: var(--gold);
  font-size: var(--text-sm);
}

.pd-name {
  font-family: var(--font-display);
  font-size: var(--text-2xl);
  font-weight: 600;
  color: var(--color-text);
  margin-bottom: var(--space-2);
  line-height: 1.2;
}

.pd-short {
  font-size: var(--text-base);
  color: var(--color-text-muted);
  margin-bottom: var(--space-5);
  font-style: italic;
  color: var(--cinnabar);
  opacity: 0.8;
}

.pd-meta {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: var(--space-3);
  margin-bottom: var(--space-5);
}

.pd-meta-item {
  position: relative;
  overflow: hidden;
  background: var(--glass-bg);
  backdrop-filter: blur(12px) saturate(180%);
  -webkit-backdrop-filter: blur(12px) saturate(180%);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-md);
  padding: var(--space-3);
  text-align: center;
}

.pd-meta-item::before {
  content: '';
  position: absolute;
  inset: 0;
  background: var(--glass-highlight);
  pointer-events: none;
  border-radius: inherit;
}

.pd-meta-label {
  font-size: var(--text-xs);
  color: var(--color-text-faint);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-bottom: var(--space-1);
  position: relative;
  z-index: 2;
}

.pd-meta-value {
  font-size: var(--text-sm);
  font-weight: 500;
  color: var(--color-text);
  position: relative;
  z-index: 2;
}

.pd-section {
  margin-bottom: var(--space-5);
}

.pd-section-title {
  font-size: var(--text-sm);
  font-weight: 600;
  color: var(--gold);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-bottom: var(--space-3);
  padding-bottom: var(--space-2);
  border-bottom: 1px solid var(--color-border);
}

.pd-description {
  font-size: var(--text-base);
  color: var(--color-text);
  line-height: 1.7;
  white-space: pre-line;
}

.pd-benefits-list {
  list-style: none;
  padding: 0;
}

.pd-benefits-list li {
  display: flex;
  align-items: flex-start;
  gap: var(--space-2);
  padding: var(--space-2) 0;
  font-size: var(--text-base);
  color: var(--color-text);
  line-height: 1.5;
}

.pd-benefits-list li::before {
  content: '◆';
  color: var(--gold);
  font-size: var(--text-xs);
  margin-top: 0.2em;
  flex-shrink: 0;
}

.pd-usage {
  font-size: var(--text-base);
  color: var(--color-text);
  line-height: 1.7;
  position: relative;
  overflow: hidden;
  background: var(--glass-bg);
  backdrop-filter: blur(12px) saturate(180%);
  -webkit-backdrop-filter: blur(12px) saturate(180%);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-md);
  padding: var(--space-4);
}

.pd-actions {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
  margin-top: var(--space-6);
  margin-bottom: var(--space-8);
}

.pd-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  padding: var(--space-4);
  border-radius: var(--radius-lg);
  font-size: var(--text-base);
  font-weight: 600;
  text-decoration: none;
  text-align: center;
}

.pd-btn-ai {
  background: linear-gradient(135deg, var(--gold-dim), var(--gold));
  color: var(--pd-btn-ai-text);
}

.pd-btn-ai:active { transform: scale(0.97); }

.pd-btn-academy {
  background: var(--glass-bg);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid #16A34A;
  color: #4ADE80;
}

[data-theme="light"] .pd-btn-academy {
  color: #16A34A;
}


/* ═══════════════════════════════
   CHAT
   ═══════════════════════════════ */
.chat-header {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding-bottom: var(--space-3);
  margin-bottom: var(--space-3);
  border-bottom: 1px solid var(--color-border);
}

.chat-title {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  font-weight: 600;
  font-size: var(--text-base);
  color: var(--gold);
}

.chat-title-icon {
  display: flex;
  align-items: center;
  color: var(--gold);
}

.chat-messages {
  flex: 1;
  overflow-y: auto;
  padding-bottom: var(--space-4);
  min-height: calc(100dvh - var(--header-h) - var(--bottom-nav-h) - 200px);
  max-height: calc(100dvh - var(--header-h) - var(--bottom-nav-h) - 180px);
}

.chat-welcome {
  text-align: center;
  padding: var(--space-8) var(--space-4);
}

.chat-welcome-icon {
  margin: 0 auto var(--space-4);
  width: 72px;
  height: 72px;
  border-radius: 50%;
  background: var(--glass-bg);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid var(--glass-border);
  display: flex;
  align-items: center;
  justify-content: center;
}

.chat-welcome h3 {
  font-family: var(--font-display);
  font-size: var(--text-xl);
  color: var(--gold);
  margin-bottom: var(--space-3);
}

.chat-welcome p {
  font-size: var(--text-sm);
  color: var(--color-text-muted);
  line-height: 1.6;
  margin: 0 auto var(--space-5);
  max-width: 320px;
}

.quick-prompts {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: var(--space-2);
}

.quick-prompt {
  padding: var(--space-2) var(--space-3);
  position: relative;
  overflow: hidden;
  background: var(--glass-bg);
  backdrop-filter: blur(12px) saturate(180%);
  -webkit-backdrop-filter: blur(12px) saturate(180%);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-full);
  font-size: var(--text-xs);
  color: var(--color-text);
  white-space: nowrap;
}

.quick-prompt:active {
  background: var(--color-surface-3);
  border-color: var(--gold-dim);
}

/* Messages */
.chat-msg {
  margin-bottom: var(--space-3);
  animation: fadeIn 200ms ease-out;
}

.chat-msg-user {
  display: flex;
  justify-content: flex-end;
}

.chat-msg-user .chat-bubble {
  background: linear-gradient(135deg, var(--gold-dim), var(--gold));
  color: var(--user-bubble-text);
  border-radius: var(--radius-lg) var(--radius-lg) var(--radius-sm) var(--radius-lg);
  max-width: 85%;
}

.chat-msg-ai .chat-bubble {
  position: relative;
  overflow: hidden;
  background: var(--glass-bg);
  backdrop-filter: blur(16px) saturate(180%);
  -webkit-backdrop-filter: blur(16px) saturate(180%);
  border: 1px solid var(--glass-border);
  color: var(--color-text);
  border-radius: var(--radius-lg) var(--radius-lg) var(--radius-lg) var(--radius-sm);
  max-width: 90%;
}

.chat-bubble {
  padding: var(--space-3) var(--space-4);
  font-size: var(--text-base);
  line-height: 1.65;
  word-break: break-word;
}

.chat-bubble p { margin-bottom: var(--space-2); }
.chat-bubble p:last-child { margin-bottom: 0; }
.chat-bubble strong { font-weight: 600; color: var(--gold); }

.chat-typing {
  display: flex;
  gap: 4px;
  padding: var(--space-3) var(--space-4);
}

.chat-typing span {
  width: 6px;
  height: 6px;
  background: var(--color-text-muted);
  border-radius: 50%;
  animation: typingBounce 1.4s infinite;
}

.chat-typing span:nth-child(2) { animation-delay: 0.2s; }
.chat-typing span:nth-child(3) { animation-delay: 0.4s; }

@keyframes typingBounce {
  0%, 60%, 100% { transform: translateY(0); }
  30% { transform: translateY(-6px); }
}

/* Chat Input */
.chat-input-area {
  padding-top: var(--space-3);
  border-top: 1px solid var(--color-border);
}

.chat-input-box {
  display: flex;
  align-items: flex-end;
  gap: var(--space-2);
  position: relative;
  overflow: hidden;
  background: var(--glass-bg);
  backdrop-filter: blur(16px) saturate(180%);
  -webkit-backdrop-filter: blur(16px) saturate(180%);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-lg);
  padding: var(--space-2) var(--space-3);
}

.chat-input-box:focus-within {
  border-color: var(--gold-dim);
}

.chat-input-box textarea {
  flex: 1;
  background: transparent;
  border: none;
  outline: none;
  font-size: var(--text-base);
  color: var(--color-text);
  resize: none;
  max-height: 100px;
  padding: var(--space-1) 0;
  line-height: 1.5;
  position: relative;
  z-index: 2;
}

.chat-input-box textarea::placeholder {
  color: var(--color-text-faint);
}

.chat-send {
  flex-shrink: 0;
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--gold);
  color: var(--chat-send-text);
  border-radius: 50%;
  opacity: 0.3;
  pointer-events: none;
  position: relative;
  z-index: 2;
}

.chat-send.active {
  opacity: 1;
  pointer-events: all;
}

.chat-send.active:active {
  transform: scale(0.9);
}


/* ═══════════════════════════════
   BOTTOM NAVIGATION — Glass
   ═══════════════════════════════ */
.bottom-nav {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 100;
  background: var(--glass-bg-dense);
  backdrop-filter: blur(24px) saturate(180%);
  -webkit-backdrop-filter: blur(24px) saturate(180%);
  border-top: 1px solid var(--glass-border);
  display: flex;
  justify-content: space-around;
  padding: var(--space-2) 0;
  padding-bottom: calc(var(--space-2) + var(--safe-bottom));
  height: calc(var(--bottom-nav-h) + var(--safe-bottom));
}

.nav-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  padding: var(--space-1);
  color: var(--color-text-faint);
  font-size: var(--text-xs);
  text-decoration: none;
  min-width: 56px;
}

.nav-item.active {
  color: var(--gold);
}

.nav-item:active {
  transform: scale(0.92);
}

.nav-item span {
  font-size: 0.625rem;
  font-weight: 500;
  letter-spacing: 0.02em;
}


/* ═══════════════════════════════
   CTA BANNER — Glass
   ═══════════════════════════════ */
.cta-banner {
  position: fixed;
  bottom: calc(var(--bottom-nav-h) + var(--safe-bottom) + var(--space-3));
  left: var(--space-3);
  right: var(--space-3);
  z-index: 90;
  background: var(--glass-bg-dense);
  backdrop-filter: blur(24px) saturate(180%);
  -webkit-backdrop-filter: blur(24px) saturate(180%);
  border: 1px solid var(--gold-dim);
  border-radius: var(--radius-lg);
  padding: var(--space-4);
  box-shadow: var(--shadow-lg), var(--shadow-gold);
  animation: slideUp 400ms ease-out;
}

.cta-content {
  padding-right: var(--space-6);
}

.cta-title {
  font-size: var(--text-sm);
  font-weight: 600;
  color: var(--gold);
  margin-bottom: var(--space-2);
}

.cta-link {
  display: block;
  font-size: var(--text-xs);
  color: var(--color-text-muted);
  text-decoration: none;
  margin-bottom: var(--space-2);
  line-height: 1.4;
}

.cta-link:last-child { margin-bottom: 0; }

.cta-academy { color: #4ADE80; }

[data-theme="light"] .cta-academy { color: #16A34A; }

.cta-close {
  position: absolute;
  top: var(--space-2);
  right: var(--space-2);
  color: var(--color-text-faint);
  font-size: 1.25rem;
  padding: var(--space-1);
}


/* ═══════════════════════════════
   FOOTER CREDIT
   ═══════════════════════════════ */
.app-footer-credit {
  position: fixed;
  bottom: calc(var(--bottom-nav-h) + var(--safe-bottom));
  left: 0;
  right: 0;
  z-index: 50;
  text-align: center;
  padding: var(--space-2) var(--space-4);
  font-size: 0.6rem;
  color: var(--color-text-faint);
  letter-spacing: 0.04em;
  pointer-events: none;
  background: linear-gradient(to top, var(--color-bg) 50%, transparent);
}


/* ═══════════════════════════════
   SCROLLBAR
   ═══════════════════════════════ */
::-webkit-scrollbar { width: 4px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--color-border); border-radius: 2px; }


/* ═══════════════════════════════
   SKELETON LOADING
   ═══════════════════════════════ */
.skeleton {
  background: linear-gradient(90deg, var(--color-surface) 25%, var(--color-surface-2) 50%, var(--color-surface) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.5s infinite;
  border-radius: var(--radius-md);
}

@keyframes shimmer {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}


/* ═══════════════════════════════
   PROGRAMS SCREEN
   ═══════════════════════════════ */
.programs-header {
  text-align: center;
  margin-bottom: var(--space-5);
}

.programs-subtitle {
  font-size: var(--text-sm);
  color: var(--color-text-muted);
  line-height: 1.5;
  margin-top: var(--space-2);
}

/* Progress indicator */
.programs-progress {
  display: flex;
  justify-content: center;
  margin-bottom: var(--space-6);
}

.progress-steps {
  display: flex;
  gap: var(--space-2);
  align-items: center;
}

.progress-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--color-border);
  transition: background 300ms, transform 300ms;
}

.progress-dot.active {
  background: var(--gold-dim);
}

.progress-dot.current {
  background: var(--gold);
  transform: scale(1.3);
  box-shadow: 0 0 8px rgba(200, 168, 78, 0.4);
}

/* Program question */
.prog-question {
  font-family: var(--font-display);
  font-size: var(--text-lg);
  font-weight: 600;
  color: var(--color-text);
  text-align: center;
  margin-bottom: var(--space-5);
  line-height: 1.4;
}

/* Program options */
.prog-options {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
  max-width: 400px;
  margin: 0 auto;
}

.prog-options-row {
  flex-direction: row;
  flex-wrap: wrap;
  justify-content: center;
}

/* Pill-shaped option buttons */
.prog-pill {
  position: relative;
  overflow: hidden;
  background: var(--glass-bg);
  backdrop-filter: blur(16px) saturate(180%);
  -webkit-backdrop-filter: blur(16px) saturate(180%);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-full);
  padding: var(--space-3) var(--space-5);
  font-size: var(--text-base);
  color: var(--color-text);
  text-align: center;
  cursor: pointer;
  transition: all 200ms;
  white-space: nowrap;
}

.prog-pill::before {
  content: '';
  position: absolute;
  inset: 0;
  background: var(--glass-highlight);
  pointer-events: none;
  border-radius: inherit;
}

.prog-pill:active {
  transform: scale(0.96);
  border-color: var(--gold);
  background: var(--color-surface-2);
}

.prog-pill:hover {
  border-color: var(--gold-dim);
}

.prog-pill-wide {
  flex: 1;
  min-width: 120px;
}

.prog-pill-skip {
  background: transparent;
  border-color: var(--color-border);
  color: var(--color-text-muted);
  font-size: var(--text-sm);
}

.prog-pill-submit {
  background: linear-gradient(135deg, var(--gold-dim), var(--gold));
  color: var(--pd-btn-ai-text);
  border-color: transparent;
  font-weight: 600;
}

/* Program textarea input */
.prog-input-group {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
  max-width: 400px;
  margin: 0 auto;
}

.prog-textarea {
  background: var(--glass-bg);
  backdrop-filter: blur(12px) saturate(180%);
  -webkit-backdrop-filter: blur(12px) saturate(180%);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-lg);
  padding: var(--space-3) var(--space-4);
  font-size: var(--text-base);
  color: var(--color-text);
  resize: none;
  font-family: var(--font-body);
  line-height: 1.5;
}

.prog-textarea::placeholder {
  color: var(--color-text-faint);
}

.prog-textarea:focus {
  outline: none;
  border-color: var(--gold-dim);
  box-shadow: 0 0 0 3px rgba(200, 168, 78, 0.1);
}

/* Program loading */
.programs-loading {
  text-align: center;
  padding: var(--space-10) var(--space-4);
}

.loading-spinner {
  width: 48px;
  height: 48px;
  border: 3px solid var(--color-border);
  border-top: 3px solid var(--gold);
  border-radius: 50%;
  margin: 0 auto var(--space-5);
  animation: spin 1s linear infinite;
}

@keyframes spin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

.programs-loading p {
  font-size: var(--text-sm);
  color: var(--color-text-muted);
  line-height: 1.5;
}

/* Program result */
.programs-result {
  animation: fadeIn 300ms ease-out;
}

.program-result-content {
  font-size: var(--text-base);
  color: var(--color-text);
  line-height: 1.7;
  margin-bottom: var(--space-6);
}

.program-result-content p {
  margin-bottom: var(--space-3);
}

.program-result-content strong {
  color: var(--gold);
}

.program-result-actions {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
  margin-bottom: var(--space-8);
}

.prog-products-section {
  margin-top: var(--space-6);
  padding-top: var(--space-4);
  border-top: 1px solid var(--color-border);
}


/* ═══════════════════════════════
   REVIEWS SCREEN
   ═══════════════════════════════ */

/* Reviews product list */
.reviews-product-list {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
}

.review-product-card {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  position: relative;
  overflow: hidden;
  background: var(--glass-bg);
  backdrop-filter: blur(16px) saturate(180%);
  -webkit-backdrop-filter: blur(16px) saturate(180%);
  border: 1px solid var(--glass-border);
  box-shadow: var(--glass-shadow);
  border-radius: var(--radius-lg);
  padding: var(--space-3);
  cursor: pointer;
  transition: transform 150ms;
}

.review-product-card::before {
  content: '';
  position: absolute;
  inset: 0;
  background: var(--glass-highlight);
  pointer-events: none;
  border-radius: inherit;
}

.review-product-card:active {
  transform: scale(0.98);
}

.review-product-img {
  width: 56px;
  height: 56px;
  border-radius: var(--radius-md);
  object-fit: cover;
  background: var(--color-surface-2);
  flex-shrink: 0;
  position: relative;
  z-index: 2;
}

.review-product-info {
  flex: 1;
  min-width: 0;
  position: relative;
  z-index: 2;
}

.review-product-name {
  font-size: var(--text-sm);
  font-weight: 600;
  color: var(--color-text);
  margin-bottom: var(--space-1);
  line-height: 1.3;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.review-product-counts {
  display: flex;
  gap: var(--space-2);
  flex-wrap: wrap;
}

.review-count-badge {
  font-size: var(--text-xs);
  color: var(--color-text-muted);
}

.review-chevron {
  color: var(--color-text-faint);
  flex-shrink: 0;
  position: relative;
  z-index: 2;
}

/* Reviews detail view */
.reviews-product-name {
  font-family: var(--font-display);
  font-size: var(--text-xl);
  font-weight: 600;
  color: var(--color-text);
  margin-bottom: var(--space-4);
  line-height: 1.3;
}

/* Reviews tabs */
.reviews-tabs {
  display: flex;
  gap: var(--space-2);
  margin-bottom: var(--space-4);
}

.reviews-tab {
  padding: var(--space-2) var(--space-4);
  border-radius: var(--radius-full);
  font-size: var(--text-sm);
  font-weight: 500;
  color: var(--color-text-muted);
  background: var(--glass-bg);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid var(--glass-border);
  cursor: pointer;
  transition: all 200ms;
}

.reviews-tab.active {
  color: var(--gold);
  border-color: var(--gold-dim);
  background: var(--color-surface-2);
}

/* Review card */
.review-card {
  position: relative;
  overflow: hidden;
  background: var(--glass-bg);
  backdrop-filter: blur(12px) saturate(180%);
  -webkit-backdrop-filter: blur(12px) saturate(180%);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-lg);
  padding: var(--space-4);
  margin-bottom: var(--space-3);
  animation: fadeIn 200ms ease-out;
}

.review-card::before {
  content: '';
  position: absolute;
  inset: 0;
  background: var(--glass-highlight);
  pointer-events: none;
  border-radius: inherit;
}

.review-card-header {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  margin-bottom: var(--space-2);
  position: relative;
  z-index: 2;
}

.review-sentiment {
  font-size: 1.1rem;
}

.review-author {
  font-size: var(--text-sm);
  font-weight: 600;
  color: var(--color-text);
}

.review-date {
  font-size: var(--text-xs);
  color: var(--color-text-faint);
  margin-left: auto;
}

.review-summary {
  font-size: var(--text-sm);
  color: var(--gold);
  font-style: italic;
  margin-bottom: var(--space-2);
  position: relative;
  z-index: 2;
}

.review-text {
  font-size: var(--text-base);
  color: var(--color-text);
  line-height: 1.6;
  position: relative;
  z-index: 2;
}

/* Video review card */
.review-video-card {
  border-left: 3px solid var(--gold);
}

/* Load more button */
.reviews-load-more {
  display: block;
  width: 100%;
  padding: var(--space-3);
  margin-top: var(--space-3);
  background: var(--glass-bg);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-lg);
  font-size: var(--text-sm);
  font-weight: 500;
  color: var(--gold);
  text-align: center;
  cursor: pointer;
  transition: all 200ms;
}

.reviews-load-more:hover {
  border-color: var(--gold-dim);
}

.reviews-load-more:active {
  transform: scale(0.98);
}
