/* ==========================================================================
   AU PLESSIS CUISINE & NOS RECETTES - CUISINEAZ-INSPIRED DESIGN SYSTEM
   Clean, luminous, simple, responsive, and kitchen-friendly aesthetic
   ========================================================================== */

@import url('https://fonts.googleapis.com/css2?family=Outfit:wght@400;500;600;700;800&family=Plus+Jakarta+Sans:wght@400;500;600;700;800&display=swap');

:root {
  /* Color Palette - Fresh, clean, high-contrast light theme */
  --bg-main: #f8fafc;
  --bg-surface: #ffffff;
  --bg-card: #ffffff;
  --bg-card-hover: #f1f5f9;
  --bg-input: #ffffff;
  --bg-pill: #f1f5f9;
  
  --border-subtle: #e2e8f0;
  --border-strong: #cbd5e1;
  --border-dark: #0f172a;
  
  --text-main: #0f172a;
  --text-secondary: #334155;
  --text-muted: #64748b;
  --text-dim: #94a3b8;

  /* Culinary Accent - Warm appetizing orange */
  --primary: #ea580c;
  --primary-hover: #c2410c;
  --primary-light: #fff7ed;
  --primary-border: #fed7aa;
  --primary-gradient: linear-gradient(135deg, #f97316 0%, #ea580c 100%);
  
  --accent-green: #16a34a;
  --accent-green-light: #f0fdf4;
  --accent-green-border: #bbf7d0;
  --accent-amber: #d97706;
  --accent-rose: #e11d48;

  /* Typography */
  --font-sans: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --font-display: 'Outfit', -apple-system, BlinkMacSystemFont, sans-serif;

  /* Shadows */
  --shadow-xs: 0 1px 2px rgba(0, 0, 0, 0.04);
  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.06), 0 1px 2px rgba(0, 0, 0, 0.04);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.07), 0 2px 4px -2px rgba(0, 0, 0, 0.05);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.08), 0 4px 6px -4px rgba(0, 0, 0, 0.04);
  --shadow-card: 0 2px 8px -2px rgba(15, 23, 42, 0.06);

  /* Radius */
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 16px;
  --radius-xl: 20px;
  --radius-full: 9999px;

  /* Transitions */
  --trans-quick: all 0.15s ease;
  --trans-smooth: all 0.25s ease;
}

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

html {
  font-size: 16px;
  scroll-behavior: smooth;
  color-scheme: light;
}

body {
  font-family: var(--font-sans);
  background-color: var(--bg-main);
  color: var(--text-main);
  min-height: 100vh;
  line-height: 1.6;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}

/* ==========================================================================
   NAVIGATION BAR
   ========================================================================== */
.navbar {
  position: sticky;
  top: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.75rem 1.75rem;
  background: #ffffff;
  border-bottom: 1px solid var(--border-subtle);
  box-shadow: var(--shadow-xs);
  transition: var(--trans-quick);
}

.brand {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  text-decoration: none;
  color: var(--text-main);
  cursor: pointer;
  flex-shrink: 0;
}

.brand-icon {
  width: 38px;
  height: 38px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--primary-light);
  border: 1px solid var(--primary-border);
  border-radius: var(--radius-md);
  font-size: 1.35rem;
  transition: transform 0.2s ease;
}

.brand:hover .brand-icon {
  transform: scale(1.08) rotate(-4deg);
}

.brand-title {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 1.3rem;
  letter-spacing: -0.02em;
  color: var(--text-main);
}

.brand-tag {
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--primary);
  background: var(--primary-light);
  border: 1px solid var(--primary-border);
  padding: 0.15rem 0.5rem;
  border-radius: var(--radius-full);
  margin-left: 0.35rem;
}

/* Search Bar */
.nav-search {
  position: relative;
  flex: 1;
  max-width: 480px;
  display: flex;
  align-items: center;
}

.nav-search-icon {
  position: absolute;
  left: 0.85rem;
  font-size: 0.95rem;
  color: var(--text-muted);
  pointer-events: none;
}

.nav-search input {
  width: 100%;
  padding: 0.55rem 2rem 0.55rem 2.4rem;
  border-radius: var(--radius-full);
  border: 1.5px solid var(--border-subtle);
  background: #f8fafc;
  color: var(--text-main);
  font-family: var(--font-sans);
  font-size: 0.9rem;
  transition: var(--trans-quick);
}

.nav-search input:focus {
  outline: none;
  background: #ffffff;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(234, 88, 12, 0.12);
}

.nav-search-clear {
  position: absolute;
  right: 0.75rem;
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 0.85rem;
  display: none;
  padding: 0.25rem;
}

.nav-search-clear.visible {
  display: block;
}

/* Actions & Auth */
.nav-actions {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-shrink: 0;
}

/* Generic Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.45rem;
  padding: 0.55rem 1rem;
  border-radius: var(--radius-full);
  font-family: var(--font-sans);
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
  transition: var(--trans-quick);
  border: 1.5px solid transparent;
  white-space: nowrap;
}

.btn-primary {
  background: var(--primary);
  color: #ffffff;
  border-color: var(--primary);
  box-shadow: 0 2px 4px rgba(234, 88, 12, 0.2);
}

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

.btn-secondary {
  background: #ffffff;
  color: var(--text-secondary);
  border-color: var(--border-subtle);
}

.btn-secondary:hover {
  background: #f8fafc;
  color: var(--text-main);
  border-color: var(--border-strong);
}

.btn-danger {
  background: #ffffff;
  color: var(--accent-rose);
  border-color: #fecdd3;
}

.btn-danger:hover {
  background: #fff1f2;
  border-color: var(--accent-rose);
}

/* User Pill in Navbar */
.user-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.35rem 0.85rem;
  background: #f8fafc;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-full);
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-main);
}

.btn-logout {
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 0.85rem;
  padding: 0.2rem 0.4rem;
  border-radius: 4px;
}

.btn-logout:hover {
  color: var(--accent-rose);
}

/* ==========================================================================
   MAIN CONTENT CONTAINER
   ========================================================================== */
.main-content {
  max-width: 1200px;
  margin: 0 auto;
  padding: 2rem 1.5rem 4rem;
}

/* ==========================================================================
   GALLERY VIEW (HERO & CARDS)
   ========================================================================== */
.hero {
  text-align: center;
  padding: 2rem 1rem 2.5rem;
}

.hero-subtitle {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.85rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--primary);
  background: var(--primary-light);
  border: 1px solid var(--primary-border);
  padding: 0.3rem 0.85rem;
  border-radius: var(--radius-full);
  margin-bottom: 1rem;
}

.hero-title {
  font-family: var(--font-display);
  font-size: clamp(2rem, 5vw, 2.75rem);
  font-weight: 800;
  color: var(--text-main);
  letter-spacing: -0.02em;
  line-height: 1.2;
  margin-bottom: 0.75rem;
}

.hero-title span {
  color: var(--primary);
}

.hero-desc {
  max-width: 620px;
  margin: 0 auto;
  font-size: 1.05rem;
  color: var(--text-muted);
  line-height: 1.6;
}

/* Filter Bar */
.filter-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin: 1.5rem 0 2rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid var(--border-subtle);
}

.filter-tags {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  overflow-x: auto;
  scrollbar-width: none;
  -webkit-overflow-scrolling: touch;
  padding: 0.25rem 0;
}

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

.filter-chip {
  background: #ffffff;
  border: 1.5px solid var(--border-subtle);
  color: var(--text-secondary);
  padding: 0.4rem 0.9rem;
  border-radius: var(--radius-full);
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  transition: var(--trans-quick);
}

.filter-chip:hover {
  border-color: var(--border-strong);
  color: var(--text-main);
  background: #f8fafc;
}

.filter-chip.active {
  background: var(--primary);
  border-color: var(--primary);
  color: #ffffff;
  box-shadow: 0 2px 6px rgba(234, 88, 12, 0.25);
}

.recipes-count {
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--text-muted);
  white-space: nowrap;
}

/* Recipe Grid */
.recipe-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 1.75rem;
}

.recipe-card {
  background: #ffffff;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  box-shadow: var(--shadow-card);
  transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease;
  cursor: pointer;
}

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

.card-image-wrap {
  position: relative;
  width: 100%;
  height: 180px;
  overflow: hidden;
  background: #f1f5f9;
}

.card-image {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  transition: transform 0.35s ease;
}

.recipe-card:hover .card-image {
  transform: scale(1.05);
}

.card-body {
  padding: 1.35rem;
  display: flex;
  flex-direction: column;
  flex: 1;
  justify-content: space-between;
}

.card-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.85rem;
}

.card-badge-difficulty {
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 0.2rem 0.55rem;
  border-radius: var(--radius-full);
}

.diff-facile {
  background: #dcfce7;
  color: #15803d;
}

.diff-moyen {
  background: #fef3c7;
  color: #b45309;
}

.diff-difficile {
  background: #fee2e2;
  color: #b91c1c;
}

.card-portions {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-muted);
}

.card-title {
  font-family: var(--font-display);
  font-size: 1.35rem;
  font-weight: 800;
  color: var(--text-main);
  line-height: 1.3;
  margin-bottom: 0.75rem;
  transition: color 0.15s ease;
}

.recipe-card:hover .card-title {
  color: var(--primary);
}

.card-meta {
  display: flex;
  align-items: center;
  gap: 1.25rem;
  font-size: 0.85rem;
  color: var(--text-muted);
  font-weight: 500;
  margin-bottom: 1rem;
}

.card-meta-item {
  display: flex;
  align-items: center;
  gap: 0.35rem;
}

.card-ingredients-preview {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin-bottom: 1.25rem;
}

.ingredient-pill {
  font-size: 0.78rem;
  padding: 0.25rem 0.6rem;
  background: #f8fafc;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
}

.card-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-top: 1rem;
  border-top: 1px solid var(--border-subtle);
  gap: 0.5rem;
}

.card-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
}

.tag-badge {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--primary);
  background: var(--primary-light);
  padding: 0.15rem 0.5rem;
  border-radius: var(--radius-full);
}

/* ==========================================================================
   RECIPE READER VIEW (CUISINEAZ STYLE)
   ========================================================================== */
.view-container {
  display: none;
  animation: fadeIn 0.2s ease-out forwards;
}

.view-container.active {
  display: block;
}

.back-link {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  color: var(--text-muted);
  font-weight: 700;
  font-size: 0.95rem;
  cursor: pointer;
  margin-bottom: 1.5rem;
  background: none;
  border: none;
  padding: 0.4rem 0.65rem;
  border-radius: var(--radius-md);
  transition: var(--trans-quick);
}

.back-link:hover {
  color: var(--primary);
  background: var(--primary-light);
  transform: translateX(-3px);
}

/* Recipe Hero Card */
.recipe-hero {
  background: #ffffff;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 2rem 2.25rem;
  margin-bottom: 2rem;
  box-shadow: var(--shadow-sm);
}

.recipe-hero-image-wrap {
  width: 100%;
  height: 340px;
  border-radius: var(--radius-md);
  overflow: hidden;
  margin-bottom: 1.5rem;
  background: #f8fafc;
}

.recipe-hero-image {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.recipe-hero-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 1rem;
  margin-bottom: 1.25rem;
}

.recipe-hero-badges {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.recipe-hero-title {
  font-family: var(--font-display);
  font-size: clamp(1.85rem, 4vw, 2.75rem);
  font-weight: 800;
  color: var(--text-main);
  line-height: 1.2;
  margin-bottom: 1.5rem;
}

.recipe-hero-stats {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--border-subtle);
}

.stat-item {
  background: #f8fafc;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 0.75rem 1rem;
  display: flex;
  flex-direction: column;
}

.stat-label {
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
  margin-bottom: 0.2rem;
}

.stat-value {
  font-family: var(--font-display);
  font-size: 1.15rem;
  font-weight: 800;
  color: var(--text-main);
}

/* CuisineAZ Sections Container */
.recipe-layout-az {
  display: flex;
  flex-direction: column;
  gap: 2rem;
}

/* Section Card */
.az-section {
  background: #ffffff;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 2rem 2.25rem;
  box-shadow: var(--shadow-sm);
}

/* Section Header (Ingrédients & Scaler) */
.az-section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 1rem;
  margin-bottom: 1.75rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid var(--border-subtle);
}

.az-section-title {
  font-family: var(--font-display);
  font-size: 1.75rem;
  font-weight: 800;
  color: var(--text-main);
  letter-spacing: -0.01em;
}

/* CuisineAZ Portion Scaler Box: [ - 12 pers. + ] */
.az-portion-scaler {
  display: inline-flex;
  align-items: center;
  border: 1.5px solid var(--border-dark);
  border-radius: var(--radius-md);
  background: #ffffff;
  overflow: hidden;
  box-shadow: var(--shadow-xs);
}

.az-scaler-btn {
  background: none;
  border: none;
  width: 44px;
  height: 44px;
  font-size: 1.35rem;
  font-weight: 800;
  color: var(--text-main);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s ease, color 0.15s ease;
  user-select: none;
}

.az-scaler-btn:hover {
  background: var(--primary-light);
  color: var(--primary);
}

.az-scaler-btn:active {
  background: #fee2e2;
}

.az-scaler-text {
  font-family: var(--font-display);
  font-size: 1.05rem;
  font-weight: 800;
  color: var(--text-main);
  padding: 0 0.85rem;
  min-width: 90px;
  text-align: center;
  white-space: nowrap;
  border-left: 1px solid var(--border-subtle);
  border-right: 1px solid var(--border-subtle);
  line-height: 44px;
}

/* CuisineAZ Ingredients Grid */
.az-ingredients-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
  gap: 1rem;
}

/* Ingredient Card */
.az-ingredient-card {
  position: relative;
  background: #ffffff;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 1rem 0.65rem 0.85rem;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: space-between;
  cursor: pointer;
  user-select: none;
  box-shadow: 0 1px 3px rgba(0,0,0,0.03);
  transition: transform 0.15s ease, border-color 0.15s ease, box-shadow 0.15s ease, opacity 0.15s ease;
  min-height: 140px;
}

.az-ingredient-card:hover {
  transform: translateY(-2px);
  border-color: var(--border-strong);
  box-shadow: var(--shadow-md);
}

.az-card-check-badge {
  position: absolute;
  top: 6px;
  right: 6px;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: transparent;
  color: transparent;
  font-size: 0.75rem;
  font-weight: 900;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s ease;
}

.az-ingredient-card.checked {
  background: var(--accent-green-light);
  border-color: var(--accent-green-border);
  opacity: 0.65;
}

.az-ingredient-card.checked .az-card-check-badge {
  background: var(--accent-green);
  color: #ffffff;
}

.az-ingredient-card.checked .az-ingredient-name {
  text-decoration: line-through;
  color: var(--text-muted);
}

.az-ingredient-icon {
  width: 52px;
  height: 52px;
  border-radius: 50%;
  background: #f8fafc;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 28px;
  margin-bottom: 0.5rem;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.04), inset 0 0 0 1px var(--border-subtle);
  overflow: hidden;
  position: relative;
  flex-shrink: 0;
}

.az-ingredient-icon img.az-ingredient-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  border-radius: 50%;
  transition: transform 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

.az-ingredient-card:hover .az-ingredient-icon {
  background: var(--primary-light);
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.08), inset 0 0 0 1px var(--primary-border);
}

.az-ingredient-card:hover .az-ingredient-icon img.az-ingredient-img {
  transform: scale(1.1);
}

.az-ingredient-icon .az-ingredient-fallback,
.az-ingredient-icon .az-ingredient-emoji {
  line-height: 1;
  user-select: none;
}

.az-ingredient-name {
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--text-secondary);
  line-height: 1.25;
  margin-bottom: 0.35rem;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  min-height: 2.1em;
}

.az-ingredient-qty {
  font-family: var(--font-display);
  font-size: 1.05rem;
  font-weight: 800;
  color: var(--text-main);
  margin-top: auto;
}

/* CuisineAZ Preparation Section */
.az-instructions-list {
  display: flex;
  flex-direction: column;
  gap: 1.75rem;
}

.az-step-card {
  padding-bottom: 1.75rem;
  border-bottom: 1px solid var(--border-subtle);
  cursor: pointer;
  transition: opacity 0.15s ease;
}

.az-step-card:last-child {
  border-bottom: none;
  padding-bottom: 0;
}

.az-step-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 0.65rem;
}

.az-step-title {
  font-family: var(--font-display);
  font-size: 1.15rem;
  font-weight: 800;
  color: var(--text-main);
  letter-spacing: 0.02em;
  text-transform: uppercase;
}

.az-step-check {
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--accent-green);
  background: var(--accent-green-light);
  border: 1px solid var(--accent-green-border);
  padding: 0.2rem 0.55rem;
  border-radius: var(--radius-full);
}

.az-step-text {
  font-size: 1.05rem;
  line-height: 1.75;
  color: var(--text-secondary);
}

.az-step-card.completed {
  opacity: 0.55;
}

.az-step-card.completed .az-step-title {
  color: var(--text-muted);
}

/* ==========================================================================
   MODALS (RECIPE EDITOR & LOGIN)
   ========================================================================== */
.modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 1000;
  background: rgba(15, 23, 42, 0.6);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.25rem;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease;
}

.modal-overlay.active {
  opacity: 1;
  pointer-events: auto;
}

.modal-card {
  background: #ffffff;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  width: 100%;
  max-width: 820px;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  transform: translateY(12px) scale(0.99);
  transition: transform 0.2s ease;
  overflow: hidden;
}

.modal-overlay.active .modal-card {
  transform: translateY(0) scale(1);
}

.modal-header {
  padding: 1.25rem 1.75rem;
  background: #ffffff;
  border-bottom: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.modal-title {
  font-family: var(--font-display);
  font-size: 1.35rem;
  font-weight: 800;
  color: var(--text-main);
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.modal-close {
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 1.35rem;
  cursor: pointer;
  padding: 0.2rem 0.5rem;
  border-radius: var(--radius-sm);
  transition: var(--trans-quick);
}

.modal-close:hover {
  color: var(--text-main);
  background: #f1f5f9;
}

.modal-body {
  padding: 1.75rem;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

.modal-footer {
  padding: 1.25rem 1.75rem;
  background: #f8fafc;
  border-top: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

/* Forms */
.form-group {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.form-label {
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--text-secondary);
}

.form-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 1rem;
}

.form-control {
  width: 100%;
  padding: 0.65rem 0.85rem;
  border-radius: var(--radius-md);
  background: #ffffff;
  border: 1.5px solid var(--border-subtle);
  color: var(--text-main);
  font-family: var(--font-sans);
  font-size: 0.95rem;
  transition: var(--trans-quick);
}

.form-control:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(234, 88, 12, 0.12);
}

/* Dynamic Editor Rows */
.editor-list-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.65rem;
}

.editor-row {
  display: grid;
  grid-template-columns: 90px 110px 1fr 40px;
  gap: 0.5rem;
  align-items: center;
  margin-bottom: 0.5rem;
}

.editor-step-row {
  display: grid;
  grid-template-columns: 40px 1fr 40px;
  gap: 0.5rem;
  align-items: flex-start;
  margin-bottom: 0.65rem;
}

.btn-remove-row {
  background: #fff1f2;
  border: 1px solid #fecdd3;
  color: var(--accent-rose);
  border-radius: var(--radius-sm);
  height: 38px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: var(--trans-quick);
}

.btn-remove-row:hover {
  background: var(--accent-rose);
  color: white;
}

/* Toast Notifications */
.toast-container {
  position: fixed;
  bottom: 2rem;
  right: 2rem;
  z-index: 2000;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  pointer-events: none;
}

.toast {
  pointer-events: auto;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.85rem 1.25rem;
  border-radius: var(--radius-md);
  background: #ffffff;
  border: 1px solid var(--border-subtle);
  color: var(--text-main);
  box-shadow: var(--shadow-lg);
  font-size: 0.92rem;
  font-weight: 600;
  animation: slideUp 0.25s ease forwards;
  max-width: 420px;
}

.toast.toast-success {
  border-left: 4px solid var(--accent-green);
}

.toast.toast-error {
  border-left: 4px solid var(--accent-rose);
}

.toast.toast-info {
  border-left: 4px solid var(--primary);
}

/* Animations */
@keyframes fadeIn {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes slideUp {
  from { opacity: 0; transform: translateY(14px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ==========================================================================
   RESPONSIVE DESIGN (MOBILE ADAPTATION)
   ========================================================================== */
@media (max-width: 768px) {
  .navbar {
    flex-wrap: wrap;
    padding: 0.65rem 1rem;
    gap: 0.65rem;
  }

  .brand {
    order: 1;
  }

  .nav-actions {
    order: 2;
    margin-left: auto;
  }

  .nav-search {
    order: 3;
    max-width: 100%;
    width: 100%;
  }

  .main-content {
    padding: 1.25rem 1rem 3rem;
  }

  .hero {
    padding: 1.25rem 0.5rem 1.75rem;
  }

  .hero-title {
    font-size: 1.85rem;
  }

  .filter-bar {
    margin: 1rem 0 1.5rem;
  }

  .recipe-grid {
    grid-template-columns: 1fr;
    gap: 1.25rem;
  }

  .recipe-hero {
    padding: 1.35rem 1.15rem;
  }

  .recipe-hero-title {
    font-size: 1.75rem;
  }

  .recipe-hero-stats {
    grid-template-columns: repeat(2, 1fr);
    gap: 0.75rem;
  }

  /* Section and Scaler on Mobile */
  .az-section {
    padding: 1.35rem 1.15rem;
  }

  .az-section-header {
    margin-bottom: 1.25rem;
  }

  .az-section-title {
    font-size: 1.5rem;
  }

  .az-portion-scaler {
    width: 100%;
    justify-content: space-between;
    margin-top: 0.5rem;
  }

  .az-scaler-text {
    flex: 1;
  }

  /* CuisineAZ 2-column ingredients grid on mobile */
  .az-ingredients-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 0.75rem;
  }

  .az-ingredient-card {
    padding: 0.85rem 0.5rem 0.75rem;
    min-height: 130px;
  }

  .az-ingredient-icon {
    width: 46px;
    height: 46px;
    font-size: 24px;
  }

  .az-ingredient-name {
    font-size: 0.8rem;
  }

  .az-ingredient-qty {
    font-size: 0.95rem;
  }

  .az-step-text {
    font-size: 1rem;
    line-height: 1.65;
  }

  /* Editor dynamic table on mobile */
  .editor-row {
    grid-template-columns: 1fr 1fr;
  }

  .editor-row input:nth-child(3) {
    grid-column: 1 / -1;
  }

  .editor-row .btn-remove-row {
    grid-column: 1 / -1;
    width: 100%;
  }

  .toast-container {
    left: 1rem;
    right: 1rem;
    bottom: 1rem;
  }
}

/* ==========================================================================
   PRINT MODE
   ========================================================================== */
@media print {
  body {
    background: #ffffff !important;
    color: #000000 !important;
  }
  .navbar, .hero, .filter-bar, .back-link, .modal-overlay, .toast-container, .card-actions, .az-portion-scaler, .btn {
    display: none !important;
  }
  .recipe-hero, .az-section {
    background: none !important;
    border: none !important;
    box-shadow: none !important;
    padding: 0 !important;
    color: #000000 !important;
  }
  .recipe-hero-title, .az-section-title, .az-step-title {
    color: #000000 !important;
  }
  .stat-item {
    background: none !important;
    border: 1px solid #ddd !important;
  }
  .az-ingredients-grid {
    grid-template-columns: repeat(4, 1fr) !important;
  }
  .az-ingredient-card {
    box-shadow: none !important;
    border: 1px solid #ccc !important;
  }
}
