/* ==========================================================================
   WELL MEAL - Modern Nutritional Health & Calorie Tracker
   Design System: Warm Vibrant Palette (Red, Orange, Yellow, Crisp White)
   Typography: Plus Jakarta Sans
   High Contrast Deep Dark / Black Text for Maximum Readability
   ========================================================================== */

/* --- CSS Reset & Variables --- */
:root {
  /* Color Palette: Red, Orange, Yellow, White */
  --c-red-deep: #dc2626;
  --c-red-primary: #ef4444;
  --c-red-light: #fee2e2;
  --c-red-soft: #fef2f2;

  --c-orange-deep: #ea580c;
  --c-orange-primary: #f97316;
  --c-orange-light: #ffedd5;
  --c-orange-soft: #fff7ed;

  --c-yellow-primary: #f59e0b;
  --c-yellow-bright: #fbbf24;
  --c-yellow-light: #fef3c7;
  --c-yellow-soft: #fffbeb;

  --c-green-accent: #16a34a;
  --c-green-light: #dcfce7;

  --c-white-pure: #ffffff;
  --c-white-translucent: rgba(255, 255, 255, 0.92);
  --c-white-glass: rgba(255, 255, 255, 0.82);

  /* Deep Black & Charcoal Text for Top-Tier Readability */
  --text-main: #0f172a;        /* Pitch black / dark slate */
  --text-body: #1e293b;        /* High-contrast readable body */
  --text-secondary: #334155;   /* Secondary descriptive text */
  --text-muted: #64748b;       /* Subtle meta notes */

  /* Borders & Shadows */
  --border-light: rgba(249, 115, 22, 0.2);
  --border-card: rgba(255, 255, 255, 0.85);
  --shadow-sm: 0 2px 8px rgba(234, 88, 12, 0.08);
  --shadow-md: 0 8px 24px -4px rgba(234, 88, 12, 0.12), 0 4px 12px -2px rgba(239, 68, 68, 0.08);
  --shadow-lg: 0 16px 36px -6px rgba(234, 88, 12, 0.18), 0 8px 16px -4px rgba(245, 158, 11, 0.12);
  --shadow-hover: 0 20px 40px -8px rgba(234, 88, 12, 0.25);

  /* Radii & Transitions */
  --radius-sm: 8px;
  --radius-md: 14px;
  --radius-lg: 20px;
  --radius-full: 9999px;
  --transition-fast: 0.18s ease;
  --transition-normal: 0.28s cubic-bezier(0.4, 0, 0.2, 1);
}

*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  color: var(--text-main);
  background: 
    radial-gradient(circle at 10% 20%, rgba(255, 237, 213, 0.8) 0%, transparent 40%),
    radial-gradient(circle at 90% 10%, rgba(254, 226, 226, 0.8) 0%, transparent 45%),
    radial-gradient(circle at 50% 80%, rgba(254, 243, 199, 0.7) 0%, transparent 50%),
    linear-gradient(135deg, #fff7ed 0%, #fffbf0 35%, #fff1f2 70%, #ffffff 100%);
  background-attachment: fixed;
  min-height: 100vh;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  position: relative;
  overflow-x: hidden;
}

/* Ambient dynamic background glowing blurs */
.bg-orb {
  position: fixed;
  border-radius: 50%;
  filter: blur(90px);
  z-index: -1;
  pointer-events: none;
  opacity: 0.45;
  animation: floatOrb 12s ease-in-out infinite alternate;
}
.orb-1 {
  width: 420px;
  height: 420px;
  background: linear-gradient(135deg, #ff7a00, #ff453a);
  top: -80px;
  left: -100px;
}
.orb-2 {
  width: 480px;
  height: 480px;
  background: linear-gradient(135deg, #f59e0b, #fbbf24);
  top: 35%;
  right: -120px;
  animation-duration: 15s;
}
.orb-3 {
  width: 380px;
  height: 380px;
  background: linear-gradient(135deg, #ef4444, #f97316);
  bottom: -60px;
  left: 20%;
  animation-duration: 18s;
}

@keyframes floatOrb {
  0% { transform: translateY(0px) scale(1); }
  50% { transform: translateY(35px) scale(1.08); }
  100% { transform: translateY(-20px) scale(0.96); }
}

/* App Container Layout */
.app-container {
  max-width: 1240px;
  margin: 0 auto;
  padding: 28px 20px 60px;
  display: flex;
  flex-direction: column;
  gap: 28px;
}

/* --- Common Card Style --- */
.card {
  background: var(--c-white-translucent);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border: 1px solid var(--border-card);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-md);
  padding: 26px;
  transition: transform var(--transition-normal), box-shadow var(--transition-normal);
}

.card:hover {
  box-shadow: var(--shadow-lg);
}

/* Step Badges & Typography Helpers */
.step-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.78rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  background: linear-gradient(135deg, var(--c-red-primary), var(--c-orange-primary));
  color: var(--c-white-pure);
  padding: 4px 12px;
  border-radius: var(--radius-full);
  margin-bottom: 6px;
}

.section-title {
  font-size: 1.45rem;
  font-weight: 800;
  color: var(--text-main);
  letter-spacing: -0.02em;
}

.section-desc {
  font-size: 0.95rem;
  color: var(--text-secondary);
  margin-top: 4px;
}

.card-subtitle {
  font-size: 1.22rem;
  font-weight: 700;
  color: var(--text-main);
}

/* ==========================================================================
   HEADER / HERO BRANDING
   ========================================================================== */
.hero-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 18px;
  padding-bottom: 8px;
}

.hero-brand {
  display: flex;
  align-items: center;
  gap: 16px;
}

.logo-badge {
  width: 68px;
  height: 68px;
  background: linear-gradient(135deg, #ffffff, #fff4e6);
  border: 2px solid #ffd8a8;
  border-radius: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 10px 20px -5px rgba(249, 115, 22, 0.35);
  transform: rotate(-3deg);
  transition: transform 0.3s ease;
}

.logo-badge:hover {
  transform: rotate(0deg) scale(1.05);
}

.brand-icon {
  width: 52px;
  height: 52px;
}

.badge-tag {
  display: inline-block;
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--c-orange-deep);
  background: var(--c-orange-light);
  padding: 3px 10px;
  border-radius: var(--radius-full);
  margin-bottom: 4px;
}

.brand-name {
  font-size: 2.2rem;
  font-weight: 800;
  color: #111827;
  letter-spacing: -0.04em;
  line-height: 1.1;
}

.brand-name span {
  background: linear-gradient(135deg, var(--c-red-primary), var(--c-orange-primary), var(--c-yellow-primary));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.brand-tagline {
  font-size: 0.96rem;
  color: var(--text-secondary);
  font-weight: 500;
}

.hero-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}

/* ==========================================================================
   BUTTONS & INPUTS
   ========================================================================== */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-family: inherit;
  font-size: 0.92rem;
  font-weight: 700;
  padding: 10px 18px;
  border-radius: var(--radius-md);
  border: none;
  cursor: pointer;
  transition: all var(--transition-fast);
  white-space: nowrap;
}

.btn-primary {
  background: linear-gradient(135deg, var(--c-red-primary) 0%, var(--c-orange-primary) 100%);
  color: var(--c-white-pure);
  box-shadow: 0 4px 14px rgba(239, 68, 68, 0.35);
}

.btn-primary:hover {
  background: linear-gradient(135deg, var(--c-red-deep) 0%, var(--c-orange-deep) 100%);
  transform: translateY(-2px);
  box-shadow: 0 6px 18px rgba(239, 68, 68, 0.45);
}

.btn-primary:active {
  transform: translateY(0);
}

.btn-secondary {
  background: #ffffff;
  color: #1e293b;
  border: 1.5px solid #fed7aa;
  box-shadow: var(--shadow-sm);
}

.btn-secondary:hover {
  background: var(--c-orange-soft);
  border-color: var(--c-orange-primary);
  color: var(--c-orange-deep);
  transform: translateY(-1px);
}

.btn-ghost {
  background: rgba(255, 255, 255, 0.7);
  color: var(--text-secondary);
  border: 1px solid #e2e8f0;
}

.btn-ghost:hover {
  background: var(--c-red-soft);
  color: var(--c-red-primary);
  border-color: var(--c-red-light);
}

/* Form Controls */
.form-label {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 0.92rem;
  font-weight: 700;
  color: var(--text-main);
  margin-bottom: 6px;
}

.tooltip {
  cursor: help;
  font-size: 0.9rem;
}

.helper-text {
  display: block;
  font-size: 0.78rem;
  color: var(--text-muted);
  margin-top: 5px;
}

.input-with-affix {
  position: relative;
  display: flex;
  align-items: center;
}

.input-with-affix input,
.select-wrapper select,
.food-search-input,
.food-portion-input,
.food-cal-input,
#db-search-input {
  width: 100%;
  font-family: inherit;
  font-size: 0.96rem;
  font-weight: 600;
  color: #0f172a;
  background: #ffffff;
  border: 1.5px solid #fed7aa;
  border-radius: var(--radius-md);
  padding: 10px 14px;
  outline: none;
  transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
}

.input-with-affix input {
  padding-right: 48px;
}

.input-with-affix .affix {
  position: absolute;
  right: 14px;
  font-weight: 700;
  color: var(--text-muted);
  pointer-events: none;
}

.select-wrapper {
  position: relative;
}

.select-wrapper select {
  appearance: none;
  cursor: pointer;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%23ea580c' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 14px center;
  padding-right: 42px;
}

input:focus, select:focus {
  border-color: var(--c-orange-primary);
  box-shadow: 0 0 0 3px rgba(249, 115, 22, 0.2);
}

/* ==========================================================================
   CONFIG CARD: USER PROFILE & TARGET
   ========================================================================== */
.config-card {
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.96) 0%, rgba(255, 247, 237, 0.92) 100%);
  border: 1.5px solid rgba(251, 146, 60, 0.35);
  box-shadow: 0 10px 30px -5px rgba(249, 115, 22, 0.12);
}

.card-header-flex {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  flex-wrap: wrap;
  gap: 12px;
  margin-bottom: 20px;
}

.info-pill {
  font-size: 0.9rem;
  background: var(--c-orange-light);
  color: var(--c-orange-deep);
  padding: 6px 16px;
  border-radius: var(--radius-full);
  border: 1px solid rgba(249, 115, 22, 0.25);
  font-weight: 600;
}

.info-pill strong {
  font-size: 1.05rem;
  color: #c2410c;
}

.config-grid {
  display: grid;
  grid-template-columns: 1fr 1.3fr 1.6fr;
  gap: 20px;
  align-items: flex-start;
}

.target-display-box {
  background: linear-gradient(135deg, #fff7ed 0%, #fff1f2 100%);
  border: 1.5px dashed #fb923c;
  border-radius: var(--radius-md);
  padding: 16px 20px;
}

.target-inner {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.target-col .sub-label {
  font-size: 0.8rem;
  font-weight: 700;
  color: #9a3412;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.metric-val {
  font-size: 1.9rem;
  font-weight: 800;
  color: #111827;
  line-height: 1.1;
  margin-top: 2px;
}

.metric-val .unit {
  font-size: 1rem;
  font-weight: 700;
  color: var(--c-orange-deep);
}

.target-distribution {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding-top: 8px;
  border-top: 1px solid rgba(249, 115, 22, 0.2);
}

.dist-item {
  font-size: 0.82rem;
  font-weight: 600;
  background: rgba(255, 255, 255, 0.9);
  padding: 3px 8px;
  border-radius: var(--radius-sm);
  color: #1e293b;
  border: 1px solid #fed7aa;
}

/* ==========================================================================
   WORKSPACE GRID (MEAL TRACKER + SIDEBAR)
   ========================================================================== */
.workspace-grid {
  display: grid;
  grid-template-columns: 1.6fr 1fr;
  gap: 28px;
  align-items: start;
}

.meals-tracker-section {
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.tracker-header {
  margin-bottom: 4px;
}

/* Individual Meal Block */
.meal-block {
  position: relative;
  border-left: 6px solid var(--c-orange-primary);
  display: flex;
  flex-direction: column;
  gap: 16px;
  transition: transform var(--transition-normal), box-shadow var(--transition-normal);
}

#card-breakfast { border-left-color: #f59e0b; }
#card-lunch { border-left-color: #ea580c; }
#card-dinner { border-left-color: #e11d48; }

.meal-block:hover {
  transform: translateY(-2px);
}

.meal-block-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
}

.meal-title-group {
  display: flex;
  align-items: center;
  gap: 12px;
}

.meal-icon-wrapper {
  width: 48px;
  height: 48px;
  border-radius: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.06);
}

.breakfast-theme {
  background: linear-gradient(135deg, #fffbeb, #fef3c7);
  color: #d97706;
}

.lunch-theme {
  background: linear-gradient(135deg, #fff7ed, #ffedd5);
  color: #ea580c;
}

.dinner-theme {
  background: linear-gradient(135deg, #fff1f2, #ffe4e6);
  color: #e11d48;
}

.meal-name {
  font-size: 1.25rem;
  font-weight: 800;
  color: var(--text-main);
  line-height: 1.2;
}

.meal-time-tag {
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--text-muted);
}

.meal-subtotal-badge {
  background: #ffffff;
  border: 1.5px solid #fed7aa;
  padding: 6px 14px;
  border-radius: var(--radius-full);
  font-size: 0.88rem;
  color: #1e293b;
  font-weight: 600;
}

.meal-subtotal-badge strong {
  font-size: 1.05rem;
  color: var(--c-orange-deep);
}

/* Quick Suggestion Chips */
.quick-chips {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  padding: 6px 0;
}

.chip-label {
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--text-muted);
}

.chip {
  background: #ffffff;
  border: 1px solid #ffd8a8;
  color: #1f2937;
  font-family: inherit;
  font-size: 0.8rem;
  font-weight: 600;
  padding: 4px 10px;
  border-radius: var(--radius-full);
  cursor: pointer;
  transition: all var(--transition-fast);
}

.chip:hover {
  background: linear-gradient(135deg, var(--c-orange-light), var(--c-yellow-light));
  border-color: var(--c-orange-primary);
  color: var(--c-orange-deep);
  transform: translateY(-1px);
}

/* Meal Input Form Row */
.meal-input-form {
  display: grid;
  grid-template-columns: 1fr 100px 130px auto;
  gap: 10px;
  align-items: end;
  background: rgba(255, 247, 237, 0.6);
  padding: 14px;
  border-radius: var(--radius-md);
  border: 1px solid rgba(254, 215, 170, 0.7);
}

.form-autocomplete-group {
  position: relative;
}

.portion-group,
.custom-cal-group {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.portion-group label,
.custom-cal-group label {
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--text-secondary);
}

.btn-add-food {
  height: 42px;
  padding: 0 16px;
}

/* Autocomplete Dropdown */
.autocomplete-dropdown {
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  right: 0;
  background: #ffffff;
  border: 1.5px solid #fb923c;
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
  max-height: 240px;
  overflow-y: auto;
  z-index: 50;
}

.autocomplete-dropdown.hidden {
  display: none;
}

.ac-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 14px;
  cursor: pointer;
  border-bottom: 1px solid #f1f5f9;
  transition: background var(--transition-fast);
}

.ac-item:last-child {
  border-bottom: none;
}

.ac-item:hover,
.ac-item.highlighted {
  background: #fff7ed;
}

.ac-name {
  font-size: 0.88rem;
  font-weight: 700;
  color: #0f172a;
}

.ac-portion-hint {
  font-size: 0.75rem;
  color: var(--text-muted);
  display: block;
}

.ac-cal-badge {
  font-size: 0.8rem;
  font-weight: 800;
  background: var(--c-orange-light);
  color: var(--c-orange-deep);
  padding: 3px 8px;
  border-radius: var(--radius-sm);
  white-space: nowrap;
}

/* Food List */
.food-list-container {
  margin-top: 4px;
}

.food-items-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.empty-list-notice {
  font-size: 0.88rem;
  color: var(--text-muted);
  font-style: italic;
  padding: 12px;
  text-align: center;
  background: rgba(255, 255, 255, 0.5);
  border-radius: var(--radius-sm);
  border: 1px dashed #e2e8f0;
}

.food-item-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 14px;
  background: #ffffff;
  border-radius: var(--radius-md);
  border: 1px solid #fed7aa;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.03);
  animation: fadeInItem 0.25s ease;
  transition: transform var(--transition-fast), border-color var(--transition-fast);
}

.food-item-row:hover {
  transform: translateX(3px);
  border-color: #fb923c;
}

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

.item-left {
  display: flex;
  align-items: center;
  gap: 10px;
}

.item-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--c-orange-primary);
  flex-shrink: 0;
}

.item-name {
  font-size: 0.92rem;
  font-weight: 700;
  color: #111827;
}

.item-portion-tag {
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--text-muted);
  background: #f8fafc;
  padding: 2px 7px;
  border-radius: 4px;
  margin-left: 6px;
}

.item-right {
  display: flex;
  align-items: center;
  gap: 12px;
}

.item-calorie-val {
  font-size: 0.92rem;
  font-weight: 800;
  color: var(--c-orange-deep);
}

.btn-delete-item {
  background: transparent;
  border: none;
  color: #94a3b8;
  cursor: pointer;
  padding: 6px;
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all var(--transition-fast);
}

.btn-delete-item:hover {
  color: var(--c-red-primary);
  background: var(--c-red-soft);
  transform: scale(1.1);
}

/* ==========================================================================
   SIDEBAR: SUMMARY DASHBOARD & NUTRITIONIST FEEDBACK
   ========================================================================== */
.dashboard-sidebar {
  display: flex;
  flex-direction: column;
  gap: 24px;
  position: sticky;
  top: 24px;
}

/* Summary Card */
.summary-card {
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.98) 0%, rgba(255, 247, 237, 0.94) 100%);
  border: 1.5px solid rgba(251, 146, 60, 0.4);
}

.summary-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
}

.badge-status {
  font-size: 0.78rem;
  font-weight: 800;
  padding: 4px 12px;
  border-radius: var(--radius-full);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.status-init { background: #f1f5f9; color: #64748b; }
.status-deficit { background: #fef3c7; color: #b45309; border: 1px solid #fde68a; }
.status-balanced { background: #dcfce7; color: #15803d; border: 1px solid #bbf7d0; }
.status-surplus { background: #fee2e2; color: #b91c1c; border: 1px solid #fecaca; }

/* Calorie Dial Gauge */
.cal-gauge-wrapper {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  margin: 10px 0 20px;
}

.gauge-dial {
  position: relative;
  width: 170px;
  height: 170px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.gauge-svg {
  width: 100%;
  height: 100%;
  transform: rotate(-90deg);
}

.gauge-bg {
  stroke: #ffedd5;
}

.gauge-bar {
  stroke: #ea580c;
  stroke-linecap: round;
  transition: stroke-dashoffset 0.8s cubic-bezier(0.4, 0, 0.2, 1), stroke 0.3s ease;
}

.gauge-content {
  position: absolute;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
}

.gauge-caption {
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
}

.gauge-number {
  font-size: 2.1rem;
  font-weight: 800;
  color: #0f172a;
  line-height: 1.1;
  letter-spacing: -0.03em;
}

.gauge-sub {
  font-size: 0.78rem;
  color: var(--text-secondary);
}

.gauge-percentage-pill {
  font-size: 0.84rem;
  font-weight: 700;
  color: #9a3412;
  background: var(--c-orange-light);
  padding: 4px 14px;
  border-radius: var(--radius-full);
}

/* Linear Progress Bar */
.cal-progress-wrapper {
  margin-bottom: 20px;
}

.progress-labels {
  display: flex;
  justify-content: space-between;
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--text-muted);
  margin-bottom: 6px;
}

.progress-track {
  width: 100%;
  height: 10px;
  background: #ffedd5;
  border-radius: var(--radius-full);
  overflow: hidden;
  position: relative;
}

.progress-fill {
  height: 100%;
  border-radius: var(--radius-full);
  background: linear-gradient(90deg, #f59e0b, #ea580c, #dc2626);
  transition: width 0.6s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Meal Breakdown List */
.meal-breakdown-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 14px 0;
  border-top: 1px solid #fed7aa;
  border-bottom: 1px solid #fed7aa;
  margin-bottom: 16px;
}

.breakdown-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.88rem;
}

.b-info {
  display: flex;
  align-items: center;
  gap: 8px;
}

.b-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
}

.dot-breakfast { background: #f59e0b; }
.dot-lunch { background: #ea580c; }
.dot-dinner { background: #e11d48; }

.b-label {
  font-weight: 600;
  color: #1e293b;
}

.b-values {
  display: flex;
  align-items: center;
  gap: 6px;
}

.b-kcal {
  font-weight: 800;
  color: #0f172a;
}

.b-percent {
  font-size: 0.78rem;
  color: var(--text-muted);
}

/* Difference / Indicator Box */
.difference-box {
  display: flex;
  gap: 12px;
  padding: 12px 14px;
  background: #ffffff;
  border-radius: var(--radius-md);
  border: 1px solid #fed7aa;
}

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

.diff-title {
  display: block;
  font-size: 0.88rem;
  font-weight: 800;
  color: #111827;
  margin-bottom: 2px;
}

.diff-desc {
  font-size: 0.8rem;
  color: var(--text-secondary);
  line-height: 1.4;
}

/* ==========================================================================
   SMART NUTRITIONIST FEEDBACK CARD
   ========================================================================== */
.feedback-card {
  background: #ffffff;
  border: 1.5px solid #fed7aa;
}

.doctor-badge {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 14px;
}

.doctor-avatar {
  width: 44px;
  height: 44px;
  background: linear-gradient(135deg, #fef3c7, #fed7aa);
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
}

.doctor-title {
  font-size: 1.05rem;
  font-weight: 800;
  color: #111827;
}

.doctor-sub {
  font-size: 0.78rem;
  color: var(--text-muted);
  display: block;
}

.feedback-body {
  font-size: 0.88rem;
  line-height: 1.6;
  color: var(--text-body);
}

.feedback-placeholder {
  color: var(--text-muted);
  font-style: italic;
  background: #fafaf9;
  padding: 14px;
  border-radius: var(--radius-md);
  border: 1px dashed #e2e8f0;
}

/* Dynamic Advice Elements */
.advice-alert {
  padding: 12px 14px;
  border-radius: var(--radius-md);
  margin-bottom: 12px;
  font-weight: 600;
}

.advice-alert.surplus {
  background: #fee2e2;
  border-left: 4px solid var(--c-red-primary);
  color: #991b1b;
}

.advice-alert.deficit {
  background: #fef3c7;
  border-left: 4px solid var(--c-yellow-primary);
  color: #92400e;
}

.advice-alert.balanced {
  background: #dcfce7;
  border-left: 4px solid var(--c-green-accent);
  color: #166534;
}

.advice-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 10px;
}

.advice-list li {
  position: relative;
  padding-left: 24px;
  font-size: 0.86rem;
  color: #1e293b;
}

.advice-list li::before {
  content: "👉";
  position: absolute;
  left: 0;
  top: 1px;
  font-size: 0.85rem;
}

.highlight-cut {
  background: #fee2e2;
  color: #b91c1c;
  padding: 1px 6px;
  border-radius: 4px;
  font-weight: 700;
}

.highlight-add {
  background: #dcfce7;
  color: #15803d;
  padding: 1px 6px;
  border-radius: 4px;
  font-weight: 700;
}

/* ==========================================================================
   PERSONALIZED HEALTHY MENU RECOMMENDATION
   ========================================================================== */
.recommendation-section {
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.98) 0%, rgba(255, 247, 237, 0.9) 100%);
  border: 1.5px solid rgba(251, 146, 60, 0.4);
}

.rec-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  flex-wrap: wrap;
  gap: 14px;
  margin-bottom: 24px;
}

.rec-tag-badge {
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--c-red-deep);
  background: var(--c-red-light);
  border: 1px solid rgba(239, 68, 68, 0.3);
  padding: 6px 14px;
  border-radius: var(--radius-full);
}

.rec-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 20px;
}

.rec-card {
  background: #ffffff;
  border-radius: var(--radius-md);
  border: 1.5px solid #fed7aa;
  padding: 20px;
  box-shadow: 0 4px 12px rgba(249, 115, 22, 0.06);
  display: flex;
  flex-direction: column;
  transition: transform var(--transition-normal), box-shadow var(--transition-normal);
}

.rec-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-hover);
  border-color: var(--c-orange-primary);
}

.rec-card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
}

.rec-time-badge {
  font-size: 0.75rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 3px 10px;
  border-radius: var(--radius-full);
}

.rec-time-breakfast { background: #fef3c7; color: #b45309; }
.rec-time-lunch { background: #ffedd5; color: #c2410c; }
.rec-time-dinner { background: #ffe4e6; color: #be123c; }
.rec-time-snack { background: #dcfce7; color: #15803d; }

.rec-cal-tag {
  font-size: 0.88rem;
  font-weight: 800;
  color: var(--c-orange-deep);
}

.rec-food-art {
  width: 100%;
  height: 120px;
  background: linear-gradient(135deg, #fff7ed, #fef3c7);
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 14px;
}

.rec-food-art svg {
  width: 72px;
  height: 72px;
}

.rec-menu-title {
  font-size: 1.05rem;
  font-weight: 800;
  color: #111827;
  margin-bottom: 6px;
}

.rec-menu-details {
  font-size: 0.85rem;
  color: var(--text-secondary);
  line-height: 1.5;
  margin-bottom: 12px;
  flex-grow: 1;
}

.rec-portion-guide {
  font-size: 0.78rem;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  padding: 6px 10px;
  border-radius: var(--radius-sm);
  color: #334155;
}

.rec-portion-guide strong {
  color: var(--c-orange-deep);
}

.btn-adopt-menu {
  margin-top: 14px;
  width: 100%;
  padding: 8px;
  font-size: 0.82rem;
}

/* ==========================================================================
   FOOD DATABASE QUICK EXPLORER
   ========================================================================== */
.food-db-explorer {
  background: #ffffff;
  border: 1.5px solid #fed7aa;
}

.db-header-flex {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  flex-wrap: wrap;
  gap: 14px;
  margin-bottom: 18px;
}

.db-search-wrap {
  width: 320px;
  max-width: 100%;
}

.db-chips-carousel {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding-bottom: 10px;
  margin-bottom: 16px;
}

.db-chips-carousel::-webkit-scrollbar {
  height: 4px;
}
.db-chips-carousel::-webkit-scrollbar-thumb {
  background: #fed7aa;
  border-radius: 4px;
}

.db-filter-btn {
  font-family: inherit;
  font-size: 0.82rem;
  font-weight: 700;
  padding: 6px 14px;
  border-radius: var(--radius-full);
  background: #f8fafc;
  color: #334155;
  border: 1px solid #e2e8f0;
  cursor: pointer;
  white-space: nowrap;
  transition: all var(--transition-fast);
}

.db-filter-btn:hover {
  background: #ffedd5;
  color: #ea580c;
  border-color: #fdba74;
}

.db-filter-btn.active {
  background: linear-gradient(135deg, var(--c-orange-primary), var(--c-red-primary));
  color: #ffffff;
  border-color: transparent;
  box-shadow: 0 2px 8px rgba(234, 88, 12, 0.25);
}

.db-cards-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(210px, 1fr));
  gap: 12px;
  max-height: 380px;
  overflow-y: auto;
  padding-right: 6px;
}

.db-cards-grid::-webkit-scrollbar {
  width: 6px;
}
.db-cards-grid::-webkit-scrollbar-thumb {
  background: #fed7aa;
  border-radius: 4px;
}

.db-item-card {
  background: #fffaf5;
  border: 1px solid #fed7aa;
  border-radius: var(--radius-md);
  padding: 12px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 8px;
  transition: all var(--transition-fast);
}

.db-item-card:hover {
  background: #ffffff;
  border-color: #fb923c;
  transform: translateY(-2px);
  box-shadow: var(--shadow-sm);
}

.db-item-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 8px;
}

.db-item-name {
  font-size: 0.88rem;
  font-weight: 700;
  color: #0f172a;
}

.db-item-portion {
  font-size: 0.74rem;
  color: var(--text-muted);
}

.db-item-cal {
  font-size: 0.9rem;
  font-weight: 800;
  color: var(--c-orange-deep);
}

.db-item-actions {
  display: flex;
  gap: 6px;
  margin-top: 4px;
}

.btn-quick-add {
  flex: 1;
  font-size: 0.72rem;
  font-weight: 700;
  padding: 4px 6px;
  background: #ffffff;
  border: 1px solid #ffd8a8;
  border-radius: var(--radius-sm);
  color: #334155;
  cursor: pointer;
  transition: all var(--transition-fast);
}

.btn-quick-add:hover {
  background: var(--c-orange-light);
  color: var(--c-orange-deep);
  border-color: #fb923c;
}

/* ==========================================================================
   FOOTER
   ========================================================================== */
.app-footer {
  margin-top: 20px;
  padding-top: 24px;
  border-top: 1px solid rgba(249, 115, 22, 0.2);
}

.footer-inner {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  flex-wrap: wrap;
  gap: 20px;
}

.footer-brand .brand-name {
  font-size: 1.3rem;
}

.footer-brand p {
  font-size: 0.85rem;
  color: var(--text-secondary);
  margin-top: 4px;
}

.footer-meta {
  max-width: 580px;
  font-size: 0.8rem;
  color: var(--text-muted);
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.copyright {
  font-weight: 600;
  color: #1e293b;
}

/* ==========================================================================
   RESPONSIVE DESIGN (MEDIA QUERIES)
   ========================================================================== */
@media (max-width: 1024px) {
  .workspace-grid {
    grid-template-columns: 1fr;
  }

  .dashboard-sidebar {
    position: static;
  }

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

  .target-display-box {
    grid-column: span 2;
  }
}

@media (max-width: 768px) {
  .app-container {
    padding: 16px 14px 40px;
    gap: 20px;
  }

  .hero-header {
    flex-direction: column;
    align-items: flex-start;
  }

  .hero-actions {
    width: 100%;
    justify-content: flex-start;
  }

  .brand-name {
    font-size: 1.8rem;
  }

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

  .target-display-box {
    grid-column: span 1;
  }

  .meal-input-form {
    grid-template-columns: 1fr 1fr;
  }

  .form-autocomplete-group {
    grid-column: span 2;
  }

  .btn-add-food {
    grid-column: span 2;
  }

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

  .db-search-wrap {
    width: 100%;
  }
}

@media (max-width: 480px) {
  .meal-block-header {
    flex-direction: column;
    align-items: flex-start;
  }

  .meal-subtotal-badge {
    width: 100%;
    text-align: center;
  }

  .meal-input-form {
    grid-template-columns: 1fr;
  }

  .portion-group,
  .custom-cal-group {
    grid-column: span 1;
  }
}
