/* ─── Design Tokens ────────────────────────────────────────────── */
:root {
  /* Palette: Frozen Parlour
     Signature: frosted glass card with mint-teal gradient hero stripe */
  --mint:        #4ECDC4;
  --mint-dark:   #3ABAB3;
  --mint-light:  #A8EDEA;
  --berry:       #C7497A;
  --berry-light: #F5C6D9;
  --cream:       #FFF8F0;
  --cream-dark:  #F2E8DC;
  --vanilla:     #FAF3E0;
  --chocolate:   #3D2C1E;
  --grey-soft:   #EEF1F4;
  --grey-mid:    #B8C0CC;
  --grey-text:   #6B7280;
  --text-main:   #1A1A2E;
  --text-light:  #FFFFFF;
  --shadow-sm:   0 2px 8px rgba(0,0,0,0.07);
  --shadow-md:   0 4px 20px rgba(0,0,0,0.10);
  --shadow-lg:   0 8px 40px rgba(0,0,0,0.14);
  --radius-sm:   8px;
  --radius-md:   14px;
  --radius-lg:   20px;
  --radius-xl:   28px;
  --transition:  0.2s ease;
}

/* ─── Reset ─────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
body {
  font-family: 'Inter', system-ui, sans-serif;
  background: var(--cream);
  color: var(--text-main);
  font-size: 16px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}
img { max-width: 100%; height: auto; display: block; }
a { color: inherit; text-decoration: none; }
input, select, textarea, button { font-family: inherit; font-size: inherit; }

/* ─── Typography ─────────────────────────────────────────────────── */
.display { font-family: 'Playfair Display', serif; }
h1, h2, h3 { font-family: 'Playfair Display', serif; line-height: 1.2; }

/* ─── Utility ────────────────────────────────────────────────────── */
.hidden { display: none !important; }
.text-center { text-align: center; }

/* ─── Header ─────────────────────────────────────────────────────── */
.site-header {
  background: var(--chocolate);
  padding: 0 1.5rem;
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: 0 2px 12px rgba(61,44,30,0.25);
}
.header-inner {
  max-width: 1200px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  gap: 1.5rem;
  height: 64px;
}
.logo {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-shrink: 0;
}
.logo-icon { font-size: 1.6rem; }
.logo-img {
  height: 40px;
  width: auto;
  object-fit: contain;
  display: block;
  flex-shrink: 0;
}
.logo-img {
  height: 40px;
  width: auto;
  object-fit: contain;
  display: block;
  flex-shrink: 0;
}
.logo-text {
  font-family: 'Playfair Display', serif;
  font-size: 1.4rem;
  font-weight: 800;
  color: var(--text-light);
  letter-spacing: -0.02em;
}
.logo-accent { color: var(--mint); }
.logo-tagline {
  font-size: 0.78rem;
  color: var(--grey-mid);
  font-weight: 300;
  display: none;
}
@media (min-width: 600px) { .logo-tagline { display: block; } }
.back-link {
  margin-left: auto;
  background: var(--mint);
  color: white;
  font-size: 0.8rem;
  font-weight: 600;
  padding: 0.45rem 1rem;
  border-radius: 100px;
  transition: background var(--transition);
  white-space: nowrap;
  flex-shrink: 0;
}
.back-link:hover { background: var(--mint-dark); }
.header-admin-link {
  margin-left: auto;
  color: rgba(255,255,255,0.55);
  font-size: 0.78rem;
  font-weight: 500;
  transition: color var(--transition);
  flex-shrink: 0;
}
.header-admin-link:hover { color: var(--mint); }
.header-admin-link {
  margin-left: auto;
  color: rgba(255,255,255,0.55);
  font-size: 0.78rem;
  font-weight: 500;
  transition: color var(--transition);
  flex-shrink: 0;
}
.header-admin-link:hover { color: var(--mint); }

/* ─── Main layout ────────────────────────────────────────────────── */
.main-content {
  max-width: 1200px;
  margin: 0 auto;
  padding: 2rem 1.5rem 4rem;
}

/* ─── Hero stripe (signature element) ──────────────────────────── */
.hero-stripe {
  background: linear-gradient(135deg, var(--mint) 0%, var(--mint-dark) 50%, var(--berry) 100%);
  border-radius: var(--radius-xl);
  padding: 2.5rem 2rem;
  margin-bottom: 2.5rem;
  color: white;
  position: relative;
  overflow: hidden;
}
.hero-stripe::before {
  content: '🍦';
  position: absolute;
  right: 2rem;
  top: 50%;
  transform: translateY(-50%);
  font-size: 5rem;
  opacity: 0.15;
  pointer-events: none;
}
.hero-title {
  font-family: 'Playfair Display', serif;
  font-size: clamp(1.6rem, 4vw, 2.6rem);
  font-weight: 800;
  line-height: 1.1;
}
.hero-sub { font-size: 0.95rem; opacity: 0.85; margin-top: 0.4rem; font-weight: 300; }

/* ─── Search & Filter ────────────────────────────────────────────── */
.search-section {
  margin-bottom: 2rem;
}
.search-bar-wrap {
  margin-bottom: 0.75rem;
}
.search-input-group {
  position: relative;
}
.search-icon {
  position: absolute;
  left: 1rem;
  top: 50%;
  transform: translateY(-50%);
  width: 18px;
  height: 18px;
  color: var(--grey-mid);
  pointer-events: none;
}
.search-input {
  width: 100%;
  padding: 0.85rem 1rem 0.85rem 2.8rem;
  border: 2px solid var(--cream-dark);
  border-radius: var(--radius-md);
  background: white;
  font-size: 0.95rem;
  transition: border-color var(--transition), box-shadow var(--transition);
  outline: none;
}
.search-input:focus {
  border-color: var(--mint);
  box-shadow: 0 0 0 3px rgba(78,205,196,0.15);
}
.filter-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  align-items: flex-end;
}
.filter-group {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}
.filter-label {
  font-size: 0.72rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--grey-text);
}
.filter-select {
  padding: 0.5rem 2rem 0.5rem 0.75rem;
  border: 2px solid var(--cream-dark);
  border-radius: var(--radius-sm);
  background: white;
  font-size: 0.85rem;
  cursor: pointer;
  outline: none;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%236B7280' stroke-width='1.5' fill='none' stroke-linecap='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 0.6rem center;
  transition: border-color var(--transition);
}
.filter-select:focus { border-color: var(--mint); }

/* ─── Results count ──────────────────────────────────────────────── */
.results-count {
  font-size: 0.82rem;
  color: var(--grey-text);
  margin-bottom: 1.25rem;
  font-weight: 500;
}

/* ─── Recipe Grid ────────────────────────────────────────────────── */
.recipe-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(290px, 1fr));
  gap: 1.5rem;
  align-items: stretch;
}

/* ─── Recipe Card ────────────────────────────────────────────────── */
.recipe-card {
  background: white;
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
  transition: transform var(--transition), box-shadow var(--transition);
  cursor: pointer;
  text-decoration: none;
  display: flex;
  flex-direction: column;
  color: inherit;
  /* height managed by .recipe-card-wrap when present */
}
.recipe-card:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow-md);
}
/* Image frame: 4:3 container, blurred bg + sharp foreground */
.recipe-img-frame {
  position: relative;
  width: 100%;
  aspect-ratio: 4 / 3;
  overflow: hidden;
  flex-shrink: 0;
  background: var(--cream-dark);
}
.recipe-img-frame .img-blur {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  filter: blur(18px) brightness(0.85) saturate(1.2);
  transform: scale(1.1); /* prevents blur edge fringing */
}
.recipe-img-frame .img-sharp {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: contain;
}
/* Legacy single-img rule kept for safety */
.recipe-card-img {
  width: 100%;
  aspect-ratio: 4 / 3;
  object-fit: contain;
  background: var(--cream-dark);
  flex-shrink: 0;
}
/* Placeholder: use padding-bottom to enforce 4:3 regardless of flex stretching */
.recipe-card-img-placeholder {
  position: relative;
  width: 100%;
  flex-shrink: 0;
}
.recipe-card-img-placeholder::before {
  content: '';
  display: block;
  padding-top: 75%; /* 3/4 = 4:3 ratio */
}
.recipe-card-img-placeholder-inner {
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, var(--mint-light) 0%, var(--berry-light) 100%);
  display: flex;
  align-items: center;
  justify-content: center;
}
.recipe-card-body {
  padding: 1.1rem 1.25rem 1.25rem;
  display: flex;
  flex-direction: column;
  flex: 1;
}
.recipe-card-title {
  font-family: 'Playfair Display', serif;
  font-size: 1.1rem;
  font-weight: 700;
  margin-bottom: 0.3rem;
  line-height: 1.3;
}
.recipe-card-desc {
  font-size: 0.83rem;
  color: var(--grey-text);
  line-height: 1.5;
  margin-bottom: 0.9rem;
  /* Exactly 2 lines — fixed height regardless of content */
  height: calc(0.83rem * 1.5 * 2);
  min-height: calc(0.83rem * 1.5 * 2);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  flex-shrink: 0;
}
.recipe-card-rating {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  margin-bottom: 0.75rem;
}
.stars { color: #F5A623; font-size: 0.85rem; letter-spacing: 0.05em; }
.rating-count { font-size: 0.75rem; color: var(--grey-text); }
.macro-pills {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.4rem;
}
.macro-pill {
  padding: 0.3rem 0.65rem;
  border-radius: var(--radius-sm);
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.01em;
  white-space: nowrap;
  text-align: center;
}
.macro-pill--cal { background: #DBF0FF; color: #006DAD; }
.macro-pill--prot { background: #F0FFE8; color: #397800; }
.macro-pill--carbs { background: #FFF0DB; color: #C17A00; }
.macro-pill--fat { background: #FFEAEA; color: #C0392B; }

/* ─── Loading / Empty ────────────────────────────────────────────── */
.loading-state {
  grid-column: 1 / -1;
  text-align: center;
  padding: 4rem 1rem;
  color: var(--grey-text);
}
.spinner {
  width: 36px;
  height: 36px;
  border: 3px solid var(--cream-dark);
  border-top-color: var(--mint);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  margin: 0 auto 1rem;
}
@keyframes spin { to { transform: rotate(360deg); } }
.empty-state {
  text-align: center;
  padding: 4rem 1rem;
  color: var(--grey-text);
}
.empty-icon { font-size: 3rem; display: block; margin-bottom: 0.75rem; }
.empty-state h3 {
  font-size: 1.1rem;
  margin-bottom: 0.35rem;
  color: var(--text-main);
}
.empty-state p { font-size: 0.87rem; }
.empty-logo {
  width: 80px;
  height: auto;
  margin: 0 auto 0.75rem;
  opacity: 0.6;
}
.empty-logo {
  width: 80px;
  height: auto;
  margin: 0 auto 0.75rem;
  opacity: 0.6;
}

/* ─── Recipe Detail ──────────────────────────────────────────────── */
.recipe-detail-main {
  max-width: 900px;
  margin: 0 auto;
  padding: 2rem 1.5rem 4rem;
}
.recipe-detail-hero {
  border-radius: var(--radius-xl);
  overflow: hidden;
  margin-bottom: 2rem;
  position: relative;
  width: 100%;
  aspect-ratio: 4 / 3;
  background: var(--cream-dark);
}
.recipe-detail-hero .img-blur {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  filter: blur(22px) brightness(0.8) saturate(1.2);
  transform: scale(1.12);
}
.recipe-detail-hero .img-sharp {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: contain;
}
.recipe-detail-hero-placeholder {
  position: relative;
  width: 100%;
}
.recipe-detail-hero-placeholder::before {
  content: '';
  display: block;
  padding-top: 75%; /* 4:3 */
}
.recipe-detail-hero-placeholder-inner {
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, var(--mint-light), var(--berry-light));
  display: flex;
  align-items: center;
  justify-content: center;
}
.recipe-detail-header {
  margin-bottom: 1.5rem;
}
.recipe-detail-title {
  font-size: clamp(1.6rem, 4vw, 2.4rem);
  margin-bottom: 0.6rem;
}
.recipe-detail-rating {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 1rem;
}
.stars-lg { font-size: 1.2rem; color: #F5A623; }
.rating-avg { font-size: 1rem; font-weight: 600; }
.rating-count-lg { font-size: 0.85rem; color: var(--grey-text); }
.recipe-detail-desc {
  font-size: 1rem;
  color: var(--grey-text);
  line-height: 1.7;
}
.macro-bar {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 0.75rem;
  margin: 1.5rem 0 2rem;
}
.macro-bar-item {
  background: white;
  border-radius: var(--radius-md);
  padding: 1rem;
  text-align: center;
  box-shadow: var(--shadow-sm);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}
.macro-bar-val {
  font-family: 'Playfair Display', serif;
  font-size: 1.4rem;
  font-weight: 700;
  display: block;
  line-height: 1;
  margin-bottom: 0.25rem;
  text-align: center;
  width: 100%;
}
.macro-bar-label {
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--grey-text);
  text-align: center;
  width: 100%;
}
.macro-bar-item--cal  .macro-bar-label { color: #005a94; }
.macro-bar-item--prot .macro-bar-label { color: #2d6000; }
.macro-bar-item--carbs .macro-bar-label { color: #a06000; }
.macro-bar-item--fat  .macro-bar-label { color: #9e2a1f; }
.macro-bar-item--cal  { background: #DBF0FF; }
.macro-bar-item--prot { background: #F0FFE8; }
.macro-bar-item--carbs{ background: #FFF0DB; }
.macro-bar-item--fat  { background: #FFEAEA; }
.macro-bar-item--cal .macro-bar-val { color: #006DAD; }
.macro-bar-item--prot .macro-bar-val { color: #397800; }
.macro-bar-item--carbs .macro-bar-val { color: #C17A00; }
.macro-bar-item--fat .macro-bar-val { color: #C0392B; }

/* ─── Ingredient / Topping Tables ───────────────────────────────── */
.recipe-section {
  background: white;
  border-radius: var(--radius-lg);
  padding: 1.5rem;
  margin-bottom: 1.5rem;
  box-shadow: var(--shadow-sm);
}
.recipe-section-title {
  font-family: 'Playfair Display', serif;
  font-size: 1.2rem;
  margin-bottom: 1rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}
.recipe-section-title::after {
  content: '';
  flex: 1;
  height: 2px;
  background: var(--cream-dark);
  border-radius: 2px;
}
.ing-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.87rem;
}
.ing-table th {
  text-align: left;
  padding: 0.4rem 0.6rem;
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--grey-text);
  border-bottom: 2px solid var(--cream-dark);
}
.ing-table td {
  padding: 0.6rem 0.6rem;
  border-bottom: 1px solid var(--grey-soft);
  vertical-align: middle;
}
.ing-table tr:last-child td { border-bottom: none; }
.ing-table .col-name { font-weight: 500; }
.ing-table .col-amount, .ing-table .col-unit { color: var(--grey-text); }
.ing-table .col-cal { color: #006DAD; font-weight: 500; }
.ing-table .col-prot { color: #397800; font-weight: 500; }
.ing-table .col-carbs { color: #C17A00; font-weight: 500; }
.ing-table .col-fat { color: #C0392B; font-weight: 500; }

/* Topping rows are clickable */
.topping-row {
  cursor: pointer;
  transition: background var(--transition);
}
.topping-row:hover { background: var(--grey-soft); }
.topping-row .col-name {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  width: 100%; /* fills all remaining space, pushing right cols to fixed positions */
}
/* Fixed-width right columns so layout is consistent regardless of name length */
#toppingIngTable .col-view   { width: 70px;  text-align: right; white-space: nowrap; padding-right: 0.4rem !important; }
#toppingIngTable .col-amount { width: 80px;  white-space: nowrap; }
#toppingIngTable .col-cal    { width: 60px;  }
#toppingIngTable .col-prot   { width: 70px;  }
#toppingIngTable .col-carbs  { width: 60px;  }
#toppingIngTable .col-fat    { width: 50px;  }
#toppingIngTable th:nth-child(3) { width: 70px;  text-align: right; }
#toppingIngTable th:nth-child(4) { width: 80px;  }
#toppingIngTable th:nth-child(5) { width: 60px;  }
#toppingIngTable th:nth-child(6) { width: 70px;  }
#toppingIngTable th:nth-child(7) { width: 60px;  }
#toppingIngTable th:nth-child(8) { width: 50px;  }
.topping-thumb {
  width: 28px;
  height: 28px;
  border-radius: 6px;
  object-fit: cover;
  background: var(--cream-dark);
  flex-shrink: 0;
}
.topping-thumb-placeholder {
  width: 28px;
  height: 28px;
  border-radius: 6px;
  background: linear-gradient(135deg, var(--mint-light), var(--berry-light));
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.9rem;
  flex-shrink: 0;
}
/* (view) button in table — always visible on landscape/desktop */
.topping-table-info-btn {
  background: none;
  font-size: 0.75rem;
  color: var(--mint-dark);
  font-weight: 700;
  cursor: pointer;
  padding: 0.15rem 0.4rem;
  border: 1.5px solid var(--mint);
  border-radius: 4px;
  line-height: 1.4;
  white-space: nowrap;
}
.col-view {
  width: 60px;
  text-align: right;
  padding-right: 0.5rem !important;
}
.click-hint {
  font-size: 0.65rem;
  color: var(--mint);
  font-weight: 500;
  white-space: nowrap;
}

/* ─── Rating Widget ──────────────────────────────────────────────── */
.rating-section {
  background: linear-gradient(135deg, var(--mint) 0%, var(--mint-dark) 100%);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
  margin-bottom: 1.5rem;
  color: white;
  text-align: center;
}
.rating-section-title {
  font-family: 'Playfair Display', serif;
  font-size: 1.1rem;
  margin-bottom: 0.3rem;
}
.rating-section-sub {
  font-size: 0.82rem;
  opacity: 0.85;
  margin-bottom: 1rem;
}
.star-picker {
  display: flex;
  gap: 0.4rem;
  justify-content: center;
  margin-bottom: 0.75rem;
}
.star-btn {
  font-size: 2rem;
  background: none;
  border: none;
  cursor: pointer;
  color: rgba(255,255,255,0.4);
  transition: color var(--transition), transform var(--transition);
  line-height: 1;
}
.star-btn:hover, .star-btn.hovered, .star-btn.selected { color: #FFD700; transform: scale(1.15); }
.rating-submit-btn {
  background: white;
  color: var(--mint-dark);
  border: none;
  padding: 0.6rem 1.75rem;
  border-radius: 100px;
  font-weight: 600;
  font-size: 0.9rem;
  cursor: pointer;
  transition: opacity var(--transition);
}
.rating-submit-btn:disabled { opacity: 0.4; cursor: not-allowed; }
.rating-done-msg {
  font-size: 0.9rem;
  opacity: 0.9;
  background: rgba(255,255,255,0.2);
  border-radius: var(--radius-sm);
  padding: 0.5rem 1rem;
  display: inline-block;
}

/* ─── Topping Popup ──────────────────────────────────────────────── */
.popup-overlay {
  position: fixed;
  inset: 0;
  background: rgba(26,26,46,0.6);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 500;
  padding: 1.5rem;
  backdrop-filter: blur(4px);
}
.popup-card {
  background: white;
  border-radius: var(--radius-xl);
  padding: 1.5rem;
  width: 100%;
  max-width: 360px;
  max-height: 90vh;
  overflow-y: auto;
  position: relative;
  box-shadow: var(--shadow-lg);
  animation: popIn 0.25s ease;
}
.popup-card--sm { max-width: 320px; }
.popup-card--md { max-width: 480px; }
@keyframes popIn {
  from { opacity: 0; transform: scale(0.94) translateY(10px); }
  to   { opacity: 1; transform: none; }
}
.popup-close {
  position: absolute;
  top: 1rem;
  right: 1rem;
  background: var(--grey-soft);
  border: none;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 0.8rem;
  color: var(--grey-text);
  transition: background var(--transition);
}
.popup-close:hover { background: var(--cream-dark); }
.popup-title { font-size: 1.2rem; margin-bottom: 1rem; }
/* Popup topping image frame — 4:3 blurred background */
.popup-topping-img-frame {
  position: relative;
  width: 100%;
  aspect-ratio: 4 / 3;
  overflow: hidden;
  border-radius: var(--radius-md);
  margin-bottom: 1rem;
  background: var(--cream-dark);
}
.popup-topping-img-frame .img-blur {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  filter: blur(18px) brightness(0.85) saturate(1.2);
  transform: scale(1.1);
}
.popup-topping-img-frame .img-sharp {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: contain;
}
.popup-topping-img {
  width: 100%;
  aspect-ratio: 4 / 3;
  object-fit: contain;
  border-radius: var(--radius-md);
  margin-bottom: 1rem;
}
.popup-topping-img-placeholder {
  width: 100%;
  aspect-ratio: 4 / 3;
  background: linear-gradient(135deg, var(--mint-light), var(--berry-light));
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 3.5rem;
  margin-bottom: 1rem;
}
.popup-topping-name { font-family: 'Playfair Display', serif; font-size: 1.3rem; margin-bottom: 0.3rem; }
.popup-topping-amount { font-size: 0.85rem; color: var(--grey-text); margin-bottom: 0.75rem; }
.popup-macros {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 0.3rem;
  margin-bottom: 0.9rem;
}
.popup-macro {
  background: var(--grey-soft);
  border-radius: var(--radius-sm);
  padding: 0.35rem 0.15rem;
  text-align: center;
}
.popup-macro-val { display: block; font-weight: 700; font-size: 0.82rem; }
.popup-macro-label { font-size: 0.56rem; text-transform: uppercase; letter-spacing: 0.04em; color: var(--grey-text); font-weight: 600; }
.popup-topping-desc { font-size: 0.85rem; color: var(--grey-text); line-height: 1.6; }

/* ─── Auth ───────────────────────────────────────────────────────── */
.auth-body {
  background: var(--chocolate);
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
}
.auth-card {
  background: white;
  border-radius: var(--radius-xl);
  padding: 2.5rem 2rem;
  width: 100%;
  max-width: 380px;
  box-shadow: var(--shadow-lg);
}
.auth-logo {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  margin-bottom: 1.5rem;
}
.auth-title {
  font-size: 1.5rem;
  margin-bottom: 1.5rem;
  text-align: center;
}
.auth-form { display: flex; flex-direction: column; gap: 1rem; }
.auth-back {
  display: block;
  text-align: center;
  margin-top: 1.25rem;
  font-size: 0.85rem;
  color: var(--grey-text);
}
.auth-back:hover { color: var(--mint-dark); }

/* ─── Buttons ────────────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  padding: 0.65rem 1.4rem;
  border-radius: var(--radius-sm);
  font-weight: 600;
  font-size: 0.88rem;
  cursor: pointer;
  border: none;
  transition: background var(--transition), opacity var(--transition), transform var(--transition);
  white-space: nowrap;
  text-decoration: none;
}
.btn:active { transform: scale(0.97); }
.btn-primary { background: var(--mint); color: white; }
.btn-primary:hover { background: var(--mint-dark); }
.btn-ghost { background: var(--grey-soft); color: var(--text-main); }
.btn-ghost:hover { background: var(--cream-dark); }
.btn-danger { background: #FFE8E8; color: #C0392B; }
.btn-danger:hover { background: #FFD0D0; }
.btn-full { width: 100%; }
.btn-sm { padding: 0.45rem 0.9rem; font-size: 0.8rem; }
.btn-icon { padding: 0.45rem; width: 32px; height: 32px; border-radius: 6px; }

/* ─── Form elements ──────────────────────────────────────────────── */
.form-group { display: flex; flex-direction: column; gap: 0.35rem; }
.form-label {
  font-size: 0.78rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--grey-text);
}
.form-input {
  padding: 0.6rem 0.85rem;
  border: 2px solid var(--cream-dark);
  border-radius: var(--radius-sm);
  background: white;
  width: 100%;
  outline: none;
  transition: border-color var(--transition);
}
.form-input--lg { font-size: 1rem; padding: 0.75rem 1rem; }
.form-textarea { resize: vertical; min-height: 80px; }
.form-section-label {
  font-weight: 700;
  font-size: 0.85rem;
  margin: 1rem 0 0.5rem;
  color: var(--text-main);
}
.form-hint { font-weight: 400; color: var(--grey-text); font-size: 0.78rem; }

/* ─── Toggle ─────────────────────────────────────────────────────── */
.toggle-wrap { display: flex; align-items: center; gap: 0.75rem; padding-top: 0.25rem; }
.toggle { position: relative; display: inline-block; width: 44px; height: 24px; }
.toggle input { opacity: 0; width: 0; height: 0; }
.toggle-slider {
  position: absolute;
  inset: 0;
  background: var(--grey-mid);
  border-radius: 24px;
  cursor: pointer;
  transition: background var(--transition);
}
.toggle-slider::before {
  content: '';
  position: absolute;
  height: 18px;
  width: 18px;
  left: 3px;
  bottom: 3px;
  background: white;
  border-radius: 50%;
  transition: transform var(--transition);
}
.toggle input:checked + .toggle-slider { background: var(--mint); }
.toggle input:checked + .toggle-slider::before { transform: translateX(20px); }
.toggle-label { font-size: 0.87rem; font-weight: 500; }

/* ─── Error / Success banners ────────────────────────────────────── */
.error-banner {
  background: #FFEAEA;
  color: #C0392B;
  border: 1px solid #FFC3C3;
  border-radius: var(--radius-sm);
  padding: 0.7rem 1rem;
  font-size: 0.85rem;
  margin-bottom: 1rem;
}
.success-banner {
  background: #EAFFF5;
  color: #1A7F5A;
  border: 1px solid #A8F0D1;
  border-radius: var(--radius-sm);
  padding: 0.7rem 1rem;
  font-size: 0.85rem;
  margin-bottom: 1rem;
}

/* ─── Image preview ──────────────────────────────────────────────── */
.image-preview-wrap { margin-top: 0.5rem; }
.image-preview-wrap img {
  max-width: 200px;
  max-height: 150px;
  object-fit: contain;
  border-radius: var(--radius-sm);
  border: 2px solid var(--cream-dark);
}

/* ─── Footer ─────────────────────────────────────────────────────── */
.site-footer {
  background: var(--chocolate);
  padding: 1.25rem 1.5rem;
  margin-top: auto;
}
.footer-inner {
  max-width: 1200px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}
.footer-left {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
}
.footer-inner p { font-size: 0.78rem; color: var(--grey-mid); margin: 0; }
.footer-admin-link {
  font-size: 0.72rem;
  color: rgba(255,255,255,0.4);
  transition: color var(--transition);
}
.footer-admin-link:hover { color: var(--mint); }
.footer-about-link {
  font-size: 0.78rem;
  color: rgba(255,255,255,0.55);
  transition: color var(--transition);
  flex-shrink: 0;
}
.footer-about-link:hover { color: var(--mint); }

/* ─── About / Welcome popup ──────────────────────────────────────── */
.popup-card--about {
  max-width: 480px;
  text-align: center;
}
.about-popup-logo {
  width: 220px;
  max-width: 70%;
  margin: 0 auto 1.25rem;
}
.about-popup-logo img { width: 100%; height: auto; display: block; }
.about-popup-title {
  font-family: 'Playfair Display', serif;
  font-size: 1.4rem;
  margin-bottom: 1rem;
}
.about-popup-text {
  text-align: left;
  font-size: 0.88rem;
  line-height: 1.7;
  color: var(--text-main);
  margin-bottom: 1.5rem;
}
.about-popup-text p { margin-bottom: 0.85rem; }
.about-popup-text p:last-child { margin-bottom: 0; }
.about-popup-signoff {
  font-weight: 600;
  color: var(--mint-dark);
}


/* ─── Topping radio selector ─────────────────────────────────────── */
.topping-radio-cell {
  width: 32px;
  text-align: center;
  padding-right: 0;
}
.topping-radio {
  width: 18px;
  height: 18px;
  accent-color: var(--mint);
  cursor: pointer;
  vertical-align: middle;
}
.topping-row.selected-topping {
  background: rgba(78,205,196,0.08);
}
.topping-row.selected-topping td { font-weight: 500; }

/* ─── Responsive ─────────────────────────────────────────────────── */
@media (max-width: 600px) and (orientation: portrait) {
  .macro-bar { grid-template-columns: repeat(2, 1fr); }
  .filter-bar { gap: 0.5rem; }
  .filter-select { font-size: 0.8rem; }
  .recipe-detail-main { padding: 1.25rem 1rem 3rem; }
  .recipe-section { padding: 1rem; }
  /* Hide ingredient table on portrait — card list shown instead */
  #ingredientIngTable { display: none; }
  /* Hide topping table on portrait — card list shown instead */
  #toppingIngTable { display: none; }
  /* Tighter popup overlay padding */
  .popup-overlay { padding: 0.75rem; }
  .popup-card { padding: 1.25rem 1rem; border-radius: var(--radius-lg); }
}

/* ─── Ingredient cards (portrait mobile) ────────────────────────── */
.ingredient-cards { display: none; }

@media (max-width: 600px) and (orientation: portrait) {
  .ingredient-cards { display: flex; flex-direction: column; gap: 0; }

  .ingredient-card-item {
    padding: 0.55rem 0;
    border-bottom: 1px solid var(--grey-soft);
  }
  .ingredient-card-item:last-child { border-bottom: none; }

  /* Row 1: name only */
  .ingredient-card-row1 {
    margin-bottom: 0.1rem;
  }
  .ingredient-card-name {
    font-weight: 600;
    font-size: 0.88rem;
    color: var(--text-main);
    display: block;
  }

  /* Row 2: amount (left) + macros (right) on same line */
  .ingredient-card-row2 {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 0.4rem;
  }
  .ingredient-card-amount {
    font-size: 0.78rem;
    color: var(--grey-text);
    flex-shrink: 0;
    white-space: nowrap;
  }
  .ingredient-card-macros {
    display: flex;
    gap: 0.45rem;
    justify-content: flex-end;
    font-size: 0.74rem;
    font-weight: 600;
    flex-wrap: nowrap;
  }
}

/* All phones (both orientations) */
@media (max-width: 600px) {
  .macro-bar { grid-template-columns: repeat(2, 1fr); }
}

/* Landscape phones: show all columns */
@media (max-width: 900px) and (orientation: landscape) {
  .ing-table { font-size: 0.8rem; }
  .ing-table th, .ing-table td { padding: 0.4rem 0.45rem; }
}

/* ─── Topping note (recipe detail page) ─────────────────────────── */
.topping-note {
  font-size: 0.82rem;
  color: var(--grey-text);
  margin-bottom: 0.85rem;
}

/* ─── Macro bar note ─────────────────────────────────────────────── */
.macro-bar-note {
  font-size: 0.75rem;
  color: var(--grey-text);
  text-align: center;
  margin-top: -0.5rem;
  margin-bottom: 1.5rem;
}

/* ─── Comments / Preparation Notes section ───────────────────────── */
.recipe-section--comments {
  background: white;
}
.recipe-comments-text {
  font-size: 0.92rem;
  line-height: 1.75;
  color: var(--text-main);
  white-space: pre-wrap;
}

/* ─── Topping cards (portrait mobile) ───────────────────────────── */
/* On portrait phones, toppings render as cards instead of table rows */
.topping-cards { display: none; }

@media (max-width: 600px) and (orientation: portrait) {
  /* Show the card-based layout */
  .topping-cards { display: flex; flex-direction: column; gap: 0; }

  .topping-card-item {
    display: flex;
    align-items: flex-start;
    gap: 0;
    padding: 0.6rem 0;
    border-bottom: 1px solid var(--grey-soft);
    cursor: pointer;
    transition: background var(--transition);
  }
  .topping-card-item:last-child { border-bottom: none; }
  .topping-card-item:active { background: var(--grey-soft); }
  .topping-card-item.selected-topping { background: rgba(78,205,196,0.08); }

  .topping-card-radio {
    margin-top: 0.25rem;
    margin-right: 0.5rem;
    flex-shrink: 0;
    width: 18px;
    height: 18px;
    accent-color: var(--mint);
  }

  .topping-card-body {
    flex: 1;
    min-width: 0;
  }

  /* Row 1: name (left) + (view) button (right) */
  .topping-card-row1 {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 0.15rem;
  }

  .topping-card-name {
    font-weight: 600;
    font-size: 0.88rem;
    color: var(--text-main);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  /* Row 2: amount (left) + macros (right) */
  .topping-card-row2 {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.78rem;
    font-weight: 600;
    margin-bottom: 0;
  }

  .topping-card-amount {
    font-size: 0.8rem;
    color: var(--grey-text);
    flex-shrink: 0;
    white-space: nowrap;
  }

  .topping-card-macros {
    display: flex;
    gap: 0.5rem;
    justify-content: flex-end;
    flex-wrap: nowrap;
  }

  .topping-card-info-btn {
    background: none;
    border: none;
    font-size: 0.75rem;
    color: var(--mint-dark);
    font-weight: 700;
    cursor: pointer;
    padding: 0.15rem 0.4rem;
    flex-shrink: 0;
    border: 1.5px solid var(--mint);
    border-radius: 4px;
    line-height: 1.4;
    white-space: nowrap;
  }
}

/* ─── Recipe card creator / source ──────────────────────────────── */
.recipe-card-creator {
  margin-top: 0.6rem;
  font-size: 0.75rem;
  color: var(--grey-text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.recipe-card-source {
  color: var(--mint-dark);
  font-weight: 600;
  text-decoration: underline;
  text-decoration-color: rgba(58,186,179,0.4);
  text-underline-offset: 2px;
  transition: color var(--transition);
}
.recipe-card-source:hover { color: var(--mint); }

/* ─── Recipe detail creator / source ────────────────────────────── */
.recipe-detail-creator {
  margin-top: 0.5rem;
  font-size: 0.82rem;
  color: var(--grey-text);
}
.recipe-detail-source {
  color: var(--mint-dark);
  font-weight: 600;
  text-decoration: underline;
  text-decoration-color: rgba(58,186,179,0.4);
  text-underline-offset: 2px;
  transition: color var(--transition);
}
.recipe-detail-source:hover { color: var(--mint); }

/* ─── Recipe card wrapper (holds card + creator strip) ───────────── */
.recipe-card-wrap {
  display: flex;
  flex-direction: column;
  height: 100%;
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
  transition: transform var(--transition), box-shadow var(--transition);
}
.recipe-card-wrap:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow-md);
}
/* The inner <a> loses its own shadow/radius — wrapper handles it */
.recipe-card-wrap .recipe-card {
  box-shadow: none;
  border-radius: 0;
  flex: 1;
}

/* ─── Creator strip — front page cards ──────────────────────────── */
.recipe-card-creator-strip {
  background: #F2F4F7;
  border-top: 1px solid #E2E6EC;
  padding: 0.45rem 1.25rem;
  font-size: 0.75rem;
  color: var(--grey-text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  flex-shrink: 0;
}
.creator-label { color: var(--grey-text); }
.creator-link {
  color: var(--mint-dark);
  font-weight: 600;
  text-decoration: underline;
  text-decoration-color: rgba(58,186,179,0.4);
  text-underline-offset: 2px;
  transition: color var(--transition);
}
.creator-link:hover { color: var(--mint); }
.creator-name { font-weight: 600; color: var(--text-main); }

/* ─── Creator badge — recipe detail page ─────────────────────────── */
.recipe-detail-creator {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  background: #F2F4F7;
  border: 1px solid #E2E6EC;
  border-radius: var(--radius-sm);
  padding: 0.35rem 0.75rem;
  font-size: 0.8rem;
  color: var(--grey-text);
  margin-top: 0.75rem;
}
.recipe-detail-source {
  color: var(--mint-dark);
  font-weight: 600;
  text-decoration: underline;
  text-decoration-color: rgba(58,186,179,0.4);
  text-underline-offset: 2px;
  transition: color var(--transition);
}
.recipe-detail-source:hover { color: var(--mint); }

/* ─── Header Submit link ─────────────────────────────────────────── */
.header-submit-link {
  margin-left: auto;
  background: var(--mint);
  color: white;
  font-size: 0.8rem;
  font-weight: 600;
  padding: 0.45rem 1rem;
  border-radius: 100px;
  transition: background var(--transition);
  white-space: nowrap;
  flex-shrink: 0;
}
.header-submit-link:hover { background: var(--mint-dark); }

/* ─── Form validation — red border on missing required fields ────── */
.form-input.field-error {
  border-color: #e74c3c !important;
  outline: 3px solid rgba(231,76,60,0.35) !important;
  outline-offset: 0 !important;
  background: #fff8f8 !important;
  box-shadow: none !important;
}
.form-input.field-error:focus {
  border-color: #c0392b !important;
  outline: 3px solid rgba(192,57,43,0.4) !important;
  outline-offset: 0 !important;
  box-shadow: none !important;
}
/* Generic focus — only when NOT in error state */
.form-input:not(.field-error):focus { border-color: var(--mint); }
