/* Import modern premium fonts */
@import url('https://fonts.googleapis.com/css2?family=Outfit:wght@300;400;500;600;700;800&family=Playfair+Display:ital,wght@0,600;0,700;0,800;1,500&display=swap');

/* Color Variables and Theme Setup */
:root {
  /* Light Mode (Luxury Editorial & Fine Dining) */
  --primary: #d4af37; /* Warm Champagne Gold */
  --primary-hover: #b89025;
  --primary-rgb: 212, 175, 55;
  --primary-gradient: linear-gradient(135deg, #d4af37 0%, #b89025 100%);
  --secondary: #556b2f; /* Deep Olive Green */
  --secondary-light: rgba(85, 107, 47, 0.06);
  --success: #3c5e32;
  
  --bg: #fdfbf7; /* Premium Book-Page Warm Ivory */
  --surface: #ffffff;
  --surface-muted: #f7f3eb;
  --border: rgba(180, 150, 120, 0.18); /* Delicate hairline golden-grey */
  
  --text: #27201a; /* Rich Espresso Brown */
  --text-muted: #736257;
  --text-light: #ffffff;
  
  --shadow-sm: 0 2px 10px rgba(39, 32, 26, 0.02);
  --shadow-md: 0 10px 35px rgba(39, 32, 26, 0.04);
  --shadow-lg: 0 20px 60px rgba(39, 32, 26, 0.07);
  --glow: 0 0 25px rgba(212, 175, 55, 0.2);
  --active-glow: 0 8px 24px rgba(212, 175, 55, 0.15);
  
  --radius-sm: 10px;
  --radius-md: 16px;
  --radius-lg: 24px;
  --radius-full: 9999px;
  
  --transition-fast: 0.15s ease;
  --transition-normal: 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  --transition-slow: 0.55s cubic-bezier(0.34, 1.56, 0.64, 1); /* Elastic spring bounce */
}

[data-theme="dark"] {
  /* Dark Mode (Cozy Candlelight Bistro) */
  --primary: #e5c158; /* Sparkling Champagne Gold */
  --primary-hover: #f3d578;
  --primary-rgb: 229, 193, 88;
  --primary-gradient: linear-gradient(135deg, #e5c158 0%, #c9a53f 100%);
  --secondary: #7f9c7a; /* Sage Green */
  --secondary-light: rgba(127, 156, 122, 0.1);
  --success: #608d5b;
  
  --bg: #120e0a; /* Deep Obsidian Espresso */
  --surface: #1c1813; /* Velvet Dark Chocolate */
  --surface-muted: #27221b;
  --border: rgba(229, 193, 88, 0.15);
  
  --text: #f7f3ee;
  --text-muted: #aa9c90;
  
  --shadow-sm: 0 2px 10px rgba(0, 0, 0, 0.2);
  --shadow-md: 0 10px 35px rgba(0, 0, 0, 0.35);
  --shadow-lg: 0 20px 60px rgba(0, 0, 0, 0.5);
  --glow: 0 0 25px rgba(229, 193, 88, 0.15);
  --active-glow: 0 8px 24px rgba(229, 193, 88, 0.2);
}

/* Reset & Base Styles */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html, body {
  width: 100%;
  max-width: 100%;
  overflow-x: hidden;
  position: relative;
}

body {
  font-family: 'Outfit', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  background-color: var(--bg);
  color: var(--text);
  line-height: 1.6;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  transition: background-color var(--transition-normal), color var(--transition-normal);
}

h1, h2, h3, h4 {
  font-family: 'Playfair Display', Georgia, serif;
  font-weight: 700;
  line-height: 1.25;
}

/* =============================================
   AMBIENT BACKGROUND ORBS
   ============================================= */
.bg-orbs-container {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  overflow: hidden;
  z-index: -10;
  pointer-events: none;
}

.bg-orb {
  position: absolute;
  width: 500px;
  height: 500px;
  border-radius: 50%;
  pointer-events: none;
  filter: blur(140px);
  opacity: 0.16; /* Light mode ambient opacity */
  transition: opacity var(--transition-normal);
}

.bg-orb-1 {
  background: var(--primary);
  top: -150px;
  left: -150px;
  animation: floatOrb1 25s infinite alternate ease-in-out;
}

.bg-orb-2 {
  background: #fecdd3; /* Peach rose color */
  bottom: -150px;
  right: -150px;
  animation: floatOrb2 30s infinite alternate ease-in-out;
}

[data-theme="dark"] .bg-orb {
  opacity: 0.07; /* Dark mode ambient opacity */
}

@keyframes floatOrb1 {
  0% {
    transform: translate(0, 0) scale(1);
  }
  100% {
    transform: translate(150px, 80px) scale(1.15);
  }
}

@keyframes floatOrb2 {
  0% {
    transform: translate(0, 0) scale(1.1);
  }
  100% {
    transform: translate(-100px, -120px) scale(0.9);
  }
}

button {
  font-family: 'Outfit', sans-serif;
  cursor: pointer;
  border: none;
  outline: none;
  background: none;
  transition: all var(--transition-fast);
}

a {
  color: inherit;
  text-decoration: none;
}

header {
  position: sticky;
  top: 0;
  z-index: 100;
  background-color: rgba(255, 255, 255, 0.72);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-bottom: 1px solid rgba(255, 255, 255, 0.4);
  box-shadow: 0 4px 30px rgba(28, 10, 0, 0.02);
  transition: all var(--transition-normal);
}

[data-theme="dark"] header {
  background-color: rgba(24, 20, 16, 0.78);
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.header-container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 1.25rem 2rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.logo {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  text-decoration: none;
}

.logo-text-wrapper {
  display: flex;
  flex-direction: column;
  line-height: 1.15;
}

.logo-name {
  font-size: 1.5rem;
  font-weight: 800;
  color: var(--secondary);
  font-family: 'Outfit', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  letter-spacing: -0.03em;
  transition: color var(--transition-fast);
}

[data-theme="dark"] .logo-name {
  color: var(--primary);
}

.logo-slogan {
  font-size: 0.72rem;
  font-weight: 500;
  color: var(--text-muted);
  font-family: 'Outfit', sans-serif;
  letter-spacing: 0.01em;
}

.logo svg {
  width: 2rem;
  height: 2rem;
  fill: currentColor;
  animation: float 4s ease-in-out infinite;
}

.header-controls {
  display: flex;
  align-items: center;
  gap: 1rem;
}

/* Round Icon Buttons */
.icon-btn {
  width: 2.75rem;
  height: 2.75rem;
  border-radius: var(--radius-full);
  background-color: var(--surface);
  border: 1px solid var(--border);
  color: var(--text);
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: var(--shadow-sm);
  position: relative;
}

.icon-btn:hover {
  background-color: var(--surface-muted);
  transform: translateY(-2px);
}

.icon-btn svg {
  width: 1.25rem;
  height: 1.25rem;
  fill: currentColor;
}

.icon-btn .badge {
  position: absolute;
  top: -4px;
  right: -4px;
  background-color: var(--primary);
  color: var(--text-light);
  font-size: 0.7rem;
  font-weight: 700;
  width: 1.25rem;
  height: 1.25rem;
  border-radius: var(--radius-full);
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 0 10px rgba(var(--primary-rgb), 0.4);
}

/* Main Container Layout */
main {
  flex: 1;
  max-width: 1200px;
  width: 100%;
  margin: 0 auto;
  padding: 2rem;
  display: grid;
  grid-template-columns: 1fr;
  gap: 2.5rem;
}

@media (min-width: 1024px) {
  main {
    grid-template-columns: 320px 1fr;
  }
}

/* Left Sidebar - Filters & Control */
.sidebar {
  display: flex;
  flex-direction: column;
  gap: 2rem;
  min-width: 0;
}

.filter-card {
  background-color: rgba(255, 255, 255, 0.72);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-radius: var(--radius-lg);
  padding: 2rem;
  border: 1px solid rgba(255, 255, 255, 0.45);
  box-shadow: 0 15px 35px rgba(28, 10, 0, 0.04), inset 0 1px 0 rgba(255, 255, 255, 0.6);
  transition: all var(--transition-normal);
}

[data-theme="dark"] .filter-card {
  background-color: rgba(24, 20, 16, 0.78);
  border: 1px solid rgba(255, 255, 255, 0.08);
  box-shadow: 0 15px 35px rgba(0, 0, 0, 0.3), inset 0 1px 0 rgba(255, 255, 255, 0.05);
}

.filter-header-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  width: 100%;
  margin-bottom: 1.5rem;
}

.filter-toggle {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex: 1;
  background: none;
  border: none;
  padding: 0;
  margin: 0;
  cursor: default;
  color: var(--text);
  font-family: inherit;
  text-align: left;
  pointer-events: none; /* Always open on desktop */
}

.filter-toggle-left {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-family: 'Playfair Display', Georgia, serif;
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--text);
}

.filter-toggle-meta {
  display: none; /* Hidden on desktop */
}

.filter-chevron {
  display: none; /* Hidden on desktop */
  transition: transform var(--transition-normal);
}

.filter-toggle[aria-expanded="false"] .filter-chevron {
  transform: rotate(0deg);
}

.filter-toggle[aria-expanded="true"] .filter-chevron {
  transform: rotate(180deg);
}

.shuffle-btn.shuffle-btn-mini {
  background-color: var(--primary);
  color: var(--text-light);
  font-size: 0.9rem !important;
  font-weight: 700;
  padding: 0.6rem 1rem !important;
  width: 100% !important;
  max-width: none !important;
  border-radius: var(--radius-md);
  box-shadow: 0 2px 5px rgba(234, 88, 12, 0.1);
  display: inline-flex !important;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  border: none;
  cursor: pointer;
  white-space: nowrap;
  flex-shrink: 0;
  margin-top: 0.75rem;
  transition: transform var(--transition-fast), background-color var(--transition-fast), box-shadow var(--transition-fast);
}

.shuffle-btn.shuffle-btn-mini:hover {
  transform: translateY(-2px) scale(1.01);
  background-color: var(--primary-hover);
  box-shadow: 0 4px 10px rgba(234, 88, 12, 0.15);
}

.shuffle-btn.shuffle-btn-mini:active {
  transform: translateY(0) scale(0.98);
}

.filter-body {
  display: block; /* Always visible on desktop */
}

.sidebar h2 {
  font-size: 1.5rem;
  margin-bottom: 1.5rem;
  color: var(--text);
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.filter-group {
  border-bottom: 1px solid var(--border);
  padding-bottom: 1.25rem;
  margin-bottom: 1.25rem;
}

.filter-group:last-of-type {
  border-bottom: none;
  padding-bottom: 0;
  margin-bottom: 0;
}

.filter-group-header-static {
  display: block;
  font-family: 'Outfit', sans-serif;
  font-size: 0.9rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
  margin-bottom: 0.85rem;
  user-select: none;
}

.filter-group-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  width: 100%;
  background: none;
  border: none;
  padding: 0.5rem 0;
  cursor: pointer;
  color: var(--text);
  text-align: left;
  outline: none;
  transition: opacity var(--transition-fast);
}

.filter-group-header:hover {
  opacity: 0.8;
}

.filter-group-title {
  font-family: 'Outfit', sans-serif;
  font-size: 1.05rem;
  font-weight: 600;
  color: var(--text);
}

.filter-group-meta {
  display: flex;
  align-items: center;
  gap: 0.6rem;
}

.filter-group-status {
  font-size: 0.8rem;
  color: var(--primary);
  font-weight: 600;
  max-width: 130px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.filter-group-chevron {
  width: 16px;
  height: 16px;
  fill: var(--primary);
  transition: transform var(--transition-normal);
}

.filter-group-content {
  max-height: 0;
  overflow: hidden;
  opacity: 0;
  transition: max-height var(--transition-normal) cubic-bezier(0.4, 0, 0.2, 1), opacity var(--transition-normal) ease;
  margin-top: 0;
}

/* Expanded state */
.filter-group.expanded .filter-group-content {
  max-height: 380px; /* high enough for chips grids */
  opacity: 1;
  margin-top: 0.85rem;
  overflow: visible; /* allow autocompletes to show outside bounds */
}

.filter-group.expanded .filter-group-chevron {
  transform: rotate(180deg);
}

/* Always expanded (e.g. search input) */
.filter-group.always-expanded .filter-group-content {
  max-height: none !important;
  opacity: 1 !important;
  margin-top: 0.85rem !important;
  overflow: visible !important;
}

/* Search Input Wrapper */
.search-input-wrapper {
  position: relative;
  display: flex;
  align-items: center;
  width: 100%;
}

.search-input-wrapper input {
  width: 100%;
  padding: 0.75rem 2.25rem 0.75rem 2.5rem;
  border-radius: var(--radius-md);
  background-color: var(--surface);
  border: 1.5px solid var(--border);
  color: var(--text);
  font-size: 0.9rem;
  font-family: inherit;
  transition: all var(--transition-fast);
}

.search-input-wrapper input::placeholder {
  color: var(--text-muted);
  opacity: 1;
}

.search-input-wrapper input:focus {
  outline: none;
  background-color: var(--surface);
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(var(--primary-rgb), 0.15);
}

.search-icon {
  position: absolute;
  left: 0.85rem;
  width: 1.15rem;
  height: 1.15rem;
  fill: var(--text-muted);
  opacity: 0.9;
  pointer-events: none;
  transition: fill var(--transition-fast);
}

.search-input-wrapper input:focus ~ .search-icon {
  fill: var(--primary);
}

.search-clear-btn {
  position: absolute;
  right: 0.75rem;
  background: none;
  border: none;
  font-size: 1.4rem;
  color: var(--text-muted);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 1.5rem;
  height: 1.5rem;
  border-radius: var(--radius-full);
  transition: all var(--transition-fast);
}

.search-clear-btn:hover {
  background-color: var(--border);
  color: var(--text);
}

.search-result-count {
  display: block;
  font-size: 0.8rem;
  margin-top: 0.5rem;
  font-weight: 600;
}

.search-result-count.no-results {
  color: hsl(0, 75%, 55%);
}

.search-result-count.has-results {
  color: var(--secondary);
}

[data-theme="dark"] .search-result-count.has-results {
  color: hsl(150, 60%, 55%);
}

.search-results-list {
  list-style: none;
  padding: 0;
  margin: 0.75rem 0 0 0;
  max-height: 220px;
  overflow-y: auto;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background-color: var(--surface-muted);
}

.search-results-list li {
  padding: 0.6rem 0.75rem;
  border-bottom: 1px solid var(--border);
  cursor: pointer;
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  transition: background-color var(--transition-fast);
}

.search-results-list li:last-child {
  border-bottom: none;
}

.search-results-list li:hover {
  background-color: var(--surface);
}

.search-results-list li .recipe-item-title {
  font-weight: 600;
  color: var(--text);
  font-size: 0.85rem;
  line-height: 1.2;
}

.search-results-list li .recipe-item-meta {
  font-size: 0.75rem;
  color: var(--text-muted);
}

/* Custom Scrollbar for results list */
.search-results-list::-webkit-scrollbar {
  width: 6px;
}

.search-results-list::-webkit-scrollbar-track {
  background: transparent;
}

.search-results-list::-webkit-scrollbar-thumb {
  background-color: var(--border);
  border-radius: var(--radius-full);
}

/* Chips / Option buttons */
/* Chips / Option buttons (Option 3: Modern App Grid) */
.chips-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 0.6rem;
  width: 100%;
}

/* Smart Grid stretching rules */
/* If there are exactly 3 children (e.g. Diet), stretch the first child ("Alle") across 2 columns */
.chips-grid button:first-child:nth-last-child(3) {
  grid-column: span 2;
}

/* If there is exactly 1 child (e.g. Gluten-free), stretch it across 2 columns */
.chips-grid button:first-child:nth-last-child(1) {
  grid-column: span 2;
}

.chip {
  position: relative; /* For the absolute positioned checkmark */
  padding: 1.25rem 0.5rem 0.85rem 0.5rem;
  min-height: 88px;
  border-radius: var(--radius-sm);
  background-color: var(--surface); /* White background for inactive cards like the mockup */
  border: 1.5px solid var(--border); /* Slightly thicker border for definition */
  color: var(--text);
  font-size: 0.82rem;
  font-weight: 600;
  display: flex;
  flex-direction: column; /* Vertical stack alignment! */
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  width: 100%;
  cursor: pointer;
  transition: all var(--transition-fast), transform var(--transition-fast);
}

.chip svg {
  width: 1.8rem; /* Larger icon */
  height: 1.8rem;
  flex-shrink: 0;
  stroke-width: 1.5; /* Sleeker stroke thickness */
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  transition: transform var(--transition-fast);
}

.chip:hover {
  background-color: var(--surface);
  border-color: var(--primary);
  transform: translateY(-4px) scale(1.02);
  box-shadow: var(--shadow-md);
}

.chip:hover svg {
  transform: scale(1.08);
}

/* Active State: Soft green background, orange border, original text color */
.chip.active {
  background-color: var(--secondary-light) !important; /* Soft sage green */
  border-color: var(--primary) !important; /* Orange border */
  color: var(--text) !important; /* Keep original dark text */
  font-weight: 700;
  box-shadow: var(--active-glow) !important;
  transform: translateY(0);
}

/* Green checkmark badge in top-right corner */
.chip.active::after {
  content: '';
  position: absolute;
  top: 6px;
  right: 6px;
  width: 14px;
  height: 14px;
  background-color: var(--success); /* Green circle */
  border-radius: 50%;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='white' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='20 6 9 17 4 12'/%3E%3C/svg%3E");
  background-size: 8px 8px;
  background-position: center;
  background-repeat: no-repeat;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
}

/* Dark theme overrides */
[data-theme="dark"] .chip {
  background-color: var(--surface);
  border-color: var(--border);
}

[data-theme="dark"] .chip.active {
  background-color: var(--secondary-light) !important; /* Soft dark green */
  border-color: var(--primary) !important;
  color: var(--text) !important;
  box-shadow: var(--active-glow) !important;
}

/* =============================================
   SEGMENTED CONTROL (Sleek Horizontal Slider)
   ============================================= */
.segmented-control {
  display: flex;
  background-color: var(--surface-muted);
  border-radius: var(--radius-sm);
  padding: 3px;
  width: 100%;
  gap: 2px;
  border: 1px solid var(--border);
}

.segmented-control .chip {
  flex: 1;
  padding: 0.5rem 0.25rem;
  border-radius: 6px;
  background-color: transparent !important;
  border: none !important;
  color: var(--text-muted);
  font-size: 0.8rem;
  font-weight: 600;
  min-height: auto;
  flex-direction: row;
  gap: 0.25rem;
  box-shadow: none !important;
  transform: none !important;
}

.segmented-control .chip::after {
  display: none !important; /* Hide checkmark circle on slider tabs */
}

.segmented-control .chip:hover {
  background-color: rgba(0, 0, 0, 0.04);
  color: var(--text);
}

.segmented-control .chip.active {
  background-color: var(--surface) !important;
  color: var(--primary) !important;
  font-weight: 700;
  box-shadow: var(--shadow-sm) !important;
}

/* Dark theme segmented control */
[data-theme="dark"] .segmented-control {
  background-color: var(--surface-muted);
  border-color: var(--border);
}
[data-theme="dark"] .segmented-control .chip.active {
  background-color: var(--surface) !important;
  color: var(--primary) !important;
}

/* =============================================
   iOS-STYLE SLIDING TOGGLE SWITCH
   ============================================= */
.toggle-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background-color: var(--surface);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 0.85rem 1rem;
  width: 100%;
}

.toggle-label-text {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text);
}

.toggle-label-icon {
  color: var(--text-muted);
  flex-shrink: 0;
}

.switch-toggle {
  width: 44px;
  height: 24px;
  border-radius: var(--radius-full);
  background-color: var(--border);
  position: relative;
  border: none;
  cursor: pointer;
  padding: 0;
  transition: background-color var(--transition-fast);
  flex-shrink: 0;
}

.switch-handle {
  position: absolute;
  top: 2px;
  left: 2px;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background-color: var(--surface);
  box-shadow: 0 1px 3px rgba(0,0,0,0.15);
  transition: transform var(--transition-fast);
}

.switch-toggle.active {
  background-color: var(--primary) !important;
}

.switch-toggle.active .switch-handle {
  transform: translateX(20px);
}

/* Würfeln Button inside filter card */
.shuffle-action-group {
  margin-top: 0.5rem;
  padding-top: 1.5rem;
  border-top: none;
}

.shuffle-btn {
  position: relative;
  background: var(--primary-gradient);
  color: var(--text-light);
  font-size: 1.1rem;
  font-weight: 700;
  padding: 0.9rem 1.5rem;
  border-radius: var(--radius-full);
  box-shadow: 0 3px 8px rgba(234, 88, 12, 0.12);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.75rem;
  z-index: 1;
  overflow: hidden;
  width: 100%;
  border: none;
  cursor: pointer;
  transition: transform var(--transition-fast), background-color var(--transition-fast), box-shadow var(--transition-fast);
}

.shuffle-btn::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: linear-gradient(120deg, transparent, rgba(255, 255, 255, 0.35), transparent);
  transform: translateX(-100%);
  z-index: 2;
  pointer-events: none;
  animation: shuffleShine 4s infinite ease-in-out;
}

@keyframes shuffleShine {
  0% {
    transform: translateX(-100%);
  }
  15% {
    transform: translateX(100%);
  }
  100% {
    transform: translateX(100%);
  }
}

.shuffle-btn:hover {
  transform: translateY(-2px) scale(1.01);
  box-shadow: 0 5px 12px rgba(234, 88, 12, 0.18);
}



.shuffle-btn:active {
  transform: translateY(1px) scale(0.98);
}

.shuffle-btn svg {
  width: 1.5rem;
  height: 1.5rem;
  flex-shrink: 0;
}

/* 3D Dice Styling & Shadow Effects */
.dice-3d-icon {
  filter: drop-shadow(0 2px 3px rgba(0, 0, 0, 0.15));
  transition: transform var(--transition-normal);
}

/* 3D Dice Roll Animation */
@keyframes diceRoll3D {
  0% {
    transform: rotate(0deg) scale(1);
  }
  30% {
    transform: rotate(-60deg) scale(0.8);
  }
  70% {
    transform: rotate(420deg) scale(1.2);
  }
  100% {
    transform: rotate(360deg) scale(1);
  }
}

.shuffle-animate {
  animation: diceRoll3D 0.6s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
}

/* Recipe Card Footer Actions Section */
.recipe-card-actions {
  display: flex;
  justify-content: center;
  padding: 2rem;
  background-color: var(--surface-muted);
  border-top: 1px solid var(--border);
  transition: background-color var(--transition-normal);
}

/* Recipe Content Area */
.content-area {
  display: flex;
  flex-direction: column;
  gap: 2rem;
  min-width: 0;
}

/* Card States */
.recipe-card-container {
  position: relative;
  min-height: 400px;
}

/* Blank / Welcome Screen */
.welcome-card {
  height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background-color: rgba(255, 255, 255, 0.45);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 2px dashed rgba(255, 255, 255, 0.6);
  border-radius: var(--radius-lg);
  padding: 4rem 2rem;
  text-align: center;
  color: var(--text-muted);
  box-shadow: var(--shadow-sm);
  transition: all var(--transition-normal);
}

[data-theme="dark"] .welcome-card {
  background-color: rgba(24, 20, 16, 0.45);
  border: 2px dashed rgba(255, 255, 255, 0.15);
}

.welcome-card svg {
  width: 4rem;
  height: 4rem;
  margin-bottom: 1.5rem;
  fill: var(--primary);
  opacity: 0.7;
}

.welcome-card h3 {
  font-size: 1.8rem;
  color: var(--text);
  margin-bottom: 0.75rem;
}

/* Main Recipe Card */
.recipe-card {
  background-color: rgba(255, 255, 255, 0.72);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-radius: var(--radius-lg);
  border: 1px solid rgba(255, 255, 255, 0.45);
  box-shadow: 0 20px 40px rgba(28, 10, 0, 0.05), inset 0 1px 0 rgba(255, 255, 255, 0.6);
  overflow: hidden;
  display: none; /* Controlled by JS */
  animation: cardEntrance var(--transition-slow);
  transition: all var(--transition-normal);
}

[data-theme="dark"] .recipe-card {
  background-color: rgba(24, 20, 16, 0.78);
  border: 1px solid rgba(255, 255, 255, 0.08);
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.3), inset 0 1px 0 rgba(255, 255, 255, 0.05);
}

.recipe-card.active {
  display: block;
}

/* Card Header Section */
.recipe-hero {
  padding: 3.5rem 2rem 2.5rem 2rem;
  background: radial-gradient(circle at top, var(--secondary-light) 0%, transparent 75%);
  position: relative;
  border-bottom: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
}

[data-theme="dark"] .recipe-hero {
  background: radial-gradient(circle at top, var(--secondary-light) 0%, transparent 75%);
}

.recipe-meta-tags {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.5rem;
  margin-bottom: 1.25rem;
}

.meta-tag {
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  padding: 0.35rem 0.75rem;
  border-radius: var(--radius-full);
  background-color: var(--surface);
  border: 1px solid var(--border);
  color: var(--secondary);
}

.meta-tag.diet-tag {
  background-color: var(--secondary);
  color: var(--text-light);
  border: none;
}

[data-theme="dark"] .meta-tag.diet-tag {
  background-color: var(--primary);
}



.source-tag {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  font-weight: 700;
  text-transform: uppercase;
  font-size: 0.75rem;
  padding: 0.35rem 0.75rem;
  border-radius: var(--radius-full);
}

.source-tag.is-random {
  background-color: hsla(28, 95%, 53%, 0.12);
  color: var(--primary);
  border: 1px solid hsla(28, 95%, 53%, 0.35);
}

[data-theme="dark"] .source-tag.is-random {
  background-color: hsla(28, 95%, 58%, 0.18);
  color: var(--primary);
  border: 1px solid hsla(28, 95%, 58%, 0.45);
}

.source-tag.is-direct {
  background-color: var(--secondary-light);
  color: var(--secondary);
  border: 1px solid var(--border);
}

[data-theme="dark"] .source-tag.is-direct {
  background-color: hsla(150, 30%, 18%, 0.4);
  color: hsl(150, 40%, 65%);
  border: 1px solid var(--border);
}

.recipe-title-row {
  display: flex;
  justify-content: center;
  align-items: center;
  width: 100%;
  margin-bottom: 0.75rem;
}

.recipe-title {
  font-family: 'Playfair Display', Georgia, serif;
  font-size: 2.5rem;
  font-weight: 700;
  color: var(--text);
  line-height: 1.25;
  letter-spacing: -0.01em;
  max-width: 80%;
  margin-left: auto;
  margin-right: auto;
}

.favorite-action-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  background-color: var(--surface);
  border: 1.2px solid var(--primary);
  border-radius: var(--radius-full);
  padding: 0.45rem 1.15rem;
  font-family: 'Outfit', sans-serif;
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--primary);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  cursor: pointer;
  margin: 1.25rem auto 0 auto;
  box-shadow: var(--shadow-sm);
  transition: all var(--transition-fast);
}

.favorite-action-btn:hover {
  background-color: var(--secondary-light);
  transform: translateY(-1px);
  box-shadow: var(--shadow-md);
}

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

.favorite-action-btn svg {
  width: 1rem;
  height: 1rem;
  fill: none;
  stroke: var(--primary);
  stroke-width: 2.5;
  transition: fill var(--transition-fast), stroke var(--transition-fast), transform var(--transition-normal);
}

.favorite-action-btn:active svg {
  transform: scale(1.3);
}

/* Active state (favorited) */
.favorite-action-btn.is-favorite {
  background-color: var(--primary);
  color: var(--surface);
  border-color: var(--primary);
}

.favorite-action-btn.is-favorite svg {
  fill: var(--surface);
  stroke: var(--surface);
}

[data-theme="dark"] .favorite-action-btn.is-favorite svg {
  fill: var(--secondary);
  stroke: var(--secondary);
}

[data-theme="dark"] .favorite-action-btn.is-favorite {
  color: var(--secondary);
}

.recipe-actions-row {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 0.75rem;
  margin: 1.25rem auto 0 auto;
  flex-wrap: wrap;
  width: 100%;
}

.recipe-actions-row .favorite-action-btn {
  margin: 0;
}

.pinterest-action-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  background-color: var(--surface);
  border: 1.2px solid #e60023;
  border-radius: var(--radius-full);
  padding: 0.45rem 1.15rem;
  font-family: 'Outfit', sans-serif;
  font-size: 0.82rem;
  font-weight: 700;
  color: #e60023;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  cursor: pointer;
  box-shadow: var(--shadow-sm);
  transition: all var(--transition-fast);
}

.pinterest-action-btn:hover {
  background-color: #fcebeb;
  transform: translateY(-1px);
  box-shadow: var(--shadow-md);
}

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

.pinterest-action-btn svg {
  width: 1rem;
  height: 1rem;
  fill: #e60023;
  transition: transform var(--transition-normal);
}

.pinterest-action-btn:active svg {
  transform: scale(1.3);
}

[data-theme="dark"] .pinterest-action-btn {
  background-color: var(--surface);
}

[data-theme="dark"] .pinterest-action-btn:hover {
  background-color: rgba(230, 0, 35, 0.15);
}

.recipe-description {
  font-family: 'Playfair Display', Georgia, serif;
  font-size: 1.15rem;
  font-style: italic;
  color: var(--text-muted);
  max-width: 650px;
  margin: 0.5rem auto 0 auto;
  line-height: 1.6;
}

/* Decorative Divider Ornament */
.divider-ornament {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 1.25rem;
  width: 100%;
  max-width: 280px;
  margin: 1.5rem auto;
}

.divider-line {
  flex: 1;
  height: 1px;
  background: linear-gradient(to right, transparent, var(--primary), transparent);
}

.divider-symbol {
  font-size: 0.85rem;
  color: var(--primary);
  opacity: 0.8;
  user-select: none;
}

.gluten-warning {
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  background-color: hsl(40, 100%, 96%);
  border: 1px solid hsl(40, 80%, 85%);
  border-radius: var(--radius-md);
  padding: 1rem;
  margin-top: 1.25rem;
  font-size: 0.9rem;
  color: hsl(30, 40%, 15%);
}

[data-theme="dark"] .gluten-warning {
  background-color: hsl(40, 20%, 12%);
  border-color: hsl(40, 30%, 20%);
  color: hsl(40, 50%, 90%);
}

.gluten-warning svg {
  width: 1.25rem;
  height: 1.25rem;
  fill: hsl(35, 90%, 45%);
  flex-shrink: 0;
  margin-top: 0.15rem;
}

[data-theme="dark"] .gluten-warning svg {
  fill: hsl(40, 95%, 60%);
}

/* Quick Info Bar */
.recipe-quick-info {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  border-bottom: 1px solid var(--border);
  background-color: var(--surface-muted);
}

.quick-info-item {
  padding: 1.25rem;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.25rem;
  border-right: 1px solid var(--border);
}

.quick-info-item:last-child {
  border-right: none;
}

.quick-info-item svg {
  width: 1.5rem;
  height: 1.5rem;
  fill: var(--secondary);
}

[data-theme="dark"] .quick-info-item svg {
  fill: var(--primary);
}

.quick-info-val {
  font-weight: 700;
  font-size: 1.1rem;
}

.quick-info-lbl {
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
}

/* Main Recipe Body (Split view for ingredients and preparation) */
.recipe-body {
  padding: 2.5rem;
  display: grid;
  grid-template-columns: 1fr;
  gap: 2.5rem;
}

@media (min-width: 768px) {
  .recipe-body {
    grid-template-columns: 320px 1fr;
  }
}

/* Ingredients Section */
.ingredients-section h4 {
  font-size: 1.4rem;
  margin-bottom: 1.25rem;
  color: var(--text);
  border-bottom: 2px solid var(--border);
  padding-bottom: 0.5rem;
}

/* Portions Calculator */
.portion-calculator {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background-color: var(--surface-muted);
  border-radius: var(--radius-md);
  padding: 0.75rem 1rem;
  margin-bottom: 1.5rem;
}

.portion-label {
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text-muted);
}

.portion-controls {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.portion-btn {
  width: 2rem;
  height: 2rem;
  border-radius: var(--radius-full);
  background-color: var(--surface);
  border: 1px solid var(--border);
  color: var(--text);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.1rem;
  font-weight: 700;
}

.portion-btn:hover {
  background-color: var(--primary);
  color: var(--text-light);
  border-color: var(--primary);
}

.portion-count {
  font-weight: 700;
  font-size: 1.1rem;
  min-width: 1.5rem;
  text-align: center;
}

/* Ingredient list with checks */
.ingredient-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.ingredient-item {
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  font-size: 0.95rem;
  cursor: pointer;
  padding: 0.25rem 0;
}

.ingredient-checkbox {
  width: 1.25rem;
  height: 1.25rem;
  border-radius: var(--radius-full);
  border: 1.5px solid var(--primary);
  background-color: var(--surface);
  margin-top: 0.1rem;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: all var(--transition-fast);
}

.ingredient-checkbox svg {
  width: 0.75rem;
  height: 0.75rem;
  fill: none;
  stroke: var(--surface);
  stroke-width: 3;
  stroke-linecap: round;
  stroke-linejoin: round;
  display: none;
}

.ingredient-item.checked {
  color: var(--text-muted);
  opacity: 0.75;
}

.ingredient-item.checked .ingredient-checkbox {
  background-color: var(--primary);
  border-color: var(--primary);
}

.ingredient-item.checked .ingredient-checkbox svg {
  display: block;
}

.ingredient-amount {
  font-weight: 700;
  color: var(--text);
  margin-right: 0.25rem;
  transition: color var(--transition-normal);
}

.ingredient-item.checked .ingredient-amount {
  color: var(--text-muted);
}

/* Steps / Directions Section */
.steps-section h4 {
  font-size: 1.4rem;
  margin-bottom: 1.5rem;
  color: var(--text);
  border-bottom: 2px solid var(--border);
  padding-bottom: 0.5rem;
}

.steps-list {
  display: flex;
  flex-direction: column;
  gap: 1.75rem;
}

.step-item {
  display: flex;
  gap: 1.25rem;
}

.step-number {
  font-family: 'Playfair Display', Georgia, serif;
  font-size: 2.25rem;
  font-weight: 700;
  font-style: italic;
  color: var(--primary);
  width: 2.5rem;
  line-height: 0.9;
  text-align: right;
  flex-shrink: 0;
  user-select: none;
}

.step-content {
  font-size: 1.05rem;
  padding-top: 0.2rem;
}

/* Favorites Drawer Panel */
.drawer {
  position: fixed;
  top: 0;
  right: 0;
  width: 100%;
  max-width: 420px;
  height: 100%;
  background-color: var(--surface);
  z-index: 1000;
  box-shadow: var(--shadow-lg);
  border-left: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  transform: translateX(100%);
  visibility: hidden;
  transition: transform var(--transition-normal), visibility var(--transition-normal);
}

.drawer.open {
  transform: translateX(0);
  visibility: visible;
}

.drawer-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.4);
  z-index: 999;
  display: none;
  opacity: 0;
  transition: opacity var(--transition-normal);
}

.drawer-overlay.open {
  display: block;
  opacity: 1;
}

.drawer-header {
  padding: 1.5rem 2rem;
  border-bottom: 1px solid var(--border);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.drawer-header h3 {
  font-size: 1.5rem;
  color: var(--text);
}

.close-btn {
  width: 2.25rem;
  height: 2.25rem;
  border-radius: var(--radius-full);
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--border);
  color: var(--text-muted);
}

.close-btn:hover {
  background-color: var(--surface-muted);
  color: var(--text);
}

.close-btn svg {
  width: 1rem;
  height: 1rem;
  fill: currentColor;
}

.drawer-content {
  flex: 1;
  overflow-y: auto;
  padding: 2rem;
}

.fav-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.fav-item {
  padding: 1rem;
  border-radius: var(--radius-md);
  background-color: var(--surface-muted);
  border: 1px solid var(--border);
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  transition: transform var(--transition-fast), border-color var(--transition-fast);
}

.fav-item:hover {
  transform: translateY(-2px);
  border-color: var(--primary);
}

.fav-info {
  flex: 1;
  cursor: pointer;
}

.fav-title {
  font-weight: 600;
  font-size: 1rem;
  color: var(--text);
  margin-bottom: 0.25rem;
}

.fav-meta {
  font-size: 0.8rem;
  color: var(--text-muted);
  text-transform: capitalize;
}

.delete-fav-btn {
  color: var(--text-muted);
  padding: 0.25rem;
}

.delete-fav-btn:hover {
  color: hsl(350, 80%, 55%);
}

.delete-fav-btn svg {
  width: 1.1rem;
  height: 1.1rem;
  fill: currentColor;
}

.empty-favorites {
  text-align: center;
  padding: 3rem 0;
  color: var(--text-muted);
}

.empty-favorites svg {
  width: 3rem;
  height: 3rem;
  fill: var(--border);
  margin-bottom: 1rem;
}

/* Footer Section */
footer {
  text-align: center;
  padding: 2rem;
  margin-top: auto;
  font-size: 0.9rem;
  color: var(--text-muted);
  border-top: 1px solid var(--border);
  background-color: var(--surface);
  transition: background-color var(--transition-normal), border-color var(--transition-normal);
}

.footer-links {
  margin-top: 0.5rem;
  display: flex;
  justify-content: center;
  gap: 1rem;
}

.footer-link {
  color: var(--text-muted);
  text-decoration: none;
  font-size: 0.85rem;
  font-weight: 500;
  transition: color var(--transition-fast);
}

.footer-link:hover {
  color: var(--primary);
}

.affiliate-disclaimer {
  margin-top: 1rem;
  font-size: 0.68rem;
  color: var(--text-muted);
  opacity: 0.5;
  max-width: 600px;
  margin-left: auto;
  margin-right: auto;
  line-height: 1.4;
}

/* Custom Keyframe Animations */
@keyframes float {
  0% { transform: translateY(0); }
  50% { transform: translateY(-4px); }
  100% { transform: translateY(0); }
}

@keyframes cardEntrance {
  0% {
    opacity: 0;
    transform: translateY(20px) scale(0.98);
  }
  100% {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

/* Shuffle Spin / Dice animation */
.shuffle-animate {
  animation: diceRoll 0.6s cubic-bezier(0.2, 0.8, 0.2, 1);
}

@keyframes diceRoll {
  0% { transform: rotate(0deg) scale(1); }
  50% { transform: rotate(180deg) scale(0.9); }
  100% { transform: rotate(360deg) scale(1); }
}

/* Screen Shake (if no recipes found) */
.shake-animate {
  animation: shake 0.5s ease-in-out;
}

@keyframes shake {
  0%, 100% { transform: translateX(0); }
  10%, 30%, 50%, 70%, 90% { transform: translateX(-6px); }
  20%, 40%, 60%, 80% { transform: translateX(6px); }
}

/* Toast Notification System */
.toast-container {
  position: fixed;
  bottom: 2rem;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.75rem;
  z-index: 99999;
  pointer-events: none;
  width: 90%;
  max-width: 400px;
}

.toast {
  background-color: rgba(24, 20, 16, 0.95); /* Elegant translucent dark brown matching brand */
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: var(--surface);
  padding: 0.75rem 1.25rem;
  border-radius: var(--radius-md);
  font-family: 'Outfit', sans-serif;
  font-size: 0.88rem;
  font-weight: 600;
  box-shadow: var(--shadow-lg);
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  gap: 0.5rem;
  opacity: 0;
  transform: translateY(10px) scale(0.98);
  width: 100%;
  white-space: normal;
  word-break: break-word;
  animation: toastFadeIn 0.3s ease-out forwards,
             toastFadeOut 0.3s ease-out forwards 2.7s;
  pointer-events: auto;
}

@keyframes toastFadeIn {
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

@keyframes toastFadeOut {
  to {
    opacity: 0;
    transform: translateY(10px) scale(0.95);
  }
}

/* Tooltip Balloon Popups */
[data-tooltip] {
  position: relative;
}

[data-tooltip]::after {
  content: attr(data-tooltip);
  position: absolute;
  bottom: 125%;
  left: 50%;
  transform: translateX(-50%) scale(0.9);
  background-color: var(--text);
  color: var(--surface);
  padding: 0.4rem 0.75rem;
  border-radius: var(--radius-sm);
  font-size: 0.75rem;
  font-weight: 600;
  white-space: nowrap;
  box-shadow: var(--shadow-md);
  opacity: 0;
  pointer-events: none;
  transition: all var(--transition-fast) cubic-bezier(0.2, 0.8, 0.2, 1);
  z-index: 1000;
}

[data-tooltip]::before {
  content: '';
  position: absolute;
  bottom: 110%;
  left: 50%;
  transform: translateX(-50%) scale(0.9);
  border-width: 6px;
  border-style: solid;
  border-color: var(--text) transparent transparent transparent;
  opacity: 0;
  pointer-events: none;
  transition: all var(--transition-fast) cubic-bezier(0.2, 0.8, 0.2, 1);
  z-index: 1000;
}

[data-tooltip]:hover::after,
[data-tooltip]:hover::before {
  opacity: 1;
  transform: translateX(-50%) scale(1);
}

/* Tooltips pointing downwards for header controls */
.header-controls [data-tooltip]::after {
  bottom: auto;
  top: 125%;
}

.header-controls [data-tooltip]::before {
  bottom: auto;
  top: 110%;
  border-color: transparent transparent var(--text) transparent;
}

/* =============================================
   RESPONSIVE DESIGN – TABLET (641px – 1023px)
   ============================================= */
@media (max-width: 1023px) {
  main {
    padding: 1.5rem;
    gap: 1.5rem;
  }

  .filter-card {
    padding: 1.5rem;
  }

  .filter-toggle {
    cursor: pointer;
    pointer-events: auto; /* Enable toggle clicks on mobile/tablet */
  }

  .filter-toggle-meta {
    display: inline-block; /* Show filters meta text on mobile/tablet */
  }

  .filter-chevron {
    display: block; /* Show chevron on mobile/tablet */
  }

  .filter-body {
    display: none; /* Collapsed by default on mobile/tablet */
    margin-top: 1.5rem;
    width: 100%;
  }

  .filter-body.open {
    display: block; /* Show when open class is applied */
  }

  .recipe-hero {
    padding: 1.75rem;
  }

  .recipe-body {
    padding: 1.75rem;
    gap: 1.75rem;
  }

  .recipe-title {
    font-size: 1.8rem;
  }

  .shuffle-btn {
    font-size: 1rem;
  }
}

/* =============================================
   RESPONSIVE DESIGN – MOBILE (max 640px)
   ============================================= */
@media (max-width: 640px) {

  /* --- Header --- */
  .header-container {
    padding: 0.9rem 1rem;
  }

  .logo {
    font-size: 1.2rem;
  }

  .logo svg {
    width: 1.6rem;
    height: 1.6rem;
  }

  .logo-slogan {
    display: none;
  }

  .logo-name {
    font-size: 1.15rem;
  }

  .header-controls {
    gap: 0.5rem;
  }

  .icon-btn {
    width: 2.4rem;
    height: 2.4rem;
  }

  /* --- Main Layout --- */
  main {
    padding: 1rem;
    gap: 1.25rem;
  }

  /* --- Filter Card --- */
  .filter-card {
    padding: 1.25rem;
  }



  .filter-group-title,
  .filter-group-header-static {
    font-size: 0.95rem;
  }

  .filter-group {
    border-bottom: 1px solid var(--border);
    padding-bottom: 1rem;
    margin-bottom: 1rem;
  }

  .chips-grid {
    gap: 0.4rem;
  }

  .chip {
    font-size: 0.78rem;
    padding: 0.85rem 0.35rem 0.65rem 0.35rem;
    min-height: 76px;
  }
  .chip svg {
    width: 1.5rem;
    height: 1.5rem;
  }

  /* --- Shuffle Button --- */
  .shuffle-btn {
    font-size: 1rem;
    padding: 0.85rem 1.25rem;
  }

  .shuffle-action-group {
    padding-top: 1.25rem;
  }

  /* --- Welcome Card --- */
  .welcome-card {
    padding: 2.5rem 1.25rem;
  }

  .welcome-card h3 {
    font-size: 1.4rem;
  }

  .welcome-card p {
    font-size: 0.9rem;
  }

  /* --- Recipe Card Hero --- */
  .recipe-hero {
    padding: 1.25rem;
  }

  .recipe-title {
    font-size: 1.5rem;
    line-height: 1.2;
  }

  .recipe-title-row {
    gap: 0.75rem;
  }

  .recipe-description {
    font-size: 0.92rem;
  }

  .recipe-meta-tags {
    gap: 0.4rem;
    margin-bottom: 0.9rem;
  }

  .meta-tag {
    font-size: 0.7rem;
    padding: 0.3rem 0.65rem;
  }

  /* --- Quick Info Grid --- */
  .recipe-quick-info {
    grid-template-columns: repeat(3, 1fr);
  }

  .quick-info-item {
    padding: 0.75rem 0.5rem;
  }

  .quick-info-val {
    font-size: 1rem;
  }

  .quick-info-lbl {
    font-size: 0.65rem;
  }

  .quick-info-item svg {
    width: 1.25rem;
    height: 1.25rem;
  }

  /* --- Recipe Body (Ingredients + Steps) --- */
  .recipe-body {
    padding: 1.25rem;
    gap: 1.5rem;
    grid-template-columns: 1fr; /* Always single column on mobile */
  }

  .ingredients-section h4,
  .steps-section h4 {
    font-size: 1.15rem;
    margin-bottom: 1rem;
  }

  /* --- Portion Calculator --- */
  .portion-calculator {
    padding: 0.65rem 0.9rem;
    margin-bottom: 1.1rem;
  }

  .portion-label {
    font-size: 0.85rem;
  }

  /* --- Ingredient List --- */
  .ingredient-item {
    font-size: 0.9rem;
    gap: 0.6rem;
  }

  /* --- Steps List --- */
  .step-item {
    gap: 0.85rem;
  }

  .step-number {
    width: 2rem;
    height: 2rem;
    font-size: 0.95rem;
    flex-shrink: 0;
  }

  .step-content {
    font-size: 0.92rem;
    line-height: 1.55;
  }

  /* --- Ingredient Search --- */
  .search-input-wrapper input {
    font-size: 0.9rem;
  }

  /* --- Favorites Drawer --- */
  .drawer {
    width: 100% !important;
    max-width: 100%;
    border-radius: var(--radius-lg) var(--radius-lg) 0 0;
    top: auto !important;
    bottom: 0;
    right: 0;
    transform: translateY(100%);
    max-height: 80vh;
    overflow-y: auto;
  }

  .drawer.open {
    transform: translateY(0);
  }

  .drawer-header {
    padding: 1.1rem 1.25rem;
  }

  /* --- Footer --- */
  footer {
    padding: 1.5rem 1rem;
    font-size: 0.8rem;
  }

  .footer-links {
    gap: 1rem;
    margin-top: 0.5rem;
  }

  /* --- Gluten Warning --- */
  .gluten-warning {
    font-size: 0.82rem;
    padding: 0.85rem;
  }

  /* --- Affiliate Disclaimer --- */
  .affiliate-disclaimer {
    font-size: 0.68rem;
    padding: 0 0.5rem;
  }
}

/* =============================================
   VERY SMALL SCREENS (max 380px)
   ============================================= */
@media (max-width: 380px) {
  .logo-name {
    font-size: 1.05rem;
  }

  .recipe-title {
    font-size: 1.3rem;
  }

  .recipe-quick-info {
    grid-template-columns: repeat(3, 1fr);
  }

  .quick-info-val {
    font-size: 0.9rem;
  }
}

/* =============================================
   HELP MODAL DIALOG (Bedienungsanleitung)
   ============================================= */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(15, 10, 5, 0.4);
  backdrop-filter: blur(12px); /* Soft blur backdrop */
  -webkit-backdrop-filter: blur(12px);
  z-index: 10000;
  display: none;
  opacity: 0;
  transition: opacity var(--transition-normal);
  
  /* Flexbox Centering */
  align-items: center;
  justify-content: center;
  padding: 1rem;
}

.modal {
  position: relative;
  transform: scale(0.95);
  width: 100%;
  max-width: 440px;
  max-height: 85vh;
  overflow-y: auto;
  background-color: rgba(255, 255, 255, 0.85); /* Glass translucent white */
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-radius: var(--radius-lg);
  border: 1px solid rgba(255, 255, 255, 0.4);
  box-shadow: 0 20px 50px rgba(28, 10, 0, 0.12), inset 0 1px 0 rgba(255, 255, 255, 0.6);
  z-index: 10001;
  display: none;
  opacity: 0;
  padding: 1.5rem 1.25rem;
  transition: all var(--transition-normal);
  scrollbar-width: thin;
  scrollbar-color: var(--border) transparent;
}

[data-theme="dark"] .modal {
  background-color: rgba(24, 20, 16, 0.85); /* Glass translucent dark */
  border: 1px solid rgba(255, 255, 255, 0.1);
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.4), inset 0 1px 0 rgba(255, 255, 255, 0.05);
}

.modal.open {
  display: block;
  opacity: 1;
  transform: scale(1);
}

.modal-overlay.open {
  display: flex;
  opacity: 1;
}

.modal-close-btn {
  position: absolute;
  top: 1rem;
  right: 1.25rem;
  font-size: 2rem;
  font-weight: 300;
  color: var(--text-muted);
  cursor: pointer;
  background: none;
  border: none;
  line-height: 1;
  transition: color var(--transition-fast);
}

.modal-close-btn:hover {
  color: var(--primary);
}

.modal-header h3 {
  font-size: 1.25rem;
  color: var(--text);
  margin-bottom: 0.75rem;
  font-family: 'Playfair Display', Georgia, serif;
}

.modal-intro {
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-bottom: 1.25rem;
  line-height: 1.45;
}

/* 2x2 Guide Grid layout */
.guide-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 0.65rem;
  margin-bottom: 1.25rem;
}

.guide-card {
  background-color: var(--surface);
  border: 1.2px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 0.85rem 0.75rem;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  transition: transform var(--transition-fast), border-color var(--transition-fast), box-shadow var(--transition-fast);
}

.guide-card:hover {
  transform: translateY(-2px);
  border-color: var(--primary);
  box-shadow: var(--shadow-sm);
}

.guide-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  margin-bottom: 0.4rem;
}

.guide-number {
  background-color: var(--secondary-light);
  color: var(--secondary);
  font-weight: 800;
  font-size: 0.8rem;
  width: 1.4rem;
  height: 1.4rem;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

[data-theme="dark"] .guide-number {
  background-color: var(--secondary-light);
  color: var(--primary);
}

.guide-card-icon {
  color: var(--primary);
  flex-shrink: 0;
  width: 16px;
  height: 16px;
}

.guide-card strong {
  display: block;
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 0.2rem;
}

.guide-card p {
  font-size: 0.72rem;
  color: var(--text-muted);
  line-height: 1.35;
  margin: 0;
}

.modal-understand-btn {
  width: 100%;
  background-color: var(--primary);
  color: var(--text-light);
  font-size: 0.85rem;
  font-weight: 700;
  padding: 0.85rem;
  border-radius: var(--radius-full);
  text-align: center;
  border: none;
  cursor: pointer;
  transition: background-color var(--transition-fast), transform var(--transition-fast);
}

.modal-understand-btn:hover {
  background-color: var(--primary-hover);
  transform: translateY(-1px);
}

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

@media (max-width: 500px) {
  .guide-grid {
    grid-template-columns: 1fr; /* Single column on small viewports */
    gap: 0.75rem;
  }
  .modal {
    width: 88%;
    max-width: 360px;
    padding: 1.15rem 1rem;
  }
}

/* =============================================
   RECIPE COVER IMAGE (Cookbook Aesthetic)
   ============================================= */
.recipe-cover-wrapper {
  width: 100%;
  height: 320px;
  overflow: hidden;
  position: relative;
  background: linear-gradient(135deg, var(--surface-muted) 0%, var(--bg) 100%);
  border-bottom: 1px solid var(--border);
  transition: all var(--transition-normal);
}

.recipe-cover-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform var(--transition-slow);
}

.recipe-card:hover .recipe-cover-img {
  transform: scale(1.03);
}

/* Fallback state if the image blocks or fails to load */
.recipe-cover-wrapper.no-image {
  height: 16px; /* Elegant thin solid accent bar at the top of the card */
  background: var(--primary-gradient);
  border-bottom: none;
}

.recipe-cover-wrapper.no-image .recipe-cover-img {
  display: none !important;
}

/* History Card */
.history-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.history-item-btn {
  width: 100%;
  background: none;
  border: none;
  padding: 0.45rem 0.6rem;
  border-radius: var(--radius-sm);
  color: var(--text);
  font-family: 'Outfit', sans-serif;
  font-size: 0.85rem;
  font-weight: 500;
  text-align: left;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  transition: background-color var(--transition-fast), color var(--transition-fast);
}

.history-item-btn:hover {
  background-color: var(--border);
  color: var(--primary);
}

.history-item-btn svg {
  fill: currentColor;
  opacity: 0.4;
  flex-shrink: 0;
  transition: opacity var(--transition-fast);
}

.history-item-btn:hover svg {
  opacity: 1;
}

.history-item-title {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  flex-grow: 1;
}

/* Mobile Sticky Action Bar */
.mobile-sticky-bar {
  display: none; /* Hidden on desktop */
}

@media (max-width: 1023px) {
  /* Layout-Tausch: Recipe Card at the top, Sidebar at the bottom */
  main {
    display: flex !important;
    flex-direction: column !important;
    gap: 1.5rem !important;
  }

  .content-area {
    order: -1 !important; /* Recipe card goes first */
  }

  .sidebar {
    order: 1 !important; /* Sidebar goes second */
  }

  .mobile-sticky-bar {
    position: fixed;
    bottom: 0;
    left: 0;
    width: 100%;
    background-color: rgba(255, 254, 252, 0.9); /* Ivory background match */
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border-top: 1px solid var(--border);
    padding: 0.75rem 1.25rem;
    box-shadow: 0 -4px 20px rgba(28, 10, 0, 0.05);
    display: flex !important;
    justify-content: space-between;
    gap: 0.75rem;
    z-index: 900;
    padding-bottom: calc(0.75rem + env(safe-area-inset-bottom, 0px));
  }

  /* Add spacing at bottom so content is not obscured */
  body {
    padding-bottom: calc(4.5rem + env(safe-area-inset-bottom, 0px)) !important;
  }

  .sticky-bar-btn {
    flex: 1;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.75rem 1rem;
    border-radius: var(--radius-md);
    font-family: 'Outfit', sans-serif;
    font-size: 0.95rem;
    font-weight: 700;
    border: none;
    cursor: pointer;
    transition: all var(--transition-fast);
  }

  .sticky-bar-btn.secondary {
    background-color: var(--surface);
    color: var(--text);
    border: 1px solid var(--border);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.02);
  }

  .sticky-bar-btn.primary {
    background-color: var(--primary);
    color: var(--text-light);
    box-shadow: 0 4px 10px rgba(234, 88, 12, 0.15);
  }

  .sticky-bar-btn:active {
    transform: scale(0.97);
  }
}

/* Equipment Recommendation inside ingredients section */
.equipment-recommendation-title {
  font-family: 'Outfit', sans-serif;
  font-size: 0.8rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
  margin-bottom: 0.60rem;
  display: flex;
  align-items: center;
  gap: 0.35rem;
}

.equipment-links {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.equipment-link-item {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  color: var(--primary);
  font-size: 0.9rem;
  font-weight: 600;
  text-decoration: none;
  transition: color var(--transition-fast);
}

.equipment-link-item:hover {
  color: var(--primary-hover);
  text-decoration: underline;
}

.equipment-link-item svg {
  fill: currentColor;
  opacity: 0.8;
  flex-shrink: 0;
}

/* Book Recommendations Sidebar Card */
.book-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
}

.book-item {
  border-bottom: 1px solid var(--border);
  padding-bottom: 0.85rem;
}

.book-item:last-child {
  border-bottom: none;
  padding-bottom: 0;
}

.book-link {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  text-decoration: none;
  color: var(--text);
  transition: opacity var(--transition-fast);
}

.book-cover-thumbnail {
  width: 44px;
  height: 58px;
  object-fit: cover;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
  flex-shrink: 0;
  transition: transform var(--transition-fast);
}

.book-link:hover .book-cover-thumbnail {
  transform: translateY(-2px) scale(1.02);
}

.book-info {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
}

.book-link:hover .book-title {
  color: var(--primary);
  text-decoration: underline;
}

.book-title {
  font-family: 'Outfit', sans-serif;
  font-size: 0.88rem;
  font-weight: 700;
  color: var(--text);
  line-height: 1.2;
  transition: color var(--transition-fast);
}

.book-desc {
  font-size: 0.75rem;
  color: var(--text-muted);
  line-height: 1.3;
}

/* Chef's Recommendation Box at the bottom of preparation steps */
.chef-recommendation-card {
  display: flex;
  background-color: var(--surface-hover);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 1rem;
  gap: 1.25rem;
  align-items: center;
  text-decoration: none;
  color: var(--text);
  transition: transform var(--transition-fast), border-color var(--transition-fast), box-shadow var(--transition-fast);
}

.chef-recommendation-card:hover {
  transform: translateY(-2px);
  border-color: var(--primary-light);
  box-shadow: 0 4px 12px rgba(234, 88, 12, 0.05);
}

.chef-rec-img {
  width: 70px;
  height: 70px;
  object-fit: cover;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  flex-shrink: 0;
}

.chef-rec-info {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.chef-rec-tag {
  font-family: 'Outfit', sans-serif;
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  color: var(--primary);
  letter-spacing: 0.05em;
}

.chef-rec-title {
  font-family: 'Outfit', sans-serif;
  font-weight: 700;
  font-size: 0.95rem;
  color: var(--text);
}

.chef-rec-desc {
  font-size: 0.8rem;
  color: var(--text-muted);
  line-height: 1.35;
}

@media (max-width: 480px) {
  .chef-recommendation-card {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.75rem;
    padding: 0.85rem;
  }

  .chef-rec-img {
    width: 100%;
    height: 120px;
  }
}




