/* ═══════════════════════════════════════════════════════════
   SAVORLY — Main Stylesheet
   Sections:
   1. CSS Variables (Light + Dark themes)
   2. Reset & Base
   3. Header
   4. Hero & Floating Food
   5. Input Panel
   6. Results & Filters
   7. Recipe Cards
   8. Skeleton Loader
   9. Loading State
   10. Modal
   11. Favorites Page
   12. Footer
   13. Animations
   14. Responsive (Mobile)
═══════════════════════════════════════════════════════════ */

/* ─── 1. CSS VARIABLES ─── */
:root,
[data-theme="light"] {
  --bg: #fdf6f0;
  --surface: #ffffff;
  --surface2: #fef0e8;
  --surface3: #fde8d8;
  --coral: #f4845f;
  --coral-light: #f9b49a;
  --coral-dim: #e86a40;
  --mint: #7bc9a0;
  --mint-dim: #4fa87a;
  --gold: #f5c842;
  --gold-dim: #d4a820;
  --text: #2d2a26;
  --text-dim: #8a7f76;
  --text-light: #b5ada6;
  --border: rgba(244, 132, 95, 0.18);
  --border2: rgba(244, 132, 95, 0.09);
  --shadow: 0 4px 24px rgba(244, 132, 95, 0.10);
  --shadow-lg: 0 12px 48px rgba(244, 132, 95, 0.15);
  --radius: 20px;
  --radius-sm: 10px;
  --skeleton-base: #f0e8e0;
  --skeleton-shine: #fdf6f0;
}

[data-theme="dark"] {
  --bg: #1a1714;
  --surface: #242019;
  --surface2: #2e281f;
  --surface3: #38302a;
  --coral: #f4845f;
  --coral-light: #c9624a;
  --coral-dim: #e86a40;
  --mint: #7bc9a0;
  --mint-dim: #5db882;
  --gold: #f5c842;
  --gold-dim: #c9a030;
  --text: #f0e8df;
  --text-dim: #a89880;
  --text-light: #6a5f55;
  --border: rgba(244, 132, 95, 0.22);
  --border2: rgba(244, 132, 95, 0.11);
  --shadow: 0 4px 24px rgba(0, 0, 0, 0.35);
  --shadow-lg: 0 12px 48px rgba(0, 0, 0, 0.45);
  --skeleton-base: #2e281f;
  --skeleton-shine: #38302a;
}

/* ─── 2. RESET & BASE ─── */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html { scroll-behavior: smooth; }

body {
  font-family: 'DM Sans', sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  overflow-x: hidden;
  transition: background 0.3s ease, color 0.3s ease;
}

::-webkit-scrollbar { width: 5px; }
::-webkit-scrollbar-track { background: var(--bg); }
::-webkit-scrollbar-thumb { background: var(--coral-light); border-radius: 3px; }

/* ─── 3. HEADER ─── */
header {
  position: fixed;
  top: 0; left: 0; right: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 32px;
  background: rgba(253, 246, 240, 0.96);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--border2);
  transition: background 0.3s ease, border-color 0.3s ease;
}

[data-theme="dark"] header {
  background: rgba(26, 23, 20, 0.96);
}

.logo {
  font-family: 'Playfair Display', serif;
  font-size: 24px;
  font-weight: 700;
  color: var(--coral);
  cursor: pointer;
  line-height: 1.1;
  user-select: none;
}

.logo span {
  color: var(--text-dim);
  font-weight: 400;
  font-style: italic;
  font-size: 11px;
  display: block;
}

nav {
  display: flex;
  gap: 12px;
  align-items: center;
}

.nav-link {
  color: var(--text-dim);
  text-decoration: none;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: color 0.2s;
  white-space: nowrap;
  background: none;
  border: none;
}

.nav-link:hover { color: var(--coral); }

.theme-btn {
  background: var(--surface2);
  border: 1.5px solid var(--border);
  border-radius: 50%;
  width: 36px; height: 36px;
  font-size: 16px;
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: all 0.2s;
}

.theme-btn:hover { background: var(--coral); border-color: var(--coral); }

.lang-btn {
  background: var(--surface2);
  border: 1.5px solid var(--border);
  border-radius: 100px;
  padding: 6px 14px;
  font-size: 12px; font-weight: 600;
  color: var(--coral);
  cursor: pointer;
  transition: all 0.2s;
  white-space: nowrap;
}

.lang-btn:hover { background: var(--coral); color: white; }

/* ─── 4. HERO & FLOATING FOOD ─── */
.hero {
  min-height: 100vh;
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  padding: 100px 20px 60px;
  position: relative;
  text-align: center;
  overflow: hidden;
}

.hero-bg {
  position: absolute; inset: 0; z-index: 0;
  background:
    radial-gradient(ellipse 70% 50% at 50% 0%, rgba(244,132,95,0.13) 0%, transparent 70%),
    radial-gradient(ellipse 40% 40% at 85% 75%, rgba(123,201,160,0.11) 0%, transparent 60%),
    radial-gradient(ellipse 40% 40% at 15% 70%, rgba(245,200,66,0.08) 0%, transparent 60%);
}

.food-float {
  position: absolute;
  pointer-events: none;
  user-select: none;
  font-size: clamp(20px, 3vw, 36px);
  animation: floatAnim linear infinite;
  opacity: 0.55;
  z-index: 0;
}

.hero-eyebrow {
  display: inline-flex; align-items: center; gap: 8px;
  background: rgba(244, 132, 95, 0.1);
  border: 1px solid rgba(244, 132, 95, 0.25);
  border-radius: 100px;
  padding: 7px 18px;
  font-size: 11px; font-weight: 600; letter-spacing: 0.14em; text-transform: uppercase;
  color: var(--coral);
  margin-bottom: 22px;
  animation: fadeUp 0.6s ease both;
  position: relative; z-index: 1;
}

.hero-eyebrow::before { content: '✦'; font-size: 8px; }

.hero h1 {
  font-family: 'Playfair Display', serif;
  font-size: clamp(36px, 6vw, 80px);
  font-weight: 700; line-height: 1.08;
  color: var(--text);
  margin-bottom: 18px;
  animation: fadeUp 0.7s ease 0.1s both;
  position: relative; z-index: 1;
}

.hero h1 em { color: var(--coral); font-style: italic; }

.hero p {
  font-size: clamp(14px, 2vw, 17px);
  font-weight: 300; color: var(--text-dim);
  max-width: 480px; line-height: 1.75;
  margin-bottom: 40px;
  animation: fadeUp 0.7s ease 0.2s both;
  position: relative; z-index: 1;
}

/* ─── 5. INPUT PANEL ─── */
.input-panel {
  width: 100%; max-width: 720px;
  position: relative; z-index: 1;
  animation: fadeUp 0.7s ease 0.3s both;
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  overflow: hidden;
}

.input-tabs {
  display: flex;
  background: var(--surface3);
  border-bottom: 1px solid var(--border);
}

.tab-btn {
  flex: 1; padding: 13px 16px;
  background: none; border: none; cursor: pointer;
  font-family: 'DM Sans', sans-serif;
  font-size: 13px; font-weight: 600;
  color: var(--text-dim);
  transition: all 0.2s;
  display: flex; align-items: center; justify-content: center; gap: 7px;
}

.tab-btn.active { background: var(--surface); color: var(--coral); }
.tab-btn:hover:not(.active) { background: rgba(255,255,255,0.1); color: var(--text); }

.input-body { background: var(--surface); padding: 20px; }

.text-input-row { display: flex; gap: 10px; align-items: flex-end; }

.ingredient-textarea {
  flex: 1;
  background: var(--surface2);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 13px 15px;
  color: var(--text);
  font-family: 'DM Sans', sans-serif; font-size: 15px;
  resize: none; min-height: 72px; line-height: 1.6;
  outline: none;
  transition: border-color 0.2s, box-shadow 0.2s;
  -webkit-appearance: none;
}

.ingredient-textarea:focus {
  border-color: var(--coral-light);
  box-shadow: 0 0 0 3px rgba(244,132,95,0.1);
}

.ingredient-textarea::placeholder { color: var(--text-light); }
.input-hint { font-size: 12px; color: var(--text-light); margin-top: 8px; }

.upload-zone {
  border: 2px dashed rgba(244, 132, 95, 0.3);
  border-radius: var(--radius-sm);
  padding: 36px 16px;
  cursor: pointer;
  transition: all 0.25s;
  position: relative;
  background: var(--surface2);
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  text-align: center;
}

.upload-zone:hover,
.upload-zone.drag-over {
  border-color: var(--coral);
  background: rgba(244, 132, 95, 0.05);
}

.upload-zone input {
  position: absolute; inset: 0;
  opacity: 0; cursor: pointer;
  width: 100%; height: 100%;
}

.upload-zone-icon { font-size: 36px; display: block; margin-bottom: 10px; }
.upload-zone h3 { font-size: 15px; font-weight: 600; color: var(--text); margin-bottom: 6px; }
.upload-zone p  { font-size: 13px; color: var(--text-dim); }

.image-preview-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(90px, 1fr));
  gap: 10px; margin-top: 14px;
}

.preview-img-wrap {
  position: relative;
  border-radius: var(--radius-sm);
  overflow: hidden;
  aspect-ratio: 1;
}

.preview-img-wrap img { width: 100%; height: 100%; object-fit: cover; }

.remove-img {
  position: absolute; top: 4px; right: 4px;
  background: rgba(255,255,255,0.9);
  border: none; border-radius: 50%;
  width: 22px; height: 22px;
  cursor: pointer; font-size: 12px;
  display: flex; align-items: center; justify-content: center;
}

.btn-primary {
  background: linear-gradient(135deg, var(--coral) 0%, var(--coral-dim) 100%);
  color: white; border: none;
  border-radius: var(--radius-sm);
  padding: 13px 20px;
  font-family: 'DM Sans', sans-serif;
  font-size: 14px; font-weight: 600;
  cursor: pointer;
  transition: all 0.25s;
  white-space: nowrap;
  display: flex; align-items: center; gap: 7px;
  box-shadow: 0 4px 16px rgba(244,132,95,0.35);
  -webkit-appearance: none;
}

.btn-primary:hover { transform: translateY(-2px); box-shadow: 0 8px 24px rgba(244,132,95,0.45); }
.btn-primary:active { transform: translateY(0); }
.btn-full { width: 100%; justify-content: center; margin-top: 12px; }

/* ─── 6. RESULTS & FILTERS ─── */
#results {
  padding: 0 20px 80px;
  max-width: 1200px;
  margin: 0 auto;
}

.results-top {
  display: flex; align-items: flex-start; justify-content: space-between;
  padding-bottom: 18px;
  border-bottom: 2px solid var(--border);
  margin-bottom: 18px;
  flex-wrap: wrap; gap: 10px;
}

.results-title { font-family: 'Playfair Display', serif; font-size: 26px; font-weight: 700; color: var(--text); }
.results-title span { color: var(--coral); }
.results-meta { font-size: 13px; color: var(--text-dim); margin-top: 3px; }

.filters-row {
  display: flex; gap: 8px;
  flex-wrap: wrap; align-items: center;
  margin-bottom: 18px;
}

.search-box {
  flex: 1; min-width: 140px; max-width: 260px;
  background: var(--surface);
  border: 1.5px solid var(--border);
  border-radius: 100px;
  padding: 8px 16px;
  font-family: 'DM Sans', sans-serif;
  font-size: 13px; color: var(--text);
  outline: none;
  transition: border-color 0.2s;
  -webkit-appearance: none;
}

.search-box:focus { border-color: var(--coral-light); }
.search-box::placeholder { color: var(--text-light); }

.filter-btn {
  background: var(--surface);
  border: 1.5px solid var(--border);
  border-radius: 100px;
  padding: 7px 16px;
  font-family: 'DM Sans', sans-serif;
  font-size: 12px; font-weight: 600;
  color: var(--text-dim);
  cursor: pointer;
  transition: all 0.2s;
  white-space: nowrap;
}

.filter-btn.active { background: var(--coral); border-color: var(--coral); color: white; }
.filter-btn:hover:not(.active) { border-color: var(--coral-light); color: var(--coral); }

.detected-ingredients {
  background: var(--surface);
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  padding: 16px 20px;
  margin-bottom: 24px;
  box-shadow: var(--shadow);
}

.detected-label { font-size: 11px; font-weight: 700; letter-spacing: 0.14em; text-transform: uppercase; color: var(--coral); margin-bottom: 10px; }
.chip-row { display: flex; flex-wrap: wrap; gap: 7px; }
.chip { background: rgba(244,132,95,0.08); border: 1px solid rgba(244,132,95,0.2); border-radius: 100px; padding: 4px 13px; font-size: 13px; color: var(--coral-dim); font-weight: 500; }

/* ─── 7. RECIPE CARDS ─── */
.recipe-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px,1fr)); gap: 20px; }

.recipe-card {
  background: var(--surface);
  border: 1.5px solid var(--border2);
  border-radius: var(--radius);
  overflow: hidden; cursor: pointer;
  transition: transform 0.3s, box-shadow 0.3s, border-color 0.3s;
  animation: fadeUp 0.5s ease both;
  box-shadow: var(--shadow);
  position: relative;
}

.recipe-card:hover { border-color: var(--coral-light); transform: translateY(-4px); box-shadow: var(--shadow-lg); }

.fav-btn {
  position: absolute; top: 12px; right: 12px; z-index: 2;
  background: var(--surface);
  border: 1.5px solid var(--border);
  border-radius: 50%;
  width: 32px; height: 32px;
  font-size: 15px; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: all 0.2s;
  box-shadow: var(--shadow);
}

.fav-btn:hover { transform: scale(1.15); }
.fav-btn.active { background: #ffe0e0; border-color: #ffb3b3; }

.card-header { padding: 16px 16px 0; display: flex; align-items: flex-start; justify-content: space-between; padding-right: 48px; }
.card-origin { display: inline-flex; align-items: center; gap: 5px; background: rgba(123,201,160,0.12); border: 1px solid rgba(123,201,160,0.3); border-radius: 100px; padding: 4px 11px; font-size: 11px; font-weight: 600; letter-spacing: 0.07em; text-transform: uppercase; color: var(--mint-dim); }
/* Fix badge styling on cards */
.badge {
  padding: 4px 10px;
  border-radius: 100px;
  font-size: 11px; font-weight: 600;
  display: inline-flex; align-items: center;
}
.badge.time  { background: rgba(245,200,66,0.15); color: var(--gold-dim); }
.badge.diff  { background: rgba(244,132,95,0.12); color: var(--coral); border: 1px solid rgba(244,132,95,0.2); }
.badge.smart { background: rgba(123,201,160,0.15); color: var(--mint-dim); }

/* Fix footer layout */
footer {
  border-top: 1px solid var(--border);
  padding: 24px 32px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 10px;
  color: var(--text-dim);
  font-size: 13px;
  background: var(--surface);
}
.footer-love {
  display: flex;
  align-items: center;
  gap: 5px;
  flex-wrap: nowrap;
  white-space: nowrap;
}
.footer-love span { color: var(--coral); }

/* Fix modal meta cards equal size */
.modal-meta {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 10px;
  margin-bottom: 24px;
}
.meta-item {
  background: var(--surface2);
  border: 1px solid var(--border2);
  border-radius: var(--radius-sm);
  padding: 12px 8px;
  text-align: center;
}
.meta-value {
  font-size: 16px;
  font-weight: 700;
  color: var(--text);
  font-family: 'Playfair Display', serif;
  word-break: break-word;
}
.meta-label {
  font-size: 10px;
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: 0.09em;
  margin-top: 2px;
}

.card-emoji { font-size: 52px; text-align: center; padding: 12px 12px 4px; display: block; line-height: 1; }
.card-body { padding: 0 16px 16px; }
.card-title { font-family: 'Playfair Display', serif; font-size: 19px; font-weight: 700; color: var(--text); margin-bottom: 6px; line-height: 1.2; }
.card-desc { font-size: 13px; color: var(--text-dim); line-height: 1.6; margin-bottom: 10px; }
.card-ingredients { display: flex; flex-wrap: wrap; gap: 5px; margin-bottom: 12px; }
.ing-chip { background: var(--surface2); border: 1px solid var(--border2); border-radius: 6px; padding: 3px 8px; font-size: 11px; font-family: 'DM Mono', monospace; color: var(--text-dim); }
.ing-chip.missing { color: var(--coral-light); text-decoration: line-through; }
.smart-suggestion { background: linear-gradient(135deg,rgba(123,201,160,0.12),rgba(244,132,95,0.06)); border: 1px solid rgba(123,201,160,0.25); border-radius: var(--radius-sm); padding: 9px 12px; font-size: 12px; color: var(--mint-dim); margin-bottom: 10px; line-height: 1.5; }
.nutrition-row { display: flex; gap: 7px; margin-bottom: 10px; flex-wrap: wrap; }
.nut-badge { background: rgba(245,200,66,0.12); border: 1px solid rgba(245,200,66,0.25); border-radius: 100px; padding: 3px 10px; font-size: 11px; color: var(--gold-dim); font-weight: 600; }
.card-footer { display: flex; align-items: center; justify-content: space-between; padding-top: 12px; border-top: 1px solid var(--border2); }
.view-recipe-btn { background: none; border: 1.5px solid var(--border); border-radius: var(--radius-sm); padding: 7px 15px; color: var(--coral); font-family: 'DM Sans', sans-serif; font-size: 12px; font-weight: 600; letter-spacing: 0.04em; text-transform: uppercase; cursor: pointer; transition: all 0.2s; }
.view-recipe-btn:hover { background: var(--coral); color: white; border-color: var(--coral); }
.match-score { font-size: 11px; color: var(--text-dim); font-family: 'DM Mono', monospace; }
.match-score strong { color: var(--mint-dim); }

/* ─── 8. SKELETON LOADER ─── */
.skeleton-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px,1fr)); gap: 20px; margin-top: 24px; }
.skeleton-card { background: var(--surface); border: 1.5px solid var(--border2); border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow); padding: 16px; animation: fadeIn 0.4s ease both; }
.skeleton-block { background: linear-gradient(90deg, var(--skeleton-base) 25%, var(--skeleton-shine) 50%, var(--skeleton-base) 75%); background-size: 200% 100%; animation: shimmer 1.4s infinite; border-radius: 6px; }
.sk-header { display: flex; justify-content: space-between; margin-bottom: 14px; }
.sk-badge  { height: 22px; width: 80px; border-radius: 100px; }
.sk-badge2 { height: 22px; width: 55px; border-radius: 100px; }
.sk-emoji  { height: 60px; width: 60px; border-radius: 50%; margin: 10px auto 14px; }
.sk-title  { height: 22px; width: 75%; margin-bottom: 10px; }
.sk-desc   { height: 13px; width: 100%; margin-bottom: 6px; }
.sk-desc2  { height: 13px; width: 80%; margin-bottom: 16px; }
.sk-chips  { display: flex; gap: 6px; margin-bottom: 16px; }
.sk-chip   { height: 22px; width: 60px; border-radius: 6px; }
.sk-footer { display: flex; justify-content: space-between; padding-top: 12px; border-top: 1px solid var(--border2); }
.sk-btn    { height: 32px; width: 110px; border-radius: var(--radius-sm); }
.sk-score  { height: 16px; width: 70px; border-radius: 4px; }

/* ─── 9. LOADING STATE ─── */
.loading-state { text-align: center; padding: 60px 20px; animation: fadeIn 0.4s ease; }
.chef-spinner { font-size: 48px; display: inline-block; animation: spin 1.5s linear infinite; margin-bottom: 18px; }
.loading-state h3 { font-family: 'Playfair Display', serif; font-size: 22px; color: var(--coral); margin-bottom: 8px; }
.loading-state p { color: var(--text-dim); font-size: 14px; }
.loading-dots { display: inline-flex; gap: 6px; margin-top: 14px; }
.loading-dots span { width: 7px; height: 7px; border-radius: 50%; background: var(--coral-light); animation: bounce 1.2s ease infinite; }
.loading-dots span:nth-child(2) { animation-delay: 0.2s; }
.loading-dots span:nth-child(3) { animation-delay: 0.4s; }

/* ─── 10. MODAL ─── */
.modal-overlay { position: fixed; inset: 0; z-index: 500; background: rgba(45,42,38,0.6); backdrop-filter: blur(10px); display: flex; align-items: flex-end; justify-content: center; padding: 0; animation: fadeIn 0.2s ease; }
.modal { background: var(--surface); border-radius: 24px 24px 0 0; width: 100%; max-width: 720px; max-height: 92vh; overflow-y: auto; animation: slideUp 0.35s ease; -webkit-overflow-scrolling: touch; }
.modal-header { position: sticky; top: 0; background: var(--surface); border-bottom: 1px solid var(--border2); padding: 18px 22px; z-index: 1; display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.modal-close { background: var(--surface2); border: 1.5px solid var(--border); border-radius: 50%; width: 36px; height: 36px; color: var(--text-dim); cursor: pointer; font-size: 18px; display: flex; align-items: center; justify-content: center; flex-shrink: 0; transition: all 0.2s; }
.modal-close:hover { background: var(--coral); color: white; border-color: var(--coral); }
.modal-body { padding: 22px; }
.modal-origin-line { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; flex-wrap: wrap; }
.modal-origin-badge { background: rgba(123,201,160,0.12); border: 1px solid rgba(123,201,160,0.3); border-radius: 100px; padding: 5px 13px; font-size: 12px; font-weight: 600; letter-spacing: 0.07em; text-transform: uppercase; color: var(--mint-dim); }
.modal-title { font-family: 'Playfair Display', serif; font-size: clamp(24px,4vw,32px); font-weight: 700; color: var(--text); margin-bottom: 8px; line-height: 1.15; }
.modal-desc { font-size: 14px; color: var(--text-dim); line-height: 1.75; margin-bottom: 24px; }
.modal-section-title { font-size: 11px; font-weight: 700; letter-spacing: 0.16em; text-transform: uppercase; color: var(--coral); margin-bottom: 13px; padding-bottom: 7px; border-bottom: 2px solid var(--border); }
.modal-meta { display: flex; gap: 10px; margin-bottom: 24px; flex-wrap: wrap; }
.meta-item { background: var(--surface2); border: 1px solid var(--border2); border-radius: var(--radius-sm); padding: 11px 14px; text-align: center; min-width: 72px; flex: 1; }
.meta-value { font-size: 17px; font-weight: 700; color: var(--text); font-family: 'Playfair Display', serif; }
.meta-label { font-size: 10px; color: var(--text-dim); text-transform: uppercase; letter-spacing: 0.09em; margin-top: 2px; }
.nutrition-grid { display: grid; grid-template-columns: repeat(4,1fr); gap: 8px; margin-bottom: 24px; }
.nut-item { background: rgba(245,200,66,0.08); border: 1px solid rgba(245,200,66,0.2); border-radius: var(--radius-sm); padding: 11px; text-align: center; }
.nut-value { font-size: 18px; font-weight: 700; color: var(--gold-dim); font-family: 'Playfair Display', serif; }
.nut-label { font-size: 10px; color: var(--text-dim); text-transform: uppercase; letter-spacing: 0.07em; margin-top: 2px; }
.ingredients-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 7px; margin-bottom: 24px; }
.ing-row { display: flex; align-items: center; gap: 9px; padding: 9px 12px; background: var(--surface2); border-radius: var(--radius-sm); border: 1px solid var(--border2); }
.ing-check { font-size: 13px; flex-shrink: 0; }
.ing-name  { font-size: 13px; color: var(--text); font-weight: 500; flex: 1; }
.ing-amount { font-size: 11px; color: var(--text-dim); font-family: 'DM Mono', monospace; white-space: nowrap; }
.step-item { display: flex; gap: 16px; padding: 16px 0; border-bottom: 1px solid var(--border2); }
.step-item:last-child { border-bottom: none; }
.step-num { font-family: 'Playfair Display', serif; font-size: 30px; font-weight: 700; color: var(--coral); opacity: 0.22; line-height: 1; flex-shrink: 0; width: 38px; }
.step-content { flex: 1; padding-top: 2px; }
.step-title { font-size: 14px; font-weight: 700; color: var(--coral); margin-bottom: 5px; }
.step-text  { font-size: 14px; color: var(--text-dim); line-height: 1.72; }
.chef-tip { margin-top: 22px; padding: 15px 17px; background: rgba(244,132,95,0.06); border: 1.5px solid rgba(244,132,95,0.15); border-radius: var(--radius-sm); }
.chef-tip-label { font-size: 11px; font-weight: 700; letter-spacing: 0.13em; text-transform: uppercase; color: var(--coral); margin-bottom: 5px; }
.chef-tip-text  { font-size: 13px; color: var(--text-dim); line-height: 1.65; }

/* ─── 11. FAVORITES & EXTRA PAGES ─── */
.page { display: none; }
.page.active { display: block; }
#page-home.active { display: block; padding: 0; max-width: none; }
#page-favorites, #page-categories, #page-stats {
  padding: 90px 20px 80px;
  max-width: 1200px;
  margin: 0 auto;
}
.page-title { font-family: 'Playfair Display', serif; font-size: 32px; font-weight: 700; color: var(--text); margin-bottom: 6px; }
.page-title span { color: var(--coral); }
.page-subtitle { font-size: 14px; color: var(--text-dim); margin-bottom: 28px; }
.empty-state { text-align: center; padding: 70px 20px; }
.empty-state .empty-icon { font-size: 56px; margin-bottom: 14px; }
.empty-state h3 { font-family: 'Playfair Display', serif; font-size: 22px; color: var(--text-dim); margin-bottom: 7px; }
.empty-state p  { font-size: 14px; color: var(--text-light); }

/* Fix category emoji rendering */
.category-card { position: relative; }
.cat-emoji {
  font-size: 36px;
  line-height: 1;
  display: block;
  font-family: "Segoe UI Emoji", "Apple Color Emoji", "Noto Color Emoji", sans-serif;
}
.cat-name { font-size: 13px; font-weight: 600; color: var(--text); }

/* Fix stat-value overflow */
.stat-value {
  font-family: 'Playfair Display', serif;
  font-size: 28px; font-weight: 700;
  color: var(--coral); margin-bottom: 4px;
  line-height: 1.1;
  word-break: break-word;
  overflow-wrap: break-word;
}
.stat-value-sm { font-size: 14px; line-height: 1.3; }
.category-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 16px;
  margin-bottom: 40px;
}

.category-card {
  background: var(--surface);
  border: 1.5px solid var(--border2);
  border-radius: var(--radius);
  padding: 24px 16px;
  text-align: center;
  cursor: pointer;
  transition: all 0.25s;
  box-shadow: var(--shadow);
  display: flex; flex-direction: column;
  align-items: center; gap: 10px;
}

.category-card:hover {
  border-color: var(--coral-light);
  transform: translateY(-4px);
  box-shadow: var(--shadow-lg);
}

.category-card.active {
  border-color: var(--coral);
  background: rgba(244, 132, 95, 0.06);
  transform: translateY(-4px);
  box-shadow: var(--shadow-lg);
}

.cat-emoji { font-size: 36px; line-height: 1; }
.cat-name  { font-size: 13px; font-weight: 600; color: var(--text); }

/* ─── STATS ─── */
.stats-summary {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 16px;
  margin-bottom: 32px;
}

.stat-card {
  background: var(--surface);
  border: 1.5px solid var(--border2);
  border-radius: var(--radius);
  padding: 24px 20px;
  text-align: center;
  box-shadow: var(--shadow);
  transition: all 0.25s;
}

.stat-card:hover { transform: translateY(-3px); box-shadow: var(--shadow-lg); }
.stat-icon  { font-size: 28px; margin-bottom: 10px; }
.stat-value { font-family: 'Playfair Display', serif; font-size: 28px; font-weight: 700; color: var(--coral); margin-bottom: 4px; line-height: 1.1; }
.stat-value-sm { font-size: 16px; }
.stat-label { font-size: 12px; color: var(--text-dim); text-transform: uppercase; letter-spacing: 0.08em; }

.stats-section { background: var(--surface); border: 1.5px solid var(--border2); border-radius: var(--radius); padding: 24px; margin-bottom: 20px; box-shadow: var(--shadow); }
.stats-section-title { font-size: 11px; font-weight: 700; letter-spacing: 0.14em; text-transform: uppercase; color: var(--coral); margin-bottom: 20px; }

.stats-bar-list  { display: flex; flex-direction: column; gap: 14px; }
.stats-bar-row   { display: flex; align-items: center; gap: 12px; }
.stats-bar-label { font-size: 13px; font-weight: 500; color: var(--text); min-width: 120px; }
.stats-bar-track { flex: 1; height: 8px; background: var(--surface2); border-radius: 100px; overflow: hidden; }
.stats-bar-fill  { height: 100%; background: linear-gradient(90deg, var(--coral), var(--coral-light)); border-radius: 100px; animation: barGrow 0.8s ease both; }
.stats-bar-count { font-size: 12px; color: var(--text-dim); font-family: 'DM Mono', monospace; min-width: 30px; text-align: right; }

.stats-recipe-list { display: flex; flex-direction: column; gap: 10px; }
.stats-recipe-row  { display: flex; align-items: center; gap: 14px; padding: 12px 16px; background: var(--surface2); border-radius: var(--radius-sm); }
.stats-recipe-rank { width: 24px; height: 24px; border-radius: 50%; background: rgba(244,132,95,0.15); color: var(--coral); font-size: 12px; font-weight: 700; display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.stats-recipe-name  { flex: 1; font-size: 14px; font-weight: 500; color: var(--text); }
.stats-recipe-count { font-size: 12px; color: var(--text-dim); font-family: 'DM Mono', monospace; white-space: nowrap; }

.stats-global-banner {
  background: linear-gradient(135deg, rgba(244,132,95,0.08), rgba(123,201,160,0.08));
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 12px 20px;
  font-size: 13px;
  color: var(--text-dim);
  margin-bottom: 20px;
  text-align: center;
}
  background: none;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 10px 24px;
  font-family: 'DM Sans', sans-serif;
  font-size: 13px; font-weight: 600;
  color: var(--text-dim);
  cursor: pointer;
  transition: all 0.2s;
}
.btn-reset-stats:hover { border-color: var(--coral); color: var(--coral); }

@keyframes barGrow { from { width: 0; } }

/* ─── 12. FOOTER ─── */
footer { border-top: 1px solid var(--border); padding: 24px 20px; display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 10px; color: var(--text-dim); font-size: 13px; background: var(--surface); }
.footer-logo { font-family: 'Playfair Display', serif; color: var(--coral); font-size: 20px; font-weight: 700; }
.footer-love { display: flex; align-items: center; gap: 5px; }
.footer-love span { color: var(--coral); }

/* ─── MOBILE NAV MENU ─── */
.hamburger {
  display: none;
  background: none;
  border: none;
  cursor: pointer;
  font-size: 22px;
  color: var(--text);
  padding: 4px;
}

.mobile-nav {
  display: none;
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  z-index: 200;
  background: rgba(45, 42, 38, 0.5);
  backdrop-filter: blur(4px);
  animation: fadeIn 0.2s ease;
}

.mobile-nav.open { display: block; }

.mobile-nav-panel {
  position: absolute;
  top: 0; right: 0; bottom: 0;
  width: 260px;
  background: var(--surface);
  border-left: 1px solid var(--border);
  padding: 24px 20px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  animation: slideInRight 0.25s ease;
}

.mobile-nav-close {
  background: none;
  border: none;
  font-size: 22px;
  color: var(--text-dim);
  cursor: pointer;
  align-self: flex-end;
  margin-bottom: 8px;
}

.mobile-nav-link {
  padding: 14px 16px;
  font-size: 15px;
  font-weight: 500;
  color: var(--text);
  cursor: pointer;
  border-radius: var(--radius-sm);
  transition: all 0.2s;
  border: none;
  background: none;
  text-align: left;
  width: 100%;
}

.mobile-nav-link:hover { background: var(--surface2); color: var(--coral); }

body.ar .mobile-nav-link { text-align: right; }

@keyframes slideInRight {
  from { transform: translateX(100%); opacity: 0; }
  to   { transform: translateX(0);    opacity: 1; }
}
@keyframes fadeUp   { from { opacity:0; transform:translateY(20px); } to { opacity:1; transform:translateY(0); } }
@keyframes fadeIn   { from { opacity:0; } to { opacity:1; } }
@keyframes slideUp  { from { opacity:0; transform:translateY(40px); } to { opacity:1; transform:translateY(0); } }
@keyframes spin     { from { transform:rotate(0deg); } to { transform:rotate(360deg); } }
@keyframes bounce   { 0%,80%,100% { transform:translateY(0); opacity:0.4; } 40% { transform:translateY(-8px); opacity:1; } }
@keyframes floatAnim { 0% { transform:translateY(0) rotate(0deg); } 25% { transform:translateY(-18px) rotate(8deg); } 50% { transform:translateY(-6px) rotate(-4deg); } 75% { transform:translateY(-20px) rotate(6deg); } 100% { transform:translateY(0) rotate(0deg); } }
@keyframes shimmer  { from { background-position:200% 0; } to { background-position:-200% 0; } }

/* Arabic RTL */
body.ar { direction: rtl; }
body.ar .logo span { font-style: normal; }

/* ─── 14. RESPONSIVE ─── */
@media (min-width: 640px) {
  .modal-overlay { align-items: center; padding: 20px; }
  .modal { border-radius: 24px; max-height: 88vh; }
}

@media (max-width: 480px) {
  header { padding: 12px 16px; }
  .logo { font-size: 20px; }
  .hero { padding: 88px 14px 50px; }
  .input-body { padding: 14px; }
  .text-input-row { flex-direction: column; }
  .text-input-row .ingredient-textarea { width: 100%; }
  .btn-primary { width: 100%; justify-content: center; }
  #results, #page-favorites, #page-categories, #page-stats { padding: 0 14px 60px; }
  .recipe-grid, .skeleton-grid { grid-template-columns: 1fr; }
  .nutrition-grid { grid-template-columns: repeat(2, 1fr); }
  .ingredients-grid { grid-template-columns: 1fr; }
  .modal-body { padding: 16px; }
  .modal-meta { gap: 7px; }
  .meta-item { min-width: 60px; padding: 9px 10px; }
  .filters-row { gap: 6px; }
  .search-box { min-width: 120px; }
  /* Hide desktop nav links, show hamburger */
  .nav-link { display: none; }
  .theme-btn, .lang-btn { display: none; }
  .hamburger { display: block; }
  .category-grid { grid-template-columns: repeat(3, 1fr); gap: 10px; }
  .stats-summary { grid-template-columns: repeat(2, 1fr); }
  .stats-bar-label { min-width: 80px; font-size: 12px; }
}

@media (min-width: 481px) and (max-width: 768px) {
  header { padding: 14px 20px; }
  #results, #page-favorites, #page-categories, #page-stats { padding: 0 18px 70px; }
  .recipe-grid, .skeleton-grid { grid-template-columns: 1fr 1fr; }
  .ingredients-grid { grid-template-columns: 1fr 1fr; }
  .category-grid { grid-template-columns: repeat(4, 1fr); }
  .stats-summary { grid-template-columns: repeat(2, 1fr); }
  /* Hide desktop nav links, show hamburger on tablet too */
  .nav-link { display: none; }
  .theme-btn, .lang-btn { display: none; }
  .hamburger { display: block; }
}
