/* ============================================
   PANDUAN TUKAK LAMBUNG - PWA
   Readability-First Design System
   ============================================ */

/* --- Google Fonts --- */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&family=Plus+Jakarta+Sans:wght@600;700;800&display=swap');

/* --- Design Tokens --- */
:root {
  /* Colors - Warm, easy on eyes */
  --bg-primary: #FAF9F6;
  --bg-surface: #FFFFFF;
  --bg-surface-alt: #F5F3EF;
  --bg-accent-soft: #ECFDF5;
  --bg-warning-soft: #FEF2F2;
  --bg-info-soft: #EFF6FF;
  --bg-amber-soft: #FFFBEB;

  --text-primary: #1B1B1B;
  --text-secondary: #555555;
  --text-tertiary: #888888;
  --text-inverse: #FFFFFF;

  --accent: #0F766E;
  --accent-light: #14B8A6;
  --accent-bg: #CCFBF1;
  --danger: #DC2626;
  --danger-bg: #FEF2F2;
  --success: #16A34A;
  --success-bg: #F0FDF4;
  --warning: #D97706;
  --warning-bg: #FFFBEB;
  --info: #2563EB;

  --border: #E8E5E0;
  --border-light: #F0EDE8;
  --shadow-sm: 0 1px 3px rgba(0,0,0,0.04);
  --shadow-md: 0 4px 12px rgba(0,0,0,0.06);
  --shadow-lg: 0 8px 24px rgba(0,0,0,0.08);

  /* Typography - Readability optimized */
  --font-heading: 'Plus Jakarta Sans', 'Inter', system-ui, sans-serif;
  --font-body: 'Inter', system-ui, -apple-system, sans-serif;

  --text-xs: 0.8125rem;    /* 13px */
  --text-sm: 0.875rem;     /* 14px */
  --text-base: 1.0625rem;  /* 17px - larger than default for comfort */
  --text-lg: 1.1875rem;    /* 19px */
  --text-xl: 1.375rem;     /* 22px */
  --text-2xl: 1.625rem;    /* 26px */
  --text-3xl: 2rem;        /* 32px */
  --text-4xl: 2.5rem;      /* 40px */

  --leading-tight: 1.3;
  --leading-normal: 1.75;  /* generous line height */
  --leading-relaxed: 1.85;

  --tracking-tight: -0.02em;
  --tracking-normal: -0.01em;

  /* Spacing */
  --space-xs: 0.25rem;
  --space-sm: 0.5rem;
  --space-md: 1rem;
  --space-lg: 1.5rem;
  --space-xl: 2rem;
  --space-2xl: 3rem;
  --space-3xl: 4rem;

  /* Layout */
  --content-width: 720px;
  --content-padding: 1.25rem;

  /* Radius */
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 14px;
  --radius-xl: 20px;

  /* Transitions */
  --transition: 0.2s ease;
  --transition-slow: 0.35s ease;
}

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

html {
  scroll-behavior: smooth;
  scroll-padding-top: 70px;
  -webkit-text-size-adjust: 100%;
}

body {
  font-family: var(--font-body);
  font-size: var(--text-base);
  line-height: var(--leading-normal);
  color: var(--text-primary);
  background-color: var(--bg-primary);
  letter-spacing: var(--tracking-normal);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-x: hidden;
}

/* --- Scrollbar --- */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: var(--bg-primary); }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-tertiary); }

/* --- Top Header --- */
.top-header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 100;
  background: rgba(250, 249, 246, 0.92);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border-light);
  padding: 0 var(--content-padding);
  height: 60px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  transition: box-shadow var(--transition);
}

.top-header.scrolled {
  box-shadow: var(--shadow-sm);
}

.header-title {
  font-family: var(--font-heading);
  font-size: var(--text-lg);
  font-weight: 700;
  color: var(--accent);
  display: flex;
  align-items: center;
  gap: var(--space-sm);
}

.header-title span { font-size: 1.3em; }

.menu-toggle {
  background: none;
  border: none;
  cursor: pointer;
  padding: var(--space-sm);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  font-size: 1.5rem;
  line-height: 1;
  transition: background var(--transition);
}
.menu-toggle:hover { background: var(--bg-surface-alt); }

/* --- Reading Progress Bar --- */
.progress-bar {
  position: fixed;
  top: 60px;
  left: 0;
  height: 3px;
  background: linear-gradient(90deg, var(--accent), var(--accent-light));
  z-index: 99;
  width: 0%;
  transition: width 0.1s linear;
}

/* --- Sidebar / Table of Contents --- */
.sidebar-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.3);
  z-index: 200;
  opacity: 0;
  visibility: hidden;
  transition: all var(--transition-slow);
}
.sidebar-overlay.active {
  opacity: 1;
  visibility: visible;
}

.sidebar {
  position: fixed;
  top: 0;
  left: -300px;
  width: 280px;
  max-width: 85vw;
  height: 100vh;
  background: var(--bg-surface);
  z-index: 201;
  overflow-y: auto;
  transition: left var(--transition-slow);
  padding: var(--space-xl) var(--space-lg);
  box-shadow: var(--shadow-lg);
}
.sidebar.active { left: 0; }

.sidebar-header {
  font-family: var(--font-heading);
  font-size: var(--text-xl);
  font-weight: 700;
  color: var(--accent);
  margin-bottom: var(--space-lg);
  padding-bottom: var(--space-md);
  border-bottom: 2px solid var(--accent-bg);
}

.toc-list {
  list-style: none;
}

.toc-item {
  margin-bottom: 2px;
}

.toc-link {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  padding: 10px 12px;
  border-radius: var(--radius-md);
  text-decoration: none;
  color: var(--text-secondary);
  font-size: var(--text-sm);
  font-weight: 500;
  transition: all var(--transition);
  line-height: 1.4;
}
.toc-link:hover {
  background: var(--bg-surface-alt);
  color: var(--text-primary);
}
.toc-link.active {
  background: var(--accent-bg);
  color: var(--accent);
  font-weight: 600;
}
.toc-icon {
  font-size: 1.2em;
  flex-shrink: 0;
  width: 28px;
  text-align: center;
}

/* --- Main Content Area --- */
.main-content {
  max-width: var(--content-width);
  margin: 0 auto;
  padding: calc(60px + var(--space-2xl)) var(--content-padding) var(--space-3xl);
}

/* --- Section Styling --- */
.section {
  margin-bottom: var(--space-3xl);
  animation: fadeInUp 0.5s ease both;
}

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

/* --- Typography --- */
.section-title {
  font-family: var(--font-heading);
  font-size: var(--text-2xl);
  font-weight: 800;
  color: var(--text-primary);
  letter-spacing: var(--tracking-tight);
  line-height: var(--leading-tight);
  margin-bottom: var(--space-lg);
  padding-bottom: var(--space-md);
  border-bottom: 3px solid var(--accent);
  display: inline-block;
}

.subsection-title {
  font-family: var(--font-heading);
  font-size: var(--text-xl);
  font-weight: 700;
  color: var(--text-primary);
  letter-spacing: var(--tracking-tight);
  line-height: var(--leading-tight);
  margin-top: var(--space-2xl);
  margin-bottom: var(--space-md);
  display: flex;
  align-items: center;
  gap: var(--space-sm);
}

.subsection-title .num {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  background: var(--accent);
  color: var(--text-inverse);
  border-radius: 50%;
  font-size: var(--text-sm);
  font-weight: 700;
  flex-shrink: 0;
}

.sub-heading {
  font-family: var(--font-heading);
  font-size: var(--text-lg);
  font-weight: 600;
  color: var(--text-primary);
  margin-top: var(--space-xl);
  margin-bottom: var(--space-md);
}

p {
  margin-bottom: var(--space-md);
  line-height: var(--leading-normal);
}

strong { font-weight: 600; color: var(--text-primary); }

/* --- Hero Section --- */
.hero {
  text-align: center;
  padding: var(--space-2xl) 0 var(--space-xl);
}

.hero-icon {
  font-size: 3.5rem;
  margin-bottom: var(--space-md);
  display: block;
}

.hero h1 {
  font-family: var(--font-heading);
  font-size: var(--text-3xl);
  font-weight: 800;
  color: var(--text-primary);
  letter-spacing: var(--tracking-tight);
  line-height: var(--leading-tight);
  margin-bottom: var(--space-md);
}

.hero-subtitle {
  font-size: var(--text-base);
  color: var(--text-secondary);
  max-width: 540px;
  margin: 0 auto var(--space-lg);
  line-height: var(--leading-relaxed);
}

.hero-badge {
  display: inline-flex;
  align-items: center;
  gap: var(--space-xs);
  padding: 6px 14px;
  background: var(--accent-bg);
  color: var(--accent);
  border-radius: 100px;
  font-size: var(--text-sm);
  font-weight: 600;
}

/* --- Cards --- */
.card {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: var(--space-lg);
  margin-bottom: var(--space-md);
  transition: box-shadow var(--transition);
}
.card:hover { box-shadow: var(--shadow-md); }

.card-header {
  font-family: var(--font-heading);
  font-size: var(--text-lg);
  font-weight: 700;
  margin-bottom: var(--space-md);
  display: flex;
  align-items: center;
  gap: var(--space-sm);
}

/* --- Tables --- */
.table-wrapper {
  overflow-x: auto;
  margin: var(--space-md) 0 var(--space-lg);
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: var(--text-sm);
  line-height: 1.6;
}

thead th {
  background: var(--bg-surface-alt);
  font-weight: 600;
  text-align: left;
  padding: 12px 16px;
  border-bottom: 2px solid var(--border);
  color: var(--text-primary);
  font-size: var(--text-xs);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  white-space: nowrap;
}

tbody td {
  padding: 12px 16px;
  border-bottom: 1px solid var(--border-light);
  vertical-align: top;
}

tbody tr:last-child td { border-bottom: none; }

tbody tr:nth-child(even) { background: var(--bg-surface-alt); }

td:first-child { font-weight: 500; }

/* --- Lists --- */
.content-list {
  margin: var(--space-sm) 0 var(--space-lg);
  padding-left: var(--space-lg);
}

.content-list li {
  margin-bottom: var(--space-sm);
  line-height: var(--leading-normal);
  padding-left: var(--space-xs);
}

.content-list li::marker {
  color: var(--accent);
}

/* --- Callouts / Alerts --- */
.callout {
  padding: var(--space-md) var(--space-lg);
  border-radius: var(--radius-md);
  margin: var(--space-md) 0 var(--space-lg);
  font-size: var(--text-sm);
  line-height: 1.7;
  border-left: 4px solid;
}

.callout-warning {
  background: var(--danger-bg);
  border-color: var(--danger);
  color: #991B1B;
}

.callout-info {
  background: var(--bg-info-soft);
  border-color: var(--info);
  color: #1E40AF;
}

.callout-success {
  background: var(--success-bg);
  border-color: var(--success);
  color: #166534;
}

.callout-tip {
  background: var(--warning-bg);
  border-color: var(--warning);
  color: #92400E;
}

.callout-disclaimer {
  background: var(--bg-amber-soft);
  border-color: var(--warning);
  color: #78350F;
}

.callout strong { color: inherit; }

.callout-icon { margin-right: var(--space-xs); }

/* --- Emergency Section --- */
.emergency-card {
  background: var(--danger-bg);
  border: 2px solid var(--danger);
  border-radius: var(--radius-lg);
  padding: var(--space-lg);
  margin: var(--space-lg) 0;
}

.emergency-card h3 {
  color: var(--danger);
  margin-bottom: var(--space-md);
  font-size: var(--text-lg);
}

.emergency-list {
  list-style: none;
  padding: 0;
}

.emergency-list li {
  padding: 8px 0;
  border-bottom: 1px solid rgba(220,38,38,0.15);
  font-weight: 500;
  color: #991B1B;
  font-size: var(--text-sm);
}
.emergency-list li:last-child { border-bottom: none; }

/* --- Schedule Table --- */
.schedule-table td:first-child {
  white-space: nowrap;
  font-weight: 600;
  color: var(--accent);
  font-size: var(--text-sm);
  font-variant-numeric: tabular-nums;
}

/* --- Food Grid --- */
.food-category {
  margin-bottom: var(--space-xl);
}

.food-category-title {
  font-family: var(--font-heading);
  font-size: var(--text-base);
  font-weight: 700;
  color: var(--accent);
  margin-bottom: var(--space-sm);
  padding-bottom: var(--space-xs);
  border-bottom: 2px solid var(--accent-bg);
}

/* --- Avoid List (pantangan) --- */
.avoid-table thead th:first-child { color: var(--danger); }

/* --- References --- */
.ref-list {
  list-style: decimal;
  padding-left: var(--space-xl);
  font-size: var(--text-sm);
  color: var(--text-secondary);
  line-height: 1.8;
}
.ref-list li { margin-bottom: var(--space-xs); }

/* --- Disclaimer Banner --- */
.disclaimer-banner {
  background: linear-gradient(135deg, var(--accent), #0D9488);
  color: var(--text-inverse);
  padding: var(--space-lg);
  border-radius: var(--radius-lg);
  margin: var(--space-xl) 0;
  font-size: var(--text-sm);
  line-height: 1.7;
}

.disclaimer-banner strong { color: var(--text-inverse); }

/* --- Back to Top --- */
.back-to-top {
  position: fixed;
  bottom: 24px;
  right: 24px;
  width: 44px;
  height: 44px;
  background: var(--accent);
  color: var(--text-inverse);
  border: none;
  border-radius: 50%;
  font-size: 1.25rem;
  cursor: pointer;
  box-shadow: var(--shadow-md);
  opacity: 0;
  transform: translateY(10px);
  transition: all var(--transition);
  z-index: 50;
  display: flex;
  align-items: center;
  justify-content: center;
}
.back-to-top.visible {
  opacity: 1;
  transform: translateY(0);
}
.back-to-top:hover {
  background: #0D5E58;
  transform: translateY(-2px);
  box-shadow: var(--shadow-lg);
}

/* --- Source Badge --- */
.source-badge {
  display: inline-block;
  font-size: var(--text-xs);
  color: var(--text-tertiary);
  background: var(--bg-surface-alt);
  padding: 2px 8px;
  border-radius: 100px;
  margin-top: var(--space-xs);
}

/* --- Dose Highlight --- */
.dose {
  display: inline-block;
  background: var(--accent-bg);
  color: var(--accent);
  padding: 2px 8px;
  border-radius: var(--radius-sm);
  font-weight: 600;
  font-size: var(--text-sm);
}

/* --- Divider --- */
.section-divider {
  border: none;
  height: 1px;
  background: var(--border);
  margin: var(--space-3xl) 0;
}

/* --- Footer --- */
.footer {
  text-align: center;
  padding: var(--space-2xl) var(--content-padding);
  color: var(--text-tertiary);
  font-size: var(--text-sm);
  border-top: 1px solid var(--border-light);
  margin-top: var(--space-2xl);
}

/* --- Medication Planner Section --- */
.planner-section {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  padding: var(--space-xl);
  margin-bottom: var(--space-3xl);
  box-shadow: var(--shadow-md);
}

.planner-intro {
  color: var(--text-secondary);
  font-size: var(--text-sm);
  margin-bottom: var(--space-lg);
  line-height: var(--leading-normal);
}

.planner-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: var(--space-xl);
  margin-bottom: var(--space-lg);
}

@media (min-width: 640px) {
  .planner-grid {
    grid-template-columns: 1fr 1fr;
  }
}

.planner-col h3 {
  font-family: var(--font-heading);
  font-size: var(--text-base);
  font-weight: 700;
  color: var(--accent);
  margin-bottom: var(--space-md);
  padding-bottom: var(--space-xs);
  border-bottom: 2px solid var(--accent-bg);
}

/* Check Card Styling */
.check-card {
  display: flex;
  align-items: flex-start;
  gap: var(--space-md);
  padding: var(--space-md);
  background: var(--bg-surface-alt);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-md);
  margin-bottom: var(--space-sm);
  cursor: pointer;
  transition: all var(--transition);
  user-select: none;
  position: relative;
}

.check-card:hover {
  background: var(--bg-surface);
  border-color: var(--accent-light);
  transform: translateY(-1px);
  box-shadow: var(--shadow-sm);
}

.check-card input[type="checkbox"] {
  position: absolute;
  opacity: 0;
  cursor: pointer;
  height: 0;
  width: 0;
}

.check-box {
  width: 20px;
  height: 20px;
  background-color: var(--bg-surface);
  border: 2px solid var(--border);
  border-radius: var(--radius-sm);
  display: inline-block;
  flex-shrink: 0;
  margin-top: 2px;
  position: relative;
  transition: all var(--transition);
}

.check-card input[type="checkbox"]:checked ~ .check-box {
  background-color: var(--accent);
  border-color: var(--accent);
}

.check-box::after {
  content: "";
  position: absolute;
  display: none;
  left: 6px;
  top: 2px;
  width: 5px;
  height: 10px;
  border: solid var(--text-inverse);
  border-width: 0 2px 2px 0;
  transform: rotate(45deg);
}

.check-card input[type="checkbox"]:checked ~ .check-box::after {
  display: block;
}

.check-card input[type="checkbox"]:checked ~ .check-label strong {
  color: var(--accent);
}

.check-card.checked-active {
  border-color: var(--accent) !important;
  background: var(--bg-accent-soft) !important;
}

.check-label {
  display: flex;
  flex-direction: column;
  line-height: 1.3;
}

.check-label strong {
  font-size: var(--text-sm);
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 2px;
  transition: color var(--transition);
}

.check-label .desc {
  font-size: var(--text-xs);
  color: var(--text-tertiary);
}

/* Actions */
.planner-actions {
  display: flex;
  gap: var(--space-md);
  margin-top: var(--space-lg);
}

.btn {
  font-family: var(--font-heading);
  font-weight: 600;
  font-size: var(--text-sm);
  padding: 12px 24px;
  border-radius: var(--radius-md);
  border: none;
  cursor: pointer;
  transition: all var(--transition);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-sm);
}

.btn-primary {
  background: var(--accent);
  color: var(--text-inverse);
}

.btn-primary:hover {
  background: #0d5e58;
  transform: translateY(-1px);
  box-shadow: var(--shadow-sm);
}

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

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

/* Results section */
.planner-results {
  margin-top: var(--space-xl);
  padding-top: var(--space-xl);
  border-top: 1px solid var(--border);
  animation: fadeIn 0.4s ease both;
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

.results-title {
  font-family: var(--font-heading);
  font-size: var(--text-lg);
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: var(--space-md);
}

.warnings-container {
  margin-bottom: var(--space-xl);
}

/* Custom Warning/Alert card */
.planner-alert {
  padding: var(--space-md) var(--space-lg);
  border-radius: var(--radius-md);
  margin-bottom: var(--space-md);
  font-size: var(--text-sm);
  line-height: 1.6;
  border-left: 4px solid;
  animation: slideIn 0.3s ease both;
}

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

.alert-danger {
  background: var(--danger-bg);
  border-color: var(--danger);
  color: #991B1B;
}

.alert-warning {
  background: var(--warning-bg);
  border-color: var(--warning);
  color: #92400E;
}

.alert-success {
  background: var(--success-bg);
  border-color: var(--success);
  color: #166534;
}

/* Custom PWA Timeline */
.timeline-title {
  font-family: var(--font-heading);
  font-size: var(--text-base);
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: var(--space-md);
  display: flex;
  align-items: center;
  gap: var(--space-sm);
}

.timeline-wrapper {
  position: relative;
  padding-left: 28px;
  margin-top: var(--space-md);
}

.timeline-wrapper::before {
  content: "";
  position: absolute;
  left: 9px;
  top: 8px;
  bottom: 8px;
  width: 2px;
  background: var(--border);
}

.timeline-item {
  position: relative;
  margin-bottom: var(--space-lg);
}

.timeline-item:last-child {
  margin-bottom: 0;
}

.timeline-dot {
  position: absolute;
  left: -28px;
  top: 4px;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: var(--bg-surface);
  border: 3px solid var(--accent);
  z-index: 2;
  transition: all var(--transition);
}

.timeline-time {
  font-family: var(--font-heading);
  font-weight: 700;
  font-size: var(--text-sm);
  color: var(--accent);
  margin-bottom: var(--space-xs);
  display: flex;
  align-items: center;
  gap: var(--space-xs);
}

.timeline-content {
  font-size: var(--text-sm);
  color: var(--text-secondary);
  line-height: 1.5;
  background: var(--bg-surface-alt);
  padding: 10px 14px;
  border-radius: var(--radius-md);
}

.timeline-content strong {
  color: var(--text-primary);
  display: block;
  margin-bottom: 2px;
}

/* --- Food Checker ("Boleh Makan Nggak?") Section --- */
.food-checker-section {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  padding: var(--space-xl);
  margin-bottom: var(--space-3xl);
  box-shadow: var(--shadow-md);
}

.search-wrapper {
  position: relative;
  margin-bottom: var(--space-lg);
}

.search-input {
  width: 100%;
  padding: 14px 18px 14px 45px;
  font-family: var(--font-body);
  font-size: var(--text-base);
  color: var(--text-primary);
  background: var(--bg-surface-alt);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  transition: all var(--transition);
}

.search-input:focus {
  outline: none;
  border-color: var(--accent);
  background: var(--bg-surface);
  box-shadow: 0 0 0 3px var(--accent-bg);
}

.search-icon-inside {
  position: absolute;
  left: 16px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 1.2rem;
  color: var(--text-tertiary);
  pointer-events: none;
}

.food-results-container {
  display: flex;
  flex-direction: column;
  gap: var(--space-md);
}

.food-card {
  padding: var(--space-md) var(--space-lg);
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
  border-left: 5px solid;
  background: var(--bg-surface);
  animation: slideIn 0.3s ease both;
}

.food-card.safe { border-left-color: var(--success); background: var(--success-bg); }
.food-card.limit { border-left-color: var(--warning); background: var(--warning-bg); }
.food-card.avoid { border-left-color: var(--danger); background: var(--danger-bg); }

.food-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: var(--space-sm);
  flex-wrap: wrap;
  gap: var(--space-xs);
}

.food-name {
  font-family: var(--font-heading);
  font-size: var(--text-base);
  font-weight: 700;
  color: var(--text-primary);
}

.food-badge {
  font-size: var(--text-xs);
  font-weight: 700;
  padding: 4px 10px;
  border-radius: 100px;
  text-transform: uppercase;
}

.food-badge.safe { background: #DCFCE7; color: var(--success); }
.food-badge.limit { background: #FEF3C7; color: var(--warning); }
.food-badge.avoid { background: #FEE2E2; color: var(--danger); }

.food-reason {
  font-size: var(--text-sm);
  color: var(--text-secondary);
  line-height: 1.5;
  margin-bottom: var(--space-xs);
}

.food-alternative {
  font-size: var(--text-sm);
  color: var(--text-primary);
  background: rgba(255,255,255,0.6);
  padding: var(--space-xs) var(--space-sm);
  border-radius: var(--radius-sm);
  border-left: 2px solid var(--accent);
  margin-top: var(--space-xs);
}

/* --- Day Switcher Tabs (Meal Planner) --- */
.day-switcher {
  display: flex;
  gap: var(--space-xs);
  margin-bottom: var(--space-lg);
  overflow-x: auto;
  padding-bottom: 6px;
  scrollbar-width: thin;
}

.day-tab-btn {
  padding: 8px 16px;
  background: var(--bg-surface-alt);
  color: var(--text-secondary);
  border: 1px solid var(--border-light);
  border-radius: 100px;
  font-family: var(--font-heading);
  font-weight: 600;
  font-size: var(--text-sm);
  cursor: pointer;
  white-space: nowrap;
  transition: all var(--transition);
}

.day-tab-btn:hover {
  background: var(--border-light);
  color: var(--text-primary);
}

.day-tab-btn.active {
  background: var(--accent);
  color: var(--text-inverse);
  border-color: var(--accent);
  box-shadow: var(--shadow-sm);
}

/* --- Audio Guide & Panic Button --- */
.audio-guide-box {
  background: var(--bg-surface-alt);
  border: 1px dashed var(--accent-light);
  border-radius: var(--radius-md);
  padding: var(--space-md) var(--space-lg);
  margin-top: var(--space-md);
  display: flex;
  flex-direction: column;
  align-items: stretch;
  text-align: left;
  gap: var(--space-sm);
}

.yt-search-row,
.yt-paste-row {
  display: flex;
  gap: var(--space-sm);
  width: 100%;
}

.yt-search-input {
  flex: 1;
  min-width: 0;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg-surface);
  color: var(--text-primary);
  font-size: var(--text-sm);
  font-family: inherit;
}

.yt-search-input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(15,118,110,0.15);
}

.yt-search-btn {
  padding: 10px 14px;
  border: none;
  border-radius: var(--radius-sm);
  background: var(--accent);
  color: var(--text-inverse);
  font-weight: 600;
  font-size: var(--text-sm);
  cursor: pointer;
  white-space: nowrap;
  transition: background var(--transition);
}

.yt-search-btn:hover {
  background: #0d5e58;
}

.yt-chips {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-xs);
}

.yt-chip {
  padding: 6px 10px;
  border: 1px solid var(--accent-light);
  border-radius: 999px;
  background: var(--bg-surface);
  color: var(--accent);
  font-size: var(--text-xs);
  font-weight: 500;
  cursor: pointer;
  transition: all var(--transition);
}

.yt-chip:hover {
  background: var(--accent);
  color: var(--text-inverse);
}

.yt-player-wrap {
  display: flex;
  flex-direction: column;
  gap: var(--space-sm);
  width: 100%;
}

.yt-aspect {
  position: relative;
  width: 100%;
  padding-top: 56.25%;
  border-radius: var(--radius-sm);
  overflow: hidden;
  background: #000;
}

.yt-aspect iframe {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border: 0;
}

.yt-close-btn {
  align-self: flex-end;
  padding: 6px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg-surface);
  color: var(--text-secondary);
  font-size: var(--text-xs);
  cursor: pointer;
}

.yt-close-btn:hover {
  background: var(--border);
  color: var(--text-primary);
}

.audio-status-text {
  font-size: var(--text-xs);
  font-weight: 500;
  color: var(--text-secondary);
  line-height: 1.5;
}

/* ==========================================
   RESPONSIVE
   ========================================== */

/* Tablet */
@media (min-width: 768px) {
  :root {
    --content-padding: 2rem;
  }

  .hero h1 { font-size: var(--text-4xl); }
  .section-title { font-size: var(--text-3xl); }
  .main-content { padding-top: calc(60px + var(--space-3xl)); }
}

/* Desktop - show sidebar */
@media (min-width: 1024px) {
  .menu-toggle { display: none; }

  .sidebar-overlay { display: none; }

  .sidebar {
    position: fixed;
    left: 0;
    top: 60px;
    height: calc(100vh - 60px);
    width: 260px;
    box-shadow: none;
    border-right: 1px solid var(--border-light);
    padding-top: var(--space-lg);
    background: var(--bg-primary);
  }

  .sidebar-header { display: none; }

  .main-content {
    margin-left: 260px;
    max-width: calc(var(--content-width) + 260px + 4rem);
    padding-left: 3rem;
    padding-right: 3rem;
  }

  .back-to-top { right: 40px; bottom: 40px; }
}

/* Large Desktop */
@media (min-width: 1280px) {
  .main-content {
    max-width: 1000px;
    margin-left: 300px;
  }

  .sidebar { width: 300px; }
}

/* Mobile small */
@media (max-width: 480px) {
  :root {
    --text-base: 1rem;
    --text-lg: 1.125rem;
    --text-xl: 1.25rem;
    --text-2xl: 1.5rem;
    --text-3xl: 1.75rem;
    --content-padding: 1rem;
  }

  .hero h1 { font-size: var(--text-2xl); }

  table { font-size: var(--text-xs); }
  thead th, tbody td { padding: 8px 10px; }

  .card { padding: var(--space-md); }
}

/* --- Print Styles --- */
@media print {
  .top-header, .sidebar, .sidebar-overlay,
  .menu-toggle, .back-to-top, .progress-bar { display: none !important; }

  .main-content {
    margin: 0;
    padding: 0;
    max-width: 100%;
  }

  body {
    font-size: 12pt;
    color: #000;
    background: #fff;
  }

  .card {
    border: 1px solid #ccc;
    box-shadow: none;
    break-inside: avoid;
  }
}
