/* ============================================
   DESIGN SYSTEM
   ============================================ */
:root {
  --bg: #f0fdf4;
  --surface: #ffffff;
  --card-bg: #ffffff;
  --primary: #16a34a;
  --primary-dark: #14532d;
  --accent: #84cc16;
  --text: #0f172a;
  --text-muted: #64748b;
  --border: #e2e8f0;
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-xl: 24px;
  --shadow-sm: 0 1px 3px rgba(0,0,0,0.08), 0 1px 2px rgba(0,0,0,0.06);
  --shadow-md: 0 4px 20px rgba(0,0,0,0.07);
  --shadow-lg: 0 12px 40px rgba(0,0,0,0.13);
  --transition: 0.25s ease;
}

/* ============================================
   BASE
   ============================================ */
html, body {
  height: 100%;
  margin: 0;
}

body {
  font-family: 'Inter', system-ui, -apple-system, sans-serif;
  background-color: var(--bg);
  color: var(--text);
  display: flex;
  flex-direction: column;
  line-height: 1.65;
  transition: background-color var(--transition), color var(--transition);
}

body.dark-mode {
  background-color: #030712;
  color: #f9fafb;
}

h1, h2, h3, h4, h5, h6 {
  font-family: 'Outfit', system-ui, sans-serif;
}

/* ============================================
   CONTAINER
   ============================================ */
.container {
  background-color: var(--surface);
  color: var(--text);
  flex: 1;
  transition: background-color var(--transition), color var(--transition);
}

.container.dark-mode {
  background-color: #030712;
  color: #f9fafb;
}

.small-container {
  max-width: 700px;
}

/* ============================================
   NAVBAR
   ============================================ */
.navbar.navbar-glass {
  background: rgba(10, 18, 30, 0.90) !important;
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-bottom: 1px solid rgba(255, 255, 255, 0.07);
  box-shadow: 0 2px 20px rgba(0, 0, 0, 0.25);
  z-index: 1050;
}

.navbar-brand img {
  height: 36px;
  filter: hue-rotate(134deg) saturate(0.9) brightness(0.95) drop-shadow(0 1px 4px rgba(0,0,0,0.3));
}

.nav-link {
  font-family: 'Inter', sans-serif;
  font-weight: 500;
  font-size: 0.88rem;
  color: rgba(255, 255, 255, 0.72) !important;
  padding: 0.45rem 0.9rem !important;
  border-radius: 6px;
  letter-spacing: 0.01em;
  position: relative;
  transition: color var(--transition), background var(--transition);
}

.nav-link::after {
  content: '';
  position: absolute;
  bottom: 0px;
  left: 50%;
  transform: translateX(-50%) scaleX(0);
  width: 60%;
  height: 2px;
  background: var(--accent);
  border-radius: 2px;
  transition: transform var(--transition);
}

.nav-link:hover {
  color: #fff !important;
  background: rgba(255, 255, 255, 0.07);
}

.nav-link.active {
  color: #fff !important;
}

.nav-link:hover::after,
.nav-link.active::after {
  transform: translateX(-50%) scaleX(1);
}

#dark-mode-toggle.btn {
  color: rgba(255, 255, 255, 0.85);
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: var(--radius-md);
  padding: 0.38rem 0.75rem;
  font-size: 1rem;
  transition: all var(--transition);
  margin-left: 0.5rem;
}

#dark-mode-toggle.btn:hover {
  background: rgba(255, 255, 255, 0.1);
  color: #fff;
}

#dark-mode-toggle.btn.dark-mode {
  color: #fbbf24;
  border-color: rgba(251, 191, 36, 0.35);
}

/* ============================================
   HERO SECTION
   ============================================ */
.hero-section {
  background: linear-gradient(135deg, #14532d 0%, #16a34a 55%, #15803d 100%);
  border-radius: var(--radius-xl);
  padding: 2.5rem 2rem;
  margin-bottom: 2rem;
  margin-top: 0.75rem;
  overflow: hidden;
  position: relative;
}

.hero-section::before {
  content: '';
  position: absolute;
  top: -80px;
  right: -60px;
  width: 260px;
  height: 260px;
  background: rgba(255, 255, 255, 0.04);
  border-radius: 50%;
  pointer-events: none;
}

.hero-section::after {
  content: '';
  position: absolute;
  bottom: -50px;
  left: -40px;
  width: 180px;
  height: 180px;
  background: rgba(255, 255, 255, 0.03);
  border-radius: 50%;
  pointer-events: none;
}

.hero-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 2rem;
  position: relative;
  z-index: 1;
}

.hero-text {
  flex: 1;
  min-width: 0;
}

.hero-eyebrow {
  display: inline-block;
  background: rgba(255, 255, 255, 0.14);
  color: rgba(255, 255, 255, 0.92);
  font-family: 'Inter', sans-serif;
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  padding: 0.28rem 0.85rem;
  border-radius: 20px;
  margin-bottom: 1rem;
  border: 1px solid rgba(255, 255, 255, 0.22);
}

.hero-title {
  color: #fff;
  font-family: 'Outfit', sans-serif;
  font-size: clamp(1.5rem, 3.5vw, 2.1rem);
  font-weight: 800;
  line-height: 1.2;
  margin-bottom: 0.85rem;
  letter-spacing: -0.02em;
}

.hero-accent {
  color: #bbf7d0;
}

.hero-subtitle {
  color: rgba(255, 255, 255, 0.72);
  font-family: 'Inter', sans-serif;
  font-size: 0.88rem;
  line-height: 1.65;
  margin-bottom: 1.4rem;
}

.hero-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 0.65rem;
}

.hl-item {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  color: rgba(255, 255, 255, 0.82);
  font-family: 'Inter', sans-serif;
  font-size: 0.78rem;
  font-weight: 500;
}

.hl-dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  flex-shrink: 0;
}

.hl-low .hl-dot  { background: #4ade80; }
.hl-mid .hl-dot  { background: #fbbf24; }
.hl-high .hl-dot { background: #f87171; }

.hero-visual {
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.hero-gauge {
  width: 210px;
  max-width: 100%;
  filter: drop-shadow(0 4px 12px rgba(0,0,0,0.25));
}

/* ============================================
   CARDS
   ============================================ */
.card {
  background-color: var(--card-bg);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  transition: transform var(--transition), box-shadow var(--transition),
              background-color var(--transition), border-color var(--transition);
}

.card:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow-lg);
}

.card.dark-mode {
  background-color: #1f2937;
  color: #f9fafb;
  border-color: #374151;
}

body.dark-mode .card-subtitle,
body.dark-mode .text-body-secondary {
  color: #94a3b8 !important;
}

body.dark-mode .card-text,
body.dark-mode .card-text li {
  color: #d1d5db;
}

body.dark-mode .card-link {
  color: #4ade80;
}

.card-title {
  font-family: 'Outfit', sans-serif;
  font-weight: 700;
  font-size: 1.05rem;
}

/* ============================================
   FORM CONTROLS
   ============================================ */
.form-select {
  background-color: var(--surface);
  color: var(--text);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-md);
  padding: 0.65rem 1rem;
  font-family: 'Inter', sans-serif;
  font-size: 0.94rem;
  transition: border-color var(--transition), box-shadow var(--transition),
              background-color var(--transition);
}

.form-select:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(22, 163, 74, 0.15);
  outline: none;
}

.form-select.dark-mode {
  background-color: #1f2937;
  color: #f9fafb;
  border-color: #374151;
}

.form-control {
  border: 1.5px solid var(--border);
  border-radius: var(--radius-md);
  padding: 0.65rem 1rem;
  font-family: 'Inter', sans-serif;
  transition: border-color var(--transition), box-shadow var(--transition);
}

.form-control:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(22, 163, 74, 0.15);
  outline: none;
}

body.dark-mode .form-control {
  background-color: #1f2937;
  color: #f9fafb;
  border-color: #374151;
}

.form-label {
  color: var(--text);
  font-weight: 500;
  font-size: 0.88rem;
  font-family: 'Inter', sans-serif;
  transition: color var(--transition);
}

.form-label.dark-mode {
  color: #f9fafb;
}

/* ============================================
   BUTTONS
   ============================================ */
.btn-primary {
  background: linear-gradient(135deg, #16a34a, #15803d);
  border: none;
  border-radius: 10px;
  font-family: 'Inter', sans-serif;
  font-weight: 600;
  font-size: 0.9rem;
  padding: 0.6rem 1.4rem;
  color: #fff;
  transition: transform var(--transition), box-shadow var(--transition), filter var(--transition);
}

.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(22, 163, 74, 0.38);
  filter: brightness(1.05);
  color: #fff;
}

.btn-success {
  background: linear-gradient(135deg, #16a34a, #15803d);
  border: none;
  border-radius: 10px;
  font-family: 'Inter', sans-serif;
  font-weight: 600;
  font-size: 0.9rem;
  padding: 0.6rem 1.4rem;
  color: #fff;
  transition: transform var(--transition), box-shadow var(--transition), filter var(--transition);
}

.btn-success:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(22, 163, 74, 0.38);
  filter: brightness(1.05);
  color: #fff;
}

.btn-outline-secondary {
  border: 1.5px solid var(--border);
  border-radius: 10px;
  font-family: 'Inter', sans-serif;
  font-weight: 500;
  font-size: 0.9rem;
  color: var(--text-muted);
  transition: all var(--transition);
}

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

body.dark-mode .btn-outline-secondary {
  color: #94a3b8;
  border-color: #4b5563;
}

body.dark-mode .btn-outline-secondary:hover {
  background-color: #1f2937;
  color: #f9fafb;
  border-color: #6b7280;
}

/* ============================================
   BADGES
   ============================================ */
.badge {
  font-family: 'Outfit', sans-serif;
  font-weight: 700;
  letter-spacing: 0.02em;
  border-radius: 8px;
  padding: 0.45em 0.9em;
  font-size: 0.95rem !important;
}

.badge.bg-success {
  background: linear-gradient(135deg, #16a34a, #15803d) !important;
  color: #fff !important;
  box-shadow: 0 2px 8px rgba(22, 163, 74, 0.3);
}

.badge.bg-warning {
  background: linear-gradient(135deg, #f59e0b, #d97706) !important;
  color: #fff !important;
  box-shadow: 0 2px 8px rgba(245, 158, 11, 0.3);
}

.badge.bg-danger {
  background: linear-gradient(135deg, #ef4444, #dc2626) !important;
  color: #fff !important;
  box-shadow: 0 2px 8px rgba(239, 68, 68, 0.3);
}

.badge.text-bg-secondary {
  background: #475569 !important;
  color: #fff !important;
  font-family: 'Outfit', sans-serif;
  font-weight: 700;
  border-radius: 8px;
  box-shadow: var(--shadow-sm);
}

/* ============================================
   FOOD DETAIL SECTION
   ============================================ */
#food-name {
  font-family: 'Outfit', sans-serif;
  font-weight: 800;
  letter-spacing: -0.02em;
}

h5#category-label,
h5 span#category {
  color: var(--text-muted);
  font-family: 'Inter', sans-serif;
  font-weight: 500;
  font-size: 1rem;
}

body.dark-mode h5 span#category {
  color: #94a3b8;
}

#food-image {
  max-height: 200px;
  object-fit: contain;
  border-radius: var(--radius-md);
  display: block;
  margin: 0 auto 1.5rem;
  box-shadow: var(--shadow-md);
}

.animate-in {
  animation: fadeSlideIn 0.4s ease both;
}

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

/* ============================================
   PAGE TITLE (mealcalc)
   ============================================ */
.page-title {
  font-family: 'Outfit', sans-serif;
  font-weight: 800;
  font-size: 2rem;
  letter-spacing: -0.025em;
  position: relative;
  display: inline-block;
  margin-bottom: 0.75rem;
}

.page-title::after {
  content: '';
  position: absolute;
  bottom: -5px;
  left: 0;
  width: 44px;
  height: 4px;
  background: linear-gradient(to right, var(--primary), var(--accent));
  border-radius: 3px;
}

/* ============================================
   MEAL LIST
   ============================================ */
#meal-list {
  list-style: none;
  padding: 0;
  margin-bottom: 1.25rem;
}

#meal-list li {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-left: 3px solid var(--primary);
  border-radius: var(--radius-md);
  padding: 0.6rem 1rem;
  margin-bottom: 0.5rem;
  font-family: 'Inter', sans-serif;
  font-size: 0.9rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  transition: background var(--transition), box-shadow var(--transition);
}

#meal-list li:hover {
  box-shadow: var(--shadow-sm);
}

body.dark-mode #meal-list li {
  background: #1f2937;
  border-color: #374151;
  border-left-color: #22c55e;
  color: #f9fafb;
}

/* ============================================
   TOTAL GL CARD
   ============================================ */
.total-gl-card {
  border: 2px solid var(--border);
  border-top: 3px solid var(--primary);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-md);
}

.total-gl-card .card-title {
  font-family: 'Outfit', sans-serif;
  font-weight: 700;
}

.total-gl-card #total-gl {
  font-family: 'Outfit', sans-serif;
  font-weight: 800;
  font-size: 1.4rem;
}

/* ============================================
   BENTO GRID (info.html)
   ============================================ */
.bento-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1.25rem;
  padding: 1.5rem 1rem;
  max-width: 1100px;
  margin: 0 auto;
}

.bento-wide {
  grid-column: span 2;
}

.bento-card {
  border-top: 3px solid var(--primary);
}

.bento-card:nth-child(1) { border-top-color: #16a34a; }
.bento-card:nth-child(2) { border-top-color: #84cc16; }
.bento-card:nth-child(3) { border-top-color: #0ea5e9; }
.bento-card:nth-child(4) { border-top-color: #8b5cf6; }
.bento-card:nth-child(5) { border-top-color: #f59e0b; }

.bento-icon {
  font-size: 1.6rem;
  display: block;
  margin-bottom: 0.5rem;
  line-height: 1;
}

/* ============================================
   LEGEND
   ============================================ */
.legend-item {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 0.5rem;
}

.legend-dot {
  width: 12px;
  height: 12px;
  border-radius: 4px;
  flex-shrink: 0;
}

/* ============================================
   SOURCE LINK
   ============================================ */
#source {
  color: var(--primary);
  font-weight: 600;
  font-family: 'Inter', sans-serif;
  font-size: 0.85rem;
  text-decoration: none;
}

#source:hover { text-decoration: underline; }

body.dark-mode #source { color: #4ade80; }

/* ============================================
   FOOTER
   ============================================ */
footer {
  background: linear-gradient(to right, #0f172a, #1e293b);
  color: rgba(255, 255, 255, 0.65);
  text-align: center;
  padding: 1.25rem 0;
  width: 100%;
  margin-top: auto;
  border-top: 1px solid rgba(255, 255, 255, 0.06);
}

footer p {
  margin: 0;
  font-size: 0.8rem;
  font-family: 'Inter', sans-serif;
  color: rgba(255, 255, 255, 0.65) !important;
}

footer a {
  color: #4ade80;
  text-decoration: none;
  font-weight: 600;
  transition: color var(--transition);
}

footer a:hover {
  color: #86efac;
  text-decoration: underline;
}

/* ============================================
   UTILITIES
   ============================================ */
.smaller-text { font-size: 14px; }
.small-text   { font-size: 18px; }
.margin-top-large { margin-top: 120px; }

.d-none  { display: none !important; }
.d-block { display: block !important; }

#reset-meal {
  width: 150px;
  white-space: nowrap;
  flex-shrink: 0;
}

hr {
  border-color: var(--border);
  opacity: 1;
}

body.dark-mode hr {
  border-color: #374151;
}

/* ============================================
   RESPONSIVE
   ============================================ */
@media (max-width: 768px) {
  .bento-grid {
    grid-template-columns: repeat(2, 1fr);
    padding: 1rem 0.75rem;
    gap: 1rem;
  }
  .bento-wide {
    grid-column: span 1;
  }
}

@media (max-width: 576px) {
  .bento-grid {
    grid-template-columns: 1fr;
    padding: 0.75rem;
  }
  .hero-inner {
    flex-direction: column;
    align-items: flex-start;
  }
  .hero-visual {
    align-self: center;
    width: 100%;
  }
  .hero-gauge {
    width: 180px;
    margin: 0 auto;
  }
  .hero-section {
    padding: 1.75rem 1.25rem;
  }
  .hero-title {
    font-size: 1.5rem;
  }
  .page-title {
    font-size: 1.65rem;
  }
}
