/* ─────────────────────────────────────────────
   fromFridge — design tokens
───────────────────────────────────────────── */
:root {
  --color-bg: #F8FAFC;           /* Cloud */
  --color-surface: #FFFFFF;
  --color-text: #0F172A;         /* Midnight */
  --color-text-muted: #64748B;   /* Slate */
  --color-border: #E2E8F0;

  --color-primary: #1F6FFF;      /* Primary Blue */
  --color-primary-dark: #1554C7;
  --color-secondary: #2DD4BF;    /* Fresh Mint */
  --color-star: #F5A623;

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

  --radius-sm: 8px;
  --radius-md: 14px;
  --radius-lg: 20px;

  --shadow-card: 0 2px 8px rgba(15, 23, 42, 0.06), 0 1px 2px rgba(15, 23, 42, 0.04);
  --shadow-hover: 0 8px 24px rgba(15, 23, 42, 0.12);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: var(--font-body);
  background: var(--color-bg);
  color: var(--color-text);
  line-height: 1.5;
}

h1, h2, h3, h4 {
  font-family: var(--font-heading);
  margin: 0 0 0.5em;
  line-height: 1.2;
}

a { color: var(--color-primary); text-decoration: none; }
a:hover { color: var(--color-primary-dark); }

/* ─────────────────────────────────────────────
   Header / nav
───────────────────────────────────────────── */
.site-header {
  background: var(--color-surface);
  border-bottom: 1px solid var(--color-border);
  position: sticky;
  top: 0;
  z-index: 50;
}
.site-header__inner {
  max-width: 1400px;
  margin: 0 auto;
  padding: 16px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: relative;
}
.logo {
  font-family: var(--font-heading);
  font-weight: 700;
  font-size: 1.4rem;
  color: var(--color-text);
  display: flex;
  align-items: center;
  gap: 8px;
}
.logo__icon { display: block; }
.logo__text { display: inline-flex; align-items: baseline; }
.logo__accent { color: var(--color-primary); }
.main-nav {
  display: flex;
  align-items: center;
  gap: 24px;
}
.main-nav a {
  color: var(--color-text);
  font-weight: 500;
  font-size: 0.95rem;
}
.main-nav a:hover { color: var(--color-primary); }

.nav-dropdown { position: relative; }
.nav-dropdown__trigger {
  color: var(--color-text);
  font-weight: 500;
  font-size: 0.95rem;
  cursor: pointer;
}
.nav-dropdown__trigger:hover { color: var(--color-primary); }
.nav-dropdown__menu {
  display: none;
  position: absolute;
  top: 100%;
  right: 0;
  margin-top: 8px;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-hover);
  min-width: 180px;
  padding: 6px;
  z-index: 60;
}
/* Invisible bridge over the gap so the mouse doesn't leave :hover while moving down to the menu. */
.nav-dropdown__menu::before {
  content: '';
  position: absolute;
  top: -8px;
  left: 0;
  right: 0;
  height: 8px;
}
.nav-dropdown:hover .nav-dropdown__menu,
.nav-dropdown:focus-within .nav-dropdown__menu {
  display: block;
}
.nav-dropdown__menu a {
  display: block;
  padding: 8px 12px;
  border-radius: 6px;
  font-size: 0.9rem;
  font-weight: 500;
  color: var(--color-text);
  white-space: nowrap;
}
.nav-dropdown__menu a:hover {
  background: var(--color-bg);
  color: var(--color-primary);
}

.nav-toggle {
  display: none;
  flex-direction: column;
  justify-content: center;
  gap: 5px;
  width: 32px;
  height: 32px;
  background: none;
  border: none;
  cursor: pointer;
  padding: 0;
}
.nav-toggle span {
  display: block;
  width: 100%;
  height: 2px;
  background: var(--color-text);
  border-radius: 2px;
}

@media (max-width: 860px) {
  .nav-toggle { display: flex; }

  .main-nav {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    flex-direction: column;
    align-items: stretch;
    gap: 0;
    background: var(--color-surface);
    border-bottom: 1px solid var(--color-border);
    box-shadow: var(--shadow-hover);
    padding: 8px 0;
  }
  .main-nav.is-open { display: flex; }
  .main-nav a,
  .nav-dropdown__trigger {
    padding: 12px 24px;
    width: 100%;
  }
  .btn-inline { margin: 8px 24px; width: fit-content; }

  /* On mobile the Admin submenu is just part of the stacked list —
     no hover flyout, no absolute positioning, always expanded. */
  .nav-dropdown { width: 100%; }
  .nav-dropdown__menu {
    display: block;
    position: static;
    box-shadow: none;
    border: none;
    border-radius: 0;
    background: var(--color-bg);
    margin-top: 0;
    padding: 4px 0;
  }
  .nav-dropdown__menu::before { display: none; }
  .nav-dropdown__menu a { padding-left: 40px; }
}

.btn-inline {
  background: var(--color-primary);
  color: #fff !important;
  padding: 8px 16px;
  border-radius: var(--radius-sm);
  font-weight: 600 !important;
}
.btn-inline:hover { background: var(--color-primary-dark); }

/* ─────────────────────────────────────────────
   Flash messages
───────────────────────────────────────────── */
.flash {
  max-width: 1400px;
  margin: 16px auto 0;
  padding: 12px 20px;
  border-radius: var(--radius-sm);
  font-size: 0.95rem;
}
.flash--success { background: #E4F4EC; color: #1E5E43; }
.flash--error { background: #FCE8E4; color: #A63A24; }
.flash--info { background: #EAF1FF; color: #1554C7; align-items: center; justify-content: space-between; gap: 12px; }
.flash--info:not([hidden]) { display: flex; }

/* Off-screen bait element used only to detect ad blockers (see
   includes/adblock-banner.php + assets/js/main.js). Deliberately kept
   out of normal flow so it can never affect real layout either way.
   Targeted by #adblock-bait (id), not by its .ad-banner/.adsbox classes —
   those class names are load-bearing bait for blocklists and must stay
   exactly as-is; don't "clean them up" like the real .rail/.rail-unit
   classes elsewhere in this file. */
#adblock-bait {
  position: absolute;
  top: -9999px;
  left: -9999px;
  width: 1px;
  height: 1px;
  overflow: hidden;
}
.adblock-banner__dismiss {
  background: none;
  border: none;
  color: inherit;
  font-size: 1.2rem;
  line-height: 1;
  cursor: pointer;
  padding: 0 4px;
  flex-shrink: 0;
}

/* ─────────────────────────────────────────────
   3-column page layout: ads | content | ads
───────────────────────────────────────────── */
.page-layout {
  max-width: 1400px;
  margin: 0 auto;
  display: grid;
  grid-template-columns: 200px 1fr 200px;
  gap: 24px;
  padding: 24px;
  align-items: start;
}
.rail { position: sticky; top: 84px; min-height: 250px; overflow: hidden; }
.rail-unit {
  background: var(--color-surface);
  border: 1px dashed var(--color-border);
  border-radius: var(--radius-sm);
  min-height: 250px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--color-text-muted);
  font-size: 0.8rem;
}
.page-content { min-width: 0; }

@media (max-width: 1100px) {
  .page-layout { grid-template-columns: 1fr; }
  .rail { display: none; }
}

/* ─────────────────────────────────────────────
   Recipe grid + cards
───────────────────────────────────────────── */
.recipe-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 24px;
  margin-top: 24px;
}
.recipe-card {
  background: var(--color-surface);
  border-radius: var(--radius-md);
  overflow: hidden;
  box-shadow: var(--shadow-card);
  transition: transform 0.15s ease, box-shadow 0.15s ease;
  display: flex;
  flex-direction: column;
}
.recipe-card:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow-hover);
}
.recipe-card__img {
  width: 100%;
  aspect-ratio: 4 / 3;
  object-fit: cover;
  background: var(--color-border);
}
.recipe-card__body { padding: 16px; flex: 1; display: flex; flex-direction: column; gap: 6px; }
.recipe-card__title {
  font-family: var(--font-heading);
  font-weight: 600;
  font-size: 1.05rem;
  color: var(--color-text);
}
.recipe-card__meta {
  font-size: 0.85rem;
  color: var(--color-text-muted);
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}
.recipe-card__meta span { white-space: nowrap; }
.recipe-card__date {
  font-size: 0.7rem;
  color: #94A3B8;
  margin-top: 2px;
}
.recipe-card__category {
  font-size: 0.72rem;
  color: var(--color-text-muted);
  text-transform: uppercase;
  letter-spacing: 0.02em;
  margin-bottom: 2px;
}

/* ─────────────────────────────────────────────
   Homepage category filter (dropdown panel + applied pills)
───────────────────────────────────────────── */
.category-filter {
  position: relative;
}
.category-filter__bar {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
}
.category-filter__applied-row {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  margin: 16px 0 0;
}
.category-filter__applied-row[hidden] { display: none; }
.category-pill-applied {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 6px 12px;
  border-radius: 20px;
  background: var(--color-primary);
  color: #fff;
  font-size: 0.85rem;
  text-decoration: none;
}
.category-pill-applied:hover { background: var(--color-primary-dark); }
.category-filter__clear-all {
  font-size: 0.85rem;
  color: var(--color-text-muted);
  text-decoration: underline;
}

/* The panel: fixed side margins, pills wrap to fill available width
   naturally — no fixed column count, driven purely by screen/pill width. */
.category-filter__panel {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  z-index: 50;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-hover);
  padding: 16px;
  width: min(480px, calc(100vw - 32px));
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}
.category-filter__panel[hidden] { display: none; }

.category-pill-checkbox {
  display: inline-flex;
  align-items: center;
  padding: 6px 14px;
  border-radius: 20px;
  border: 1px solid var(--color-border);
  background: var(--color-bg);
  color: var(--color-text);
  font-size: 0.85rem;
  cursor: pointer;
  user-select: none;
}
.category-pill-checkbox input {
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0;
}
.category-pill-checkbox:hover { border-color: var(--color-primary); }
.category-pill-checkbox.is-checked {
  background: var(--color-primary);
  border-color: var(--color-primary);
  color: #fff;
}
.category-filter__apply {
  margin-left: auto;
}

/* ─────────────────────────────────────────────
   Star ratings
───────────────────────────────────────────── */
.stars { display: inline-flex; gap: 2px; font-size: 1.1rem; color: var(--color-star); }
.stars--interactive .star { cursor: pointer; }
.star-empty { color: var(--color-border); }
.rating-count { color: var(--color-text-muted); font-size: 0.85rem; margin-left: 6px; }

/* ─────────────────────────────────────────────
   Magic Fridge subscriber-gate card
───────────────────────────────────────────── */
.ai-gate-card {
  background: var(--color-surface);
  border: 1px solid var(--color-primary);
  border-radius: var(--radius-md);
  padding: 24px;
  margin: 24px 0;
}
.ai-gate-card p { color: var(--color-text-muted); }

/* ─────────────────────────────────────────────
   Forms
───────────────────────────────────────────── */
.form-card {
  background: var(--color-surface);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-card);
  padding: 32px;
  max-width: 520px;
  margin: 32px auto;
}
.form-group { margin-bottom: 18px; }
.form-group label { display: block; font-weight: 600; margin-bottom: 6px; font-size: 0.9rem; }
.form-group input,
.form-group textarea,
.form-group select {
  width: 100%;
  padding: 10px 14px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  font-family: var(--font-body);
  font-size: 1rem;
  background: var(--color-bg);
}
.form-group textarea {
  resize: vertical;
  max-width: 100%;
}
.form-group input:focus,
.form-group textarea:focus,
.form-group select:focus {
  outline: none;
  border-color: var(--color-primary);
}
.repeatable-row { display: flex; gap: 8px; margin-bottom: 8px; }
.repeatable-row input, .repeatable-row textarea { flex: 1; }

.btn {
  display: inline-block;
  background: var(--color-primary);
  color: #fff;
  border: none;
  padding: 12px 24px;
  border-radius: var(--radius-sm);
  font-weight: 600;
  font-size: 1rem;
  cursor: pointer;
  font-family: var(--font-body);
}
.btn:hover { background: var(--color-primary-dark); }
.btn-secondary { background: transparent; color: var(--color-text); border: 1px solid var(--color-border); }
.btn-secondary:hover { background: var(--color-border); color: var(--color-text); }
.btn-small { padding: 6px 12px; font-size: 0.85rem; }
.btn-danger { background: #C94E1E; }

.btn-magic {
  position: relative;
  background: linear-gradient(135deg, var(--color-text), var(--color-primary));
  color: #fff;
  border: none;
}
.btn-magic::before,
.btn-magic::after {
  content: '';
  position: absolute;
  background: var(--color-star);
  clip-path: polygon(50% 0%, 62% 38%, 100% 50%, 62% 62%, 50% 100%, 38% 62%, 0% 50%, 38% 38%);
}
.btn-magic::before { width: 10px; height: 10px; top: 8px; left: 14px; }
.btn-magic::after { width: 7px; height: 7px; bottom: 10px; right: 16px; }
.btn-magic:hover { filter: brightness(1.1); }

/* Match the colors used in the admin approval email buttons exactly */
.btn-approve { background: #2E7D5B; color: #fff; }
.btn-approve:hover { background: #24634A; }
.btn-reject { background: #92650B; color: #fff; }
.btn-reject:hover { background: #74510A; }
.btn-spam { background: #A63A24; color: #fff; }
.btn-spam:hover { background: #872F1D; }

/* ─────────────────────────────────────────────
   Recipe detail page
───────────────────────────────────────────── */
.recipe-hero { display: grid; grid-template-columns: 1fr 1fr; gap: 32px; margin-top: 24px; }
.recipe-hero__img { width: 100%; border-radius: var(--radius-lg); aspect-ratio: 4/3; object-fit: cover; background: var(--color-border); }
.recipe-meta-row { display: flex; gap: 24px; color: var(--color-text-muted); margin: 12px 0; flex-wrap: wrap; }
.recipe-section { margin-top: 32px; }
.recipe-section h2 { font-size: 1.3rem; border-bottom: 2px solid var(--color-border); padding-bottom: 8px; }
.ingredient-list { list-style: none; padding: 0; }
.ingredient-list li {
  padding: 10px 0;
  border-bottom: 1px solid var(--color-border);
  display: flex;
  align-items: baseline;
  gap: 10px;
}
.ingredient-list li::before { content: '•'; color: var(--color-primary); font-weight: 700; }
.step-list { padding-left: 0; list-style: none; counter-reset: step; }
.step-list li {
  counter-increment: step;
  padding: 14px 0 14px 44px;
  position: relative;
  border-bottom: 1px solid var(--color-border);
}
.step-list li::before {
  content: counter(step);
  position: absolute;
  left: 0; top: 12px;
  width: 28px; height: 28px;
  background: var(--color-secondary);
  color: #fff;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 0.85rem;
}

@media (max-width: 700px) {
  .recipe-hero { grid-template-columns: 1fr; }
}

/* ─────────────────────────────────────────────
   Ad interstitial overlay
───────────────────────────────────────────── */
.ad-interstitial {
  position: fixed; inset: 0;
  background: rgba(15, 23, 42, 0.92);
  z-index: 999;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  color: #fff; text-align: center; gap: 16px;
}
.ad-interstitial__box {
  background: var(--color-surface);
  color: var(--color-text);
  width: min(560px, 90vw);
  min-height: 280px;
  border-radius: var(--radius-md);
  display: flex; align-items: center; justify-content: center;
}
.ad-interstitial__count { font-size: 1.1rem; }
.ad-interstitial__skip {
  margin-top: 8px;
  padding: 10px 20px;
  border-radius: var(--radius-sm);
  background: var(--color-primary);
  color: #fff;
  border: none;
  font-weight: 600;
  cursor: not-allowed;
  opacity: 0.5;
}
.ad-interstitial__skip.is-ready { cursor: pointer; opacity: 1; }

/* ─────────────────────────────────────────────
   Admin
───────────────────────────────────────────── */
.admin-table { width: 100%; border-collapse: collapse; margin-top: 16px; }
.admin-table th, .admin-table td {
  text-align: left; padding: 12px; border-bottom: 1px solid var(--color-border);
}
.badge { padding: 3px 10px; border-radius: 20px; font-size: 0.78rem; font-weight: 600; }

/* ─────────────────────────────────────────────
   Ad-free card (shared by go-ad-free.php and go-ad-free-mobile.php,
   see includes/ad-free-card.php)
───────────────────────────────────────────── */
.status-badge {
  display: inline-block;
  background: #E4F4EC;
  color: #1E5E43;
  font-weight: 600;
  font-size: 0.85rem;
  padding: 6px 14px;
  border-radius: 999px;
  margin-bottom: 16px;
}
.price {
  font-size: 2rem;
  font-weight: 700;
  color: var(--color-text);
  font-family: var(--font-heading);
  margin: 4px 0 4px;
}
.price span {
  font-size: 1rem;
  font-weight: 500;
  color: var(--color-text-muted);
}
.badge--pending { background: #FDF1DA; color: #92650B; }
.badge--approved { background: #E4F4EC; color: #1E5E43; }
.badge--rejected { background: #FCE8E4; color: #A63A24; }
.badge--tag { background: #1F6FFF; color: #fff; }

/* ─────────────────────────────────────────────
   Site footer
───────────────────────────────────────────── */
.site-footer {
  text-align: center;
  padding: 32px 16px;
  color: var(--color-text-muted);
  font-size: 0.85rem;
}
