/* ─────────────────────────────────────────────
   ANTI-INFLAMMATORY KITCHEN — CSS
   Aesthetic: Organic warmth meets editorial
   Fonts: Playfair Display + DM Sans
   ───────────────────────────────────────────── */

:root {
  --sage:       #1a4a35;
  --sage-mid:   #2d6b4f;
  --sage-light: #e8f2ec;
  --sage-pale:  #f4f9f6;
  --gold:       #c8780a;
  --gold-light: #fef3e2;
  --cream:      #faf8f3;
  --warm-white: #fffefb;
  --ink:        #1c1c1c;
  --ink-mid:    #444;
  --ink-soft:   #777;
  --border:     #e0dbd0;
  --border-dark:#c8c0b0;

  /* cuisine accent colors */
  --c-med:      #2d6b4f;
  --c-ind:      #b85c0a;
  --c-jpn:      #5c2d6b;
  --c-tha:      #7a3010;
  --c-tri:      #b82010;
  --c-grk:      #1a3d8f;
  --c-ash:      #5c3210;
  --c-chi:      #a81010;
  --c-ita:      #8f1a1a;
  --c-ger:      #2a4a18;
  --c-eeu:      #4a2870;
  --c-ame:      #1a3a6b;
  --c-des:      #8f1a5c;
  --c-drk:      #1a6b5c;
  --c-spc:      #7a4a08;

  --radius-sm:  8px;
  --radius-md:  14px;
  --radius-lg:  20px;
  --shadow-sm:  0 2px 8px rgba(0,0,0,0.06);
  --shadow-md:  0 4px 20px rgba(0,0,0,0.10);
  --shadow-lg:  0 8px 40px rgba(0,0,0,0.14);

  --header-h:   64px;
  --safe-bottom: env(safe-area-inset-bottom, 0px);
}

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

html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
}

body {
  font-family: 'DM Sans', system-ui, sans-serif;
  background: var(--cream);
  color: var(--ink);
  min-height: 100dvh;
  -webkit-font-smoothing: antialiased;
}

/* ── HEADER ── */
.app-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: var(--sage);
  padding-top: env(safe-area-inset-top, 0px);
  box-shadow: var(--shadow-md);
}

.header-inner {
  max-width: 900px;
  margin: 0 auto;
  padding: 0 16px;
}

.header-brand {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 0 6px;
}

.brand-leaf { font-size: 18px; }

.brand-name {
  font-family: 'Playfair Display', Georgia, serif;
  font-size: 17px;
  font-weight: 700;
  color: #fff;
  letter-spacing: 0.01em;
}

.tab-nav {
  display: flex;
  gap: 2px;
  padding-bottom: 0;
}

.tab-btn {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  padding: 8px 4px 10px;
  background: transparent;
  border: none;
  border-bottom: 3px solid transparent;
  color: rgba(255,255,255,0.6);
  font-family: 'DM Sans', sans-serif;
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  position: relative;
  transition: color 0.2s, border-color 0.2s;
}

.tab-btn.active {
  color: #fff;
  border-bottom-color: #a8e6c0;
}

.tab-btn .tab-icon { font-size: 16px; }
.tab-btn .tab-label { display: none; }

@media (min-width: 400px) {
  .tab-btn .tab-label { display: inline; }
}

.badge {
  position: absolute;
  top: 6px;
  right: 6px;
  background: var(--gold);
  color: #fff;
  font-size: 10px;
  font-weight: 700;
  min-width: 18px;
  height: 18px;
  border-radius: 9px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 4px;
}

/* ── PANELS ── */
.tab-panel {
  display: none;
  max-width: 900px;
  margin: 0 auto;
  padding: 0 16px calc(80px + var(--safe-bottom));
  min-height: calc(100dvh - var(--header-h));
}

.tab-panel.active { display: block; }

.panel-header {
  padding: 24px 0 16px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 16px;
}

.panel-title {
  font-family: 'Playfair Display', Georgia, serif;
  font-size: 28px;
  font-weight: 700;
  color: var(--sage);
  line-height: 1.1;
}

.panel-sub {
  margin-top: 4px;
  font-size: 14px;
  color: var(--ink-soft);
}

/* ── FILTER BAR ── */
.filter-bar {
  margin-bottom: 12px;
  overflow: hidden;
}

.filter-scroll {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding-bottom: 8px;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}

.filter-scroll::-webkit-scrollbar { display: none; }

.filter-pill {
  flex-shrink: 0;
  padding: 6px 14px;
  border-radius: 20px;
  border: 1.5px solid var(--border-dark);
  background: var(--warm-white);
  color: var(--ink-mid);
  font-family: 'DM Sans', sans-serif;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.15s;
  white-space: nowrap;
}

.filter-pill:hover {
  border-color: var(--sage-mid);
  color: var(--sage-mid);
}

.filter-pill.active {
  background: var(--sage);
  border-color: var(--sage);
  color: #fff;
}

/* ── SEARCH ── */
.search-row {
  display: flex;
  gap: 10px;
  margin-bottom: 16px;
  align-items: center;
}

.search-input {
  flex: 1;
  padding: 10px 14px;
  border: 1.5px solid var(--border-dark);
  border-radius: var(--radius-md);
  background: var(--warm-white);
  font-family: 'DM Sans', sans-serif;
  font-size: 15px;
  color: var(--ink);
  outline: none;
  transition: border-color 0.2s;
}

.search-input:focus {
  border-color: var(--sage-mid);
}

.clear-sel-btn {
  padding: 10px 14px;
  border: 1.5px solid var(--border-dark);
  border-radius: var(--radius-md);
  background: var(--warm-white);
  color: var(--ink-soft);
  font-family: 'DM Sans', sans-serif;
  font-size: 13px;
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.15s;
}

.clear-sel-btn:hover {
  border-color: #c0392b;
  color: #c0392b;
}

/* ── RECIPE GRID ── */
.recipe-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
}

@media (min-width: 600px) {
  .recipe-grid { grid-template-columns: repeat(3, 1fr); }
}

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

/* ── RECIPE CARD ── */
.recipe-card {
  background: var(--warm-white);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-md);
  padding: 12px;
  cursor: pointer;
  position: relative;
  transition: transform 0.15s, box-shadow 0.15s, border-color 0.15s;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
}

.recipe-card:active {
  transform: scale(0.97);
}

.recipe-card.selected {
  border-color: var(--sage-mid);
  background: var(--sage-pale);
  box-shadow: 0 0 0 2px rgba(45,107,79,0.15);
}

.recipe-card .check-mark {
  position: absolute;
  top: 8px;
  right: 8px;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  border: 1.5px solid var(--border-dark);
  background: var(--warm-white);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  transition: all 0.15s;
}

.recipe-card.selected .check-mark {
  background: var(--sage-mid);
  border-color: var(--sage-mid);
  color: #fff;
}

.recipe-card .card-emoji {
  font-size: 20px;
  display: block;
  margin-bottom: 6px;
  line-height: 1;
}

.recipe-card .card-cuisine {
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-bottom: 4px;
}

.recipe-card .card-name {
  font-family: 'Playfair Display', Georgia, serif;
  font-size: 13px;
  font-weight: 600;
  line-height: 1.3;
  color: var(--ink);
  margin-bottom: 6px;
}

.recipe-card .card-meta {
  display: flex;
  gap: 4px;
  flex-wrap: wrap;
}

.card-tag {
  font-size: 10px;
  padding: 2px 7px;
  border-radius: 10px;
  background: var(--sage-light);
  color: var(--sage);
  font-weight: 500;
}

.card-tag.vol {
  background: var(--gold-light);
  color: var(--gold);
}

/* ── CUISINE COLOR ACCENTS ── */
.cuisine-Mediterranean .card-cuisine { color: var(--c-med); }
.cuisine-Indian        .card-cuisine { color: var(--c-ind); }
.cuisine-Japanese      .card-cuisine { color: var(--c-jpn); }
.cuisine-Thai          .card-cuisine { color: var(--c-tha); }
.cuisine-Trinidadian   .card-cuisine { color: var(--c-tri); }
.cuisine-Greek         .card-cuisine { color: var(--c-grk); }
.cuisine-Ashkenazi     .card-cuisine { color: var(--c-ash); }
.cuisine-Chinese       .card-cuisine { color: var(--c-chi); }
.cuisine-Italian       .card-cuisine { color: var(--c-ita); }
.cuisine-German        .card-cuisine { color: var(--c-ger); }
.cuisine-Eastern-European .card-cuisine { color: var(--c-eeu); }
.cuisine-American      .card-cuisine { color: var(--c-ame); }
.cuisine-Dessert       .card-cuisine { color: var(--c-des); }
.cuisine-Drinks        .card-cuisine { color: var(--c-drk); }
.cuisine-Spice-Blend   .card-cuisine { color: var(--c-spc); }

/* ── FAB ── */
.fab-container {
  position: fixed;
  bottom: calc(20px + var(--safe-bottom));
  left: 0;
  right: 0;
  display: flex;
  justify-content: center;
  pointer-events: none;
  z-index: 50;
}

.fab {
  pointer-events: all;
  background: var(--sage);
  color: #fff;
  border: none;
  border-radius: 30px;
  padding: 14px 28px;
  font-family: 'DM Sans', sans-serif;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  box-shadow: var(--shadow-lg);
  transition: background 0.2s, transform 0.15s;
}

.fab:active { transform: scale(0.97); }
.fab:hover  { background: var(--sage-mid); }

/* ── SHOPPING LIST ── */
.list-actions {
  display: flex;
  gap: 10px;
  margin-bottom: 20px;
  flex-wrap: wrap;
}

.action-btn {
  flex: 1;
  padding: 12px 20px;
  border: none;
  border-radius: var(--radius-md);
  background: var(--sage);
  color: #fff;
  font-family: 'DM Sans', sans-serif;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s;
  min-width: 140px;
}

.action-btn:hover   { background: var(--sage-mid); }
.action-btn.secondary { background: var(--warm-white); color: var(--ink-mid); border: 1.5px solid var(--border-dark); }
.action-btn.secondary:hover { border-color: var(--sage-mid); color: var(--sage-mid); }
.action-btn.small   { flex: 0; padding: 8px 16px; font-size: 13px; }

/* ── CATEGORY SECTIONS ── */
.category-section {
  margin-bottom: 24px;
}

.category-header {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  background: var(--sage);
  border-radius: var(--radius-md) var(--radius-md) 0 0;
  margin-bottom: 0;
}

.category-icon { font-size: 18px; }

.category-title {
  font-family: 'Playfair Display', Georgia, serif;
  font-size: 16px;
  font-weight: 700;
  color: #fff;
}

.category-count {
  margin-left: auto;
  font-size: 12px;
  color: rgba(255,255,255,0.7);
  font-weight: 500;
}

.category-items {
  background: var(--warm-white);
  border: 1.5px solid var(--border);
  border-top: none;
  border-radius: 0 0 var(--radius-md) var(--radius-md);
  overflow: hidden;
}

.ingredient-row {
  display: flex;
  align-items: center;
  padding: 11px 14px;
  border-bottom: 1px solid var(--sage-pale);
  font-size: 14px;
  transition: background 0.15s;
}

.ingredient-row:last-child { border-bottom: none; }
.ingredient-row:hover { background: var(--sage-pale); }

.ingredient-row .ing-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--sage-mid);
  flex-shrink: 0;
  margin-right: 10px;
}

.ingredient-row .ing-name {
  flex: 1;
  color: var(--ink);
  line-height: 1.4;
}

.ingredient-row .ing-amount {
  font-size: 12px;
  color: var(--ink-soft);
  margin-left: 8px;
}

/* ── SHOP MODE ── */
.shop-actions {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 20px;
}

.progress-bar-wrap {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.progress-bar-track {
  height: 8px;
  border-radius: 4px;
  background: var(--border);
  overflow: hidden;
}

.progress-bar-fill {
  height: 100%;
  background: linear-gradient(to right, var(--sage-mid), #4caf88);
  border-radius: 4px;
  transition: width 0.4s ease;
  width: 0%;
}

.progress-label {
  font-size: 12px;
  color: var(--ink-soft);
  font-weight: 500;
}

/* Shop mode item — checkable */
.shop-item {
  display: flex;
  align-items: center;
  padding: 13px 14px;
  border-bottom: 1px solid var(--sage-pale);
  cursor: pointer;
  transition: background 0.15s;
  -webkit-tap-highlight-color: transparent;
  user-select: none;
}

.shop-item:last-child { border-bottom: none; }
.shop-item:active { background: var(--sage-light); }

.shop-checkbox {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  border: 2px solid var(--border-dark);
  background: #fff;
  flex-shrink: 0;
  margin-right: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  transition: all 0.15s;
}

.shop-item.checked .shop-checkbox {
  background: var(--sage-mid);
  border-color: var(--sage-mid);
  color: #fff;
}

.shop-item .shop-ing-name {
  flex: 1;
  font-size: 15px;
  color: var(--ink);
  transition: all 0.2s;
}

.shop-item.checked .shop-ing-name {
  text-decoration: line-through;
  color: var(--ink-soft);
}

.shop-item .shop-ing-amount {
  font-size: 13px;
  color: var(--ink-soft);
}

.shop-item.checked .shop-ing-amount {
  color: var(--border-dark);
}

/* ── EMPTY STATE ── */
.empty-state {
  text-align: center;
  padding: 60px 20px;
  color: var(--ink-soft);
}

.empty-icon {
  font-size: 52px;
  margin-bottom: 16px;
}

.empty-state p {
  font-size: 16px;
  margin-bottom: 20px;
}

.goto-btn {
  display: inline-block;
  padding: 12px 24px;
  background: var(--sage);
  color: #fff;
  border: none;
  border-radius: var(--radius-md);
  font-family: 'DM Sans', sans-serif;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s;
}

.goto-btn:hover { background: var(--sage-mid); }

/* ── TOAST ── */
.toast {
  position: fixed;
  bottom: calc(90px + var(--safe-bottom));
  left: 50%;
  transform: translateX(-50%) translateY(20px);
  background: var(--ink);
  color: #fff;
  padding: 10px 20px;
  border-radius: 30px;
  font-size: 14px;
  font-weight: 500;
  opacity: 0;
  transition: opacity 0.25s, transform 0.25s;
  pointer-events: none;
  z-index: 200;
  white-space: nowrap;
}

.toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

/* ── RECIPE SECTION DIVIDER ── */
.vol-divider {
  grid-column: 1 / -1;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px 0 4px;
}

.vol-divider-line {
  flex: 1;
  height: 1px;
  background: var(--border);
}

.vol-divider-label {
  font-family: 'Playfair Display', Georgia, serif;
  font-size: 13px;
  font-weight: 700;
  color: var(--sage);
  white-space: nowrap;
  font-style: italic;
}

/* ── ANIMATIONS ── */
@keyframes fadeSlideUp {
  from { opacity: 0; transform: translateY(12px); }
  to   { opacity: 1; transform: translateY(0); }
}

.recipe-card {
  animation: fadeSlideUp 0.3s ease both;
}

/* ── SCROLLBAR ── */
::-webkit-scrollbar { width: 4px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border-dark); border-radius: 2px; }
