/* ============================================
   Theme: CSS Custom Properties (Light / Dark)
   ============================================ */
:root {
  --color-surface: #f8f9ff;
  --color-surface-dim: #d8d9e6;
  --color-surface-container-lowest: #ffffff;
  --color-surface-container-low: #f2f3ff;
  --color-surface-container: #ecedf9;
  --color-surface-container-high: #e6e7f4;
  --color-surface-container-highest: #e0e1ee;
  --color-on-surface: #1a1c2e;
  --color-on-surface-variant: #434655;
  --color-primary: #006497;
  --color-primary-container: #2b98dd;
  --color-on-primary-container: #ffffff;
  --color-tertiary: #2563eb;
  --color-tertiary-container: #3b82f6;
  --color-outline: #757888;
  --color-outline-variant: #c5c7d7;
  --color-error: #ba1a1a;
  --color-on-secondary-container: #454558;
  --color-secondary-container: #e0dff7;
  --color-accent-blue: #2563eb;
  --color-selected-border: #2563eb;
  --color-glass-bg: rgba(240, 241, 255, 0.85);
  --color-picker-overlay: rgba(240, 241, 255, 0.95);
  --color-other-month: rgba(0, 0, 0, 0.15);
  --color-pill-active-bg: #d4d5e2;
  --color-pill-text: #434655;
  --color-pill-active-text: #1a1c2e;
  --color-skeleton-from: #ecedf9;
  --color-skeleton-to: #e6e7f4;
  --color-chart-bar: #2563eb;
  --color-chart-bar-dim: rgba(37, 99, 235, 0.5);
  --color-chart-bar-empty: rgba(37, 99, 235, 0.08);
  --color-chart-line: #2563eb;
  --color-chart-fill-start: rgba(37, 99, 235, 0.15);
  --color-glow-tertiary: rgba(37, 99, 235, 0.3);
  --color-glow-primary: rgba(37, 99, 235, 0.4);
  --color-card-border: rgba(0, 0, 0, 0.06);
  --color-content-text: #1a1c2e;
  --color-fire-icon: #d97706;
  --color-deficit-bg: rgba(37, 99, 235, 0.08);
  --color-separator: rgba(0, 0, 0, 0.06);
  --color-bar-border: rgba(0, 0, 0, 0.1);
}
.dark {
  --color-surface: #111125;
  --color-surface-dim: #111125;
  --color-surface-container-lowest: #0c0c1f;
  --color-surface-container-low: #1a1a2e;
  --color-surface-container: #1e1e32;
  --color-surface-container-high: #28283d;
  --color-surface-container-highest: #333348;
  --color-on-surface: #e2e0fc;
  --color-on-surface-variant: #bfc7d2;
  --color-primary: #92ccff;
  --color-primary-container: #2b98dd;
  --color-on-primary-container: #002c47;
  --color-tertiary: #60a5fa;
  --color-tertiary-container: #3b82f6;
  --color-outline: #89929b;
  --color-outline-variant: #3f4850;
  --color-error: #ffb4ab;
  --color-on-secondary-container: #b8b6cd;
  --color-secondary-container: #48475b;
  --color-accent-blue: #60a5fa;
  --color-selected-border: #3b82f6;
  --color-glass-bg: rgba(30, 30, 50, 0.85);
  --color-picker-overlay: rgba(12, 12, 31, 0.95);
  --color-other-month: rgba(255, 255, 255, 0.1);
  --color-pill-active-bg: #28283d;
  --color-pill-text: #bfc7d2;
  --color-pill-active-text: #ffffff;
  --color-skeleton-from: #1a1a2e;
  --color-skeleton-to: #28283d;
  --color-chart-bar: #60a5fa;
  --color-chart-bar-dim: rgba(96, 165, 250, 0.6);
  --color-chart-bar-empty: rgba(96, 165, 250, 0.1);
  --color-chart-line: #60a5fa;
  --color-chart-fill-start: rgba(96, 165, 250, 0.15);
  --color-glow-tertiary: rgba(96, 165, 250, 0.4);
  --color-glow-primary: rgba(96, 165, 250, 0.4);
  --color-card-border: rgba(255, 255, 255, 0.05);
  --color-content-text: #ffffff;
  --color-fire-icon: #f59e0b;
  --color-deficit-bg: rgba(96, 165, 250, 0.1);
  --color-separator: rgba(255, 255, 255, 0.06);
  --color-bar-border: rgba(255, 255, 255, 0.1);
}

/* ============================================
   Base
   ============================================ */
body {
  font-family: 'Inter', sans-serif;
  -webkit-tap-highlight-color: transparent;
  min-height: 100dvh;
}
.material-symbols-outlined {
  font-variation-settings: 'FILL' 0, 'wght' 400, 'GRAD' 0, 'opsz' 24;
}
.glass-header {
  background: var(--color-glass-bg);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}
.glass-nav {
  background: var(--color-glass-bg);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}

/* Screen management */
.screen { display: none !important; }
.screen.active { display: block !important; }
#screen-dashboard.active { display: flex !important; }
#screen-nutrition.active { display: flex !important; }

/* Picker overlay */
#screen-picker {
  position: fixed;
  inset: 0;
  z-index: 40;
  background: var(--color-picker-overlay);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}
#screen-picker.active {
  display: flex;
  flex-direction: column;
}

/* Calendar day cell */
.cal-day {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border-radius: 12px;
  cursor: pointer;
  transition: all 0.15s ease;
  font-weight: 500;
}
.cal-day:active { transform: scale(0.9); }
.cal-day.selected {
  border: 2px solid var(--color-selected-border);
  color: var(--color-content-text);
  font-weight: 700;
}
.cal-day.today {
  color: var(--color-selected-border);
  font-weight: 700;
}
.cal-day.other-month {
  color: var(--color-other-month);
  cursor: default;
}
.cal-day.other-month:active { transform: none; }

/* Month grid cell */
.month-cell {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px 0;
  border-radius: 12px;
  cursor: pointer;
  font-weight: 500;
  transition: all 0.15s ease;
}
.month-cell:active { transform: scale(0.95); }
.month-cell.selected {
  border: 2px solid var(--color-selected-border);
  color: var(--color-content-text);
  font-weight: 700;
}
.month-cell.current-month {
  color: var(--color-selected-border);
  font-weight: 700;
}

/* Pill selector */
.pill-container {
  position: relative;
}
.pill-indicator {
  position: absolute;
  background: var(--color-pill-active-bg);
  border-radius: 10px;
  transition: left 0.25s cubic-bezier(0.4, 0, 0.2, 1), width 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  pointer-events: none;
}
.pill-btn {
  flex: 1;
  padding: 10px 0;
  text-align: center;
  border-radius: 10px;
  font-weight: 500;
  color: var(--color-pill-text);
  font-size: 12px;
  transition: color 0.2s ease;
  position: relative;
  z-index: 1;
}
.pill-btn.active {
  color: var(--color-pill-active-text);
}

/* Skeleton loading */
@keyframes shimmer {
  0% { background-position: -200% 0; }
  100% { background-position: 200% 0; }
}
.skeleton {
  background: linear-gradient(90deg, var(--color-skeleton-from) 25%, var(--color-skeleton-to) 50%, var(--color-skeleton-from) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.5s infinite;
  border-radius: 8px;
}

/* No scrollbar for horizontal scroll areas */
.no-scrollbar::-webkit-scrollbar { display: none; }
.no-scrollbar { -ms-overflow-style: none; scrollbar-width: none; }

/* Tap feedback */
.tap-feedback { transition: transform 0.1s ease; }
.tap-feedback:active { transform: scale(0.95); }
