/* =====================================================
   Carbculator — Pro Design System (LTR / English)
   Palette: Medical/Clinical + Premium Dark Navy + Teal
   Radius: 16dp (cards), 12dp (chips/buttons), 8dp (inputs)
   Spacing: 4/8/16/24 grid
   ===================================================== */

:root {
  /* Brand — Premium medical/clinical feel */
  --brand-900: #0A1F3C;
  --brand-800: #0F2B54;
  --brand-700: #163870;
  --brand-600: #1E4B8D;
  --brand-500: #2A5FB0;   /* primary button */
  --brand-400: #4A7DCE;
  --brand-300: #7EA3E0;
  --brand-200: #B7CFF0;
  --brand-100: #E0EBFA;
  --brand-50:  #F3F7FE;

  /* Accent — Teal (trust, health) */
  --teal-600: #0D9488;
  --teal-500: #14B8A6;
  --teal-100: #CCFBF1;

  /* Amber — caution / extended bolus */
  --amber-500: #F59E0B;
  --amber-100: #FEF3C7;

  /* Danger / success */
  --rose-600: #E11D48;
  --rose-100: #FFE4E6;
  --emerald-600: #059669;
  --emerald-100: #D1FAE5;

  /* Surfaces */
  --surface:   #FFFFFF;
  --surface-2: #F7F9FC;
  --surface-3: #EEF2F8;
  --surface-4: #E5EBF4;
  --border:    #D6DEEB;
  --border-strong: #B4C2D6;

  /* Text */
  --text-900:  #0B1220;
  --text-700:  #1F2A44;
  --text-500:  #54617C;
  --text-400:  #7A88A3;
  --text-300:  #A3AEC4;

  /* Radius */
  --r-2xl: 24px;
  --r-xl:  20px;
  --r-lg:  16px;
  --r-md:  12px;
  --r-sm:  8px;
  --r-xs:  6px;

  /* Shadow — layered elevation */
  --sh-1: 0 1px 2px rgba(15, 43, 84, 0.06), 0 1px 3px rgba(15, 43, 84, 0.04);
  --sh-2: 0 4px 12px rgba(15, 43, 84, 0.08), 0 2px 4px rgba(15, 43, 84, 0.04);
  --sh-3: 0 10px 24px rgba(15, 43, 84, 0.10), 0 4px 10px rgba(15, 43, 84, 0.05);
  --sh-4: 0 16px 40px rgba(15, 43, 84, 0.14), 0 6px 16px rgba(15, 43, 84, 0.08);
  --sh-brand: 0 8px 20px rgba(42, 95, 176, 0.28);
  --sh-teal:  0 8px 20px rgba(20, 184, 166, 0.28);

  /* Type scale */
  --fs-xs: 0.75rem;   /* 12px */
  --fs-sm: 0.85rem;   /* 13.5px */
  --fs-base: 0.95rem; /* 15.2px */
  --fs-md: 1.05rem;   /* 16.8px */
  --fs-lg: 1.25rem;   /* 20px */
  --fs-xl: 1.5rem;    /* 24px */
  --fs-2xl: 1.85rem;  /* 29.6px */
  --fs-3xl: 2.4rem;   /* 38.4px */

  /* Layout */
  --max-w: 640px;
  --shell-pad: 16px;

  /* Motion */
  --ease: cubic-bezier(.2,.8,.2,1);
}

/* =====================================================
   Base
   ===================================================== */

* { box-sizing: border-box; }

html, body { height: 100%; }

body {
  font-family: 'Inter', 'Segoe UI', system-ui, -apple-system, BlinkMacSystemFont, 'Helvetica Neue', Arial, sans-serif;
  font-feature-settings: 'cv11','ss01','ss03';
  background:
    radial-gradient(1200px 600px at 10% -10%, #E8F0FC 0%, transparent 60%),
    radial-gradient(900px 500px at 110% 10%, #E0FBF6 0%, transparent 55%),
    linear-gradient(180deg, var(--surface-2) 0%, var(--surface-3) 100%);
  background-attachment: fixed;
  color: var(--text-900);
  margin: 0;
  padding: 0 0 120px;
  font-size: var(--fs-base);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-size-adjust: 100%;
}

a { color: var(--brand-600); text-decoration: none; }

/* Container shell */
.container {
  max-width: var(--max-w);
  margin: 0 auto;
  padding: 0 var(--shell-pad);
}

/* =====================================================
   Top App Bar + Hero Header
   ===================================================== */

.app-header {
  position: relative;
  background:
    radial-gradient(600px 300px at 90% 0%, rgba(124, 177, 240, 0.35) 0%, transparent 60%),
    radial-gradient(600px 300px at 0% 100%, rgba(20, 184, 166, 0.18) 0%, transparent 60%),
    linear-gradient(135deg, var(--brand-900) 0%, var(--brand-700) 60%, var(--brand-600) 100%);
  color: #F7FAFF;
  padding: 22px 0 28px;
  border-radius: 0 0 var(--r-2xl) var(--r-2xl);
  box-shadow: var(--sh-3), inset 0 -1px 0 rgba(255,255,255,0.05);
  margin-bottom: 22px;
  overflow: hidden;
}

.app-header::after {
  content: '';
  position: absolute; inset: 0;
  background-image:
    linear-gradient(120deg, rgba(255,255,255,0.06) 0%, transparent 40%),
    repeating-linear-gradient(45deg, rgba(255,255,255,0.03) 0 2px, transparent 2px 10px);
  pointer-events: none;
}

.app-header .container { position: relative; z-index: 1; }

.app-header .app-logo-3d {
  width: 92px; height: 92px;
  border-radius: 24px;
  margin: 2px auto 10px;
  display: block;
  box-shadow: 0 16px 36px rgba(0,0,0,0.38), inset 0 1px 0 rgba(255,255,255,0.35);
  background: #fff;
  object-fit: cover;
}

.app-header h1 {
  margin: 0;
  font-size: var(--fs-2xl);
  letter-spacing: -0.02em;
  font-weight: 800;
  text-align: center;
  text-shadow: 0 2px 16px rgba(0,0,0,0.25);
}

.app-header p {
  margin: 6px 0 0;
  text-align: center;
  font-size: var(--fs-sm);
  opacity: 0.92;
  letter-spacing: 0.01em;
}

/* language switcher / back button (top-left/right) */
.app-header a.btn.lang-switch,
.app-header a.btn.back-btn {
  position: absolute;
  top: 16px;
  background: rgba(255,255,255,0.12);
  color: #fff;
  font-size: var(--fs-sm);
  padding: 8px 14px;
  border: 1px solid rgba(255,255,255,0.18);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border-radius: 999px;
  font-weight: 600;
  z-index: 20;
}
.app-header a.btn.lang-switch { right: 16px; }
.app-header a.btn.back-btn   { left: 16px; }
.app-header a.btn.lang-switch:hover,
.app-header a.btn.back-btn:hover { background: rgba(255,255,255,0.2); }

/* =====================================================
   Cards (elevated surfaces)
   ===================================================== */

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-xl);
  padding: 20px;
  margin-bottom: 18px;
  box-shadow: var(--sh-2);
  position: relative;
  transition: transform .25s var(--ease), box-shadow .25s var(--ease), border-color .25s var(--ease);
}
.card:hover { box-shadow: var(--sh-3); transform: translateY(-1px); border-color: var(--border-strong); }

.card-header {
  display: flex; justify-content: space-between; align-items: center;
  margin: -4px 0 14px;
}
.card-header h2 { margin: 0; }

.card h2 {
  font-size: var(--fs-md);
  color: var(--text-900);
  font-weight: 700;
  letter-spacing: -0.01em;
  margin: 0 0 14px;
  display: flex; align-items: center; gap: 10px;
}
.card h2::before {
  content: '';
  display: inline-block;
  width: 4px; height: 18px;
  border-radius: 2px;
  background: linear-gradient(180deg, var(--brand-500), var(--teal-500));
}

/* =====================================================
   Buttons
   ===================================================== */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 18px;
  border-radius: var(--r-md);
  border: 1px solid transparent;
  font-weight: 600;
  font-size: var(--fs-sm);
  letter-spacing: 0.01em;
  cursor: pointer;
  text-decoration: none;
  transition: transform .15s var(--ease), background-color .2s var(--ease),
              color .2s var(--ease), border-color .2s var(--ease), box-shadow .2s var(--ease);
  line-height: 1.2;
  user-select: none;
  white-space: nowrap;
  font-family: inherit;
}
.btn:active { transform: scale(0.97); }
.btn:disabled { opacity: .5; pointer-events: none; }

.btn.primary {
  background: linear-gradient(180deg, var(--brand-500), var(--brand-600));
  color: white;
  box-shadow: var(--sh-brand);
  border-color: rgba(0,0,0,0.06);
}
.btn.primary:hover { filter: brightness(1.05); }

.btn.secondary {
  background: white;
  color: var(--brand-700);
  border-color: var(--brand-200);
  box-shadow: var(--sh-1);
}
.btn.secondary:hover { background: var(--brand-50); }

.btn.ghost { background: transparent; color: var(--text-700); border-color: var(--border); }
.btn.ghost:hover { background: var(--surface-2); }

.btn.tonal { background: var(--brand-50); color: var(--brand-700); border-color: transparent; }
.btn.tonal:hover { background: var(--brand-100); }

.btn.danger { background: var(--rose-600); color: white; }
.btn.danger:hover { filter: brightness(1.05); }

.btn.text-danger {
  background: transparent; color: var(--rose-600);
  padding: 6px 10px; border-radius: 999px;
  border: 1px solid transparent;
  font-size: var(--fs-sm);
}
.btn.text-danger:hover { background: var(--rose-100); border-color: transparent; }

.btn.text-success { background: transparent; color: var(--emerald-600); padding: 6px 10px; border-radius: 999px; font-size: var(--fs-sm); }
.btn.text-success:hover { background: var(--emerald-100); }

/* Wide actions */
.btn.w-full, .btn[style*="width: 100%"] { width: 100%; }

/* =====================================================
   Inputs
   ===================================================== */

.input-group { margin-bottom: 14px; }
.input-group label {
  display: block;
  margin-bottom: 6px;
  font-size: var(--fs-sm);
  font-weight: 600;
  color: var(--text-500);
  letter-spacing: 0.01em;
}

input[type="text"],
input[type="number"],
input[type="search"],
input[type="email"],
input[type="password"],
input[type="tel"],
input[type="date"],
textarea {
  width: 100%;
  min-height: 48px;
  padding: 14px 16px;
  border: 1.5px solid var(--border);
  border-radius: var(--r-sm);
  font-size: 16px;
  color: var(--text-900);
  background: var(--surface);
  transition: border-color .2s var(--ease), background-color .2s var(--ease), box-shadow .2s var(--ease);
  font-family: inherit;
  outline: none;
  box-shadow: inset 0 1px 0 rgba(0,0,0,0.02);
}
input::placeholder { color: var(--text-300); }
input:focus {
  border-color: var(--brand-500);
  background: #fff;
  box-shadow: 0 0 0 4px rgba(42,95,176,0.12);
}
input[readonly] {
  background: var(--surface-2);
  color: var(--text-700);
  font-weight: 600;
}

/* Search — split with icon on left/right */
.search-card { position: relative; z-index: 999; overflow: visible; }
.search-box { position: relative; z-index: 40; overflow: visible; }
.search-box input[type="text"],
.search-box input[type="search"] {
  padding-left: 44px;
  padding-right: 14px;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%237A88A3' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'><circle cx='11' cy='11' r='7'/><line x1='21' y1='21' x2='16.65' y2='16.65'/></svg>");
  background-repeat: no-repeat;
  background-position: 14px 50%;
  background-size: 20px 20px;
}

.search-box.results-right input[type="text"],
.search-box.results-right input[type="search"] {
  padding-left: 14px;
  padding-right: 44px;
  background-position: right 14px center;
}

/* Result dropdown */
.results-list {
  position: absolute;
  top: calc(100% + 10px); left: 0; right: 0;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  box-shadow: var(--sh-4);
  max-height: 320px;
  overflow-y: auto;
  z-index: 120;
}
.results-list::-webkit-scrollbar { width: 8px; }
.results-list::-webkit-scrollbar-thumb { background: var(--border-strong); border-radius: 4px; }
.result-item {
  padding: 12px 14px;
  border-bottom: 1px solid var(--surface-3);
  cursor: pointer;
  transition: background-color .15s var(--ease), padding-left .15s var(--ease);
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
}
.result-item:last-child { border-bottom: none; }
.result-item .ri-name { font-weight: 600; color: var(--text-900); font-size: var(--fs-sm); }
.result-item .ri-cat  { font-size: var(--fs-xs); color: var(--text-400); margin-top: 2px; }
.result-item .ri-val  { font-weight: 700; color: var(--brand-600); font-size: var(--fs-sm); white-space: nowrap; }
.result-item:hover { background: var(--brand-50); padding-left: 18px; }

/* =====================================================
   Result preview / insulin card
   ===================================================== */

.result-preview {
  margin: 14px 0;
  padding: 14px 16px;
  background: linear-gradient(135deg, var(--brand-50), var(--teal-100));
  border-radius: var(--r-md);
  border: 1px solid var(--brand-100);
  font-weight: 600;
  color: var(--brand-800);
  font-size: var(--fs-md);
  text-align: center;
}
.result-preview span {
  font-size: var(--fs-xl);
  font-weight: 800;
  color: var(--brand-700);
  margin: 0 4px;
}

.calculation-result {
  margin-top: 18px;
  padding: 22px 18px;
  border-radius: var(--r-lg);
  text-align: center;
  font-size: var(--fs-base);
  color: var(--text-700);
  background:
    radial-gradient(500px 200px at 50% -10%, rgba(20,184,166,0.12), transparent 60%),
    linear-gradient(180deg, #F2FBF9 0%, #EAF3FF 100%);
  border: 1px solid var(--border);
  box-shadow: var(--sh-1);
}
.calculation-result #suggestedDose {
  display: block;
  margin-top: 6px;
  font-size: var(--fs-3xl);
  font-weight: 800;
  color: var(--brand-700);
  letter-spacing: -0.03em;
  line-height: 1.05;
}
.calculation-result #suggestedDose::after {
  content: ' units';
  font-size: var(--fs-sm);
  font-weight: 600;
  color: var(--text-500);
  margin-left: 6px;
  letter-spacing: 0;
}
.suggestion-text { margin-top: 10px; font-size: var(--fs-xs); font-weight: 500; color: var(--text-500); }
.suggestion-text.extended {
  display: inline-block;
  margin-top: 6px;
  background: var(--amber-100);
  color: #92400E;
  border: 1px solid #FCD34D;
  padding: 6px 12px;
  border-radius: 999px;
  font-weight: 700;
}

/* =====================================================
   Meal list
   ===================================================== */

.meal-list { list-style: none; padding: 0; margin: 0; }
.meal-list li.empty-state,
p.empty-state,
#savedFoodsList .empty-state {
  padding: 28px 16px;
  text-align: center;
  color: var(--text-400);
  font-size: var(--fs-sm);
  background: repeating-linear-gradient(45deg, var(--surface-2) 0 8px, transparent 8px 16px);
  border: 1.5px dashed var(--border);
  border-radius: var(--r-md);
  margin: 0;
}

.meal-item {
  display: grid;
  grid-template-columns: 1fr auto auto;
  align-items: center;
  gap: 12px;
  padding: 12px 4px;
  border-bottom: 1px solid var(--surface-3);
  animation: fadeIn .3s var(--ease);
}
.meal-item:last-child { border-bottom: none; }
.meal-item .name { font-weight: 700; color: var(--text-900); font-size: var(--fs-sm); display: block; }
.meal-item .details { margin-top: 3px; font-size: var(--fs-xs); color: var(--text-500); }
.meal-item .carbs {
  font-weight: 800; color: var(--brand-700); font-size: var(--fs-md);
  padding: 6px 10px; border-radius: 10px;
  background: var(--brand-50);
  min-width: 64px; text-align: center;
}
.meal-item .remove {
  color: var(--text-400);
  cursor: pointer;
  width: 34px; height: 34px;
  display: inline-flex; align-items: center; justify-content: center;
  border-radius: 10px;
  transition: background-color .15s var(--ease), color .15s var(--ease), transform .15s var(--ease);
}
.meal-item .remove:hover { color: var(--rose-600); background: var(--rose-100); transform: scale(1.05); }

.meal-total {
  margin-top: 14px;
  padding: 16px;
  background: linear-gradient(135deg, #F3F7FE, #E8F9F5);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  display: flex; justify-content: space-between; align-items: center;
  font-weight: 700; color: var(--text-700);
}
.meal-total .total-number {
  font-size: var(--fs-xl);
  color: var(--brand-700);
  font-weight: 800;
  letter-spacing: -0.02em;
}
.meal-total .total-number span { margin-right: 2px; }

/* =====================================================
   Chips / Filters
   ===================================================== */

.chip-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 10px 0 18px;
}
.chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 14px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: white;
  color: var(--text-700);
  font-size: var(--fs-sm);
  font-weight: 600;
  cursor: pointer;
  transition: all .2s var(--ease);
}
.chip:hover { background: var(--surface-2); }
.chip.active {
  background: linear-gradient(180deg, var(--brand-500), var(--brand-600));
  color: white;
  border-color: transparent;
  box-shadow: var(--sh-brand);
}

/* =====================================================
   Stat / summary cards
   ===================================================== */

.stats-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  margin: -10px 0 20px;
  position: relative;
  z-index: 3;
}
@media (max-width: 420px) { .stats-grid { grid-template-columns: repeat(2, 1fr); } }

.stat-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  padding: 14px 12px;
  text-align: center;
  box-shadow: var(--sh-1);
}
.stat-card .label {
  font-size: var(--fs-xs);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-400);
  margin-bottom: 4px;
}
.stat-card .value {
  font-size: var(--fs-lg);
  font-weight: 800;
  letter-spacing: -0.02em;
  color: var(--brand-700);
}
.stat-card.teal .value { color: var(--teal-600); }
.stat-card.amber .value { color: var(--amber-500); }
.stat-card .sub { font-size: var(--fs-xs); color: var(--text-500); margin-top: 2px; }

/* Hero nav row */
.nav-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-bottom: 18px;
}
.nav-actions a.btn { width: 100%; padding: 14px; border-radius: var(--r-md); font-size: var(--fs-sm); }

/* =====================================================
   Bottom Nav (persistent)
   ===================================================== */

.bottom-nav {
  position: fixed;
  bottom: 12px; left: 50%;
  transform: translateX(-50%);
  width: calc(100% - 24px);
  max-width: var(--max-w);
  background: rgba(255,255,255,0.82);
  backdrop-filter: blur(16px) saturate(1.3);
  -webkit-backdrop-filter: blur(16px) saturate(1.3);
  border: 1px solid var(--border);
  border-radius: 999px;
  box-shadow: var(--sh-3);
  padding: 6px;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  z-index: 400;
}
.bottom-nav a {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 2px;
  padding: 8px 4px;
  border-radius: 999px;
  font-size: 10px;
  font-weight: 600;
  color: var(--text-500);
  transition: background-color .2s var(--ease), color .2s var(--ease);
}
.bottom-nav a svg { width: 20px; height: 20px; stroke: currentColor; fill: none; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.bottom-nav a.active {
  background: linear-gradient(180deg, var(--brand-500), var(--brand-600));
  color: white;
  box-shadow: var(--sh-brand);
}
.bottom-nav a:hover { color: var(--brand-700); }
.bottom-nav a.active:hover { color: white; }
.bottom-nav a .bn-label { letter-spacing: 0.01em; }

/* Floating FAB (barcode) */
.fab {
  position: fixed;
  right: 20px; bottom: 88px;
  width: 58px; height: 58px;
  border-radius: 50%;
  background: linear-gradient(180deg, var(--teal-500), var(--teal-600));
  color: white;
  border: 4px solid #fff;
  box-shadow: var(--sh-teal), 0 0 0 4px rgba(20,184,166,0.12);
  display: flex; align-items: center; justify-content: center;
  cursor: pointer;
  z-index: 450;
  transition: transform .15s var(--ease), filter .15s var(--ease);
}
.fab:hover { filter: brightness(1.05); }
.fab:active { transform: scale(0.94); }
.fab svg { width: 26px; height: 26px; }

/* RTL-aware: mirror FAB for AR when .rtl on html */
html.rtl body .fab, body.rtl .fab { right: auto; left: 20px; }

/* =====================================================
   Footer
   ===================================================== */

.app-footer {
  text-align: center;
  padding: 24px 20px 0;
  color: var(--text-400);
  font-size: var(--fs-xs);
  line-height: 1.6;
}
.app-footer p { margin: 4px 0; }

/* =====================================================
   Modals
   ===================================================== */

.modal-overlay {
  position: fixed; inset: 0;
  background: radial-gradient(circle at 50% 30%, rgba(10, 31, 60, 0.55), rgba(10, 31, 60, 0.85) 80%);
  display: flex; justify-content: center; align-items: center;
  z-index: 5000;
  padding: 20px;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  animation: fadeIn .2s var(--ease);
}
.modal-content {
  background: var(--surface);
  padding: 24px;
  border-radius: var(--r-xl);
  max-width: 520px;
  width: 100%;
  box-shadow: var(--sh-4);
  max-height: 86vh;
  display: flex; flex-direction: column;
  animation: modalIn .25s var(--ease);
  border: 1px solid var(--border);
}
@keyframes modalIn { from { transform: translateY(10px) scale(.98); opacity: 0; } to { transform: none; opacity: 1; } }

.modal-content h2 {
  font-size: var(--fs-lg);
  margin: 0 0 8px;
  font-weight: 800;
  color: var(--text-900);
  letter-spacing: -0.01em;
}
.modal-content h2::before {
  content: ''; display: inline-block; width: 6px; height: 22px;
  border-radius: 3px; background: linear-gradient(180deg, var(--rose-600), var(--amber-500));
  margin-right: 10px; vertical-align: -4px;
}
html.rtl .modal-content h2::before, body.rtl .modal-content h2::before { margin-right: 0; margin-left: 10px; }

.modal-body {
  overflow-y: auto;
  flex: 1;
  padding: 10px 4px;
  color: var(--text-700);
  font-size: var(--fs-sm);
}
.modal-body p { margin: 0 0 10px; line-height: 1.6; }
.modal-body hr { border: 0; border-top: 1px dashed var(--border); margin: 16px 0; }
.modal-body strong { color: var(--text-900); }

.modal-footer { margin-top: 14px; flex-shrink: 0; }
.modal-footer .btn { width: 100%; padding: 14px; border-radius: var(--r-md); font-size: var(--fs-sm); }

/* GI display */
#giDisplay {
  margin-bottom: 10px;
  font-weight: 700;
  font-size: var(--fs-sm);
  padding: 8px 12px;
  border-radius: 999px;
  display: inline-block;
  background: var(--amber-100);
  color: #92400E;
}
#giDisplay.low   { background: var(--emerald-100); color: #065F46; }
#giDisplay.high  { background: var(--rose-100);    color: #881337; }

#barcodeInfo { margin-bottom: 10px; font-size: var(--fs-xs); color: var(--text-500); }

/* =====================================================
   Utilities
   ===================================================== */

.hidden { display: none !important; }

.app-only-hidden { display: none !important; }
body.no-capacitor .app-only,
body.web-mode .app-only { display: none !important; }
.bottom-nav.bn-no-scan { grid-template-columns: repeat(4, 1fr) !important; }

@media (min-width: 1000px) {
  .bottom-nav.bn-no-scan { grid-template-columns: repeat(4, 1fr) !important; }
}
.text-center { text-align: center; }
.w-full { width: 100%; }
.flex { display: flex; align-items: center; gap: 10px; }
.flex-between { display: flex; justify-content: space-between; align-items: center; gap: 12px; }

.mt-2 { margin-top: 8px; }
.mt-4 { margin-top: 16px; }
.mb-0 { margin-bottom: 0; }
.mb-2 { margin-bottom: 8px; }

/* Tip box */
.tip-box {
  background: linear-gradient(135deg, #E0F2FE 0%, #CCFBF1 100%);
  border-left: 4px solid var(--teal-500);
  padding: 14px 16px;
  border-radius: var(--r-md);
  font-size: var(--fs-sm);
  color: var(--text-700);
}
html.rtl .tip-box, body.rtl .tip-box { border-left: none; border-right: 4px solid var(--teal-500); }

@keyframes fadeIn { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

/* =====================================================
   Responsive
   ===================================================== */

@media (max-width: 420px) {
  .app-header h1 { font-size: var(--fs-xl); }
  .app-header p { font-size: var(--fs-xs); }
  .card { padding: 16px; border-radius: var(--r-lg); }
  .stats-grid { grid-template-columns: repeat(2, 1fr); }
  .nav-actions { grid-template-columns: 1fr; }
}

@media (min-width: 900px) {
  .bottom-nav { max-width: 680px; bottom: 18px; }
  .fab { right: calc(50% - 420px); bottom: 96px; }
  html.rtl body .fab, body.rtl .fab { right: auto; left: calc(50% - 420px); }
}

/* =====================================================
   My Food — saved list item controls
   ===================================================== */

.food-list-item {
  padding: 14px 16px;
  border-bottom: 1px solid var(--surface-3);
  cursor: pointer;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  transition: background-color .15s var(--ease), padding-left .15s var(--ease);
  border-radius: 0;
}
.food-list-item:last-child { border-bottom: none; border-radius: 0 0 10px 10px; }
.food-list-item:first-child { border-radius: 10px 10px 0 0; }
.food-list-item:hover {
  background-color: var(--brand-50);
  padding-left: 20px;
}
.food-list-item .fli-name {
  font-weight: 700;
  color: var(--text-900);
  font-size: var(--fs-sm);
}
.food-list-item .fli-val {
  font-weight: 700;
  color: var(--brand-700);
  font-size: var(--fs-sm);
  background: var(--brand-50);
  padding: 4px 10px;
  border-radius: 8px;
  white-space: nowrap;
}
.food-list-item .fli-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.delete-btn {
  background: linear-gradient(180deg, var(--rose-600), #BE123C);
  color: white;
  border: none;
  padding: 7px 12px;
  border-radius: 10px;
  font-size: var(--fs-xs);
  font-weight: 700;
  margin-left: 10px;
  cursor: pointer;
  box-shadow: 0 2px 8px rgba(225,29,72,0.22);
  transition: transform .15s var(--ease), filter .15s var(--ease);
  font-family: inherit;
  letter-spacing: 0.01em;
}
.delete-btn:hover { filter: brightness(1.06); }
.delete-btn:active { transform: scale(0.96); }
