@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&family=Poppins:wght@500;600;700;800&display=swap');

:root {
  /* Brand Primary - Emerald */
  --primary: #10b981;
  --primary-dark: #059669;
  --primary-light: #ecfdf5;
  --primary-gradient: linear-gradient(135deg, #10b981 0%, #059669 100%);
  
  /* Brand Secondary/Action - Coral */
  --accent: #f97316;
  --accent-dark: #ea580c;
  --accent-light: #fff7ed;
  --accent-gradient: linear-gradient(135deg, #f97316 0%, #ea580c 100%);

  /* Neutrals - Slate */
  --text-main: #0f172a;
  --text-muted: #475569;
  --text-light: #94a3b8;
  
  /* Backgrounds & Borders */
  --bg-page: #f8fafc;
  --bg-card: #ffffff;
  --bg-subtle: #f1f5f9;
  --border-color: #e2e8f0;
  --border-focus: rgba(16, 185, 129, 0.4);

  /* Typography */
  --font-heading: 'Poppins', sans-serif;
  --font-body: 'Inter', sans-serif;

  /* Shadows */
  --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
  --shadow-float: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
  
  /* Geometry */
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-pill: 9999px;
  
  /* Utility Colors */
  --color-success: #10b981;
  --color-warning: #f59e0b;
  --color-danger: #ef4444;
  --color-info: #3b82f6;
}

/* ===== RESET & BASE ===== */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; overflow-x: hidden; }
body { 
  font-family: var(--font-body); 
  color: var(--text-main); 
  background: var(--bg-page); 
  line-height: 1.6; 
  min-height: 100vh; 
  display: flex; 
  flex-direction: column; 
  overflow-x: hidden;
}
h1, h2, h3, h4, h5, h6 { font-family: var(--font-heading); font-weight: 700; color: var(--text-main); }
a { color: var(--primary); text-decoration: none; transition: color 0.2s ease; }
a:hover { color: var(--primary-dark); }
img { max-width: 100%; height: auto; }
ul, ol { list-style: none; }
input, select, textarea, button { font-family: inherit; font-size: inherit; }

/* ===== UTILITIES ===== */
.container { max-width: 1200px; margin: 0 auto; padding: 0 1rem; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0,0,0,0); }

/* ===== HEADER ===== */
.header { 
  background: rgba(255, 255, 255, 0.95); 
  backdrop-filter: blur(10px); 
  box-shadow: var(--shadow-sm); 
  position: sticky; 
  top: 0; 
  z-index: 100; 
  border-bottom: 1px solid var(--border-color);
}
.header-inner { 
  display: flex; 
  align-items: center; 
  justify-content: space-between; 
  padding: 0.75rem 1rem; 
  max-width: 1400px; 
  margin: 0 auto; 
}
.logo { 
  display: flex; 
  align-items: center; 
  gap: 0.6rem; 
  font-family: var(--font-heading); 
  font-weight: 800; 
  font-size: 1.2rem; 
  color: var(--text-main); 
  letter-spacing: -0.02em;
}
.logo-icon { 
  width: 36px; 
  height: 36px; 
  background: var(--primary-gradient); 
  border-radius: 10px; 
  display: flex; 
  align-items: center; 
  justify-content: center; 
  color: #fff; 
  font-weight: 800; 
  font-size: 0.9rem;
  box-shadow: var(--shadow-sm);
}
.logo-img {
  height: 36px;
  width: auto;
}

.nav-desktop { display: none; gap: 0.25rem; }
.nav-btn { 
  background: none; 
  border: none; 
  padding: 0.6rem 1rem; 
  border-radius: var(--radius-pill); 
  cursor: pointer; 
  font-size: 0.9rem; 
  font-weight: 500;
  color: var(--text-muted); 
  display: flex; 
  align-items: center; 
  gap: 0.35rem; 
  transition: all 0.2s ease; 
  white-space: nowrap; 
}
.nav-btn:hover, .nav-btn.active { 
  background: var(--primary-light); 
  color: var(--primary-dark); 
}
.nav-btn svg { width: 14px; height: 14px; transition: transform 0.2s ease; }
.nav-btn.active svg { transform: rotate(180deg); }

.nav-dropdown { 
  position: absolute; 
  top: 100%; 
  left: 0; 
  right: 0; 
  background: rgba(255, 255, 255, 0.98); 
  backdrop-filter: blur(12px);
  box-shadow: 0 10px 30px rgba(0,0,0,0.08); 
  border-top: 1px solid var(--border-color); 
  display: none; 
  z-index: 99; 
  animation: fadeInDown 0.2s ease forwards;
}
.nav-dropdown.show { display: block; }
.nav-dropdown-inner { 
  max-width: 1400px; 
  margin: 0 auto; 
  padding: 1.5rem; 
  display: grid; 
  grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); 
  gap: 0.5rem; 
  max-height: 400px; 
  overflow-y: auto; 
}
.nav-dropdown a { 
  padding: 0.6rem 1rem; 
  border-radius: var(--radius-sm); 
  color: var(--text-muted); 
  font-weight: 500;
  font-size: 0.9rem; 
  transition: all 0.2s ease; 
  display: block;
}
.nav-dropdown a:hover { 
  background: var(--primary-light); 
  color: var(--primary-dark); 
  transform: translateX(3px);
}

.mobile-toggle { display: flex; background: none; border: none; padding: 0.5rem; cursor: pointer; color: var(--text-muted); }
.mobile-toggle svg { width: 28px; height: 28px; }
.mobile-nav { display: none; background: #fff; border-top: 1px solid var(--border-color); padding: 0.5rem 1rem; max-height: 70vh; overflow-y: auto; }
.mobile-nav.show { display: block; }
.mobile-cat-btn { 
  width: 100%; 
  text-align: left; 
  padding: 1rem 0.75rem; 
  background: none; 
  border: none; 
  border-bottom: 1px solid var(--bg-subtle); 
  font-size: 1rem; 
  font-weight: 600;
  color: var(--text-main); 
  cursor: pointer; 
  display: flex; 
  justify-content: space-between; 
  align-items: center; 
}
.mobile-cat-btn:hover { color: var(--primary); }
.mobile-cat-links { display: none; padding: 0.5rem 0 0.5rem 1rem; border-left: 2px solid var(--primary-light); margin-left: 0.5rem; }
.mobile-cat-links.show { display: block; }
.mobile-cat-links a { display: block; padding: 0.6rem 0.5rem; color: var(--text-muted); font-size: 0.9rem; font-weight: 500; }
.mobile-cat-links a:hover { color: var(--primary); }

@keyframes fadeInDown {
  from { opacity: 0; transform: translateY(-10px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ===== HERO ===== */
.hero { 
  background: var(--text-main);
  background-image: radial-gradient(circle at top right, #1e293b 0%, #0f172a 100%);
  color: #fff; 
  padding: 4rem 1rem; 
  text-align: center; 
  position: relative;
  overflow: hidden;
}
.hero::before {
  content: ''; position: absolute; top: -50%; left: -50%; width: 200%; height: 200%;
  background: radial-gradient(circle, rgba(16, 185, 129, 0.1) 0%, transparent 50%);
  pointer-events: none;
}
.hero h1 { color: #ffffff; font-size: 2.25rem; font-weight: 800; margin-bottom: 1rem; letter-spacing: -0.03em; line-height: 1.2; }
.hero p { color: rgba(255, 255, 255, 0.9); font-size: 1.1rem; max-width: 650px; margin: 0 auto 1.5rem; line-height: 1.6; }
.hero-buttons { display: flex; gap: 1rem; justify-content: center; flex-wrap: wrap; margin-top: 2rem; }

.btn { 
  display: inline-flex; 
  align-items: center; 
  justify-content: center;
  padding: 0.8rem 1.75rem; 
  border-radius: var(--radius-pill); 
  font-weight: 600; 
  font-size: 1rem; 
  border: none; 
  cursor: pointer; 
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1); 
  box-shadow: var(--shadow-md);
}
.btn:hover { transform: translateY(-2px); box-shadow: var(--shadow-lg); }
.btn:active { transform: translateY(0); }

.btn-white { background: #fff; color: var(--text-main); }
.btn-white:hover { background: var(--bg-subtle); color: var(--primary-dark); }
.btn-outline { background: transparent; border: 2px solid rgba(255,255,255,0.3); color: #fff; box-shadow: none; }
.btn-outline:hover { border-color: #fff; background: rgba(255,255,255,0.1); box-shadow: none; }
.btn-primary { background: var(--primary-gradient); color: #fff; }
.btn-primary:hover { filter: brightness(1.1); }
.btn-accent { background: var(--accent-gradient); color: #fff; }
.btn-accent:hover { filter: brightness(1.1); }

/* ===== SECTIONS ===== */
.section { padding: 4rem 1rem; }
.section-header { text-align: center; margin-bottom: 3rem; }
.section-header h2 { font-size: 2rem; font-weight: 800; color: var(--text-main); margin-bottom: 0.75rem; letter-spacing: -0.02em; }
.section-header p { color: var(--text-muted); font-size: 1.1rem; max-width: 600px; margin: 0 auto; }

/* ===== CARD GRID ===== */
.card-grid { 
  display: grid; 
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 280px), 1fr)); 
  gap: 1.5rem; 
  max-width: 1400px; 
  margin: 0 auto; 
}
.card { 
  background: var(--bg-card); 
  border-radius: var(--radius-lg); 
  padding: 1.5rem; 
  box-shadow: var(--shadow-sm); 
  border: 1px solid var(--border-color); 
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1); 
  display: flex;
  flex-direction: column;
  color: var(--text-main); 
}
.card:hover { 
  box-shadow: var(--shadow-float); 
  transform: translateY(-4px); 
  border-color: var(--primary-light);
}
.card-icon { font-size: 2.2rem; margin-bottom: 1rem; display: inline-block; }
.card h3 { font-size: 1.15rem; font-weight: 700; margin-bottom: 0.5rem; }
.card p { font-size: 0.9rem; color: var(--text-muted); line-height: 1.6; }

/* ===== CALCULATOR ===== */
.calc-wrap { max-width: 800px; margin: 0 auto; }
.calc-card { 
  background: var(--bg-card); 
  border-radius: var(--radius-lg); 
  padding: 2rem; 
  box-shadow: var(--shadow-lg); 
  border: 1px solid var(--border-color); 
  margin-bottom: 2rem; 
}
.calc-card h3 { font-size: 1.25rem; font-weight: 700; margin-bottom: 1.5rem; color: var(--text-main); border-bottom: 2px solid var(--bg-subtle); padding-bottom: 0.75rem; }

.field-group { margin-bottom: 1.25rem; }
.field-group label { display: block; font-size: 0.9rem; font-weight: 600; color: var(--text-muted); margin-bottom: 0.5rem; }
.field-group input, .field-group select { 
  width: 100%; 
  padding: 0.75rem 1rem; 
  border: 2px solid var(--border-color); 
  border-radius: var(--radius-md); 
  font-size: 1rem; 
  font-weight: 500;
  transition: all 0.2s ease; 
  background: var(--bg-page); 
  color: var(--text-main);
}
.field-group input:focus, .field-group select:focus { 
  outline: none; 
  border-color: var(--primary); 
  background: #fff;
  box-shadow: 0 0 0 4px var(--border-focus); 
}

/* Calculate Button */
.calc-btn { 
  width: 100%; 
  padding: 1rem; 
  background: var(--accent-gradient); 
  color: #fff; 
  border: none; 
  border-radius: var(--radius-md); 
  font-family: var(--font-heading);
  font-weight: 700; 
  font-size: 1.1rem; 
  letter-spacing: 0.02em;
  cursor: pointer; 
  transition: all 0.3s ease; 
  margin-top: 1rem; 
  box-shadow: var(--shadow-md);
}
.calc-btn:hover { 
  transform: translateY(-2px); 
  box-shadow: var(--shadow-lg); 
  filter: brightness(1.05);
}

.result-card { 
  text-align: center; 
  padding: 2rem; 
  background: var(--bg-card); 
  border-radius: var(--radius-lg); 
  border: 2px solid var(--primary-light); 
  box-shadow: var(--shadow-md);
}
.result-value { font-family: var(--font-heading); font-size: 3rem; font-weight: 800; line-height: 1.1; color: var(--primary-dark); }
.result-label { font-size: 1rem; font-weight: 500; color: var(--text-muted); margin-top: 0.5rem; }
.result-unit { font-size: 1.1rem; color: var(--text-light); font-weight: 600; }

.result-badge { 
  display: inline-block; 
  padding: 0.4rem 1rem; 
  border-radius: var(--radius-pill); 
  font-size: 0.9rem; 
  font-weight: 700; 
  margin-top: 1rem; 
  letter-spacing: 0.02em;
}
.badge-green { background: var(--primary-light); color: var(--primary-dark); }
.badge-blue { background: #eff6ff; color: #1d4ed8; }
.badge-yellow { background: #fffbeb; color: #b45309; }
.badge-orange { background: var(--accent-light); color: var(--accent-dark); }
.badge-red { background: #fef2f2; color: #b91c1c; }

.result-extras { display: flex; justify-content: center; gap: 2.5rem; margin-top: 1.5rem; padding-top: 1.5rem; border-top: 1px solid var(--border-color); flex-wrap: wrap; }
.result-extra { text-align: center; }
.result-extra .label { font-size: 0.85rem; font-weight: 500; color: var(--text-light); text-transform: uppercase; letter-spacing: 0.05em; margin-bottom: 0.25rem;}
.result-extra .value { font-size: 1.1rem; font-weight: 700; color: var(--text-main); }

/* ===== RESTAURANT CALCULATOR ===== */
.cat-tabs { display: flex; gap: 0.5rem; margin-bottom: 1.5rem; flex-wrap: wrap; }
.cat-tab { 
  padding: 0.6rem 1.25rem; 
  border: 1px solid var(--border-color); 
  border-radius: var(--radius-pill); 
  background: var(--bg-card); 
  cursor: pointer; 
  font-size: 0.9rem; 
  font-weight: 600;
  color: var(--text-muted); 
  transition: all 0.2s ease; 
}
.cat-tab:hover { border-color: var(--primary); color: var(--primary); }
.cat-tab.active { background: var(--primary); color: #fff; border-color: var(--primary); box-shadow: var(--shadow-sm); }

.menu-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 1rem; margin-bottom: 2rem; max-height: 600px; overflow-y: auto; padding-right: 0.25rem; scrollbar-width: thin; }
.menu-item { 
  padding: 1rem; 
  border: 2px solid var(--border-color); 
  border-radius: var(--radius-md); 
  cursor: pointer; 
  transition: all 0.2s ease; 
  background: var(--bg-card); 
}
.menu-item:hover { border-color: var(--primary); background: var(--primary-light); transform: translateY(-2px); box-shadow: var(--shadow-md); }
.menu-item h4 { font-size: 1rem; font-weight: 700; color: var(--text-main); display: flex; justify-content: space-between; align-items: flex-start; gap: 0.5rem; }
.menu-item h4 span { color: var(--primary-dark); font-weight: 800; background: var(--primary-light); padding: 0.1rem 0.5rem; border-radius: 4px;}
.menu-item .macros { font-size: 0.8rem; font-weight: 500; color: var(--text-muted); margin-top: 0.5rem; display: flex; gap: 0.5rem; }

.detail-card { 
  background: var(--bg-card); 
  border-radius: var(--radius-lg); 
  padding: 1.5rem; 
  box-shadow: var(--shadow-lg); 
  border: 1px solid var(--border-color); 
  margin-bottom: 1.5rem; 
  position: relative; 
}
.detail-card h3 { font-size: 1.25rem; font-weight: 800; margin-bottom: 1rem; padding-right: 2rem;}
.detail-close { position: absolute; top: 1rem; right: 1rem; background: var(--bg-subtle); border: none; font-size: 1.25rem; cursor: pointer; color: var(--text-muted); width: 32px; height: 32px; display: flex; align-items: center; justify-content: center; border-radius: 50%; transition: all 0.2s; }
.detail-close:hover { background: #fee2e2; color: #ef4444; }

.nutrition-pills { display: flex; gap: 0.5rem; flex-wrap: wrap; margin-bottom: 1.5rem; }
.nutrition-pill { text-align: center; padding: 0.6rem 0.75rem; border-radius: var(--radius-md); min-width: 70px; flex: 1; }
.nutrition-pill .val { font-weight: 800; font-size: 1.1rem; }
.nutrition-pill .lbl { font-size: 0.7rem; font-weight: 600; text-transform: uppercase; letter-spacing: 0.05em; margin-top: 0.1rem;}

.pill-cal { background: #eff6ff; color: #1d4ed8; }
.pill-pro { background: var(--primary-light); color: var(--primary-dark); }
.pill-carb { background: #fefce8; color: #a16207; }
.pill-fat { background: #fef2f2; color: #b91c1c; }
.pill-fib { background: #f0fdf4; color: #15803d; }
.pill-sod { background: #fdf2f8; color: #be185d; }

.add-meal-btn { width: 100%; padding: 0.85rem; background: var(--primary); color: #fff; border: none; border-radius: var(--radius-md); font-weight: 700; font-size: 1rem; cursor: pointer; transition: all 0.2s; box-shadow: var(--shadow-md);}
.add-meal-btn:hover { background: var(--primary-dark); transform: translateY(-1px); }

.meal-summary { background: var(--bg-card); border-radius: var(--radius-lg); padding: 1.5rem; border: 2px solid var(--border-color); box-shadow: var(--shadow-md); position: sticky; top: 80px;}
.meal-summary h3 { font-size: 1.25rem; font-weight: 800; margin-bottom: 1.25rem; display: flex; justify-content: space-between; align-items: center; border-bottom: 2px solid var(--bg-subtle); padding-bottom: 0.75rem;}
.meal-totals { display: flex; gap: 0.75rem; flex-wrap: wrap; margin-bottom: 1.5rem; }
.meal-total { text-align: center; flex: 1; min-width: 65px; padding: 0.75rem 0.5rem; border-radius: var(--radius-md); background: var(--bg-subtle); }
.meal-total .num { font-weight: 800; font-size: 1.2rem; color: var(--text-main); }
.meal-total .lbl { font-size: 0.75rem; font-weight: 600; color: var(--text-muted); text-transform: uppercase; margin-top: 0.2rem;}

.meal-items-list { margin-top: 1rem; }
.meal-item-row { display: flex; justify-content: space-between; align-items: center; padding: 0.75rem 0; border-bottom: 1px solid var(--border-color); font-size: 0.9rem; font-weight: 500;}
.meal-item-row:last-child { border-bottom: none; }
.remove-btn { background: #fee2e2; border: none; color: #ef4444; cursor: pointer; font-size: 0.75rem; font-weight: 700; padding: 0.25rem 0.5rem; border-radius: 4px; transition: all 0.2s;}
.remove-btn:hover { background: #fca5a5; color: #991b1b; }

/* Additional pill colors */
.pill-sug { background: #fff7ed; color: #c2410c; }
.pill-chol { background: #faf5ff; color: #7e22ce; }
.pill-sfat { background: #fff1f2; color: #9f1239; }
.pill-caff { background: #f0fdfa; color: #0f766e; }

/* Restaurant search & layout */
.menu-item.selected { border-color: var(--primary); background: var(--primary-light); box-shadow: 0 0 0 2px var(--primary); }
.menu-item-header { display: flex; justify-content: space-between; align-items: flex-start; gap: 0.5rem; }
.menu-item-header h4 { font-size: 0.95rem; font-weight: 700; color: var(--text-main); flex: 1; }
.menu-item-cal { font-size: 1.1rem; font-weight: 800; color: var(--primary-dark); margin: 0.25rem 0; }
.item-price { font-size: 0.8rem; font-weight: 700; color: var(--primary-dark); background: var(--primary-light); padding: 0.15rem 0.5rem; border-radius: 4px; white-space: nowrap; }
.item-desc { font-size: 0.9rem; color: var(--text-muted); margin-bottom: 0.75rem; line-height: 1.5; }
.item-size { font-size: 0.85rem; color: var(--text-light); margin-bottom: 0.5rem; }
.item-price-detail { font-size: 0.95rem; font-weight: 600; color: var(--primary-dark); margin-bottom: 0.75rem; }
.macro-pro { color: var(--primary-dark); }
.macro-carb { color: #a16207; }
.macro-fat { color: #b91c1c; }

.cat-tabs-scroll { display: flex; gap: 0.5rem; flex-wrap: wrap; margin-bottom: 0.75rem; max-height: 160px; overflow-y: auto; }
.cat-count { font-size: 0.7rem; opacity: 0.7; margin-left: 0.25rem; }
.rest-search { margin-bottom: 1rem; }
.rest-search-input { width: 100%; padding: 0.75rem 1rem; border: 2px solid var(--border-color); border-radius: var(--radius-md); font-size: 0.9rem; background: var(--bg-card); transition: border-color 0.2s; }
.rest-search-input:focus { border-color: var(--primary); outline: none; box-shadow: 0 0 0 3px rgba(16,185,129,0.15); }

.meal-count { font-size: 0.85rem; font-weight: 500; color: var(--text-muted); }
.meal-progress { height: 8px; background: var(--bg-subtle); border-radius: 4px; margin-bottom: 0.5rem; overflow: hidden; }
.meal-progress-bar { height: 100%; background: linear-gradient(90deg, var(--primary), var(--primary-dark)); border-radius: 4px; transition: width 0.3s ease; }
.meal-progress-text { font-size: 0.8rem; color: var(--text-muted); text-align: center; margin-bottom: 1rem; }
.meal-item-name { flex: 1; }
.meal-item-cal { font-weight: 700; color: var(--primary-dark); margin: 0 0.75rem; white-space: nowrap; }
.reset-btn { background: #fee2e2; border: none; color: #ef4444; cursor: pointer; font-size: 0.8rem; font-weight: 700; padding: 0.3rem 0.75rem; border-radius: var(--radius-md); transition: all 0.2s;}
.reset-btn:hover { background: #fca5a5; color: #991b1b; }

/* ===== FDA NUTRITION FACTS LABEL ===== */
.nf-label {
  max-width: 340px;
  border: 2px solid #333;
  padding: 0.75rem 1rem;
  font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif;
  margin: 1.5rem auto;
  background: #fff;
  border-radius: 4px;
}
.nf-title {
  font-size: 1.75rem;
  font-weight: 900;
  letter-spacing: -0.05em;
  margin-bottom: 0.25rem;
  color: #000;
}
.nf-serving { font-size: 0.85rem; color: #333; margin-bottom: 0.25rem; }
.nf-divider-thick { height: 8px; background: #333; margin: 0.35rem 0; }
.nf-divider-medium { height: 4px; background: #333; margin: 0.2rem 0; }
.nf-divider-thin { height: 1px; background: #ccc; margin: 0.15rem 0; }
.nf-cal-row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  padding: 0.25rem 0;
}
.nf-cal-label { font-size: 0.9rem; font-weight: 900; color: #000; }
.nf-cal-val { font-size: 2rem; font-weight: 900; color: #000; }
.nf-dv-header { text-align: right; font-size: 0.8rem; font-weight: 700; color: #000; padding: 0.15rem 0; }
.nf-row {
  display: flex;
  justify-content: space-between;
  font-size: 0.85rem;
  color: #000;
  padding: 0.15rem 0;
}
.nf-row strong { font-weight: 900; }
.nf-indent { padding-left: 1.5rem; }
.nf-footnote {
  font-size: 0.7rem;
  color: #666;
  line-height: 1.4;
  margin-top: 0.5rem;
  padding-top: 0.35rem;
  border-top: 1px solid #ccc;
}

.reset-btn { background: none; border: none; color: var(--text-muted); cursor: pointer; font-size: 0.85rem; font-weight: 600; transition: color 0.2s;}
.reset-btn:hover { color: #ef4444; text-decoration: underline; }
.empty-msg { color: var(--text-light); font-size: 0.95rem; text-align: center; padding: 2rem 1rem; font-weight: 500; font-style: italic;}

/* ===== NUTRITION SEARCH ===== */
.search-input { 
  width: 100%; padding: 1rem 1.25rem; border: 2px solid var(--border-color); border-radius: var(--radius-md); font-size: 1.1rem; font-weight: 500; transition: all 0.2s; box-shadow: var(--shadow-sm);
}
.search-input:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 4px var(--border-focus); }
.search-results { margin-top: 0.5rem; border: 1px solid var(--border-color); border-radius: var(--radius-md); max-height: 250px; overflow-y: auto; display: none; background: #fff; box-shadow: var(--shadow-lg);}
.search-results.show { display: block; }
.search-result-item { padding: 0.85rem 1rem; cursor: pointer; display: flex; justify-content: space-between; border-bottom: 1px solid var(--bg-subtle); font-size: 0.95rem; font-weight: 500;}
.search-result-item:hover { background: var(--bg-subtle); color: var(--primary-dark); }
.search-result-item .kcal { color: var(--primary); font-weight: 700; white-space: nowrap; }

/* ===== CONTACT FORM ===== */
.contact-form input, .contact-form textarea { margin-bottom: 1.25rem; }
.contact-form textarea { min-height: 150px; resize: vertical; }
.success-msg { text-align: center; padding: 3rem 2rem; background: var(--bg-card); border-radius: var(--radius-lg); box-shadow: var(--shadow-md);}
.success-icon { width: 64px; height: 64px; background: var(--primary-light); border-radius: 50%; display: flex; align-items: center; justify-content: center; margin: 0 auto 1rem; color: var(--primary); font-size: 2rem; }

/* ===== STATIC PAGE CONTENT ===== */
.content-section { max-width: 800px; margin: 0 auto; padding: 3rem 1rem; background: var(--bg-card); border-radius: var(--radius-lg); box-shadow: var(--shadow-sm); margin-top: 2rem; margin-bottom: 2rem;}
.content-section h2 { font-size: 1.75rem; margin: 2rem 0 1rem; color: var(--text-main); letter-spacing: -0.01em;}
.content-section h3 { font-size: 1.35rem; margin: 1.5rem 0 0.75rem; }
.content-section p { font-size: 1.05rem; color: var(--text-muted); margin-bottom: 1.25rem; line-height: 1.8; }
.content-section ul, .content-section ol { padding-left: 1.5rem; margin-bottom: 1.25rem; font-size: 1.05rem; color: var(--text-muted); line-height: 1.8;}
.content-section li { margin-bottom: 0.5rem; }
.content-section strong { color: var(--text-main); font-weight: 700;}

/* ===== HOW-TO STEPS ===== */
.steps-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 1.5rem; margin: 3rem 0; }
.step-card { text-align: center; padding: 2rem 1.5rem; background: var(--bg-card); border-radius: var(--radius-lg); box-shadow: var(--shadow-sm); border: 1px solid var(--border-color);}
.step-num { width: 48px; height: 48px; background: var(--primary-light); color: var(--primary-dark); border-radius: 50%; display: flex; align-items: center; justify-content: center; font-weight: 800; font-size: 1.25rem; margin: 0 auto 1rem; }
.step-card h3 { font-size: 1.1rem; margin-bottom: 0.5rem; }

/* ===== FOOTER ===== */
.footer { background: var(--text-main); color: var(--text-light); padding: 4rem 1rem 2rem; margin-top: auto; }
.footer-inner { max-width: 1200px; margin: 0 auto; display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 3rem; }
.footer-brand .logo { color: #fff; margin-bottom: 1rem; }
.footer-brand p { font-size: 0.95rem; line-height: 1.7; opacity: 0.8;}
.footer h4 { color: #fff; font-size: 1.05rem; font-weight: 700; margin-bottom: 1.25rem; letter-spacing: 0.02em;}
.footer ul li { margin-bottom: 0.6rem; }
.footer ul li a { color: var(--text-light); font-size: 0.95rem; font-weight: 500; transition: color 0.2s; }
.footer ul li a:hover { color: var(--primary-light); text-decoration: underline;}
.footer-bottom { max-width: 1200px; margin: 3rem auto 0; padding-top: 1.5rem; border-top: 1px solid rgba(255,255,255,0.1); text-align: center; font-size: 0.85rem; font-weight: 500;}

/* ===== ENHANCED CALCULATOR RESULTS ===== */
.results-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 1.25rem; margin-bottom: 2rem; }
.result-mini { background: #fff; border-radius: var(--radius-lg); padding: 1.5rem; border: 2px solid var(--border-color); text-align: center; transition: all 0.3s ease; box-shadow: var(--shadow-sm);}
.result-mini:hover { transform: translateY(-3px); box-shadow: var(--shadow-md); }
.result-mini .r-icon { font-size: 1.75rem; margin-bottom: 0.5rem; display: inline-block;}
.result-mini .r-val { font-family: var(--font-heading); font-size: 1.75rem; font-weight: 800; color: var(--text-main); line-height: 1.2; word-break: break-word; }
.result-mini .r-label { font-size: 0.85rem; font-weight: 600; color: var(--text-muted); margin-top: 0.25rem; text-transform: uppercase; letter-spacing: 0.05em;}
.result-mini .r-sub { font-size: 0.8rem; margin-top: 0.5rem; font-weight: 700; }
.result-mini .r-unit { font-size: 0.75rem; font-weight: 600; color: var(--text-light); }

.result-mini.primary { border-color: var(--primary); background: var(--primary-light); }
.result-mini.success { border-color: #059669; background: #ecfdf5; }
.result-mini.warning { border-color: #d97706; background: #fffbeb; }
.result-mini.danger { border-color: #dc2626; background: #fef2f2; }
.result-mini.info { border-color: #2563eb; background: #eff6ff; }
.result-mini.pink { border-color: #db2777; background: #fdf2f8; }

/* Visual BMI/Progress Scale */
.visual-scale { margin: 2rem 0; padding: 0 0.5rem; }
.scale-bar { height: 16px; border-radius: var(--radius-pill); background: linear-gradient(90deg, #3b82f6 0%, #10b981 25%, #f59e0b 55%, #f97316 75%, #ef4444 100%); position: relative; margin-bottom: 2rem; box-shadow: inset 0 2px 4px rgba(0,0,0,0.1);}
.scale-marker { position: absolute; top: -8px; width: 32px; height: 32px; background: var(--text-main); border: 4px solid #fff; border-radius: 50%; transform: translateX(-50%); box-shadow: var(--shadow-md); transition: left 0.6s cubic-bezier(0.34, 1.56, 0.64, 1); z-index: 2;}
.scale-labels { display: flex; justify-content: space-between; font-size: 0.75rem; font-weight: 600; color: var(--text-muted); }
.scale-label { text-align: center; }
.scale-label.active { color: var(--text-main); font-weight: 800; transform: scale(1.1); transition: all 0.3s;}

/* Macro Bars */
.macro-bars { margin: 1.5rem 0; }
.macro-bar-row { margin-bottom: 1rem; }
.macro-bar-header { display: flex; justify-content: space-between; font-size: 0.95rem; font-weight: 600; margin-bottom: 0.4rem; }
.macro-bar-header .m-name { color: var(--text-main); }
.macro-bar-header .m-val { color: var(--text-muted); }
.macro-bar-track { height: 12px; background: var(--bg-subtle); border-radius: var(--radius-pill); overflow: hidden; box-shadow: inset 0 1px 2px rgba(0,0,0,0.05);}
.macro-bar-fill { height: 100%; border-radius: var(--radius-pill); transition: width 0.8s cubic-bezier(0.4, 0, 0.2, 1); }
.macro-bar-fill.protein { background: linear-gradient(90deg, #10b981, #059669); }
.macro-bar-fill.carbs { background: linear-gradient(90deg, #f59e0b, #d97706); }
.macro-bar-fill.fat { background: linear-gradient(90deg, #ef4444, #dc2626); }
.macro-bar-fill.fiber { background: linear-gradient(90deg, #3b82f6, #2563eb); }

/* Unit Switcher */
.unit-switcher { display: inline-flex; background: var(--bg-subtle); border-radius: var(--radius-md); padding: 4px; margin-bottom: 1.5rem; box-shadow: inset 0 1px 2px rgba(0,0,0,0.05);}
.unit-btn { padding: 0.5rem 1.25rem; border: none; background: transparent; border-radius: var(--radius-sm); cursor: pointer; font-size: 0.95rem; font-weight: 600; color: var(--text-muted); transition: all 0.2s; }
.unit-btn.active { background: #fff; color: var(--primary-dark); box-shadow: var(--shadow-sm); }

/* Tooltip */
.tooltip-wrap { position: relative; display: inline-flex; align-items: center; gap: 0.35rem; }
.tooltip-icon { width: 18px; height: 18px; background: var(--border-color); border-radius: 50%; display: inline-flex; align-items: center; justify-content: center; font-size: 0.75rem; color: var(--text-muted); cursor: help; font-weight: 800; transition: all 0.2s;}
.tooltip-wrap:hover .tooltip-icon { background: var(--primary); color: #fff; }
.tooltip-text { display: none; position: absolute; bottom: calc(100% + 10px); left: 50%; transform: translateX(-50%); background: var(--text-main); color: #fff; padding: 0.75rem 1rem; border-radius: var(--radius-sm); font-size: 0.85rem; font-weight: 500; z-index: 10; min-width: 200px; text-align: center; box-shadow: var(--shadow-lg); line-height: 1.4;}
.tooltip-wrap:hover .tooltip-text { display: block; animation: fadeInDown 0.2s ease forwards; }

/* FAQ Accordion */
.faq-section { margin-top: 3rem; }
.faq-section h2 { font-size: 1.75rem; font-weight: 800; color: var(--text-main); margin-bottom: 1.5rem; text-align: center;}
.faq-item { border: 1px solid var(--border-color); border-radius: var(--radius-lg); margin-bottom: 1rem; overflow: hidden; background: #fff; box-shadow: var(--shadow-sm); transition: all 0.2s;}
.faq-item:hover { border-color: var(--primary-light); }
.faq-q { width: 100%; padding: 1.25rem 1.5rem; background: none; border: none; text-align: left; cursor: pointer; font-size: 1rem; font-weight: 700; color: var(--text-main); display: flex; justify-content: space-between; align-items: center; transition: background 0.2s; gap: 1rem; }
.faq-q:hover { background: var(--bg-page); color: var(--primary); }
.faq-q .faq-arrow { transition: transform 0.3s; font-size: 0.9rem; color: var(--text-light); }
.faq-q.open .faq-arrow { transform: rotate(180deg); color: var(--primary); }
.faq-a { padding: 0 1.5rem; max-height: 0; overflow: hidden; transition: max-height 0.3s ease, padding 0.3s ease; }
.faq-a.open { max-height: 600px; padding: 0 1.5rem 1.5rem; }
.faq-a p { color: var(--text-muted); font-size: 0.95rem; line-height: 1.8; }

/* Medical Disclaimer */
.disclaimer-box { margin-top: 2rem; padding: 1.25rem 1.5rem; background: #fffbeb; border: 2px solid #fde68a; border-radius: var(--radius-lg); font-size: 0.9rem; color: #92400e; line-height: 1.6; font-weight: 500;}
.disclaimer-box strong { color: #78350f; font-weight: 800;}

/* Clinical Risk Section */
.risk-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 1rem; margin: 1.5rem 0; }
.risk-item { padding: 1rem 1.25rem; border-radius: var(--radius-md); border: 1px solid var(--border-color); background: #fff; box-shadow: var(--shadow-sm);}
.risk-item .risk-label { font-size: 0.8rem; font-weight: 600; color: var(--text-muted); text-transform: uppercase; margin-bottom: 0.35rem; }
.risk-item .risk-value { font-size: 1.1rem; font-weight: 800; }
.risk-item.low { border-left: 5px solid #10b981; } .risk-item.low .risk-value { color: #059669; }
.risk-item.moderate { border-left: 5px solid #f59e0b; } .risk-item.moderate .risk-value { color: #d97706; }
.risk-item.high { border-left: 5px solid #ef4444; } .risk-item.high .risk-value { color: #dc2626; }

/* Related Calculators */
.related-section { margin-top: 4rem; padding-top: 3rem; border-top: 2px solid var(--border-color); }
.related-section h2 { font-size: 1.75rem; font-weight: 800; color: var(--text-main); margin-bottom: 1.5rem; }
.related-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 1.25rem; }
.related-card { display: flex; align-items: center; gap: 1rem; padding: 1rem 1.25rem; background: #fff; border: 2px solid var(--border-color); border-radius: var(--radius-md); transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1); color: var(--text-main); font-weight: 600;}
.related-card:hover { border-color: var(--primary); background: var(--primary-light); transform: translateY(-2px); box-shadow: var(--shadow-md); color: var(--primary-dark);}
.related-card .rc-icon { font-size: 1.5rem; flex-shrink: 0; }
.related-card .rc-text { font-size: 0.95rem; }

/* Gender Toggle */
.gender-toggle { display: flex; gap: 0.75rem; margin-bottom: 1.25rem; }
.gender-btn { flex: 1; padding: 0.85rem; border: 2px solid var(--border-color); border-radius: var(--radius-md); background: #fff; cursor: pointer; font-size: 1rem; font-weight: 700; color: var(--text-muted); text-align: center; transition: all 0.2s; box-shadow: var(--shadow-sm);}
.gender-btn.active { border-color: var(--primary); color: var(--primary-dark); background: var(--primary-light); box-shadow: 0 0 0 2px var(--border-focus);}
.gender-btn:hover:not(.active) { border-color: var(--text-light); color: var(--text-main);}

/* ===== HOMEPAGE SEARCH & MEAL TRACKER ===== */
.search-section { display: grid; grid-template-columns: 1fr; gap: 2rem; max-width: 1200px; margin: 0 auto 3rem; }
@media (min-width: 992px) { .search-section { grid-template-columns: 1fr 1fr; } }
.search-card, .meal-tracker { background: var(--bg-card); padding: 2rem; border-radius: var(--radius-lg); border: 1px solid var(--border-color); box-shadow: var(--shadow-sm); }
.search-card h3, .meal-tracker h3 { font-size: 1.35rem; font-weight: 800; color: var(--text-main); margin-bottom: 0.5rem; }
.search-card p, .meal-tracker p { color: var(--text-muted); font-size: 0.95rem; margin-bottom: 1.5rem; }
.food-detail { margin-top: 1.5rem; padding: 1.5rem; background: var(--bg-subtle); border-radius: var(--radius-md); border-left: 4px solid var(--primary); display: none; }
.food-detail.show { display: block; }
.food-detail h4 { font-size: 1.1rem; font-weight: 700; margin-bottom: 0.75rem; color: var(--text-main); }
.food-detail .macros { display: flex; gap: 1rem; flex-wrap: wrap; margin-bottom: 1rem; }
.food-detail .macro { font-size: 0.9rem; font-weight: 600; color: var(--text-muted); }
.food-detail .macro span { color: var(--text-main); font-weight: 800; }

.qty-row { display: flex; align-items: center; gap: 0.75rem; margin: 1.5rem 0; font-weight: 600; color: var(--text-main); }
.qty-row input[type="number"] { padding: 0.4rem 0.5rem; border: 2px solid var(--border-color); border-radius: var(--radius-sm); font-size: 1rem; font-weight: 700; text-align: center; color: var(--text-main); transition: all 0.2s ease; outline: none; }
.qty-row input[type="number"]:focus { border-color: var(--primary); box-shadow: 0 0 0 3px var(--border-focus); }

.add-food-btn { padding: 0.75rem 1.25rem; background: var(--primary-gradient); color: #fff; border: none; border-radius: var(--radius-pill); font-weight: 700; font-family: var(--font-heading); font-size: 1rem; cursor: pointer; transition: all 0.2s; box-shadow: var(--shadow-sm); }
.add-food-btn:hover { transform: translateY(-2px); box-shadow: var(--shadow-md); filter: brightness(1.05); }

/* Progress Bar */
.progress-bar { height: 12px; background: var(--bg-subtle); border-radius: var(--radius-pill); overflow: hidden; margin-bottom: 0.5rem; box-shadow: inset 0 1px 2px rgba(0,0,0,0.05); }
.progress-fill { height: 100%; background: var(--primary-gradient); transition: width 0.4s ease; border-radius: var(--radius-pill); }
.goal-text { display: flex; justify-content: space-between; font-size: 0.85rem; font-weight: 600; color: var(--text-muted); margin-bottom: 1.5rem; }

/* Meal Table */
.meal-table { width: 100%; border-collapse: collapse; margin-top: 1rem; font-size: 0.9rem; }
.meal-table th { text-align: left; padding: 0.75rem 0.5rem; border-bottom: 2px solid var(--border-color); color: var(--text-main); font-weight: 700; }
.meal-table td { padding: 0.75rem 0.5rem; border-bottom: 1px solid var(--border-color); color: var(--text-muted); font-weight: 500; }
.meal-table tbody tr:hover td { background: var(--bg-subtle); color: var(--text-main); }
.meal-table tfoot td { font-weight: 800; color: var(--text-main); border-bottom: none; border-top: 2px solid var(--border-color); padding-top: 1rem; }
.remove-food-btn { background: #fee2e2; border: none; color: #ef4444; width: 24px; height: 24px; border-radius: 50%; display: flex; align-items: center; justify-content: center; cursor: pointer; font-weight: bold; font-size: 0.8rem; transition: all 0.2s; }
.remove-food-btn:hover { background: #ef4444; color: #fff; }

/* ===== INFO CARDS ===== */
.info-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 1.25rem; margin: 2rem 0; }
.info-card { background: var(--bg-card); padding: 1.5rem; border-radius: var(--radius-md); border: 1px solid var(--border-color); box-shadow: var(--shadow-sm); transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1); }
.info-card:hover { transform: translateY(-3px); box-shadow: var(--shadow-md); border-color: var(--primary-light); }
.info-card h4 { font-size: 1.1rem; font-weight: 700; color: var(--text-main); margin-bottom: 0.5rem; display: flex; align-items: center; gap: 0.5rem;}
.info-card p { font-size: 0.95rem; color: var(--text-muted); line-height: 1.6; margin: 0; }

/* ===== MENU PAGE ===== */
.menu-categories { display: flex; gap: 0.5rem; flex-wrap: wrap; margin-bottom: 2rem; justify-content: center; }
.menu-cat-btn { padding: 0.6rem 1.25rem; border: 1px solid var(--border-color); border-radius: var(--radius-pill); background: var(--bg-card); cursor: pointer; font-size: 0.95rem; font-weight: 600; color: var(--text-muted); transition: all 0.2s ease; box-shadow: var(--shadow-sm); }
.menu-cat-btn:hover { border-color: var(--primary); color: var(--primary-dark); }
.menu-cat-btn.active { background: var(--primary); color: #fff; border-color: var(--primary); box-shadow: var(--shadow-md); }
.menu-items-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 1.25rem; }
.menu-page-item { padding: 1.25rem; background: var(--bg-card); border: 1px solid var(--border-color); border-radius: var(--radius-md); box-shadow: var(--shadow-sm); transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1); }
.menu-page-item:hover { transform: translateY(-3px); box-shadow: var(--shadow-md); border-color: var(--primary-light); background: var(--bg-subtle); }
.menu-page-item h4 { font-size: 1.05rem; font-weight: 700; color: var(--text-main); display: flex; justify-content: space-between; align-items: flex-start; margin-bottom: 0.5rem; gap: 1rem; }
.menu-page-item h4 span { color: var(--primary-dark); font-weight: 800; font-family: var(--font-heading); background: var(--primary-light); padding: 0.15rem 0.6rem; border-radius: 6px; }
.menu-page-item .desc { font-size: 0.9rem; color: var(--text-muted); line-height: 1.5; }

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

/* 1. Very Small Screens (Phones, < 480px) */
@media (max-width: 479px) {
  .hero { padding: 3rem 1rem; }
  .hero h1 { font-size: 1.75rem; }
  .hero p { font-size: 1rem; }
  .section { padding: 2.5rem 1rem; }
  .result-value { font-size: 2.25rem; }
  .card-grid, .menu-grid, .related-grid, .risk-grid { grid-template-columns: 1fr; }
  .nutrition-pills { gap: 0.35rem; justify-content: space-between; }
  .nutrition-pill { padding: 0.5rem 0.35rem; min-width: 0; flex: 1; }
  .nutrition-pill .val { font-size: 0.9rem; }
  .nutrition-pill .lbl { font-size: 0.65rem; }
  .meal-totals { gap: 0.5rem; }
  .meal-total { padding: 0.5rem; }
  .btn { width: 100%; justify-content: center; }
  .hero-buttons { flex-direction: column; width: 100%; }
  .calc-card, .result-card, .detail-card { padding: 1.25rem; }
  .results-grid { grid-template-columns: 1fr 1fr; gap: 0.75rem; }
  .result-mini { padding: 1rem; }
  .result-mini .r-icon { font-size: 1.5rem; }
  .result-mini .r-val { font-size: 1.5rem; }
  .scale-labels { font-size: 0.65rem; }
  .footer-inner { grid-template-columns: 1fr; gap: 2rem; text-align: center; }
  .nav-dropdown-inner { grid-template-columns: 1fr; }
}

/* 2. Small Screens (Large Phones/Small Tablets, 480px - 767px) */
@media (min-width: 480px) and (max-width: 767px) {
  .hero h1 { font-size: 2.25rem; }
  .card-grid { grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); }
  .results-grid { grid-template-columns: repeat(2, 1fr); }
  .footer-inner { grid-template-columns: 1fr 1fr; }
}

/* 3. Medium Screens (Tablets, 768px - 1199px) */
@media (min-width: 768px) and (max-width: 1199px) {
  .hero { padding: 5rem 1rem; }
  .hero h1 { font-size: 2.75rem; }
  .card-grid { grid-template-columns: repeat(2, 1fr); }
  .results-grid { grid-template-columns: repeat(3, 1fr); }
  .calc-card .field-group { display: flex; align-items: center; gap: 1.25rem; }
  .calc-card .field-group label { width: 35%; margin-bottom: 0; text-align: right; }
  .calc-card .field-group input, .calc-card .field-group select { width: 65%; }
}

/* 4. Large Screens (Desktops, 1200px - 1439px) */
@media (min-width: 1200px) {
  /* Desktop Header Alignment */
  .header-inner { display: grid; grid-template-columns: 1fr auto 1fr; }
  .logo { justify-self: start; }
  .nav-desktop { display: flex; justify-self: center; align-items: center; }
  .mobile-toggle, .mobile-nav { display: none !important; }
  
  .hero h1 { font-size: 3.25rem; }
  .hero p { font-size: 1.25rem; max-width: 800px; }
  .card-grid { grid-template-columns: repeat(3, 1fr); }
  .calc-card .field-group { display: flex; align-items: center; gap: 1.5rem; }
  .calc-card .field-group label { width: 30%; margin-bottom: 0; text-align: right; }
  .calc-card .field-group input, .calc-card .field-group select { width: 70%; }
  
  /* Desktop layout for restaurant calculators */
  #rest-layout-wrapper { display: flex; gap: 2.5rem; align-items: flex-start; }
  .rest-left-col { flex: 2; }
  .rest-right-col { flex: 1; position: sticky; top: 100px; }
}

/* 5. Extra Large Screens (Large Desktops/4K, 1440px+) */
@media (min-width: 1440px) {
  .container { max-width: 1400px; }
  .nav-dropdown-inner { max-width: 1400px; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 1rem;}
  .card-grid { grid-template-columns: repeat(4, 1fr); gap: 2rem; }
  .hero { padding: 7rem 1rem; }
  .hero h1 { font-size: 3.75rem; }
  .hero p { font-size: 1.35rem; }
  .section { padding: 5rem 1rem; }
  .calc-wrap { max-width: 850px; }
}

/* ===== ENHANCED SEARCH STYLES ===== */

/* Search input wrapper */
.search-input-wrap { position: relative; margin-bottom: 0.5rem; }
.search-input-wrap .search-input { padding-right: 3rem; }
.search-loading { position: absolute; right: 1rem; top: 50%; transform: translateY(-50%); }
.spinner { width: 20px; height: 20px; border: 3px solid var(--border-color); border-top-color: var(--primary); border-radius: 50%; display: inline-block; animation: spin 0.6s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* Search card header */
.search-card-header h3 { display: flex; align-items: center; gap: 0.5rem; }
.search-card-header p { font-size: 0.9rem; }

/* Search result items */
.search-result-item { display: flex; justify-content: space-between; align-items: center; gap: 0.75rem; }
.result-left { flex: 1; min-width: 0; }
.result-name { font-weight: 600; color: var(--text-main); display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.result-brand { font-size: 0.8rem; color: var(--text-light); display: block; margin-top: 0.1rem; }
.result-right { display: flex; align-items: center; gap: 0.5rem; flex-shrink: 0; }
.result-cal { font-weight: 800; color: var(--primary-dark); font-size: 0.9rem; }

/* Source badges */
.source-badge { display: inline-flex; padding: 0.15rem 0.5rem; border-radius: var(--radius-pill); font-size: 0.7rem; font-weight: 700; letter-spacing: 0.03em; text-transform: uppercase; }
.source-usda { background: #eff6ff; color: #1d4ed8; }
.source-off { background: #f0fdf4; color: #15803d; }
.source-local { background: #fefce8; color: #a16207; }

/* Barcode section */
.barcode-section { margin-top: 1.25rem; padding-top: 1.25rem; border-top: 1px solid var(--border-color); }
.barcode-label { font-size: 0.9rem; font-weight: 700; color: var(--text-main); margin-bottom: 0.5rem; }
.barcode-row { display: flex; gap: 0.5rem; }
.barcode-input { flex: 1; padding: 0.65rem 1rem; border: 2px solid var(--border-color); border-radius: var(--radius-md); font-size: 0.95rem; font-weight: 500; transition: all 0.2s; }
.barcode-input:focus { border-color: var(--primary); outline: none; box-shadow: 0 0 0 3px var(--border-focus); }
.barcode-btn { padding: 0.65rem 1.25rem !important; font-size: 0.9rem !important; }

/* Food detail card */
.food-detail-card { padding: 0; }
.detail-header h4 { font-size: 1.2rem; font-weight: 800; color: var(--text-main); display: flex; align-items: center; gap: 0.5rem; flex-wrap: wrap; margin-bottom: 0.5rem; }
.detail-source { font-size: 0.7rem !important; vertical-align: middle; }
.detail-brand { font-size: 0.9rem; color: var(--text-muted); margin-bottom: 0.25rem; }
.detail-category { font-size: 0.85rem; color: var(--text-light); margin-bottom: 0.75rem; }

/* Detail badges */
.detail-badges { display: flex; gap: 0.5rem; flex-wrap: wrap; margin-bottom: 1rem; }
.nutriscore-badge { padding: 0.35rem 0.75rem; border-radius: var(--radius-pill); font-weight: 800; font-size: 0.8rem; letter-spacing: 0.05em; }
.ns-a { background: #15803d; color: #fff; }
.ns-b { background: #65a30d; color: #fff; }
.ns-c { background: #eab308; color: #1a1a1a; }
.ns-d { background: #f97316; color: #fff; }
.ns-e { background: #dc2626; color: #fff; }
.nova-badge { padding: 0.35rem 0.75rem; border-radius: var(--radius-pill); font-weight: 700; font-size: 0.8rem; background: var(--bg-subtle); color: var(--text-main); }
.nova-1 { border: 2px solid #15803d; }
.nova-2 { border: 2px solid #eab308; }
.nova-3 { border: 2px solid #f97316; }
.nova-4 { border: 2px solid #dc2626; }

/* Detail image */
.detail-image { margin-bottom: 1rem; text-align: center; }
.detail-image img { max-height: 150px; border-radius: var(--radius-md); box-shadow: var(--shadow-sm); object-fit: contain; }

/* Serving adjuster */
.serving-adjuster { display: flex; align-items: center; gap: 0.75rem; flex-wrap: wrap; margin-bottom: 1.25rem; padding: 0.75rem 1rem; background: var(--bg-subtle); border-radius: var(--radius-md); }
.serving-adjuster label { font-weight: 700; color: var(--text-main); font-size: 0.9rem; }
.serving-controls { display: flex; gap: 0.35rem; }
.serving-btn { padding: 0.35rem 0.75rem; border: 2px solid var(--border-color); border-radius: var(--radius-pill); background: var(--bg-card); cursor: pointer; font-size: 0.85rem; font-weight: 700; color: var(--text-muted); transition: all 0.2s; }
.serving-btn:hover { border-color: var(--primary); color: var(--primary); }
.serving-btn.active { background: var(--primary); color: #fff; border-color: var(--primary); }
.custom-serving { width: 55px; padding: 0.35rem; border: 2px solid var(--border-color); border-radius: var(--radius-sm); font-size: 0.9rem; font-weight: 700; text-align: center; }
.custom-serving:focus { border-color: var(--primary); outline: none; }
.serving-size { font-size: 0.85rem; color: var(--text-light); font-weight: 500; }

/* Stacked macro bar */
.macro-bar-stacked { display: flex; height: 14px; border-radius: var(--radius-pill); overflow: hidden; margin-bottom: 0.5rem; box-shadow: inset 0 1px 2px rgba(0,0,0,0.05); }
.stacked-segment { transition: width 0.5s ease; }
.stacked-segment.protein { background: linear-gradient(90deg, #10b981, #059669); }
.stacked-segment.carbs { background: linear-gradient(90deg, #f59e0b, #d97706); }
.stacked-segment.fat { background: linear-gradient(90deg, #ef4444, #dc2626); }
.macro-bar-legend { display: flex; justify-content: center; gap: 1.25rem; font-size: 0.8rem; font-weight: 600; color: var(--text-muted); margin-bottom: 1.25rem; }
.legend-item { display: flex; align-items: center; gap: 0.35rem; }
.legend-dot { width: 10px; height: 10px; border-radius: 50%; display: inline-block; }
.legend-dot.protein { background: #10b981; }
.legend-dot.carbs { background: #f59e0b; }
.legend-dot.fat { background: #ef4444; }

/* Vitamins & Minerals grid */
.vm-section { margin: 1.5rem 0; }
.vm-section h5 { font-size: 1rem; font-weight: 800; color: var(--text-main); margin-bottom: 0.75rem; }
.vm-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); gap: 0.5rem; }
.vm-item { padding: 0.5rem 0.65rem; border-radius: var(--radius-sm); border: 1px solid var(--border-color); background: var(--bg-card); text-align: center; transition: all 0.2s; }
.vm-item:hover { transform: translateY(-2px); box-shadow: var(--shadow-sm); }
.vm-name { font-size: 0.75rem; font-weight: 600; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.03em; }
.vm-val { font-size: 0.95rem; font-weight: 800; color: var(--text-main); margin: 0.15rem 0; }
.vm-pct { font-size: 0.7rem; font-weight: 700; }
.vm-high .vm-pct { color: #15803d; }
.vm-good .vm-pct { color: #059669; }
.vm-moderate .vm-pct { color: #d97706; }
.vm-low .vm-pct { color: var(--text-light); }
.vm-high { border-color: #bbf7d0; background: #f0fdf4; }
.vm-good { border-color: #a7f3d0; background: #ecfdf5; }
.vm-moderate { border-color: #fde68a; background: #fffbeb; }

/* Allergens */
.allergen-section { margin: 1rem 0; padding: 0.75rem 1rem; background: #fef2f2; border: 1px solid #fecaca; border-radius: var(--radius-md); }
.allergen-section h5 { font-size: 0.9rem; font-weight: 800; color: #991b1b; margin-bottom: 0.5rem; }
.allergen-tags { display: flex; gap: 0.35rem; flex-wrap: wrap; }
.allergen-tag { padding: 0.2rem 0.6rem; background: #fee2e2; color: #b91c1c; border-radius: var(--radius-pill); font-size: 0.8rem; font-weight: 600; }

/* Ingredients */
.ingredients-section { margin: 1rem 0; padding: 0.75rem 1rem; background: var(--bg-subtle); border-radius: var(--radius-md); }
.ingredients-section h5 { font-size: 0.9rem; font-weight: 800; color: var(--text-main); margin-bottom: 0.35rem; }
.ingredients-text { font-size: 0.85rem; color: var(--text-muted); line-height: 1.6; word-break: break-word; }

/* Detail actions */
.detail-actions { display: flex; gap: 0.75rem; margin-top: 1.25rem; }
.btn-outline-compare { padding: 0.6rem 1rem; border: 2px solid var(--border-color); border-radius: var(--radius-pill); background: var(--bg-card); cursor: pointer; font-weight: 700; font-size: 0.9rem; color: var(--text-muted); transition: all 0.2s; }
.btn-outline-compare:hover { border-color: var(--primary); color: var(--primary); background: var(--primary-light); }

/* Compare panel */
.compare-card { background: var(--bg-card); border-radius: var(--radius-lg); padding: 1.5rem; border: 2px solid var(--border-color); box-shadow: var(--shadow-md); margin-top: 1.5rem; }
.compare-card h4 { font-size: 1.1rem; font-weight: 800; display: flex; justify-content: space-between; align-items: center; margin-bottom: 1rem; }
.reset-compare { background: #fee2e2; border: none; color: #ef4444; cursor: pointer; font-size: 0.85rem; font-weight: 700; padding: 0.3rem 0.75rem; border-radius: var(--radius-md); transition: all 0.2s; }
.reset-compare:hover { background: #fca5a5; color: #991b1b; }
.compare-table-wrap { overflow-x: auto; }
.compare-table { width: 100%; border-collapse: collapse; font-size: 0.9rem; }
.compare-table th { text-align: center; padding: 0.6rem; border-bottom: 2px solid var(--border-color); font-weight: 700; background: var(--bg-subtle); }
.compare-table td { padding: 0.5rem; text-align: center; border-bottom: 1px solid var(--border-color); }
.compare-nutrient { text-align: left !important; font-weight: 600; color: var(--text-main); }
.compare-highlight { background: var(--primary-light); font-weight: 800; color: var(--primary-dark); }

/* Tracker enhancements */
.tracker-header { display: flex; justify-content: space-between; align-items: flex-start; gap: 1rem; flex-wrap: wrap; margin-bottom: 0.5rem; }
.tracker-header h3 { margin-bottom: 0; }
.tracker-goal-row { display: flex; align-items: center; gap: 0.35rem; font-size: 0.85rem; font-weight: 600; color: var(--text-muted); }
.goal-input { width: 65px; padding: 0.3rem; border: 2px solid var(--border-color); border-radius: var(--radius-sm); font-size: 0.85rem; font-weight: 700; text-align: center; }
.goal-input:focus { border-color: var(--primary); outline: none; }

.tracker-macro-summary { display: flex; gap: 0.5rem; flex-wrap: wrap; margin-bottom: 1rem; }
.tracker-macro { flex: 1; min-width: 70px; text-align: center; padding: 0.5rem; border-radius: var(--radius-md); }
.tm-val { display: block; font-weight: 800; font-size: 1rem; }
.tm-lbl { display: block; font-size: 0.7rem; font-weight: 600; text-transform: uppercase; letter-spacing: 0.04em; margin-top: 0.1rem; }

.progress-fill.progress-warn { background: linear-gradient(90deg, var(--primary), #f59e0b); }
.progress-fill.progress-over { background: linear-gradient(90deg, #f59e0b, #ef4444); }

.btn-clear-tracker { width: 100%; padding: 0.6rem; margin-top: 0.75rem; background: var(--bg-subtle); border: 1px solid var(--border-color); border-radius: var(--radius-md); cursor: pointer; font-weight: 600; font-size: 0.85rem; color: var(--text-muted); transition: all 0.2s; }
.btn-clear-tracker:hover { background: #fee2e2; color: #ef4444; border-color: #fca5a5; }
.tracker-note { font-size: 0.75rem; color: var(--text-light); text-align: center; margin-top: 0.5rem; font-style: italic; }

.tracker-food-name { font-weight: 600; color: var(--text-main); }
.tracker-food-name small { font-weight: 500; color: var(--text-light); }
.tracker-num { font-weight: 600; color: var(--text-muted); text-align: center; }

/* Search error */
.search-error { padding: 1rem; background: #fef2f2; border: 1px solid #fecaca; border-radius: var(--radius-md); color: #991b1b; font-weight: 600; font-size: 0.9rem; }
.error-icon { margin-right: 0.35rem; }

/* Toast notification */
.toast-notification { position: fixed; bottom: 2rem; left: 50%; transform: translateX(-50%) translateY(100px); background: var(--text-main); color: #fff; padding: 0.75rem 1.5rem; border-radius: var(--radius-pill); font-weight: 600; font-size: 0.9rem; z-index: 9999; box-shadow: var(--shadow-float); transition: transform 0.3s ease, opacity 0.3s ease; opacity: 0; pointer-events: none; }
.toast-notification.show { transform: translateX(-50%) translateY(0); opacity: 1; }

/* ===== RESPONSIVE FOR SEARCH ===== */
@media (max-width: 479px) {
  .search-section { grid-template-columns: 1fr !important; }
  .barcode-row { flex-direction: column; }
  .serving-adjuster { flex-direction: column; align-items: flex-start; }
  .serving-controls { flex-wrap: wrap; }
  .vm-grid { grid-template-columns: repeat(2, 1fr); }
  .detail-actions { flex-direction: column; }
  .compare-table { font-size: 0.8rem; }
  .tracker-header { flex-direction: column; }
  .tracker-macro-summary { gap: 0.35rem; }
  .tracker-macro { min-width: 60px; padding: 0.35rem; }
  .tm-val { font-size: 0.85rem; }
}

@media (min-width: 480px) and (max-width: 767px) {
  .vm-grid { grid-template-columns: repeat(3, 1fr); }
}

@media (min-width: 768px) {
  .vm-grid { grid-template-columns: repeat(4, 1fr); }
}

/* ===== HOMEPAGE ===== */
.hero-home { padding: 5rem 1rem 4rem; }
.hero-home h1 { font-size: 2.75rem; }

.hero-search {
  max-width: 550px;
  margin: 2rem auto 0;
  position: relative;
}
.hero-search input {
  width: 100%;
  padding: 1rem 1.5rem;
  border: 2px solid rgba(255,255,255,0.2);
  border-radius: var(--radius-pill);
  background: rgba(255,255,255,0.1);
  color: #fff;
  font-size: 1.05rem;
  backdrop-filter: blur(8px);
  transition: all 0.3s ease;
}
.hero-search input::placeholder { color: rgba(255,255,255,0.5); }
.hero-search input:focus {
  outline: none;
  border-color: var(--primary);
  background: rgba(255,255,255,0.15);
  box-shadow: 0 0 0 4px rgba(16,185,129,0.2);
}

.search-results {
  display: none;
  position: absolute;
  top: calc(100% + 0.5rem);
  left: 0; right: 0;
  background: var(--bg-card);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-float);
  border: 1px solid var(--border-color);
  z-index: 50;
  max-height: 400px;
  overflow-y: auto;
}
.search-result-item {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.75rem 1.25rem;
  color: var(--text-main);
  font-weight: 500;
  transition: background 0.15s;
}
.search-result-item:hover {
  background: var(--primary-light);
  color: var(--primary-dark);
}
.sr-icon { font-size: 1.3rem; flex-shrink: 0; }

/* Home category blocks */
.home-categories { background: var(--bg-page); }
.home-cat-block { margin-bottom: 3rem; }
.home-cat-block h2 { font-size: 1.5rem; font-weight: 800; margin-bottom: 0.5rem; color: var(--text-main); }
.home-cat-block > p { color: var(--text-muted); margin-bottom: 1.25rem; font-size: 0.95rem; }
.home-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 0.75rem;
}
.home-card {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.85rem 1.1rem;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  color: var(--text-main);
  font-weight: 500;
  font-size: 0.9rem;
  transition: all 0.2s ease;
}
.home-card:hover {
  border-color: var(--primary);
  box-shadow: var(--shadow-md);
  transform: translateY(-2px);
  color: var(--primary-dark);
}
.home-card-icon { font-size: 1.4rem; flex-shrink: 0; }
.home-card-title { line-height: 1.3; }

/* Trust section */
.trust-section { background: var(--bg-subtle); }
.trust-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 1.5rem;
  max-width: 1200px;
  margin: 0 auto;
}
.trust-card {
  text-align: center;
  padding: 2rem 1.5rem;
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  border: 1px solid var(--border-color);
  box-shadow: var(--shadow-sm);
}
.trust-icon { font-size: 2.5rem; margin-bottom: 1rem; }
.trust-card h3 { font-size: 1.1rem; font-weight: 700; margin-bottom: 0.5rem; }
.trust-card p { font-size: 0.9rem; color: var(--text-muted); line-height: 1.6; }

/* Content sections (about, privacy, terms, disclaimer, etc.) */
.content-section {
  max-width: 800px;
  margin: 0 auto;
  padding: 3rem 1rem 4rem;
}
.content-section h2 { font-size: 1.35rem; font-weight: 700; margin: 2rem 0 0.75rem; color: var(--text-main); }
.content-section p { color: var(--text-muted); line-height: 1.8; margin-bottom: 1rem; }
.content-section ul, .content-section ol { list-style: disc; padding-left: 1.5rem; margin-bottom: 1rem; }
.content-section li { color: var(--text-muted); line-height: 1.8; margin-bottom: 0.5rem; }
.content-section a { color: var(--primary); font-weight: 500; }
.content-section a:hover { color: var(--primary-dark); text-decoration: underline; }

/* ===== RESPONSIVE HOMEPAGE ===== */
@media (max-width: 767px) {
  .hero-home h1 { font-size: 2rem; }
  .hero-home { padding: 3rem 1rem 2.5rem; }
  .home-grid { grid-template-columns: 1fr 1fr; }
  .trust-grid { grid-template-columns: 1fr 1fr; gap: 1rem; }
  .trust-card { padding: 1.5rem 1rem; }
}
@media (max-width: 479px) {
  .hero-home h1 { font-size: 1.6rem; }
  .home-grid { grid-template-columns: 1fr; }
  .trust-grid { grid-template-columns: 1fr; }
}
