/* ══════════════════════════════════════════════════════════════
   CycleGlow Design System v2.0
   Oura Ring meets Flo — premium dark theme, data-rich, beautiful
   ══════════════════════════════════════════════════════════════ */

/* ── Design Tokens ──────────────────────────────────────────── */
:root {
  /* Backgrounds (elevation through brightness) */
  --bg-deep: #140e24;
  --bg-card: #1c1533;
  --bg-card-elevated: #241c3f;
  --bg-surface: #2a2145;
  --bg-input: #201838;

  /* Text hierarchy */
  --text-primary: #f0edf6;
  --text-secondary: #a09bb5;
  --text-tertiary: #6b6580;
  --text-disabled: #4a4560;

  /* Accent colors */
  --accent-teal: #4aedc4;
  --accent-teal-dim: rgba(74, 237, 196, 0.15);
  --accent-teal-glow: rgba(74, 237, 196, 0.3);
  --accent-pink: #ff6b8a;
  --accent-pink-dim: rgba(255, 107, 138, 0.15);
  --accent-purple: #a78bfa;
  --accent-purple-dim: rgba(167, 139, 250, 0.15);
  --accent-orange: #ff9a5c;
  --accent-orange-dim: rgba(255, 154, 92, 0.15);
  --accent-gold: #fbbf24;
  --accent-gold-dim: rgba(251, 191, 36, 0.12);
  --accent-red: #ff6b6b;
  --accent-red-dim: rgba(255, 107, 107, 0.12);

  /* Phase colors (semantic) */
  --phase-menstrual: #ff6b8a;
  --phase-follicular: #a78bfa;
  --phase-ovulatory: #4aedc4;
  --phase-luteal: #ff9a5c;

  /* Status colors */
  --green: #4aedc4;
  --green-bg: rgba(74, 237, 196, 0.1);
  --yellow: #fbbf24;
  --yellow-bg: rgba(251, 191, 36, 0.1);
  --red: #ff6b6b;
  --red-bg: rgba(255, 107, 107, 0.1);

  /* Gradients */
  --gradient-cta: linear-gradient(135deg, #4aedc4, #a78bfa);
  --gradient-header: linear-gradient(135deg, var(--accent-teal) 0%, var(--accent-purple) 50%, var(--accent-pink) 100%);

  /* Borders */
  --border-default: rgba(167, 139, 250, 0.15);
  --border-focus: rgba(74, 237, 196, 0.4);
  --border-hover: rgba(167, 139, 250, 0.25);

  /* Shadows (colored, not black) */
  --shadow-card: 0 4px 24px rgba(20, 14, 36, 0.3);
  --shadow-card-hover: 0 8px 32px rgba(20, 14, 36, 0.4);
  --shadow-glow-teal: 0 0 20px rgba(74, 237, 196, 0.15);
  --shadow-glow-pink: 0 0 20px rgba(255, 107, 138, 0.15);
  --shadow-glow-purple: 0 0 20px rgba(167, 139, 250, 0.15);
  --shadow-glow-orange: 0 0 20px rgba(255, 154, 92, 0.15);

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

  /* Typography */
  --font-family: 'Inter', system-ui, -apple-system, sans-serif;
  --font-size-xs: 0.75rem;
  --font-size-sm: 0.875rem;
  --font-size-base: 1rem;
  --font-size-lg: 1.25rem;
  --font-size-xl: 1.5rem;
  --font-size-2xl: 2rem;
  --font-weight-normal: 400;
  --font-weight-medium: 500;
  --font-weight-semibold: 600;
  --font-weight-bold: 700;

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

  /* Transitions */
  --transition-fast: 150ms ease;
  --transition-normal: 250ms ease;
  --transition-slow: 400ms ease;
}

/* ── Reset & Base ───────────────────────────────────────────── */
*, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; }

/* Global focus ring for keyboard navigation */
:focus-visible {
  outline: 2px solid var(--accent-teal);
  outline-offset: 2px;
}
:focus:not(:focus-visible) { outline: none; }

body {
  font-family: var(--font-family);
  font-size: var(--font-size-base);
  font-weight: var(--font-weight-normal);
  background: var(--bg-deep);
  color: var(--text-primary);
  min-height: 100vh;
  line-height: 1.6;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* ── Star Field Background ──────────────────────────────────── */
body::before {
  content: '';
  position: fixed;
  inset: 0;
  background:
    radial-gradient(1px 1px at 10% 20%, rgba(255,255,255,0.6) 0%, transparent 100%),
    radial-gradient(1px 1px at 30% 65%, rgba(255,255,255,0.5) 0%, transparent 100%),
    radial-gradient(1px 1px at 50% 10%, rgba(255,255,255,0.4) 0%, transparent 100%),
    radial-gradient(1.5px 1.5px at 70% 40%, rgba(255,255,255,0.7) 0%, transparent 100%),
    radial-gradient(1px 1px at 85% 75%, rgba(255,255,255,0.5) 0%, transparent 100%),
    radial-gradient(1px 1px at 15% 85%, rgba(255,255,255,0.4) 0%, transparent 100%),
    radial-gradient(1.5px 1.5px at 45% 50%, rgba(255,255,255,0.6) 0%, transparent 100%),
    radial-gradient(1px 1px at 60% 90%, rgba(255,255,255,0.3) 0%, transparent 100%),
    radial-gradient(1px 1px at 25% 35%, rgba(255,255,255,0.5) 0%, transparent 100%),
    radial-gradient(1px 1px at 90% 15%, rgba(255,255,255,0.4) 0%, transparent 100%),
    radial-gradient(1.5px 1.5px at 5% 55%, rgba(255,255,255,0.6) 0%, transparent 100%),
    radial-gradient(1px 1px at 75% 25%, rgba(255,255,255,0.3) 0%, transparent 100%),
    radial-gradient(1px 1px at 40% 80%, rgba(255,255,255,0.5) 0%, transparent 100%),
    radial-gradient(1px 1px at 95% 60%, rgba(255,255,255,0.4) 0%, transparent 100%),
    radial-gradient(1.5px 1.5px at 20% 70%, rgba(167, 139, 250, 0.5) 0%, transparent 100%),
    radial-gradient(1.5px 1.5px at 80% 50%, rgba(74, 237, 196, 0.4) 0%, transparent 100%);
  pointer-events: none;
  z-index: 0;
}

body::after {
  content: '';
  position: fixed;
  top: -50%; left: -50%;
  width: 200%; height: 200%;
  background:
    radial-gradient(ellipse at 30% 20%, rgba(167, 139, 250, 0.04) 0%, transparent 50%),
    radial-gradient(ellipse at 70% 80%, rgba(196, 181, 224, 0.03) 0%, transparent 50%),
    radial-gradient(ellipse at 50% 50%, rgba(74, 237, 196, 0.02) 0%, transparent 40%);
  pointer-events: none;
  z-index: 0;
}

/* ── Typography ─────────────────────────────────────────────── */
h1, h2, h3, h4 { font-weight: var(--font-weight-bold); letter-spacing: -0.02em; line-height: 1.3; }
h1 { font-size: var(--font-size-2xl); font-weight: 800; }
h2 { font-size: var(--font-size-xl); color: var(--text-primary); font-weight: var(--font-weight-bold); }
h3 { font-size: var(--font-size-lg); color: var(--text-primary); font-weight: var(--font-weight-bold); }
h4 { font-size: var(--font-size-base); color: var(--text-primary); font-weight: var(--font-weight-semibold); }
p, li, span, label { font-weight: var(--font-weight-normal); }

/* ── Layout ─────────────────────────────────────────────────── */
.app-container {
  max-width: 1200px;
  margin: 0 auto;
  padding: var(--space-md);
  position: relative;
  z-index: 1;
}

/* ── Header ─────────────────────────────────────────────────── */
.header {
  text-align: center;
  padding: var(--space-xl) var(--space-md) var(--space-lg);
}
.header h1 {
  font-size: 2.5rem;
  font-weight: 800;
  background: var(--gradient-header);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  filter: drop-shadow(0 0 20px rgba(74, 237, 196, 0.3));
}
.header p {
  color: var(--text-secondary);
  font-size: var(--font-size-base);
  font-weight: var(--font-weight-medium);
  margin-top: var(--space-xs);
  letter-spacing: 0.02em;
}

/* ── Navigation Tabs ────────────────────────────────────────── */
.nav-tabs {
  display: flex;
  gap: var(--space-xs);
  justify-content: center;
  padding: var(--space-sm);
  background: rgba(22, 19, 43, 0.8);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-radius: var(--radius-lg);
  margin-bottom: var(--space-lg);
  flex-wrap: wrap;
  border: 1px solid var(--border-default);
}
.nav-tab {
  padding: 10px 20px;
  border: none;
  background: transparent;
  color: var(--text-tertiary);
  font-size: var(--font-size-sm);
  font-weight: var(--font-weight-semibold);
  cursor: pointer;
  border-radius: var(--radius-sm);
  transition: all var(--transition-fast);
  font-family: inherit;
  position: relative;
  min-height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
}
.nav-tab:hover {
  background: rgba(167, 139, 250, 0.12);
  color: var(--text-secondary);
}
.nav-tab.active {
  background: linear-gradient(135deg, rgba(74, 237, 196, 0.2) 0%, rgba(167, 139, 250, 0.2) 100%);
  color: var(--accent-teal);
  box-shadow: 0 0 20px rgba(74, 237, 196, 0.18);
  border: 1px solid rgba(74, 237, 196, 0.25);
  font-weight: var(--font-weight-bold);
}
.nav-tab:active { transform: scale(0.96); transition-duration: 80ms; }
.nav-tab:focus-visible {
  outline: 2px solid var(--accent-teal);
  outline-offset: 2px;
}

/* ── Cards (Glassmorphism) ──────────────────────────────────── */
.card {
  background: rgba(28, 21, 51, 0.7);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-radius: var(--radius-lg);
  padding: var(--space-lg);
  box-shadow: var(--shadow-card);
  border: 1px solid var(--border-default);
  transition: box-shadow var(--transition-fast), border-color var(--transition-fast), transform var(--transition-fast), background var(--transition-fast);
}
.card:hover {
  box-shadow: var(--shadow-card-hover);
  border-color: var(--border-hover);
  transform: translateY(-1px);
}
.card-elevated,
#phase-info {
  background: rgba(36, 28, 63, 0.85);
  border-color: var(--border-hover);
  box-shadow: var(--shadow-card-hover), var(--shadow-glow-purple);
}

/* Recess the Cycle Setup form — lower visual priority */
.card-recessed {
  background: rgba(22, 17, 40, 0.5);
  border-color: rgba(167, 139, 250, 0.08);
  box-shadow: none;
}
.card-recessed:hover {
  background: rgba(28, 21, 51, 0.6);
  border-color: var(--border-default);
  box-shadow: var(--shadow-card);
}
.card-header {
  display: flex;
  align-items: center;
  gap: var(--space-md);
  margin-bottom: var(--space-md);
}
.card-icon {
  width: 44px;
  height: 44px;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.4rem;
  flex-shrink: 0;
}
.card-icon.lavender { background: var(--accent-purple-dim); }
.card-icon.pink { background: var(--accent-pink-dim); }
.card-icon.green { background: var(--accent-teal-dim); }
.card-icon.gold { background: var(--accent-gold-dim); }
.card-icon.orange { background: var(--accent-orange-dim); }

/* ── Tab Content ────────────────────────────────────────────── */
.tab-content { display: none; }
.tab-content.active { display: block; animation: fadeSlideIn 250ms ease; }
@keyframes fadeSlideIn {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ── Dashboard Grid ─────────────────────────────────────────── */
.dashboard-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--space-lg);
  align-items: start;
}

/* ── Cycle Wheel (Hero Element) ──────────────────────────────── */
.cycle-wheel-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: var(--space-xl) var(--space-lg);
}
.cycle-wheel {
  position: relative;
  width: 340px;
  height: 340px;
  filter: drop-shadow(0 0 40px rgba(167, 139, 250, 0.15));
  transition: filter var(--transition-normal);
}
.cycle-wheel:hover {
  filter: drop-shadow(0 0 50px rgba(167, 139, 250, 0.25));
}
.cycle-wheel canvas { width: 100%; height: 100%; }
.cycle-center {
  position: absolute;
  top: 50%; left: 50%;
  transform: translate(-50%, -50%);
  text-align: center;
  width: 160px;
}
.cycle-center .day-number {
  font-size: 3.2rem;
  font-weight: 800;
  background: linear-gradient(135deg, var(--accent-teal), var(--text-primary));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  line-height: 1;
}
.cycle-center .phase-name {
  font-size: var(--font-size-sm);
  font-weight: var(--font-weight-bold);
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.1em;
  margin-top: var(--space-sm);
}
.cycle-center .sub-label {
  font-size: var(--font-size-xs);
  color: var(--text-tertiary);
  margin-top: var(--space-xs);
}

/* ── Phase Badge ────────────────────────────────────────────── */
.phase-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 14px;
  border-radius: var(--radius-full);
  font-size: var(--font-size-xs);
  font-weight: var(--font-weight-bold);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}
.phase-badge.menstrual { background: rgba(255,107,138,0.15); color: var(--phase-menstrual); border: 1px solid rgba(255,107,138,0.3); }
.phase-badge.follicular { background: rgba(167,139,250,0.15); color: var(--phase-follicular); border: 1px solid rgba(167,139,250,0.3); }
.phase-badge.ovulatory { background: rgba(74,237,196,0.15); color: var(--phase-ovulatory); border: 1px solid rgba(74,237,196,0.3); }
.phase-badge.luteal { background: rgba(255,154,92,0.15); color: var(--phase-luteal); border: 1px solid rgba(255,154,92,0.3); }

/* ── Buttons ────────────────────────────────────────────────── */
.btn {
  padding: 12px 24px;
  border: none;
  border-radius: var(--radius-md);
  font-size: var(--font-size-sm);
  font-weight: var(--font-weight-semibold);
  cursor: pointer;
  transition: all var(--transition-fast);
  font-family: inherit;
  position: relative;
  overflow: hidden;
  min-height: 44px;
}
.btn:active { transform: scale(0.96); transition-duration: 80ms; }
.btn:focus-visible {
  outline: 2px solid var(--accent-teal);
  outline-offset: 2px;
}
.btn-primary {
  background: var(--gradient-cta);
  color: var(--bg-deep);
  box-shadow: 0 0 16px rgba(74, 237, 196, 0.2);
}
.btn-primary:hover {
  box-shadow: 0 0 28px rgba(74, 237, 196, 0.4);
  transform: translateY(-2px);
  filter: brightness(1.08);
}
.btn-primary:active { transform: scale(0.96) translateY(0); filter: brightness(0.95); }
.btn-secondary {
  background: var(--bg-surface);
  color: var(--text-secondary);
  border: 2px solid var(--border-default);
}
.btn-secondary:hover {
  border-color: var(--accent-purple);
  color: var(--text-primary);
  background: var(--bg-card-elevated);
  transform: translateY(-1px);
  box-shadow: var(--shadow-glow-purple);
}
.btn-secondary:active { transform: scale(0.96) translateY(0); }
.btn-sm {
  padding: 8px 16px;
  font-size: var(--font-size-xs);
}
.btn-block { width: 100%; }

/* ── Forms ──────────────────────────────────────────────────── */
.setup-form {
  display: flex;
  flex-direction: column;
  gap: var(--space-md);
}
.form-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.form-group label {
  font-size: var(--font-size-sm);
  font-weight: var(--font-weight-semibold);
  color: var(--text-secondary);
}
.form-group input, .form-group select, .form-group textarea {
  padding: 12px var(--space-md);
  border: 2px solid var(--border-default);
  border-radius: var(--radius-sm);
  font-size: var(--font-size-base);
  font-family: inherit;
  background: var(--bg-input);
  color: var(--text-primary);
  transition: all var(--transition-fast);
  min-height: 44px;
}
.form-group input::placeholder, .form-group textarea::placeholder {
  color: var(--text-disabled);
}
.form-group input:focus, .form-group select:focus, .form-group textarea:focus {
  outline: none;
  border-color: var(--accent-teal);
  box-shadow: 0 0 0 4px rgba(74, 237, 196, 0.1);
}
.form-group input[type="date"]::-webkit-calendar-picker-indicator {
  filter: invert(1);
}
.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--space-md);
}

/* ── Toggle/Chip Selectors ──────────────────────────────────── */
.chip-group {
  display: flex;
  gap: var(--space-sm);
  flex-wrap: wrap;
}
.chip {
  padding: 8px 16px;
  border: 2px solid var(--border-default);
  border-radius: var(--radius-full);
  background: var(--bg-surface);
  font-size: var(--font-size-sm);
  font-weight: var(--font-weight-medium);
  cursor: pointer;
  transition: all var(--transition-fast);
  font-family: inherit;
  color: var(--text-secondary);
  user-select: none;
  min-height: 44px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.chip:hover {
  border-color: var(--accent-purple);
  color: var(--text-primary);
  background: var(--bg-card-elevated);
  transform: translateY(-1px);
}
.chip:active { transform: scale(0.96); transition-duration: 80ms; }
.chip:focus-visible {
  outline: 2px solid var(--accent-teal);
  outline-offset: 2px;
}
.chip.selected {
  border-color: var(--accent-teal);
  background: var(--accent-teal-dim);
  color: var(--accent-teal);
  box-shadow: var(--shadow-glow-teal);
}
.chip.selected.pink {
  border-color: var(--accent-pink);
  background: var(--accent-pink-dim);
  color: var(--accent-pink);
  box-shadow: var(--shadow-glow-pink);
}
.chip.selected.purple {
  border-color: var(--accent-purple);
  background: var(--accent-purple-dim);
  color: var(--accent-purple);
  box-shadow: var(--shadow-glow-purple);
}
.chip.selected.orange {
  border-color: var(--accent-orange);
  background: var(--accent-orange-dim);
  color: var(--accent-orange);
  box-shadow: var(--shadow-glow-orange);
}

/* ── Scale Selector (1-5 dots/bars) ─────────────────────────── */
.scale-selector {
  display: flex;
  gap: var(--space-xs);
}
.scale-btn {
  flex: 1;
  min-height: 44px;
  border: 2px solid var(--border-default);
  border-radius: var(--radius-sm);
  background: var(--bg-surface);
  cursor: pointer;
  transition: all var(--transition-fast);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: var(--font-size-sm);
  font-weight: var(--font-weight-semibold);
  color: var(--text-tertiary);
  font-family: inherit;
}
.scale-btn:hover {
  border-color: var(--accent-purple);
  color: var(--text-secondary);
  background: var(--bg-card-elevated);
  transform: translateY(-1px);
}
.scale-btn:active { transform: scale(0.96); transition-duration: 80ms; }
.scale-btn:focus-visible {
  outline: 2px solid var(--accent-teal);
  outline-offset: 2px;
}
.scale-btn.selected {
  border-color: var(--accent-teal);
  background: var(--accent-teal-dim);
  color: var(--accent-teal);
}

/* ── Emoji Scale (mood/energy) ──────────────────────────────── */
.emoji-scale {
  display: flex;
  gap: var(--space-sm);
  justify-content: center;
}
.emoji-btn {
  width: 44px;
  height: 44px;
  border: 2px solid var(--border-default);
  border-radius: var(--radius-md);
  background: var(--bg-surface);
  font-size: 1.3rem;
  cursor: pointer;
  transition: all var(--transition-fast);
  display: flex;
  align-items: center;
  justify-content: center;
}
.emoji-btn:hover { border-color: var(--accent-purple); transform: scale(1.05); }
.emoji-btn.selected {
  border-color: var(--accent-teal);
  background: var(--accent-teal-dim);
  transform: scale(1.1);
  box-shadow: var(--shadow-glow-teal);
}

/* ── Badge ──────────────────────────────────────────────────── */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 3px 10px;
  border-radius: var(--radius-full);
  font-size: var(--font-size-xs);
  font-weight: var(--font-weight-semibold);
}
.badge-purple { background: var(--accent-purple-dim); color: var(--accent-purple); }
.badge-teal { background: var(--accent-teal-dim); color: var(--accent-teal); }
.badge-pink { background: var(--accent-pink-dim); color: var(--accent-pink); }
.badge-orange { background: var(--accent-orange-dim); color: var(--accent-orange); }

/* ── Hormone Chart ──────────────────────────────────────────── */
.chart-container {
  position: relative;
  width: 100%;
  height: 350px;
}
.chart-legend {
  display: flex;
  gap: var(--space-md);
  justify-content: center;
  flex-wrap: wrap;
  margin-top: var(--space-md);
}
.legend-item {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: var(--font-size-sm);
  color: var(--text-secondary);
}
.legend-dot {
  width: 10px;
  height: 10px;
  border-radius: var(--radius-full);
}

/* ── Scanner ────────────────────────────────────────────────── */
.scanner-area {
  display: flex;
  flex-direction: column;
  gap: var(--space-lg);
}
.camera-preview {
  width: 100%;
  aspect-ratio: 4/3;
  background: var(--bg-surface);
  border-radius: var(--radius-lg);
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 2px dashed var(--border-default);
}
.camera-preview video { width: 100%; height: 100%; object-fit: cover; }
.camera-placeholder {
  text-align: center;
  color: var(--text-tertiary);
}
.camera-placeholder .icon { font-size: 3rem; margin-bottom: var(--space-sm); }
.scan-actions {
  display: flex;
  gap: var(--space-sm);
  flex-wrap: wrap;
}

/* ── Product Result ─────────────────────────────────────────── */
.product-result { margin-top: var(--space-lg); }
.score-circle {
  width: 100px;
  height: 100px;
  border-radius: var(--radius-full);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  margin: 0 auto var(--space-md);
  border: 4px solid;
}
.score-circle.good { border-color: var(--green); background: var(--green-bg); }
.score-circle.okay { border-color: var(--yellow); background: var(--yellow-bg); }
.score-circle.bad { border-color: var(--red); background: var(--red-bg); }
.score-number { font-size: var(--font-size-2xl); font-weight: 800; line-height: 1; color: var(--text-primary); }
.score-label { font-size: var(--font-size-xs); font-weight: var(--font-weight-semibold); color: var(--text-tertiary); }

/* ── Ingredient List ────────────────────────────────────────── */
.ingredient-list { display: flex; flex-direction: column; gap: var(--space-sm); margin-top: var(--space-md); }
.ingredient-item {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  font-size: var(--font-size-sm);
}
.ingredient-item.green { background: var(--green-bg); }
.ingredient-item.yellow { background: var(--yellow-bg); }
.ingredient-item.red { background: var(--red-bg); }
.ingredient-dot { width: 10px; height: 10px; border-radius: var(--radius-full); flex-shrink: 0; }
.ingredient-dot.green { background: var(--green); }
.ingredient-dot.yellow { background: var(--yellow); }
.ingredient-dot.red { background: var(--red); }
.ingredient-info { flex: 1; }
.ingredient-name { font-weight: var(--font-weight-semibold); color: var(--text-primary); }
.ingredient-reason { font-size: var(--font-size-xs); color: var(--text-tertiary); margin-top: 2px; }

/* ── Recommendation Cards ───────────────────────────────────── */
.rec-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: var(--space-md);
}
.rec-card {
  background: var(--bg-surface);
  border-radius: var(--radius-lg);
  padding: var(--space-lg);
  border: 1px solid var(--border-default);
  transition: all var(--transition-fast);
}
.rec-card:hover {
  box-shadow: var(--shadow-card-hover), var(--shadow-glow-purple);
  border-color: var(--border-hover);
  transform: translateY(-3px);
  background: var(--bg-card-elevated);
}
.rec-card .emoji { font-size: 2rem; margin-bottom: var(--space-sm); }
.rec-card h4 { font-size: var(--font-size-base); margin-bottom: var(--space-xs); color: var(--text-primary); }
.rec-card p { font-size: var(--font-size-sm); color: var(--text-secondary); }
.rec-card .nutrients {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  margin-top: var(--space-sm);
}
.nutrient-tag {
  padding: 3px 10px;
  background: var(--accent-purple-dim);
  border-radius: var(--radius-full);
  font-size: var(--font-size-xs);
  font-weight: var(--font-weight-semibold);
  color: var(--accent-purple);
}

/* ── Skincare Score ─────────────────────────────────────────── */
.skincare-score {
  font-size: var(--font-size-2xl);
  font-weight: 800;
  color: var(--accent-teal);
}
.rec-score {
  font-size: var(--font-size-xl);
  font-weight: 800;
  color: var(--green);
}
.rec-category {
  font-size: var(--font-size-xs);
  color: var(--text-tertiary);
  text-transform: capitalize;
}

/* ── Avoid Section ──────────────────────────────────────────── */
.avoid-section {
  margin-top: var(--space-lg);
  padding: var(--space-md);
  background: var(--red-bg);
  border-radius: var(--radius-lg);
  border: 1px solid rgba(255, 107, 107, 0.15);
}
.avoid-section h3 { color: var(--accent-red); margin-bottom: var(--space-sm); font-size: var(--font-size-base); }
.avoid-list { list-style: none; }
.avoid-list li {
  padding: 6px 0;
  font-size: var(--font-size-sm);
  color: var(--text-secondary);
  display: flex;
  align-items: flex-start;
  gap: var(--space-sm);
}
.avoid-list li::before {
  content: "\2718";
  color: var(--red);
  font-weight: bold;
  flex-shrink: 0;
}

/* ── Tips ────────────────────────────────────────────────────── */
.tips-list { list-style: none; display: flex; flex-direction: column; gap: var(--space-sm); }
.tips-list li {
  padding: 10px 14px;
  background: var(--accent-purple-dim);
  border-radius: var(--radius-sm);
  font-size: var(--font-size-sm);
  display: flex;
  align-items: flex-start;
  gap: var(--space-sm);
  color: var(--text-secondary);
}
.tips-list li::before { content: "\2728"; flex-shrink: 0; }

/* ── Daily Logger ───────────────────────────────────────────── */
.log-section {
  margin-bottom: var(--space-lg);
}
.log-section-title {
  font-size: var(--font-size-sm);
  font-weight: var(--font-weight-semibold);
  color: var(--text-secondary);
  margin-bottom: var(--space-sm);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}
.log-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--space-md);
}
.log-item {
  display: flex;
  flex-direction: column;
  gap: var(--space-sm);
}
.log-item label {
  font-size: var(--font-size-sm);
  font-weight: var(--font-weight-semibold);
  color: var(--text-secondary);
}
.symptom-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
  gap: var(--space-sm);
}

/* Legacy logger grid (kept for compatibility) */
.logger-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--space-md);
  margin-bottom: var(--space-lg);
}
.logger-item { text-align: center; }
.logger-item label {
  display: block;
  font-size: var(--font-size-sm);
  font-weight: var(--font-weight-semibold);
  color: var(--text-secondary);
  margin-bottom: var(--space-sm);
}
.skin-options {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  justify-content: center;
}
.skin-btn {
  padding: 6px 12px;
  border: 2px solid var(--border-default);
  border-radius: var(--radius-full);
  background: var(--bg-surface);
  font-size: var(--font-size-xs);
  font-weight: var(--font-weight-semibold);
  cursor: pointer;
  transition: all var(--transition-fast);
  font-family: inherit;
  color: var(--text-secondary);
}
.skin-btn:hover { border-color: var(--accent-purple); }
.skin-btn.selected {
  border-color: var(--accent-teal);
  background: var(--accent-teal-dim);
  color: var(--accent-teal);
}

/* ── Number Input (stepper-style) ───────────────────────────── */
.number-input-group {
  display: flex;
  align-items: center;
  gap: var(--space-xs);
}
.number-input-group input[type="number"] {
  width: 60px;
  text-align: center;
  padding: 8px;
  border: 2px solid var(--border-default);
  border-radius: var(--radius-sm);
  background: var(--bg-input);
  color: var(--text-primary);
  font-family: inherit;
  font-size: var(--font-size-base);
  font-weight: var(--font-weight-semibold);
  -moz-appearance: textfield;
}
.number-input-group input::-webkit-outer-spin-button,
.number-input-group input::-webkit-inner-spin-button { -webkit-appearance: none; }
.number-input-group .unit {
  font-size: var(--font-size-sm);
  color: var(--text-tertiary);
}

/* ── Insights ───────────────────────────────────────────────── */
.insight-card {
  padding: var(--space-md);
  border-radius: var(--radius-md);
  margin-bottom: var(--space-md);
}
.insight-card.pattern { background: var(--accent-purple-dim); }
.insight-card.prediction { background: var(--accent-gold-dim); }
.insight-card .insight-type {
  font-size: var(--font-size-xs);
  font-weight: var(--font-weight-bold);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: var(--space-xs);
  color: var(--accent-teal);
}
.insight-card .insight-text { font-size: var(--font-size-sm); color: var(--text-secondary); }
.confidence-bar {
  height: 4px;
  border-radius: 2px;
  background: rgba(167, 139, 250, 0.15);
  margin-top: var(--space-sm);
  overflow: hidden;
}
.confidence-fill {
  height: 100%;
  border-radius: 2px;
  background: var(--gradient-cta);
}

/* ── Recent Logs ────────────────────────────────────────────── */
.log-row {
  display: flex;
  align-items: center;
  gap: var(--space-md);
  padding: 10px var(--space-md);
  background: var(--bg-surface);
  border-radius: var(--radius-sm);
  margin-bottom: 6px;
  font-size: var(--font-size-sm);
}
.log-row .log-date {
  font-weight: var(--font-weight-semibold);
  min-width: 90px;
  color: var(--text-primary);
}
.log-row .log-notes {
  color: var(--text-tertiary);
  font-size: var(--font-size-xs);
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* ── Exercise Input ─────────────────────────────────────────── */
.exercise-row {
  display: flex;
  gap: var(--space-sm);
  align-items: end;
}
.exercise-row .form-group { flex: 1; }

/* ── Loading ────────────────────────────────────────────────── */
.loading {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: var(--space-md);
  padding: var(--space-2xl);
  color: var(--text-tertiary);
}
.spinner {
  width: 28px;
  height: 28px;
  border: 3px solid var(--border-default);
  border-top-color: var(--accent-teal);
  border-right-color: var(--accent-purple);
  border-radius: var(--radius-full);
  animation: spin 0.7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* Button loading state */
.btn.loading-state {
  pointer-events: none;
  opacity: 0.7;
  position: relative;
}
.btn.loading-state::after {
  content: '';
  position: absolute;
  width: 18px;
  height: 18px;
  border: 2px solid transparent;
  border-top-color: currentColor;
  border-radius: var(--radius-full);
  animation: spin 0.7s linear infinite;
  right: 12px;
  top: 50%;
  transform: translateY(-50%);
}

/* Skeleton shimmer for loading content */
@keyframes shimmer {
  0% { background-position: -200% 0; }
  100% { background-position: 200% 0; }
}
.skeleton {
  background: linear-gradient(90deg, var(--bg-surface) 25%, var(--bg-card-elevated) 50%, var(--bg-surface) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.5s infinite ease-in-out;
  border-radius: var(--radius-sm);
}

/* ── Empty State ────────────────────────────────────────────── */
.empty-state {
  text-align: center;
  padding: var(--space-2xl) var(--space-lg);
  color: var(--text-tertiary);
}
.empty-state .icon { font-size: 3rem; margin-bottom: var(--space-md); }

/* ── Divider ────────────────────────────────────────────────── */
.divider {
  height: 1px;
  background: var(--border-default);
  margin: var(--space-lg) 0;
}

/* ── Section header ─────────────────────────────────────────── */
.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: var(--space-md);
}

/* ── Skincare Tab Layout ────────────────────────────────────── */
.skincare-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: var(--space-lg);
}
.skincare-goals {
  display: flex;
  gap: var(--space-sm);
  flex-wrap: wrap;
  margin-bottom: var(--space-lg);
}
.section-title {
  font-size: var(--font-size-lg);
  font-weight: var(--font-weight-bold);
  color: var(--text-primary);
  margin-bottom: var(--space-md);
  letter-spacing: -0.01em;
}

/* ── Utility Classes ────────────────────────────────────────── */
.mt-xs { margin-top: var(--space-xs); }
.mt-sm { margin-top: var(--space-sm); }
.mt-md { margin-top: var(--space-md); }
.mt-lg { margin-top: var(--space-lg); }
.mt-xl { margin-top: var(--space-xl); }
.mb-sm { margin-bottom: var(--space-sm); }
.mb-md { margin-bottom: var(--space-md); }
.mb-lg { margin-bottom: var(--space-lg); }
.gap-md { gap: var(--space-md); display: flex; flex-direction: column; }
.gap-lg { gap: var(--space-lg); display: flex; flex-direction: column; }
.text-center { text-align: center; }
.text-secondary { color: var(--text-secondary); }
.text-tertiary { color: var(--text-tertiary); }
.font-semibold { font-weight: var(--font-weight-semibold); }
.hidden { display: none !important; }

/* ── Phase Info Inline Styles → Classes ─────────────────────── */
.phase-skin-state {
  font-size: var(--font-size-sm);
  color: var(--text-secondary);
}
.phase-skin-state strong {
  color: var(--text-primary);
}
.phase-day-label {
  font-size: var(--font-size-xs);
  color: var(--text-tertiary);
}

/* ── Ring Legend ─────────────────────────────────────────────── */
.ring-legend {
  display: flex;
  gap: var(--space-md);
  justify-content: center;
  margin-top: var(--space-sm);
  font-size: var(--font-size-xs);
  color: var(--text-tertiary);
}
.ring-legend-item {
  display: flex;
  align-items: center;
  gap: var(--space-xs);
}
.ring-legend-dot {
  width: 6px;
  height: 6px;
  border-radius: var(--radius-full);
  display: inline-block;
  flex-shrink: 0;
}

/* ── Mobile Bottom Navigation ───────────────────────────────── */
.bottom-nav {
  display: none;
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background: rgba(20, 14, 36, 0.95);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-top: 1px solid var(--border-default);
  padding: var(--space-xs) var(--space-sm);
  padding-bottom: max(var(--space-xs), env(safe-area-inset-bottom));
  z-index: 100;
  justify-content: space-around;
}
.bottom-nav-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  padding: var(--space-xs) var(--space-sm);
  border: none;
  background: transparent;
  color: var(--text-tertiary);
  font-size: 10px;
  font-weight: var(--font-weight-semibold);
  font-family: inherit;
  cursor: pointer;
  transition: color var(--transition-fast);
  min-width: 44px;
  min-height: 44px;
  border-radius: var(--radius-sm);
}
.bottom-nav-btn .nav-icon { font-size: 1.3rem; line-height: 1; }
.bottom-nav-btn.active {
  color: var(--accent-teal);
}
.bottom-nav-btn:active { transform: scale(0.95); }

/* ── Responsive Design (Mobile-First) ───────────────────────── */
@media (max-width: 768px) {
  .dashboard-grid { grid-template-columns: 1fr; }
  .log-grid { grid-template-columns: 1fr; }
  .logger-grid { grid-template-columns: 1fr; }
  .rec-grid { grid-template-columns: 1fr; }
  .form-row { grid-template-columns: 1fr; }
  .symptom-grid { grid-template-columns: repeat(auto-fill, minmax(100px, 1fr)); }

  /* Hide top nav, show bottom nav */
  .nav-tabs { display: none; }
  .bottom-nav { display: flex; }

  .header h1 { font-size: var(--font-size-2xl); }
  .header { padding: var(--space-lg) var(--space-sm) var(--space-md); }
  .cycle-wheel { width: 280px; height: 280px; }
  .scan-actions { flex-direction: column; }
  .scan-actions .btn { width: 100%; }
  .exercise-row { flex-direction: column; }
  .app-container {
    padding: var(--space-sm);
    padding-bottom: 80px; /* space for bottom nav */
  }
  .card { padding: var(--space-md); }
  .card:hover { transform: none; } /* disable lift on touch */

  /* Ensure touch targets are 44px+ */
  .chip { min-height: 44px; padding: 10px 16px; }
  .scale-btn { min-height: 48px; }
  .btn { min-height: 48px; padding: 14px 24px; }
  .emoji-btn { width: 48px; height: 48px; }

  /* Toast above bottom nav */
  .toast { bottom: 80px; }
}

@media (max-width: 480px) {
  .header h1 { font-size: 1.75rem; }
  .cycle-wheel { width: 240px; height: 240px; }
  .emoji-btn { width: 44px; height: 44px; font-size: 1.1rem; }
  .cycle-center .day-number { font-size: 2.5rem; }
}

/* ── Skincare Phase Cards ───────────────────────────────────── */
.phase-routine {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--space-md);
  margin-bottom: var(--space-lg);
}
.phase-routine .routine-step {
  background: var(--bg-surface);
  border-radius: var(--radius-md);
  padding: var(--space-md);
  border: 1px solid var(--border-default);
}
.phase-routine .step-number {
  font-size: var(--font-size-xs);
  font-weight: var(--font-weight-bold);
  color: var(--accent-teal);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-bottom: var(--space-xs);
}
.phase-routine .step-title {
  font-weight: var(--font-weight-semibold);
  margin-bottom: var(--space-xs);
}
.phase-routine .step-desc {
  font-size: var(--font-size-sm);
  color: var(--text-secondary);
}

@media (max-width: 768px) {
  .phase-routine { grid-template-columns: 1fr; }
}

/* ── Success toast ──────────────────────────────────────────── */
.toast {
  position: fixed;
  bottom: var(--space-lg);
  left: 50%;
  transform: translateX(-50%) translateY(100px);
  background: var(--accent-teal);
  color: var(--bg-deep);
  padding: var(--space-md) var(--space-xl);
  border-radius: var(--radius-full);
  font-weight: var(--font-weight-semibold);
  font-size: var(--font-size-sm);
  box-shadow: 0 4px 24px rgba(74, 237, 196, 0.3);
  z-index: 1000;
  transition: transform var(--transition-slow);
  pointer-events: none;
}
.toast.show {
  transform: translateX(-50%) translateY(0);
}
