/* ============================================
   nomnom — Mobile PWA Food Barcode Scanner
   Dark-first glassmorphism design system
   ============================================ */

/* ---------- DESIGN TOKENS ---------- */
:root {
  /* Colors — dark-first palette */
  --bg-primary: #09090B;
  --bg-surface: #18181B;
  --bg-elevated: #27272A;
  --bg-overlay: rgba(255, 255, 255, 0.07);

  --border-subtle: rgba(255, 255, 255, 0.1);

  --text-primary: #E4E4E7;
  --text-secondary: #A1A1AA;

  --safe: #4ADE80;
  --caution: #FACC15;
  --danger: #EF4444;
  --danger-bg: rgba(239, 68, 68, 0.1);

  --accent: #F97316;
  --accent-glow: rgba(249, 115, 22, 0.12);

  /* Spacing — 8px grid */
  --space-1: 4px;
  --space-2: 8px;
  --space-3: 12px;
  --space-4: 16px;
  --space-6: 24px;
  --space-8: 32px;

  /* Border radii */
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-xl: 24px;
  --radius-full: 9999px;

  /* Motion */
  --motion-fast: 150ms;
  --motion-base: 240ms;
  --motion-slow: 400ms;
  --ease-spring: cubic-bezier(0.34, 1.56, 0.64, 1);
  --ease-smooth: cubic-bezier(0.4, 0, 0.2, 1);

  /* Typography */
  --font-primary: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
}

/* ---------- LIGHT MODE OVERRIDES ---------- */
@media (prefers-color-scheme: light) {
  :root {
    --bg-primary: #FAFAFA;
    --bg-surface: #FFFFFF;
    --bg-elevated: #F4F4F5;
    --bg-overlay: rgba(0, 0, 0, 0.04);

    --border-subtle: rgba(0, 0, 0, 0.08);

    --text-primary: #18181B;
    --text-secondary: #71717A;

    --danger-bg: rgba(239, 68, 68, 0.08);
    --accent-glow: rgba(234, 88, 12, 0.12);
  }
}

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

/* ---------- BASE RESET ---------- */
*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html,
body {
  height: 100dvh;
  overflow: hidden;
  font-family: var(--font-primary);
  background-color: var(--bg-primary);
  color: var(--text-primary);
  overscroll-behavior: none;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  display: flex;
  flex-direction: column;
  padding-top: env(safe-area-inset-top);
  padding-right: env(safe-area-inset-right);
  padding-bottom: env(safe-area-inset-bottom);
  padding-left: env(safe-area-inset-left);
}

/* ---------- ATMOSPHERIC BACKGROUND ---------- */
.bg-glow {
  position: fixed;
  pointer-events: none;
  z-index: -1;
  inset: 0;
  overflow: hidden;
}

.bg-glow::before {
  content: '';
  position: absolute;
  width: 300px;
  height: 300px;
  border-radius: 50%;
  filter: blur(120px);
  opacity: 0.08;
  background: var(--accent);
  top: -100px;
  right: -100px;
}

.bg-glow::after {
  content: '';
  position: absolute;
  width: 250px;
  height: 250px;
  border-radius: 50%;
  filter: blur(100px);
  opacity: 0.06;
  background: var(--safe);
  bottom: -50px;
  left: -50px;
}

/* ---------- APP SHELL ---------- */
.app-shell {
  height: 100dvh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  max-width: 480px;
  margin: 0 auto;
  width: 100%;
  position: relative;
}

/* ---------- SCREENS ---------- */
.screen {
  flex: 1;
  overflow-y: auto;
  padding: var(--space-4);
  display: none;
  flex-direction: column;
  -ms-overflow-style: none;
  scrollbar-width: none;
}

.screen::-webkit-scrollbar {
  display: none;
}

.screen.active {
  display: flex;
}

.screen-header {
  padding: var(--space-4) 0;
  text-align: center;
  position: relative;
}

.settings-btn {
  position: absolute;
  right: 0;
  top: 50%;
  transform: translateY(-50%);
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-md);
  color: var(--text-secondary);
  cursor: pointer;
  transition: all var(--motion-fast);
  background: none;
  border: none;
  -webkit-tap-highlight-color: transparent;
}

.settings-btn:active {
  background: var(--bg-elevated);
  color: var(--accent);
}

.screen-title {
  font-size: 1.75rem;
  font-weight: 700;
  letter-spacing: -0.03em;
}

/* ---------- ONBOARDING SCREEN ---------- */
.onboarding-screen {
  gap: var(--space-6);
}

/* Step indicator */
.step-indicator {
  display: flex;
  justify-content: center;
  gap: var(--space-2);
}

.step-dot {
  width: 8px;
  height: 8px;
  border-radius: var(--radius-full);
  background: var(--border-subtle);
  transition: all var(--motion-base) var(--ease-spring);
}

.step-dot.active {
  background: var(--accent);
  width: 24px;
}

/* Step content */
.onboarding-step {
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
}

.step-title {
  font-size: 1.5rem;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.step-subtitle {
  color: var(--text-secondary);
  font-size: 0.95rem;
  line-height: 1.5;
}

/* Allergy grid */
.allergy-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--space-2);
}

.allergy-chip {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 10px 16px;
  border-radius: var(--radius-full);
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  color: var(--text-primary);
  font-size: 0.9rem;
  font-weight: 500;
  cursor: pointer;
  transition: all var(--motion-fast) var(--ease-smooth);
  font-family: var(--font-primary);
  text-align: center;
  min-height: 44px;
  -webkit-tap-highlight-color: transparent;
}

.allergy-chip:active {
  transform: scale(0.96);
}

.allergy-chip.selected {
  background: var(--accent);
  border-color: var(--accent);
  color: #FFFFFF;
  box-shadow: 0 0 0 2px var(--accent-glow);
  transform: scale(1.02);
}

/* Diet options */
.diet-card {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-3) var(--space-4);
  border-radius: var(--radius-md);
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  color: var(--text-primary);
  font-size: 0.95rem;
  font-weight: 500;
  cursor: pointer;
  transition: all var(--motion-fast) var(--ease-smooth);
  min-height: 52px;
  -webkit-tap-highlight-color: transparent;
}

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

.diet-card.selected {
  background: var(--accent);
  border-color: var(--accent);
  color: #FFFFFF;
}

.diet-icon {
  font-size: 1.25rem;
  flex-shrink: 0;
}

/* Onboarding actions */
.onboarding-actions {
  display: flex;
  flex-direction: row;
  justify-content: space-between;
  align-items: center;
  padding-top: var(--space-6);
  gap: var(--space-3);
}

/* ---------- BUTTONS ---------- */
.btn {
  padding: 14px 28px;
  border-radius: var(--radius-full);
  font-weight: 600;
  border: none;
  cursor: pointer;
  transition: all var(--motion-fast) var(--ease-smooth);
  font-size: 1rem;
  min-height: 48px;
  font-family: var(--font-primary);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  -webkit-tap-highlight-color: transparent;
  text-decoration: none;
}

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

.btn-primary {
  background: var(--accent);
  color: #FFFFFF;
  box-shadow: 0 4px 12px var(--accent-glow);
}

.btn-primary:active {
  transform: scale(0.96);
  box-shadow: 0 2px 8px var(--accent-glow);
}

.btn-ghost {
  background: transparent;
  color: var(--text-secondary);
}

.btn-ghost:active {
  background: var(--bg-overlay);
}

.btn-block {
  width: 100%;
}

.btn-large {
  padding: 18px 32px;
  font-size: 1.1rem;
}

/* ---------- SCANNER SCREEN ---------- */
.scanner-screen {
  align-items: center;
  justify-content: center;
  gap: var(--space-6);
}

.scanner-container {
  position: relative;
  aspect-ratio: 1;
  max-width: 320px;
  width: 100%;
  min-height: 280px;
  margin: 0 auto;
  overflow: hidden;
  background: #000;
  border-radius: var(--radius-xl);
}

#reader {
  width: 100% !important;
  height: 100% !important;
  min-height: 280px;
}

#reader video {
  width: 100% !important;
  height: 100% !important;
  object-fit: cover;
}

/* Hide html5-qrcode white corner markers */
#reader canvas {
  display: none !important;
}

#reader br {
  display: none !important;
}

/* Hide html5-qrcode's default shaded region */
#qr-shaded-region {
  display: none !important;
}

.scanner-frame {
  position: absolute;
  inset: 0;
  border: 3px solid var(--accent);
  border-radius: var(--radius-xl);
  pointer-events: none;
  z-index: 10;
  overflow: hidden;
}

.scanner-frame::before {
  content: '';
  position: absolute;
  left: 0;
  right: 0;
  top: 0;
  height: 3px;
  background: var(--accent);
  box-shadow: 0 0 8px var(--accent);
  border-radius: var(--radius-full);
  opacity: 0;
  transition: opacity var(--motion-fast) var(--ease-smooth);
}

.scanner-frame.scanning::before {
  opacity: 1;
  animation: scan-line 2s infinite var(--ease-smooth);
}

.scanner-hint {
  text-align: center;
  color: var(--text-secondary);
  font-size: 0.9rem;
  font-weight: 500;
  margin-top: var(--space-4);
  letter-spacing: 0.01em;
}

.scanner-controls {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-4);
  margin-top: auto;
}

.scan-button {
  width: 80px;
  height: 80px;
  border-radius: 50%;
  background: var(--accent);
  border: none;
  box-shadow: 0 4px 16px var(--accent-glow);
  cursor: pointer;
  transition: all var(--motion-fast) var(--ease-spring);
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  -webkit-tap-highlight-color: transparent;
}

.scan-button:active {
  transform: scale(0.9);
  box-shadow:
    0 2px 8px var(--accent-glow),
    0 0 0 12px var(--accent-glow);
}

.scan-button svg,
.scan-button .icon {
  width: 36px;
  height: 36px;
  color: #FFFFFF;
}

.scan-button.scanning {
  animation: pulse-ring 2s infinite;
}

/* Manual barcode toggle & input */
.manual-toggle {
  display: flex;
  align-items: center;
  gap: 4px;
  margin: 0 auto;
  padding: 8px;
  background: none;
  border: none;
  color: var(--text-secondary);
  font-size: 0.85rem;
  font-family: var(--font-primary);
  cursor: pointer;
  transition: color var(--motion-fast);
}

.manual-toggle:active {
  color: var(--accent);
}

.manual-toggle .chevron {
  transition: transform var(--motion-base) ease;
}

.manual-toggle.open .chevron {
  transform: rotate(180deg);
}

.manual-input-section {
  overflow: hidden;
  transition:
    max-height 300ms var(--ease-smooth),
    opacity 300ms var(--ease-smooth),
    margin-top 300ms var(--ease-smooth);
  margin-top: 12px;
  opacity: 1;
  max-height: 200px;
}

.manual-input-section.hidden {
  max-height: 0;
  opacity: 0;
  margin-top: 0;
}

.manual-input-row {
  display: flex;
  gap: 8px;
  padding: 4px;
  border-radius: 12px;
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  transition: border-color var(--motion-fast), box-shadow var(--motion-fast);
}

.manual-input-row:focus-within {
  border-color: var(--accent);
  box-shadow: 0 0 0 2px var(--accent-glow);
}

#manual-barcode {
  flex: 1;
  padding: 12px 16px;
  border-radius: 8px;
  background: transparent;
  border: none;
  color: var(--text-primary);
  font-size: 0.95rem;
  font-family: var(--font-primary);
  outline: none;
  letter-spacing: 0.02em;
}

#manual-barcode::placeholder {
  color: var(--text-secondary);
  opacity: 0.5;
}

#manual-barcode:focus {
  outline: none;
}

.manual-input-row .btn-primary {
  padding: 10px 20px;
  font-size: 0.9rem;
  flex-shrink: 0;
}

/* ---------- RESULT SCREEN ---------- */
.result-screen {
  gap: var(--space-4);
}

.result-card {
  background: var(--bg-overlay);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: var(--space-6);
  animation: card-enter 0.4s var(--ease-spring);
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
}

@keyframes card-enter {
  from {
    opacity: 0;
    transform: translateY(16px) scale(0.98);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

/* Score ring */
.result-score-ring {
  width: 120px;
  height: 120px;
  border-radius: 50%;
  position: relative;
  margin: 0 auto;
}

.result-score-ring.safe {
  background: conic-gradient(var(--safe) 0deg, var(--safe) var(--score-deg, 252deg), var(--bg-elevated) var(--score-deg, 252deg));
}

.result-score-ring.caution {
  background: conic-gradient(var(--caution) 0deg, var(--caution) var(--score-deg, 180deg), var(--bg-elevated) var(--score-deg, 180deg));
}

.result-score-ring.danger {
  background: conic-gradient(var(--danger) 0deg, var(--danger) var(--score-deg, 90deg), var(--bg-elevated) var(--score-deg, 90deg));
}

.result-score-ring::after {
  content: '';
  position: absolute;
  inset: 15px;
  width: 90px;
  height: 90px;
  border-radius: 50%;
  background: var(--bg-surface);
}

.result-emoji {
  font-size: 3rem;
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  z-index: 1;
}

.result-rating {
  font-size: 1.5rem;
  font-weight: 700;
  text-align: center;
  margin-top: var(--space-3);
}

.result-description {
  color: var(--text-secondary);
  text-align: center;
  margin-top: var(--space-1);
  font-size: 0.9rem;
  line-height: 1.5;
}

/* Product info */
.result-product-image {
  width: 80px;
  height: 80px;
  border-radius: var(--radius-md);
  object-fit: cover;
  background: var(--bg-surface);
  align-self: center;
}

.result-product-brand {
  color: var(--text-secondary);
  font-size: 0.9rem;
}

.result-product-name {
  font-size: 1.25rem;
  font-weight: 600;
}

/* Warning banners */
.allergen-banner,
.warning-banner {
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  border-radius: var(--radius-md);
  font-weight: 500;
  font-size: 0.875rem;
  animation: slide-in 0.3s var(--ease-spring);
}

.allergen-banner {
  background: rgba(239, 68, 68, 0.1);
  border: 1px solid rgba(239, 68, 68, 0.2);
  color: var(--danger);
}

.warning-banner {
  background: rgba(250, 204, 21, 0.1);
  border: 1px solid rgba(250, 204, 21, 0.2);
  color: var(--caution);
}

.ingredients-text {
  font-size: 0.8rem;
  color: var(--text-secondary);
  line-height: 1.5;
  max-height: 120px;
  overflow-y: auto;
  -ms-overflow-style: none;
  scrollbar-width: none;
}

.ingredients-text::-webkit-scrollbar {
  display: none;
}

/* Score breakdown — details panel */
.details-toggle {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  width: 100%;
  padding: 10px;
  margin-top: var(--space-2);
  background: var(--bg-overlay);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  color: var(--text-secondary);
  font-size: 0.85rem;
  font-family: var(--font-primary);
  font-weight: 500;
  cursor: pointer;
  transition: all var(--motion-fast);
}

.details-toggle:active {
  background: var(--bg-elevated);
  color: var(--text-primary);
}

.details-toggle.open {
  color: var(--accent);
  border-color: var(--accent);
}

.details-chevron {
  transition: transform var(--motion-base) ease;
}

.details-toggle.open .details-chevron {
  transform: rotate(180deg);
}

.score-breakdown {
  overflow: hidden;
  transition:
    max-height 400ms var(--ease-smooth),
    opacity 300ms var(--ease-smooth),
    margin-top 300ms var(--ease-smooth);
  max-height: 800px;
  opacity: 1;
  margin-top: var(--space-2);
}

.score-breakdown.hidden {
  max-height: 0;
  opacity: 0;
  margin-top: 0;
}

.breakdown-bar {
  background: var(--bg-overlay);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: var(--space-3) var(--space-4);
  margin-bottom: var(--space-2);
  animation: card-enter 0.4s var(--ease-spring);
}

.breakdown-bar:last-child {
  margin-bottom: 0;
}

.breakdown-header {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  margin-bottom: var(--space-2);
}

.breakdown-icon {
  font-size: 1.1rem;
  flex-shrink: 0;
}

.breakdown-label {
  flex: 1;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-primary);
}

.breakdown-score {
  font-size: 0.85rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  flex-shrink: 0;
}

.breakdown-score[data-status="good"] { color: var(--safe); }
.breakdown-score[data-status="neutral"] { color: var(--caution); }
.breakdown-score[data-status="warning"] { color: var(--caution); }
.breakdown-score[data-status="bad"] { color: var(--danger); }

.breakdown-track {
  height: 6px;
  background: var(--bg-elevated);
  border-radius: var(--radius-full);
  overflow: hidden;
  margin-bottom: var(--space-1);
}

.breakdown-fill {
  height: 100%;
  border-radius: var(--radius-full);
  transition: width 600ms var(--ease-spring);
  width: 0;
}

.breakdown-fill[data-status="good"] { background: var(--safe); }
.breakdown-fill[data-status="neutral"] { background: var(--caution); }
.breakdown-fill[data-status="warning"] { background: var(--caution); }
.breakdown-fill[data-status="bad"] { background: var(--danger); }

.breakdown-detail {
  font-size: 0.78rem;
  color: var(--text-secondary);
  line-height: 1.5;
}

/* Result actions */
.result-actions {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
  margin-top: var(--space-6);
}

.btn-scan-again {
  /* Inherits btn-ghost */
}

.btn-history {
  /* Inherits btn-primary + btn-block */
}

/* ---------- HISTORY SCREEN ---------- */
.history-screen {
  gap: var(--space-3);
}

.history-list {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
}

.history-item {
  background: var(--bg-overlay);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: var(--space-4);
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: var(--space-3);
  cursor: pointer;
  transition: transform var(--motion-fast) var(--ease-smooth);
  animation: card-enter 0.4s var(--ease-spring);
  -webkit-tap-highlight-color: transparent;
}

.history-item:active {
  transform: scale(0.98);
}

.history-item-image {
  width: 48px;
  height: 48px;
  border-radius: var(--radius-sm);
  object-fit: cover;
  background: var(--bg-surface);
  flex-shrink: 0;
}

.history-item-info {
  flex: 1;
  min-width: 0;
}

.history-item-name {
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.history-item-date {
  color: var(--text-secondary);
  font-size: 0.8rem;
  margin-top: var(--space-1);
}

.history-item-rating {
  font-size: 0.85rem;
  font-weight: 600;
  padding: 4px 10px;
  border-radius: var(--radius-full);
  flex-shrink: 0;
}

.history-item-rating.safe {
  background: rgba(74, 222, 128, 0.12);
  color: var(--safe);
}

.history-item-rating.caution {
  background: rgba(250, 204, 21, 0.12);
  color: var(--caution);
}

.history-item-rating.danger {
  background: rgba(239, 68, 68, 0.12);
  color: var(--danger);
}

/* Empty state */
.history-empty {
  text-align: center;
  padding: var(--space-8);
  color: var(--text-secondary);
  display: flex;
  flex-direction: column;
  align-items: center;
}

.history-empty-icon {
  font-size: 3rem;
  margin-bottom: var(--space-3);
  opacity: 0.5;
}

.clear-history-btn {
  /* Inherits btn-ghost + text-danger */
  color: var(--danger);
  margin-top: var(--space-4);
  align-self: center;
}

/* ---------- BOTTOM NAVIGATION ---------- */
.bottom-nav {
  flex-shrink: 0;
  display: flex;
  justify-content: space-around;
  align-items: center;
  height: 68px;
  background: var(--bg-overlay);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-top: 1px solid var(--border-subtle);
  padding-bottom: env(safe-area-inset-bottom);
}

.nav-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  min-width: 64px;
  min-height: 48px;
  padding: 8px 16px;
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: all var(--motion-fast) var(--ease-spring);
  color: var(--text-secondary);
  text-decoration: none;
  border: none;
  background: none;
  font-family: var(--font-primary);
  font-size: 10px;
  font-weight: 500;
  -webkit-tap-highlight-color: transparent;
}

.nav-item.active {
  color: var(--accent);
  background: var(--accent-glow);
  transform: scale(1.05);
}

.nav-item .nav-icon {
  font-size: 1.4rem;
  transition: transform var(--motion-fast) var(--ease-spring);
}

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

.nav-item .nav-label {
  font-size: 10px;
  letter-spacing: 0.02em;
  transition: all var(--motion-fast) var(--ease-smooth);
}

/* ---------- LOADING & STATES ---------- */
.loading-spinner {
  width: 40px;
  height: 40px;
  border: 3px solid var(--border-subtle);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
}

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

.loading-overlay {
  position: absolute;
  inset: 0;
  background: rgba(9, 9, 11, 0.8);
  display: flex;
  align-items: center;
  justify-content: center;
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  z-index: 10;
}

.error-message {
  text-align: center;
  padding: var(--space-6);
  color: var(--danger);
  background: var(--danger-bg);
  border-radius: var(--radius-md);
}

.product-not-found {
  text-align: center;
  padding: var(--space-8);
  color: var(--text-secondary);
}

/* Skeleton loading */
.skeleton {
  background: linear-gradient(
    90deg,
    var(--bg-elevated) 25%,
    var(--bg-surface) 50%,
    var(--bg-elevated) 75%
  );
  background-size: 200% 100%;
  animation: shimmer 1.5s infinite;
  border-radius: var(--radius-sm);
}

/* ---------- ANIMATIONS ---------- */
@keyframes scan-line {
  0%,
  100% {
    top: 0%;
  }
  50% {
    top: calc(100% - 3px);
  }
}

@keyframes pulse-ring {
  0% {
    box-shadow: 0 0 0 0 var(--accent-glow);
  }
  70% {
    box-shadow: 0 0 0 16px rgba(249, 115, 22, 0);
  }
  100% {
    box-shadow: 0 0 0 0 rgba(249, 115, 22, 0);
  }
}

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

@keyframes slide-in {
  from {
    opacity: 0;
    transform: translateY(-8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* ---------- ALLERGENS SCREEN ---------- */
.allergens-screen {
  gap: var(--space-4);
}

.allergens-subtitle {
  color: var(--text-secondary);
  font-size: 0.85rem;
  text-align: center;
  margin-top: var(--space-1);
}

.allergens-section {
  background: var(--bg-overlay);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: var(--space-4);
}

.allergens-section-title {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: var(--space-3);
}

.allergens-section-title svg {
  color: var(--accent);
  flex-shrink: 0;
}

.allergens-allergy-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--space-2);
}

.allergens-diet-grid {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}

.allergens-saved {
  text-align: center;
  color: var(--safe);
  font-size: 0.8rem;
  font-weight: 500;
  opacity: 0;
  transform: translateY(4px);
  transition: all var(--motion-base) var(--ease-smooth);
}

.allergens-saved.visible {
  opacity: 1;
  transform: translateY(0);
}

/* ---------- UTILITY CLASSES ---------- */
.text-safe { color: var(--safe); }
.text-caution { color: var(--caution); }
.text-danger { color: var(--danger); }
.text-accent { color: var(--accent); }
.text-secondary { color: var(--text-secondary); }

.hidden { display: none !important; }

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border-width: 0;
}
