/* ==========================================================================
   ThaliTruth — Modern Light Mode Nutrition Dashboard & Thali Builder Styles
   ========================================================================== */

:root {
  --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
  --font-devanagari: 'Noto Sans Devanagari', 'Inter', -apple-system, sans-serif;

  /* Strict Light Mode Palette */
  --bg-app: #f8fafc;
  --bg-card: #ffffff;
  --bg-muted: #f1f5f9;
  --bg-subtle: #f8fafc;
  
  --border-color: #e2e8f0;
  --border-focus: #10b981;
  --border-strong: #cbd5e1;

  --text-main: #0f172a;
  --text-muted: #64748b;
  --text-subtle: #94a3b8;
  --text-inverse: #ffffff;

  /* Primary Emerald Accents */
  --primary: #059669;
  --primary-hover: #047857;
  --primary-light: #ecfdf5;
  --primary-text: #065f46;

  /* Secondary Accents */
  --accent-amber: #d97706;
  --accent-amber-light: #fffbeb;
  --accent-blue: #0284c7;
  --accent-blue-light: #f0f9ff;
  --accent-purple: #7c3aed;
  --accent-purple-light: #f5f3ff;
  --accent-rose: #e11d48;
  --accent-rose-light: #fff1f2;

  /* Shadows */
  --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.08), 0 2px 4px -2px rgba(0, 0, 0, 0.04);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.08), 0 4px 6px -4px rgba(0, 0, 0, 0.03);
  --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 8px 10px -6px rgba(0, 0, 0, 0.04);
  --shadow-drawer: -5px 0 25px rgba(0, 0, 0, 0.15);

  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 16px;
  --radius-full: 9999px;

  --transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

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

body {
  font-family: var(--font-sans);
  background-color: var(--bg-app);
  color: var(--text-main);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.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;
}

/* ==========================================================================
   Header Section
   ========================================================================== */
.site-header {
  background: var(--bg-card);
  border-bottom: 1px solid var(--border-color);
  padding: 1rem 1.5rem;
  box-shadow: var(--shadow-sm);
  position: sticky;
  top: 0;
  z-index: 40;
}

.header-container {
  max-width: 1440px;
  margin: 0 auto;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1.25rem;
  flex-wrap: wrap;
}

.brand-block {
  display: flex;
  align-items: center;
  gap: 0.85rem;
}

.brand-logo {
  font-size: 2.25rem;
  line-height: 1;
  filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.1));
}

.brand-title {
  font-size: 1.45rem;
  font-weight: 800;
  color: var(--text-main);
  letter-spacing: -0.025em;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.brand-badge {
  font-size: 0.725rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  background: var(--primary-light);
  color: var(--primary-text);
  padding: 0.2rem 0.55rem;
  border-radius: var(--radius-full);
  border: 1px solid rgba(5, 150, 105, 0.2);
}

.brand-tagline {
  font-size: 0.85rem;
  color: var(--text-muted);
  font-weight: 400;
}

.header-controls {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-wrap: wrap;
}

/* Language Switcher */
.lang-select {
  padding: 0.4rem 0.75rem;
  font-size: 0.825rem;
  font-weight: 600;
  font-family: inherit;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  background: var(--bg-subtle);
  color: var(--text-main);
  cursor: pointer;
  transition: var(--transition);
}

.lang-select:focus {
  outline: none;
  border-color: var(--border-focus);
}

/* Serving Mode Toggle */
.serving-mode-toggle {
  display: inline-flex;
  background: var(--bg-muted);
  padding: 0.2rem;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-color);
}

.serving-btn {
  padding: 0.35rem 0.75rem;
  font-size: 0.8rem;
  font-weight: 600;
  font-family: inherit;
  border: none;
  background: transparent;
  color: var(--text-muted);
  border-radius: calc(var(--radius-md) - 2px);
  cursor: pointer;
  transition: var(--transition);
}

.serving-btn.active {
  background: var(--bg-card);
  color: var(--text-main);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.source-badge {
  font-size: 0.8rem;
  font-weight: 600;
  background: #f8fafc;
  color: #334155;
  padding: 0.35rem 0.75rem;
  border-radius: var(--radius-full);
  border: 1px solid var(--border-color);
  display: inline-flex;
  align-items: center;
}

/* ==========================================================================
   Main Container & Controls
   ========================================================================== */
.main-container {
  max-width: 1440px;
  width: 100%;
  margin: 1.25rem auto;
  padding: 0 1.5rem;
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

.controls-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 1.25rem;
  box-shadow: var(--shadow-sm);
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.search-category-row {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-wrap: wrap;
}

/* Search Box */
.search-box {
  flex: 1;
  min-width: 280px;
  position: relative;
  display: flex;
  align-items: center;
}

.search-icon {
  position: absolute;
  left: 0.85rem;
  font-size: 1rem;
  color: var(--text-subtle);
  pointer-events: none;
}

.search-box input {
  width: 100%;
  padding: 0.65rem 2.2rem 0.65rem 2.5rem;
  font-size: 0.925rem;
  font-family: inherit;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  background: var(--bg-subtle);
  color: var(--text-main);
  transition: var(--transition);
}

.search-box input:focus {
  outline: none;
  background: var(--bg-card);
  border-color: var(--border-focus);
  box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.15);
}

.clear-btn {
  position: absolute;
  right: 0.75rem;
  background: none;
  border: none;
  font-size: 1.25rem;
  color: var(--text-subtle);
  cursor: pointer;
  line-height: 1;
}

.clear-btn:hover {
  color: var(--text-main);
}

/* Category Select */
.category-select-wrapper {
  min-width: 190px;
}

.category-select {
  width: 100%;
  padding: 0.65rem 1rem;
  font-size: 0.9rem;
  font-family: inherit;
  font-weight: 500;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  background: var(--bg-subtle);
  color: var(--text-main);
  cursor: pointer;
  transition: var(--transition);
}

.category-select:focus {
  outline: none;
  border-color: var(--border-focus);
  box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.15);
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  padding: 0.65rem 1.1rem;
  font-size: 0.875rem;
  font-weight: 600;
  font-family: inherit;
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: var(--transition);
  border: 1px solid transparent;
  white-space: nowrap;
}

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

.btn-primary:hover {
  background: var(--primary-hover);
}

.btn-secondary {
  background: var(--bg-muted);
  color: var(--text-main);
  border-color: var(--border-color);
}

.btn-secondary:hover {
  background: #e2e8f0;
}

.btn-outline {
  background: transparent;
  color: var(--text-muted);
  border-color: var(--border-color);
}

.btn-outline:hover {
  background: var(--bg-muted);
  color: var(--text-main);
}

.btn-sm {
  padding: 0.35rem 0.75rem;
  font-size: 0.8rem;
}

.text-danger {
  color: #dc2626 !important;
}

/* Quick Filters */
.quick-filters-row {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  flex-wrap: wrap;
  padding-top: 0.5rem;
  border-top: 1px solid var(--border-color);
}

.quick-filter-label {
  font-size: 0.775rem;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin-right: 0.25rem;
}

.filter-pill {
  background: var(--bg-subtle);
  border: 1px solid var(--border-color);
  color: var(--text-muted);
  padding: 0.3rem 0.75rem;
  border-radius: var(--radius-full);
  font-size: 0.775rem;
  font-weight: 500;
  font-family: inherit;
  cursor: pointer;
  transition: var(--transition);
}

.filter-pill:hover {
  background: var(--bg-muted);
  color: var(--text-main);
  border-color: var(--border-strong);
}

.filter-pill.active {
  background: var(--primary-light);
  color: var(--primary-text);
  border-color: rgba(5, 150, 105, 0.4);
  font-weight: 600;
}

/* ==========================================================================
   Results Meta Bar
   ========================================================================== */
.results-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.85rem;
  color: var(--text-muted);
  padding: 0 0.25rem;
}

.results-count strong {
  color: var(--text-main);
}

.view-hints {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  font-size: 0.8rem;
}

/* ==========================================================================
   Data Table Card
   ========================================================================== */
.table-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
  position: relative;
}

.table-responsive {
  width: 100%;
  overflow-x: auto;
  overflow-y: visible;
  position: relative;
}

.food-table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  font-size: 0.875rem;
  text-align: left;
}

.food-table thead th {
  background: #f8fafc;
  color: var(--text-muted);
  font-weight: 700;
  font-size: 0.785rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  padding: 0.85rem 0.9rem;
  border-bottom: 2px solid var(--border-color);
  position: sticky;
  top: 0;
  z-index: 10;
  cursor: pointer;
  user-select: none;
  white-space: nowrap;
  transition: background 0.15s ease;
}

.food-table thead th:hover {
  background: #f1f5f9;
  color: var(--text-main);
}

.food-table thead th.no-sort {
  cursor: default;
}
.food-table thead th.no-sort:hover {
  background: #f8fafc;
  color: var(--text-muted);
}

.food-table thead th .th-content {
  display: flex;
  align-items: center;
  gap: 0.35rem;
}

.food-table thead th.numeric .th-content {
  justify-content: flex-end;
}

.sort-icon {
  font-size: 0.75rem;
  color: var(--text-subtle);
  min-width: 12px;
}

.food-table thead th.sorted-asc .sort-icon,
.food-table thead th.sorted-desc .sort-icon {
  color: var(--primary);
  font-weight: bold;
}

/* Table Body */
.food-table tbody tr {
  cursor: pointer;
  transition: background 0.12s ease;
}

.food-table tbody tr:nth-child(even) {
  background-color: #fafbfc;
}

.food-table tbody tr:hover {
  background-color: #ecfdf5 !important;
}

.food-table tbody td {
  padding: 0.75rem 0.9rem;
  border-bottom: 1px solid var(--border-color);
  vertical-align: middle;
}

.food-table tbody td.numeric {
  text-align: right;
  font-variant-numeric: tabular-nums;
  font-feature-settings: "tnum";
}

/* Cells */
.checkbox-cell {
  width: 36px;
  text-align: center;
  padding-right: 0.25rem !important;
}
.checkbox-cell input[type="checkbox"] {
  width: 16px;
  height: 16px;
  accent-color: var(--primary);
  cursor: pointer;
}

.food-name-cell {
  font-weight: 600;
  color: var(--text-main);
  white-space: nowrap;
}

.serving-badge-inline {
  display: block;
  font-size: 0.725rem;
  font-weight: 500;
  color: var(--text-muted);
}

.devanagari-name-cell {
  font-family: var(--font-devanagari);
  font-size: 0.925rem;
  font-weight: 500;
  color: #334155;
  white-space: nowrap;
}

/* Category Badges */
.category-badge {
  display: inline-block;
  padding: 0.2rem 0.55rem;
  border-radius: var(--radius-full);
  font-size: 0.725rem;
  font-weight: 600;
  white-space: nowrap;
}

.cat-vegetables { background: #dcfce7; color: #15803d; }
.cat-fruits { background: #fef3c7; color: #b45309; }
.cat-grains-pseudograins { background: #ffedd5; color: #c2410c; }
.cat-legumes-pulses { background: #fce7f3; color: #be185d; }
.cat-nuts-seeds { background: #f3e8ff; color: #7e22ce; }
.cat-fresh-herbs-spices { background: #e0f2fe; color: #0369a1; }
.cat-animals { background: #fee2e2; color: #b91c1c; }
.cat-fungi { background: #e2e8f0; color: #475569; }
.cat-cooked-items { background: #fae8ff; color: #86198f; }

.guidance-cell {
  max-width: 260px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 0.8rem;
  color: var(--text-muted);
}

/* ==========================================================================
   Floating Multi-Select Action Bar & Floating Thali Button
   ========================================================================= */
.floating-action-bar {
  position: fixed;
  bottom: 1.5rem;
  left: 50%;
  transform: translateX(-50%);
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  box-shadow: var(--shadow-xl);
  padding: 0.65rem 1.25rem;
  border-radius: var(--radius-full);
  display: flex;
  align-items: center;
  gap: 1.25rem;
  z-index: 50;
  animation: slideUp 0.2s ease;
}

@keyframes slideUp {
  from { transform: translate(-50%, 20px); opacity: 0; }
  to { transform: translate(-50%, 0); opacity: 1; }
}

.selection-count-badge {
  font-weight: 700;
  font-size: 0.85rem;
  color: var(--text-main);
  background: var(--bg-muted);
  padding: 0.25rem 0.6rem;
  border-radius: var(--radius-full);
}

.action-bar-buttons {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.floating-thali-btn {
  position: fixed;
  bottom: 1.5rem;
  right: 1.5rem;
  background: var(--text-main);
  color: var(--text-inverse);
  padding: 0.65rem 1.15rem;
  border-radius: var(--radius-full);
  border: 2px solid #ffffff;
  box-shadow: var(--shadow-xl);
  display: flex;
  align-items: center;
  gap: 0.55rem;
  cursor: pointer;
  z-index: 50;
  transition: transform 0.2s cubic-bezier(0.16, 1, 0.3, 1), box-shadow 0.2s ease;
}

.floating-thali-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 25px 30px -5px rgba(0, 0, 0, 0.2);
}

.thali-icon { font-size: 1.25rem; }
.thali-text { font-weight: 700; font-size: 0.9rem; }

.thali-count-badge {
  background: var(--primary);
  color: #fff;
  font-size: 0.75rem;
  font-weight: 700;
  padding: 0.15rem 0.5rem;
  border-radius: var(--radius-full);
}

.thali-cals-badge {
  background: rgba(255, 255, 255, 0.15);
  font-size: 0.8rem;
  font-weight: 600;
  padding: 0.15rem 0.5rem;
  border-radius: var(--radius-full);
}

/* ==========================================================================
   Thali Drawer (Meal Calculator)
   ========================================================================== */
.drawer-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.45);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  z-index: 100;
  display: flex;
  justify-content: flex-end;
  overscroll-behavior: contain;
}

.drawer-panel {
  background: var(--bg-card);
  width: 100%;
  max-width: 520px;
  height: 100%;
  display: flex;
  flex-direction: column;
  box-shadow: var(--shadow-drawer);
  animation: drawerSlide 0.25s cubic-bezier(0.16, 1, 0.3, 1);
  transform: translateZ(0);
  -webkit-transform: translateZ(0);
  contain: paint;
}

@keyframes drawerSlide {
  from { transform: translateX(100%); }
  to { transform: translateX(0); }
}

.drawer-header {
  padding: 1.25rem 1.5rem;
  border-bottom: 1px solid var(--border-color);
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  flex-shrink: 0;
}

.drawer-title-group {
  display: flex;
  gap: 0.75rem;
  align-items: center;
}

.thali-header-icon { font-size: 2rem; }
.drawer-title { font-size: 1.25rem; font-weight: 800; color: var(--text-main); }
.drawer-subtitle { font-size: 0.8rem; color: var(--text-muted); }

.drawer-body {
  padding: 1.25rem 1.5rem;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
  overscroll-behavior-y: contain;
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
  contain: content;
  transform: translateZ(0);
  -webkit-transform: translateZ(0);
  will-change: scroll-position;
}

/* Thali Summary Card */
.thali-summary-card {
  background: var(--bg-subtle);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 1.1rem;
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
}

.thali-cals-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.thali-cals-val {
  font-size: 2rem;
  font-weight: 900;
  color: var(--primary);
  line-height: 1;
}

.thali-cals-label {
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  color: var(--text-muted);
}

.thali-macro-bar-wrapper {
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
}

.thali-macro-stats {
  display: flex;
  justify-content: space-between;
  font-size: 0.8rem;
}

.p-tag { color: #2563eb; }
.f-tag { color: #d97706; }
.c-tag { color: #059669; }
.fib-tag { color: #7c3aed; }

.thali-micros-row {
  display: flex;
  justify-content: space-between;
  font-size: 0.75rem;
  color: var(--text-muted);
  border-top: 1px dashed var(--border-color);
  padding-top: 0.5rem;
}

.thali-items-section {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.thali-section-heading {
  font-size: 0.85rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-muted);
}

.thali-items-list {
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
}

.thali-item-card {
  background: #ffffff;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 0.75rem 0.85rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.75rem;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04);
}

.thali-item-info {
  flex: 1;
}

.thali-item-name {
  font-weight: 600;
  font-size: 0.875rem;
  color: var(--text-main);
}

.thali-item-sub {
  font-size: 0.75rem;
  color: var(--text-muted);
}

.thali-stepper {
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.stepper-btn {
  width: 26px;
  height: 26px;
  border: 1px solid var(--border-color);
  background: var(--bg-subtle);
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  cursor: pointer;
}

.stepper-btn:hover {
  background: #e2e8f0;
}

.stepper-val {
  font-size: 0.85rem;
  font-weight: 600;
  min-width: 24px;
  text-align: center;
}

.remove-thali-item-btn {
  background: none;
  border: none;
  color: var(--text-subtle);
  cursor: pointer;
  font-size: 1.15rem;
  padding: 0.2rem;
}
.remove-thali-item-btn:hover { color: #dc2626; }

.drawer-footer {
  padding: 1rem 1.5rem;
  border-top: 1px solid var(--border-color);
  background: #f8fafc;
  display: flex;
  justify-content: flex-end;
  gap: 0.75rem;
}

/* ==========================================================================
   Modals (General, Factsheet, Comparison)
   ========================================================================== */
body.modal-open {
  overflow: hidden;
}

.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.45);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  overscroll-behavior: contain;
}

.modal-card {
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-xl);
  max-width: 580px;
  width: 100%;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  animation: modalIn 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  transform: translateZ(0);
  -webkit-transform: translateZ(0);
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
  contain: paint;
}

.modal-lg { max-width: 860px; }

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

.modal-header {
  padding: 1.25rem 1.5rem;
  border-bottom: 1px solid var(--border-color);
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  flex-shrink: 0;
}

.modal-title { font-size: 1.25rem; font-weight: 700; color: var(--text-main); }

.modal-close-btn {
  background: none;
  border: none;
  font-size: 1.5rem;
  line-height: 1;
  color: var(--text-subtle);
  cursor: pointer;
  padding: 0.25rem;
}
.modal-close-btn:hover { color: var(--text-main); }

.modal-body {
  padding: 1.5rem;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
  overscroll-behavior-y: contain;
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
  contain: content;
  transform: translateZ(0);
  -webkit-transform: translateZ(0);
  will-change: scroll-position;
}

.modal-desc { font-size: 0.875rem; color: var(--text-muted); }

.modal-footer {
  padding: 1rem 1.5rem;
  border-top: 1px solid var(--border-color);
  background: #f8fafc;
  display: flex;
  justify-content: flex-end;
  gap: 0.75rem;
  flex-shrink: 0;
}

/* Factsheet Header Badges */
.detail-badge-group {
  display: flex;
  gap: 0.45rem;
  flex-wrap: wrap;
  margin-bottom: 0.35rem;
}

.detail-category-badge,
.detail-potency-badge,
.detail-gi-badge,
.detail-vrat-badge {
  display: inline-block;
  font-size: 0.725rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  padding: 0.15rem 0.5rem;
  border-radius: var(--radius-full);
}

.detail-category-badge { background: var(--primary-light); color: var(--primary-text); }
.detail-potency-badge { background: #f0fdf4; color: #166534; border: 1px solid #bbf7d0; }
.detail-gi-badge { background: #eff6ff; color: #1e40af; border: 1px solid #bfdbfe; }
.detail-vrat-badge { background: #fdf4ff; color: #86198f; border: 1px solid #f0abfc; }

.detail-food-name { font-size: 1.5rem; font-weight: 800; color: var(--text-main); }
.detail-hindi-name { font-family: var(--font-devanagari); font-size: 1.15rem; color: var(--text-muted); }

.factsheet-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.85rem;
}

.fact-stat-card {
  background: var(--bg-subtle);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 0.85rem;
  text-align: center;
}

.fact-stat-val { font-size: 1.35rem; font-weight: 800; color: var(--text-main); }
.fact-stat-label { font-size: 0.75rem; font-weight: 600; text-transform: uppercase; color: var(--text-muted); }

.macro-bar-container {
  display: flex;
  height: 12px;
  border-radius: var(--radius-full);
  overflow: hidden;
  background: #e2e8f0;
  margin-bottom: 0.75rem;
}

.macro-bar-p { background: #3b82f6; }
.macro-bar-f { background: #f59e0b; }
.macro-bar-c { background: #10b981; }

.fact-list {
  list-style: none;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.4rem 1rem;
  font-size: 0.85rem;
}

.fact-list li {
  display: flex;
  justify-content: space-between;
  padding: 0.35rem 0;
  border-bottom: 1px dashed var(--border-color);
}

.fact-list li span:last-child { font-weight: 600; }

.guidance-box {
  background: #f8fafc;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 0.9rem;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  font-size: 0.85rem;
}

.guidance-row { display: flex; gap: 0.5rem; }
.guidance-tag { font-weight: 700; min-width: 65px; font-size: 0.775rem; text-transform: uppercase; }
.guidance-good { color: #15803d; }
.guidance-avoid { color: #b91c1c; }
.guidance-best { color: #0284c7; }

/* Comparison Table */
.compare-table-wrapper {
  overflow-x: auto;
}

.compare-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.875rem;
}

.compare-table th, .compare-table td {
  padding: 0.75rem 1rem;
  border: 1px solid var(--border-color);
  text-align: left;
}

.compare-table th {
  background: #f8fafc;
  font-weight: 700;
}

.compare-table .winner-cell {
  background: #ecfdf5 !important;
  font-weight: 700;
  color: #065f46;
}

/* ==========================================================================
   Column Customizer Modal Elements
   ========================================================================== */
.preset-buttons-row {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.column-groups-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 1.25rem;
  padding-top: 0.5rem;
}

.col-group-title {
  font-size: 0.785rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--primary);
  margin-bottom: 0.6rem;
  padding-bottom: 0.25rem;
  border-bottom: 2px solid var(--primary-light);
}

.checkbox-label {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  font-size: 0.875rem;
  color: var(--text-main);
  padding: 0.35rem 0;
  cursor: pointer;
  user-select: none;
}

.checkbox-label input[type="checkbox"] {
  width: 16px;
  height: 16px;
  accent-color: var(--primary);
  cursor: pointer;
}

/* ==========================================================================
   Dedicated Printable Thali Receipt Styles
   ========================================================================== */
.printable-thali-report {
  display: none;
  background: #ffffff;
  padding: 25px;
  color: #0f172a;
  font-family: var(--font-sans);
}

.thali-print-header {
  border-bottom: 2px solid #0f172a;
  padding-bottom: 12px;
  margin-bottom: 18px;
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
}

.thali-print-title {
  font-size: 20pt;
  font-weight: 900;
  color: #0f172a;
}

.thali-print-sub {
  font-size: 10pt;
  color: #475569;
}

.thali-print-date {
  font-size: 9pt;
  color: #64748b;
  text-align: right;
}

.thali-print-summary-box {
  background: #f8fafc;
  border: 1.5px solid #059669;
  border-radius: 8px;
  padding: 14px 18px;
  margin-bottom: 20px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.thali-print-cals-big {
  font-size: 26pt;
  font-weight: 900;
  color: #059669;
  line-height: 1;
}

.thali-print-cals-label {
  font-size: 8pt;
  font-weight: 700;
  text-transform: uppercase;
  color: #475569;
}

.thali-print-macro-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 15px;
  font-size: 9pt;
}

.thali-print-macro-grid div span {
  display: block;
  font-size: 8pt;
  color: #64748b;
  text-transform: uppercase;
}

.thali-print-macro-grid div strong {
  font-size: 11pt;
  color: #0f172a;
}

.thali-print-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 9pt;
  margin-bottom: 20px;
}

.thali-print-table th {
  background: #f1f5f9;
  border-bottom: 2px solid #334155;
  padding: 8px 10px;
  text-align: left;
  font-weight: 700;
  text-transform: uppercase;
  font-size: 8pt;
}

.thali-print-table td {
  border-bottom: 1px solid #e2e8f0;
  padding: 8px 10px;
}

.thali-print-table td.numeric,
.thali-print-table th.numeric {
  text-align: right;
}

.thali-print-footer {
  border-top: 1px dashed #cbd5e1;
  padding-top: 12px;
  font-size: 8pt;
  color: #64748b;
  display: flex;
  justify-content: space-between;
}

/* ==========================================================================
   Footer Section
   ========================================================================== */
.site-footer {
  background: var(--bg-card);
  border-top: 1px solid var(--border-color);
  padding: 2rem 1.5rem;
  margin-top: 3rem;
  font-size: 0.825rem;
  color: var(--text-muted);
}

.footer-container {
  max-width: 1440px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: 1rem;
  text-align: center;
}

.footer-info h4 {
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--text-main);
  margin-bottom: 0.35rem;
}

.footer-info p {
  max-width: 860px;
  margin: 0 auto;
  line-height: 1.6;
}

.footer-links {
  display: flex;
  justify-content: center;
  gap: 0.75rem;
  color: var(--text-subtle);
  font-size: 0.775rem;
}

/* ==========================================================================
   Print Styles (Optimized for Table Landscape vs Thali Factsheet)
   ========================================================================== */
@media print {
  body {
    background: #fff !important;
    color: #000 !important;
  }

  /* Default print hides interactive UI */
  .site-header,
  .controls-card,
  .results-bar,
  .floating-action-bar,
  .floating-thali-btn,
  .drawer-overlay,
  .modal-overlay,
  .site-footer {
    display: none !important;
  }

  /* CASE 1: Printing Thali Factsheet ONLY */
  body.print-thali-mode .main-container {
    display: none !important;
  }

  body.print-thali-mode .printable-thali-report {
    display: block !important;
  }

  @page {
    size: landscape;
    margin: 10mm;
  }

  body.print-thali-mode {
    background: #ffffff !important;
  }

  body:not(.print-thali-mode) .main-container {
    max-width: 100% !important;
    margin: 0 !important;
    padding: 0 !important;
  }

  body:not(.print-thali-mode) .table-card {
    border: none !important;
    box-shadow: none !important;
  }

  body:not(.print-thali-mode) .table-responsive {
    max-height: none !important;
    overflow: visible !important;
  }

  body:not(.print-thali-mode) .food-table {
    font-size: 8pt;
  }

  body:not(.print-thali-mode) .food-table thead th {
    background: #f1f5f9 !important;
    color: #000 !important;
    border-bottom: 2px solid #000;
  }

  body:not(.print-thali-mode) .food-table tbody td {
    border-bottom: 1px solid #ccc;
    padding: 4px 6px;
  }
}

/* ==========================================================================
   Responsive Breakpoints
   ========================================================================== */
@media (max-width: 768px) {
  .header-container {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.75rem;
  }

  .header-controls {
    width: 100%;
    justify-content: space-between;
  }

  .search-category-row {
    flex-direction: column;
    align-items: stretch;
  }

  .search-box, .category-select-wrapper {
    width: 100%;
  }

  .results-bar {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.4rem;
  }

  .floating-thali-btn {
    bottom: 1rem;
    right: 1rem;
    padding: 0.55rem 0.95rem;
  }

  .floating-action-bar {
    bottom: 1rem;
    width: 90%;
    justify-content: space-between;
  }

  .drawer-panel {
    max-width: 100%;
  }

  .factsheet-grid {
    grid-template-columns: 1fr;
  }

  .fact-list {
    grid-template-columns: 1fr;
  }
}

/* ==========================================================================
   SEO Informational Guide & FAQ Accordion Section
   ========================================================================== */
.seo-guide-section {
  margin-top: 2.5rem;
  margin-bottom: 2.5rem;
  display: flex;
  flex-direction: column;
  gap: 2.5rem;
}

.seo-section-title {
  font-size: 1.35rem;
  font-weight: 700;
  color: var(--text-main);
  margin-bottom: 0.35rem;
  letter-spacing: -0.01em;
}

.seo-section-subtitle {
  font-size: 0.9rem;
  color: var(--text-muted);
  margin-bottom: 1.25rem;
  line-height: 1.5;
}

.seo-cards-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 1.25rem;
}

.seo-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 1.25rem 1.4rem;
  box-shadow: var(--shadow-sm);
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
}

.seo-card-header {
  display: flex;
  align-items: center;
  gap: 0.6rem;
}

.seo-card-icon {
  font-size: 1.4rem;
  line-height: 1;
}

.seo-card h3 {
  font-size: 1.05rem;
  font-weight: 600;
  color: var(--text-main);
}

.seo-card p {
  font-size: 0.85rem;
  color: var(--text-muted);
  line-height: 1.6;
}

.faq-container {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.faq-item {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
  transition: var(--transition);
}

.faq-item summary {
  padding: 0.9rem 1.25rem;
  font-weight: 600;
  font-size: 0.95rem;
  color: var(--text-main);
  cursor: pointer;
  display: flex;
  justify-content: space-between;
  align-items: center;
  list-style: none;
  user-select: none;
  transition: background-color 0.15s ease;
}

.faq-item summary::-webkit-details-marker {
  display: none;
}

.faq-item summary::after {
  content: '▾';
  font-size: 1.1rem;
  color: var(--text-muted);
  transition: transform 0.2s ease;
}

.faq-item[open] summary::after {
  transform: rotate(180deg);
  color: var(--primary);
}

.faq-item[open] summary {
  border-bottom: 1px solid var(--border-color);
  background: var(--bg-subtle);
}

.faq-answer {
  padding: 1rem 1.25rem;
  font-size: 0.875rem;
  line-height: 1.65;
  color: var(--text-muted);
}
