/* 
 * FridgeChef Design System & Stylesheet
 */

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

:root {
  /* Color Palette - Warm & Appetizing */
  --primary: #d35400;      /* Warm Terracotta */
  --primary-hover: #e67e22;/* Darker Amber Orange */
  --primary-light: #fdf2e9;
  --secondary: #27ae60;    /* Sage Green (You Have / Success) */
  --secondary-hover: #2ecc71;
  --secondary-light: #ebf5fb;
  --accent: #f1c40f;       /* Honey Yellow */
  --danger: #e74c3c;       /* Red for "You Need" / Missing */
  --danger-light: #fadbd8;
  
  /* Interface Colors */
  --bg-creamy: #fdfcf9;    /* Creamy Warm White background */
  --bg-card: #ffffff;
  --bg-sidebar: #faf6f0;
  --text-main: #2c3e50;    /* Dark Charcoal */
  --text-muted: #7f8c8d;
  --border: #ebdcc9;       /* Soft crust border */
  --border-light: #f8efe6;
  --glass-bg: rgba(255, 255, 255, 0.85);
  --glass-border: rgba(255, 255, 255, 0.6);
  
  /* Shadows & Radius */
  --shadow-sm: 0 4px 12px rgba(211, 84, 0, 0.04);
  --shadow-md: 0 10px 30px rgba(211, 84, 0, 0.06);
  --shadow-lg: 0 20px 40px rgba(211, 84, 0, 0.12);
  --radius-sm: 8px;
  --radius-md: 16px;
  --radius-lg: 24px;
  --radius-full: 9999px;
  
  /* Fonts & Animations */
  --font-heading: 'Outfit', sans-serif;
  --font-body: 'Plus Jakarta Sans', sans-serif;
  --transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
}

/* Dark Mode Color Variables */
body.dark-mode {
  --bg-creamy: #14110e;
  --bg-card: #1d1915;
  --bg-sidebar: #221d19;
  --text-main: #f5eae0;
  --text-muted: #a39587;
  --border: #383028;
  --border-light: #2e2720;
  --primary-light: #2b170c;
  --secondary-light: #11261a;
  --danger-light: #2e1515;
  --glass-bg: rgba(29, 25, 21, 0.85);
  --glass-border: rgba(29, 25, 21, 0.6);
  --shadow-md: 0 10px 30px rgba(0, 0, 0, 0.3);
  --shadow-lg: 0 20px 45px rgba(0, 0, 0, 0.5);
}

/* --- Base Styles --- */
* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  scroll-behavior: smooth;
}

body {
  font-family: var(--font-body);
  background-color: var(--bg-creamy);
  color: var(--text-main);
  line-height: 1.6;
  transition: background-color 0.3s ease, color 0.3s ease;
  overflow-x: hidden;
}

h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-heading);
  font-weight: 700;
  color: var(--text-main);
  line-height: 1.25;
}

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

button, input, select, textarea {
  font-family: inherit;
  outline: none;
}

/* --- Header / Navigation --- */
header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: 80px;
  background-color: var(--glass-bg);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border-light);
  z-index: 100;
  transition: var(--transition);
}

.nav-container {
  max-width: 1400px;
  margin: 0 auto;
  height: 100%;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0 24px;
}

.logo {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 24px;
  font-weight: 800;
  font-family: var(--font-heading);
  color: var(--primary);
}

.logo svg {
  fill: currentColor;
  width: 32px;
  height: 32px;
}

.nav-links {
  display: flex;
  gap: 32px;
  list-style: none;
}

.nav-links a {
  font-weight: 600;
  font-size: 15px;
  color: var(--text-main);
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  transition: var(--transition);
}

.nav-links a:hover, .nav-links a.active {
  color: var(--primary);
  background-color: var(--primary-light);
}

.nav-actions {
  display: flex;
  align-items: center;
  gap: 16px;
}

.icon-btn {
  background: none;
  border: 1px solid var(--border);
  color: var(--text-main);
  width: 44px;
  height: 44px;
  border-radius: var(--radius-md);
  display: flex;
  justify-content: center;
  align-items: center;
  cursor: pointer;
  position: relative;
  transition: var(--transition);
}

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

.icon-btn .badge {
  position: absolute;
  top: -4px;
  right: -4px;
  background-color: var(--primary);
  color: white;
  font-size: 11px;
  font-weight: 700;
  border-radius: 50%;
  width: 18px;
  height: 18px;
  display: flex;
  justify-content: center;
  align-items: center;
}

/* --- Hero Section --- */
.hero {
  padding: 160px 24px 80px 24px;
  background: radial-gradient(circle at 90% 10%, rgba(211, 84, 0, 0.04) 0%, transparent 50%),
              radial-gradient(circle at 10% 90%, rgba(39, 174, 96, 0.03) 0%, transparent 50%);
  text-align: center;
  min-height: 80vh;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  max-width: 900px;
  margin: 0 auto;
}

.hero-tag {
  background-color: var(--primary-light);
  color: var(--primary);
  padding: 8px 18px;
  border-radius: var(--radius-full);
  font-size: 14px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1px;
  margin-bottom: 24px;
  display: inline-block;
}

.hero h1 {
  font-size: clamp(36px, 6vw, 64px);
  line-height: 1.15;
  margin-bottom: 16px;
  background: linear-gradient(135deg, var(--text-main) 30%, var(--primary));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.hero p.hero-desc {
  font-size: clamp(16px, 2.5vw, 20px);
  color: var(--text-muted);
  max-width: 600px;
  margin-bottom: 36px;
}

.btn-primary {
  background-color: var(--primary);
  color: white;
  border: none;
  font-weight: 700;
  font-size: 16px;
  padding: 16px 36px;
  border-radius: var(--radius-full);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  box-shadow: 0 10px 25px rgba(211, 84, 0, 0.25);
  transition: var(--transition);
}

.btn-primary:hover {
  background-color: var(--primary-hover);
  transform: translateY(-3px);
  box-shadow: 0 15px 30px rgba(211, 84, 0, 0.35);
}

.btn-secondary {
  background-color: transparent;
  border: 2px solid var(--border);
  color: var(--text-main);
  font-weight: 700;
  font-size: 16px;
  padding: 14px 32px;
  border-radius: var(--radius-full);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  transition: var(--transition);
}

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

/* --- App Section / Workspace --- */
.app-workspace {
  max-width: 1400px;
  margin: 0 auto;
  padding: 40px 24px;
}

.workspace-grid {
  display: grid;
  grid-template-columns: 430px 1fr;
  gap: 40px;
  align-items: start;
}

/* --- Panel Layouts --- */
.panel {
  background-color: var(--bg-card);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-lg);
  padding: 32px;
  box-shadow: var(--shadow-md);
  margin-bottom: 32px;
  transition: var(--transition);
}

.panel:hover {
  box-shadow: var(--shadow-lg);
}

.panel-title {
  font-size: 20px;
  font-weight: 700;
  margin-bottom: 20px;
  display: flex;
  align-items: center;
  gap: 10px;
  border-bottom: 2px solid var(--border-light);
  padding-bottom: 12px;
}

.panel-title svg {
  color: var(--primary);
}

/* --- Sentence Parser Component --- */
.sentence-parser-box {
  background-color: var(--primary-light);
  border-radius: var(--radius-md);
  padding: 20px;
  margin-bottom: 24px;
  border: 1px dashed var(--primary);
}

.sentence-parser-box label {
  display: block;
  font-weight: 700;
  font-size: 14px;
  color: var(--primary);
  margin-bottom: 8px;
}

.sentence-parser-box textarea {
  width: 100%;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 12px;
  font-size: 14px;
  resize: none;
  height: 75px;
  background-color: var(--bg-card);
  color: var(--text-main);
  transition: var(--transition);
}

.sentence-parser-box textarea:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(211, 84, 0, 0.1);
}

.sentence-parser-box button {
  margin-top: 10px;
  width: 100%;
  font-size: 13px;
  padding: 10px;
}

/* --- Tag Input Component --- */
.tag-input-wrapper {
  position: relative;
  margin-bottom: 20px;
}

.input-container {
  display: flex;
  gap: 8px;
}

.text-input {
  flex: 1;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 14px 18px;
  font-size: 15px;
  background-color: var(--bg-card);
  color: var(--text-main);
  transition: var(--transition);
}

.text-input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(211, 84, 0, 0.15);
}

.autocomplete-dropdown {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  background-color: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
  z-index: 10;
  max-height: 200px;
  overflow-y: auto;
  margin-top: 6px;
  display: none;
}

.autocomplete-item {
  padding: 12px 18px;
  cursor: pointer;
  font-weight: 500;
  font-size: 14px;
  transition: var(--transition);
}

.autocomplete-item:hover {
  background-color: var(--primary-light);
  color: var(--primary);
}

/* --- Ingredient Chips (Tags) --- */
.tags-cloud-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
}

.tags-cloud-header span {
  font-weight: 700;
  font-size: 14px;
}

.clear-btn {
  background: none;
  border: none;
  color: var(--primary);
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  padding: 4px 8px;
  border-radius: var(--radius-sm);
}

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

.tags-cloud {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  min-height: 60px;
  border: 1px solid var(--border-light);
  background-color: var(--bg-sidebar);
  padding: 14px;
  border-radius: var(--radius-md);
  margin-bottom: 24px;
}

.tags-cloud:empty::after {
  content: "No ingredients added yet. Type manually or tap suggestions below.";
  color: var(--text-muted);
  font-size: 13px;
  margin: auto;
  text-align: center;
  font-style: italic;
}

.tag-chip {
  background-color: var(--primary-light);
  color: var(--primary);
  border: 1px solid rgba(211, 84, 0, 0.15);
  border-radius: var(--radius-full);
  padding: 6px 14px;
  font-size: 13px;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 6px;
  animation: tagScaleIn 0.25s cubic-bezier(0.175, 0.885, 0.32, 1.275) forwards;
}

.tag-chip button {
  background: none;
  border: none;
  color: var(--primary);
  cursor: pointer;
  font-size: 16px;
  display: inline-flex;
  justify-content: center;
  align-items: center;
  padding: 0;
  border-radius: 50%;
  width: 16px;
  height: 16px;
  transition: var(--transition);
}

.tag-chip button:hover {
  background-color: var(--primary);
  color: white;
}

@keyframes tagScaleIn {
  0% { transform: scale(0.6); opacity: 0; }
  100% { transform: scale(1); opacity: 1; }
}

/* --- Ingredient Categories Accordion --- */
.category-accordion {
  border: 1px solid var(--border-light);
  border-radius: var(--radius-md);
  overflow: hidden;
  margin-bottom: 24px;
}

.category-row {
  border-bottom: 1px solid var(--border-light);
}

.category-row:last-child {
  border-bottom: none;
}

.category-header {
  width: 100%;
  background: none;
  border: none;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 20px;
  font-weight: 700;
  font-size: 14px;
  color: var(--text-main);
  cursor: pointer;
  text-align: left;
  transition: var(--transition);
}

.category-header:hover {
  background-color: var(--bg-sidebar);
}

.category-header .arrow {
  transition: var(--transition);
}

.category-header.active {
  background-color: var(--primary-light);
  color: var(--primary);
}

.category-header.active .arrow {
  transform: rotate(180deg);
}

.category-body {
  padding: 0;
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.3s cubic-bezier(0, 1, 0, 1);
  background-color: var(--bg-card);
}

.category-body.expanded {
  max-height: 1000px;
  padding: 16px 20px;
  transition: max-height 0.4s cubic-bezier(1, 0, 1, 0);
  border-top: 1px solid var(--border-light);
}

.category-items-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 8px;
}

.category-item-btn {
  background-color: var(--bg-sidebar);
  border: 1px solid var(--border-light);
  padding: 8px 12px;
  font-size: 13px;
  font-weight: 500;
  border-radius: var(--radius-sm);
  cursor: pointer;
  text-align: left;
  display: flex;
  align-items: center;
  gap: 6px;
  transition: var(--transition);
  color: var(--text-main);
}

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

.category-item-btn.selected {
  background-color: var(--primary);
  border-color: var(--primary);
  color: white;
}

/* --- Fridge Score & Summary --- */
.fridge-score-box {
  background-color: var(--bg-sidebar);
  border-radius: var(--radius-md);
  padding: 20px;
  text-align: center;
  border: 1px solid var(--border-light);
}

.score-container {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 20px;
  margin-top: 10px;
}

.score-circle {
  width: 80px;
  height: 80px;
  border-radius: 50%;
  border: 8px solid var(--border-light);
  display: flex;
  justify-content: center;
  align-items: center;
  font-size: 20px;
  font-weight: 800;
  color: var(--primary);
  position: relative;
}

.score-text {
  text-align: left;
}

.score-title {
  font-size: 15px;
  font-weight: 700;
  color: var(--text-main);
}

.score-comment {
  font-size: 12px;
  color: var(--text-muted);
}

/* --- Preferences Panel --- */
.filter-group {
  margin-bottom: 20px;
}

.filter-group label {
  display: block;
  font-weight: 700;
  font-size: 14px;
  margin-bottom: 8px;
}

.custom-select {
  width: 100%;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 12px 16px;
  font-size: 14px;
  background-color: var(--bg-card);
  color: var(--text-main);
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%232c3e50' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 16px center;
  background-size: 16px;
  cursor: pointer;
  transition: var(--transition);
}

.custom-select:focus {
  border-color: var(--primary);
}

.serving-selector {
  display: flex;
  align-items: center;
  gap: 8px;
}

.serving-btn {
  background-color: var(--bg-sidebar);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  width: 38px;
  height: 38px;
  display: flex;
  justify-content: center;
  align-items: center;
  cursor: pointer;
  font-weight: 700;
  font-size: 16px;
  transition: var(--transition);
  color: var(--text-main);
}

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

.serving-val {
  font-weight: 700;
  font-size: 16px;
  width: 30px;
  text-align: center;
}

.dietary-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.dietary-chip-checkbox {
  display: none;
}

.dietary-chip-label {
  background-color: var(--bg-sidebar);
  border: 1px solid var(--border);
  border-radius: var(--radius-full);
  padding: 8px 16px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition);
}

.dietary-chip-checkbox:checked + .dietary-chip-label {
  background-color: var(--primary-light);
  border-color: var(--primary);
  color: var(--primary);
}

/* --- Match Modes (Smart Features) --- */
.mode-switches {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  margin-bottom: 24px;
}

.mode-checkbox {
  display: none;
}

.mode-label {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  justify-content: center;
  background-color: var(--bg-sidebar);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 12px 8px;
  cursor: pointer;
  transition: var(--transition);
}

.mode-label svg {
  margin-bottom: 6px;
  color: var(--text-muted);
}

.mode-label span.mode-name {
  font-size: 11px;
  font-weight: 700;
}

.mode-checkbox:checked + .mode-label {
  background-color: var(--primary-light);
  border-color: var(--primary);
  color: var(--primary);
}

.mode-checkbox:checked + .mode-label svg {
  color: var(--primary);
}

/* --- Search Bar --- */
.search-container {
  margin-bottom: 30px;
}

.search-wrapper {
  position: relative;
  display: flex;
  gap: 12px;
}

.search-input-field {
  width: 100%;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 16px 20px;
  font-size: 16px;
  background-color: var(--bg-card);
  color: var(--text-main);
  box-shadow: var(--shadow-sm);
  transition: var(--transition);
}

.search-input-field:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(211, 84, 0, 0.1);
}

/* --- Recipe Grid (Feed) --- */
.recipe-section-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
}

.recipe-section-title {
  font-size: 22px;
  font-weight: 800;
}

.results-count {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-muted);
}

.recipe-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 24px;
}

/* --- Recipe Card --- */
.recipe-card {
  background-color: var(--bg-card);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: var(--shadow-md);
  display: flex;
  flex-direction: column;
  position: relative;
  transition: var(--transition);
}

.recipe-card:hover {
  transform: translateY(-6px);
  box-shadow: var(--shadow-lg);
  border-color: rgba(211, 84, 0, 0.2);
}

.recipe-img-container {
  height: 200px;
  position: relative;
  overflow: hidden;
  background-color: var(--bg-sidebar);
}

.recipe-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.5s ease;
}

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

/* Badges */
.match-badge {
  position: absolute;
  top: 16px;
  left: 16px;
  padding: 6px 12px;
  border-radius: var(--radius-full);
  font-size: 12px;
  font-weight: 800;
  display: flex;
  align-items: center;
  gap: 6px;
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.15);
  color: white;
}

.match-badge.high {
  background-color: var(--secondary);
}

.match-badge.medium {
  background-color: var(--accent);
  color: #1a1a1a;
}

.match-badge.low {
  background-color: var(--text-muted);
}

.fav-card-btn {
  position: absolute;
  top: 16px;
  right: 16px;
  background-color: rgba(255, 255, 255, 0.85);
  border: none;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  display: flex;
  justify-content: center;
  align-items: center;
  cursor: pointer;
  color: var(--text-main);
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.1);
  transition: var(--transition);
}

.fav-card-btn:hover {
  background-color: white;
  transform: scale(1.1);
}

.fav-card-btn.active {
  color: #e74c3c;
}

.recipe-card-content {
  padding: 24px;
  display: flex;
  flex-direction: column;
  flex: 1;
}

.recipe-card-type {
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
  color: var(--primary);
  letter-spacing: 0.5px;
  margin-bottom: 6px;
}

.recipe-card-name {
  font-size: 18px;
  font-weight: 700;
  margin-bottom: 8px;
  line-height: 1.3;
}

.recipe-card-desc {
  font-size: 13px;
  color: var(--text-muted);
  margin-bottom: 16px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  height: 40px;
}

.recipe-meta-row {
  display: flex;
  gap: 16px;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-muted);
  margin-bottom: 20px;
  border-bottom: 1px solid var(--border-light);
  padding-bottom: 12px;
}

.recipe-meta-item {
  display: flex;
  align-items: center;
  gap: 4px;
}

/* Card Ingredients List */
.card-ingredients-box {
  margin-bottom: 16px;
  flex: 1;
}

.card-ing-title {
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-bottom: 8px;
}

.card-ing-list {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}

.card-ing-chip {
  font-size: 10px;
  font-weight: 700;
  padding: 4px 8px;
  border-radius: var(--radius-sm);
}

.card-ing-chip.have {
  background-color: var(--secondary-light);
  color: var(--secondary);
}

.card-ing-chip.need {
  background-color: var(--danger-light);
  color: var(--danger);
}

/* Card Why Explanation */
.card-why-bubble {
  background-color: var(--primary-light);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  font-size: 12px;
  font-weight: 600;
  color: var(--primary);
  margin-bottom: 20px;
  border-left: 3px solid var(--primary);
}

.view-recipe-btn {
  width: 100%;
  border: none;
  background-color: var(--primary-light);
  color: var(--primary);
  font-weight: 700;
  font-size: 14px;
  padding: 12px;
  border-radius: var(--radius-md);
  cursor: pointer;
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 8px;
  transition: var(--transition);
}

.view-recipe-btn:hover {
  background-color: var(--primary);
  color: white;
  transform: translateY(-2px);
}

/* --- Empty / Loading States --- */
.empty-state {
  text-align: center;
  padding: 60px 24px;
  background-color: var(--bg-card);
  border-radius: var(--radius-lg);
  border: 1px dashed var(--border);
  box-shadow: var(--shadow-sm);
}

.empty-state svg {
  color: var(--border);
  margin-bottom: 16px;
}

.empty-state h3 {
  font-size: 18px;
  margin-bottom: 8px;
}

.empty-state p {
  color: var(--text-muted);
  font-size: 14px;
  max-width: 400px;
  margin: 0 auto;
}

/* Skeleton Loading Animation */
.skeleton-card {
  height: 420px;
  background-color: var(--bg-card);
  border-radius: var(--radius-lg);
  border: 1px solid var(--border-light);
  overflow: hidden;
  padding: 24px;
  display: flex;
  flex-direction: column;
}

.skeleton-thumb {
  height: 180px;
  background: linear-gradient(90deg, var(--border-light) 25%, var(--bg-sidebar) 50%, var(--border-light) 75%);
  background-size: 200% 100%;
  animation: pulseBg 1.5s infinite;
  border-radius: var(--radius-md);
  margin-bottom: 20px;
}

.skeleton-line {
  background: linear-gradient(90deg, var(--border-light) 25%, var(--bg-sidebar) 50%, var(--border-light) 75%);
  background-size: 200% 100%;
  animation: pulseBg 1.5s infinite;
  border-radius: 4px;
  margin-bottom: 12px;
}

.skeleton-line.h { height: 20px; width: 70%; }
.skeleton-line.p { height: 12px; width: 90%; }
.skeleton-line.p.short { width: 50%; }

@keyframes pulseBg {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

/* --- Modals / Recipe Details --- */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(8px);
  z-index: 1000;
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 24px;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.3s ease, visibility 0.3s ease;
}

.modal-overlay.open {
  opacity: 1;
  visibility: visible;
}

.modal-content {
  background-color: var(--bg-card);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  width: 100%;
  max-width: 960px;
  max-height: 90vh;
  overflow-y: auto;
  border: 1px solid var(--border);
  position: relative;
  transform: scale(0.9);
  transition: transform 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.modal-overlay.open .modal-content {
  transform: scale(1);
}

.close-modal-btn {
  position: absolute;
  top: 20px;
  right: 20px;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: none;
  background-color: rgba(0, 0, 0, 0.5);
  color: white;
  display: flex;
  justify-content: center;
  align-items: center;
  cursor: pointer;
  z-index: 1010;
  transition: var(--transition);
}

.close-modal-btn:hover {
  background-color: var(--primary);
  transform: rotate(90deg);
}

.recipe-header-banner {
  height: 300px;
  position: relative;
}

.recipe-banner-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.recipe-banner-overlay {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: linear-gradient(to top, rgba(0,0,0,0.85) 0%, rgba(0,0,0,0.2) 60%, transparent 100%);
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  padding: 32px;
  color: white;
}

.recipe-banner-overlay h2 {
  font-size: clamp(24px, 4vw, 36px);
  color: white;
  margin-bottom: 8px;
}

.recipe-banner-overlay p {
  font-size: 15px;
  color: rgba(255, 255, 255, 0.9);
  max-width: 700px;
}

.recipe-detail-body {
  padding: 32px;
}

.recipe-details-grid {
  display: grid;
  grid-template-columns: 1fr 1.3fr;
  gap: 40px;
}

.detail-section-title {
  font-size: 18px;
  font-weight: 700;
  margin-bottom: 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

/* Servings adjuster inside details */
.detail-servings-box {
  display: flex;
  align-items: center;
  gap: 12px;
  background-color: var(--bg-sidebar);
  padding: 8px 16px;
  border-radius: var(--radius-full);
}

.detail-servings-box span {
  font-size: 13px;
  font-weight: 700;
}

/* Ingredients Checklist */
.checklist-item {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  margin-bottom: 14px;
  border-bottom: 1px solid var(--border-light);
  padding-bottom: 12px;
}

.checklist-item:last-child {
  border-bottom: none;
}

.checklist-checkbox {
  margin-top: 4px;
  width: 18px;
  height: 18px;
  accent-color: var(--secondary);
  cursor: pointer;
}

.checklist-label {
  flex: 1;
  font-size: 14px;
  font-weight: 600;
}

.checklist-item.have .checklist-label {
  color: var(--secondary);
}

.checklist-item.need .checklist-label {
  color: var(--text-main);
  text-decoration: line-through;
  opacity: 0.6;
}

.checklist-item.need-active .checklist-label {
  color: var(--text-main);
}

.add-shop-btn {
  background: none;
  border: none;
  color: var(--primary);
  cursor: pointer;
  padding: 2px;
  display: flex;
  align-items: center;
  transition: var(--transition);
}

.add-shop-btn:hover {
  transform: scale(1.2);
}

/* Steps List */
.step-item {
  display: flex;
  gap: 16px;
  margin-bottom: 20px;
}

.step-num {
  background-color: var(--primary-light);
  color: var(--primary);
  width: 28px;
  height: 28px;
  border-radius: 50%;
  font-weight: 800;
  font-size: 14px;
  display: flex;
  justify-content: center;
  align-items: center;
  flex-shrink: 0;
}

.step-text {
  font-size: 14px;
  font-weight: 500;
  line-height: 1.6;
}

.step-item.completed .step-num {
  background-color: var(--secondary);
  color: white;
}

.step-item.completed .step-text {
  opacity: 0.6;
  text-decoration: line-through;
}

/* Cooking Tips */
.tips-container {
  background-color: var(--primary-light);
  border-radius: var(--radius-md);
  padding: 20px;
  border-left: 4px solid var(--accent);
}

.tips-title {
  font-weight: 800;
  font-size: 14px;
  color: var(--primary);
  margin-bottom: 8px;
  display: flex;
  align-items: center;
  gap: 6px;
}

.tips-list {
  list-style: none;
  font-size: 13px;
  font-weight: 500;
}

.tips-list li {
  margin-bottom: 6px;
  position: relative;
  padding-left: 14px;
}

.tips-list li::before {
  content: "•";
  color: var(--accent);
  position: absolute;
  left: 0;
  font-weight: bold;
}

/* Modal Actions */
.modal-actions-row {
  margin-top: 30px;
  padding-top: 24px;
  border-top: 1px solid var(--border);
  display: flex;
  justify-content: space-between;
  gap: 16px;
}

/* Cooking Mode Panel Overlay */
.cooking-mode-overlay {
  display: none;
  padding: 32px;
  background-color: var(--bg-card);
  min-height: 350px;
  flex-direction: column;
  justify-content: center;
  text-align: center;
}

.cooking-mode-overlay.active {
  display: flex;
}

.cooking-step-card {
  max-width: 600px;
  margin: 0 auto;
}

.cooking-step-title {
  font-size: 13px;
  font-weight: 800;
  text-transform: uppercase;
  color: var(--primary);
  margin-bottom: 12px;
}

.cooking-step-body {
  font-size: clamp(18px, 3.5vw, 24px);
  font-weight: 700;
  line-height: 1.4;
  margin-bottom: 30px;
}

.cooking-progress-bar {
  height: 8px;
  background-color: var(--border-light);
  border-radius: var(--radius-full);
  margin-bottom: 30px;
  overflow: hidden;
  position: relative;
}

.cooking-progress-fill {
  height: 100%;
  background-color: var(--secondary);
  width: 0%;
  transition: width 0.3s ease;
}

.cooking-nav-btns {
  display: flex;
  justify-content: center;
  gap: 16px;
}

/* --- Drawers (Sidebars) --- */
.drawer {
  position: fixed;
  top: 0;
  right: -420px;
  width: 400px;
  height: 100vh;
  background-color: var(--bg-card);
  box-shadow: var(--shadow-lg);
  border-left: 1px solid var(--border);
  z-index: 1050;
  display: flex;
  flex-direction: column;
  transition: right 0.4s cubic-bezier(0.25, 0.8, 0.25, 1);
}

.drawer.open {
  right: 0;
}

.drawer-backdrop {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: rgba(0, 0, 0, 0.4);
  z-index: 1040;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.3s ease, visibility 0.3s ease;
}

.drawer-backdrop.open {
  opacity: 1;
  visibility: visible;
}

.drawer-header {
  height: 80px;
  padding: 0 24px;
  border-bottom: 1px solid var(--border);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.drawer-title {
  font-size: 18px;
  font-weight: 800;
  display: flex;
  align-items: center;
  gap: 8px;
}

.close-drawer-btn {
  background: none;
  border: none;
  cursor: pointer;
  color: var(--text-main);
  transition: var(--transition);
}

.close-drawer-btn:hover {
  color: var(--primary);
  transform: scale(1.1);
}

.drawer-body {
  flex: 1;
  overflow-y: auto;
  padding: 24px;
}

.drawer-footer {
  padding: 20px 24px;
  border-top: 1px solid var(--border);
}

/* Saved Recipe List Item */
.saved-recipe-item {
  display: flex;
  gap: 16px;
  margin-bottom: 16px;
  background-color: var(--bg-sidebar);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-md);
  padding: 12px;
  align-items: center;
  transition: var(--transition);
}

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

.saved-recipe-img {
  width: 60px;
  height: 60px;
  object-fit: cover;
  border-radius: var(--radius-sm);
}

.saved-recipe-details {
  flex: 1;
}

.saved-recipe-name {
  font-size: 14px;
  font-weight: 700;
  margin-bottom: 4px;
  cursor: pointer;
}

.saved-recipe-name:hover {
  color: var(--primary);
}

.saved-recipe-meta {
  font-size: 11px;
  color: var(--text-muted);
}

.remove-saved-btn {
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  transition: var(--transition);
}

.remove-saved-btn:hover {
  color: var(--danger);
}

/* Shopping List Drawer items */
.shop-item {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 12px;
  background-color: var(--bg-sidebar);
  padding: 12px 16px;
  border-radius: var(--radius-sm);
  border-left: 4px solid var(--primary);
}

.shop-item-checkbox {
  width: 16px;
  height: 16px;
  accent-color: var(--primary);
}

.shop-item-name {
  flex: 1;
  font-size: 14px;
  font-weight: 600;
}

.shop-item-checkbox:checked + .shop-item-name {
  text-decoration: line-through;
  opacity: 0.6;
}

.remove-shop-item {
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
}

.remove-shop-item:hover {
  color: var(--danger);
}

/* --- API Key Settings Panel --- */
.settings-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: rgba(0, 0, 0, 0.4);
  z-index: 1200;
  display: flex;
  justify-content: center;
  align-items: center;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.3s ease, visibility 0.3s ease;
}

.settings-overlay.open {
  opacity: 1;
  visibility: visible;
}

.settings-modal {
  background-color: var(--bg-card);
  border-radius: var(--radius-lg);
  padding: 32px;
  width: 450px;
  box-shadow: var(--shadow-lg);
  border: 1px solid var(--border);
  position: relative;
}

.api-instructions {
  background-color: var(--primary-light);
  border-radius: var(--radius-md);
  padding: 16px;
  font-size: 12px;
  color: var(--primary);
  margin-bottom: 20px;
  line-height: 1.5;
}

.settings-input-group {
  margin-bottom: 20px;
}

.settings-input-group label {
  display: block;
  font-weight: 700;
  font-size: 14px;
  margin-bottom: 8px;
}

.api-key-input {
  width: 100%;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 12px 16px;
  font-size: 14px;
  background-color: var(--bg-card);
  color: var(--text-main);
}

/* --- Footer --- */
footer {
  background-color: var(--bg-sidebar);
  border-top: 1px solid var(--border-light);
  padding: 40px 24px;
  text-align: center;
  color: var(--text-muted);
  font-size: 14px;
  font-weight: 500;
}

footer p {
  margin-bottom: 8px;
}

/* --- Responsive Media Queries --- */
@media (max-width: 1100px) {
  .workspace-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 768px) {
  .nav-links {
    display: none; /* Hide standard nav on mobile */
  }
  
  .hero {
    padding-top: 120px;
  }
  
  .panel {
    padding: 20px;
  }
  
  .recipe-details-grid {
    grid-template-columns: 1fr;
    gap: 24px;
  }
  
  .drawer {
    width: 100%;
    right: -100%;
  }
  
  .settings-modal {
    width: 90%;
    padding: 24px;
  }
  
  .modal-overlay {
    padding: 0;
  }
  
  .modal-content {
    max-height: 100vh;
    height: 100vh;
    border-radius: 0;
  }
  
  .recipe-header-banner {
    height: 200px;
  }
  
  .recipe-detail-body {
    padding: 20px 16px 80px 16px;
  }
  
  .modal-content {
    -webkit-overflow-scrolling: touch;
  }
}

/* --- Mobile Header, Grid, and Detail Overrides --- */
@media (max-width: 480px) {
  .nav-container {
    padding: 0 12px;
  }
  .nav-actions {
    gap: 8px;
  }
  .icon-btn {
    width: 40px;
    height: 40px;
    border-radius: var(--radius-sm);
  }
  .logo span {
    font-size: 18px;
  }
  .recipe-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 360px) {
  .logo span {
    display: none;
  }
}

/* --- Dark Mode Custom Arrow Override --- */
body.dark-mode .custom-select {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23f5eae0' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
}

/* --- Completed Shopping List Item Styles --- */
.shop-item.completed {
  opacity: 0.6;
  border-left-color: var(--text-muted) !important;
}

.shop-item.completed .shop-item-name {
  text-decoration: line-through;
  color: var(--text-muted);
}

/* --- Toast Notifications System --- */
#toast-container {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 2100;
  display: flex;
  flex-direction: column;
  gap: 10px;
  pointer-events: none;
}

.toast-message {
  background-color: var(--text-main);
  color: var(--bg-card);
  padding: 12px 20px;
  border-radius: var(--radius-md);
  font-weight: 600;
  font-size: 13px;
  box-shadow: var(--shadow-lg);
  opacity: 0;
  transform: translateY(20px);
  transition: opacity 0.3s ease, transform 0.3s ease;
  border: 1px solid var(--border);
  pointer-events: auto;
  max-width: 320px;
}

.toast-message.show {
  opacity: 1;
  transform: translateY(0);
}

/* --- Body Scroll Lock when Overlay is Open --- */
body.modal-open {
  overflow: hidden;
}

