:root {
  /* Colors */
  --primary: #ff8c00;
  --primary-container: #ffd5a3;
  --on-primary: #ffffff;
  
  --secondary: #006e1c;
  --secondary-container: #8cfb99;
  
  --surface: #fff8f3;
  --surface-container-lowest: #ffffff;
  --surface-container-low: #f9ede4;
  --surface-container-high: #ebdcd0;
  --on-surface: #1e1b17;
  
  /* Use DESIGN.md specific error color for missing ingredients */
  --error: #ba1a1a;
  
  /* Typrography */
  --font-display: 'Plus Jakarta Sans', sans-serif;
  --font-body: 'Be Vietnam Pro', sans-serif;
  
  /* Spacing */
  --spacing-6: 2rem;
  --spacing-12: 4rem;
  
  /* Border Radius */
  --roundedness-sm: 0.5rem;
  --roundedness-md: 1rem;
  --roundedness-lg: 2rem;
  --roundedness-full: 9999px;
  
  /* Shadows */
  --ambient-shadow: 0px 8px 32px rgba(30, 27, 23, 0.06);
  --ghost-border: 1px solid rgba(30, 27, 23, 0.15);
}

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

body {
  font-family: var(--font-body);
  background-color: var(--surface);
  color: var(--on-surface);
  min-height: 100vh;
  margin: 0;
  overflow-x: hidden;
}

h1, h2, h3 {
  font-family: var(--font-display);
}

.hidden {
  display: none !important;
}

/* Home Modern Layout (Mobile First Redeisgn) */
.home-modern-layout {
  position: relative;
  min-height: 100vh;
  width: 100vw;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

.home-background {
  position: absolute;
  top: 0; left: 0; right: 0; bottom: 0;
  /* Dark, blurred, atmospheric culinary background */
  background-image: url('https://images.unsplash.com/photo-1490645935967-10de6ba17061?q=80&w=2053&auto=format&fit=crop');
  background-size: cover;
  background-position: center;
  filter: blur(10px) brightness(0.35);
  z-index: 1;
  transform: scale(1.1); /* Hides blurred edges */
}

.home-content-wrapper {
  position: relative;
  z-index: 2;
  width: 100%;
  max-width: 500px;
  padding: 2.5rem;
  display: flex;
  flex-direction: column;
  gap: 3.5rem;
}

.home-header {
  text-align: center;
  color: #ffffff;
}

.home-header h1 {
  font-size: 3rem;
  font-weight: 800;
  margin-bottom: 0.5rem;
  text-shadow: 0 4px 12px rgba(0,0,0,0.5);
  line-height: 1.1;
}

.home-header p {
  font-size: 1.25rem;
  font-family: var(--font-body);
  opacity: 0.9;
  text-shadow: 0 2px 8px rgba(0,0,0,0.4);
}

.home-menu-buttons {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

/* Glassmorphism Buttons */
.glass-btn {
  display: flex;
  align-items: center;
  gap: 1.5rem;
  padding: 1.75rem 1.5rem;
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: var(--roundedness-lg);
  cursor: pointer;
  text-align: left;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  background: rgba(20, 20, 20, 0.45);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  color: #ffffff;
  box-shadow: 0 8px 32px rgba(0,0,0,0.25);
  width: 100%;
}

.glass-btn:hover {
  transform: translateY(-4px);
  background: rgba(30, 30, 30, 0.6);
  box-shadow: 0 16px 40px rgba(0,0,0,0.4);
  border-color: rgba(255, 255, 255, 0.3);
}

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

.secondary-glass {
  border-left: 4px solid var(--secondary);
}

.btn-icon {
  font-size: 2.5rem;
  filter: drop-shadow(0 4px 8px rgba(0,0,0,0.3));
}

.btn-text h2 {
  font-size: 1.5rem;
  margin-bottom: 0.25rem;
  font-weight: 700;
}

.btn-text p {
  font-size: 0.95rem;
  opacity: 0.85;
  font-family: var(--font-body);
  margin: 0;
}

/* Views (Kitchen, Recipes) */
.view {
  min-height: 100vh;
  position: relative;
  animation: fadeIn 0.4s ease-out;
}

.view-background {
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background-size: cover;
  background-position: center;
  filter: blur(12px) brightness(0.25);
  z-index: 1;
  transform: scale(1.1);
}

.kitchen-bg {
  background-image: url('https://images.unsplash.com/photo-1556911220-e15b29be8c8f?q=80&w=2070&auto=format&fit=crop');
}

.recipes-bg {
  background-image: url('https://images.unsplash.com/photo-1546069901-ba9599a7e63c?q=80&w=2080&auto=format&fit=crop');
}

.view-content-layer {
  position: relative;
  z-index: 2;
  padding: var(--spacing-6);
  min-height: 100vh;
}

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

.view-header {
  display: flex;
  align-items: flex-start;
  flex-direction: column;
  margin-bottom: var(--spacing-12);
  max-width: 800px;
  margin: 0 auto var(--spacing-12);
  color: #fff;
}

.header-titles h2 {
  font-size: 3.5rem;
  margin-top: 1rem;
  text-shadow: 0 4px 12px rgba(0,0,0,0.5);
}

.header-titles p.subtitle {
  font-size: 1.25rem;
  color: rgba(255,255,255,0.85);
  font-weight: 500;
  letter-spacing: 0.05em;
  text-shadow: 0 2px 8px rgba(0,0,0,0.4);
}

.btn-icon {
  background: var(--surface-container-high);
  border: none;
  border-radius: var(--roundedness-full);
  padding: 0.75rem 1.5rem;
  cursor: pointer;
  font-family: var(--font-body);
  font-weight: 600;
  color: var(--on-surface);
  transition: transform 0.2s, background-color 0.2s;
}
.btn-icon:hover {
  transform: translateY(-2px);
  background: var(--surface-container-lowest);
  box-shadow: var(--ambient-shadow);
}

.container {
  max-width: 800px;
  margin: 0 auto;
}

/* Forms and Inputs */
#add-ingredient-form {
  display: flex;
  gap: 1rem;
  margin-bottom: var(--spacing-6);
  background: var(--surface-container-lowest);
  padding: 1rem;
  border-radius: var(--roundedness-full);
  box-shadow: var(--ambient-shadow);
}

#ingredient-input {
  flex: 1;
  border: none;
  background: transparent;
  padding: 0.5rem 1.5rem;
  font-size: 1.1rem;
  font-family: var(--font-body);
  color: var(--on-surface);
  outline: none;
}

.btn-primary {
  background: linear-gradient(135deg, var(--primary), var(--primary-container));
  color: var(--on-primary);
  /* The guidelines say padding for hovering, text is inside so color --on-primary (White) */
  color: white; 
  font-weight: 600;
  font-family: var(--font-body);
  font-size: 1rem;
  border: none;
  padding: 0.75rem 2.5rem;
  border-radius: var(--roundedness-full);
  cursor: pointer;
  transition: transform 0.2s, box-shadow 0.2s;
}

.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(255, 140, 0, 0.3);
}

/* List Items (Glassmorphism & Surface Tiers) */
.fridge-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.fridge-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: rgba(255, 255, 255, 0.6);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  padding: 1.25rem 2rem;
  border-radius: var(--roundedness-md);
  box-shadow: var(--ambient-shadow);
  font-size: 1.15rem;
  font-weight: 500;
  transition: transform 0.2s;
}

.fridge-item:hover {
  transform: translateX(4px);
}

.fridge-item span.ing-name {
  color: var(--secondary); /* secondary color for "in my fridge" */
}

.fridge-item .btn-remove {
  background: var(--surface-container-high);
  border: none;
  border-radius: var(--roundedness-full);
  width: 40px;
  height: 40px;
  cursor: pointer;
  color: var(--on-surface);
  font-weight: bold;
  font-family: var(--font-body);
  font-size: 1.2rem;
  transition: background-color 0.2s;
}
.fridge-item .btn-remove:hover {
  background-color: var(--surface-container-low);
}

/* Chips Filter */
.filter-chips {
  display: flex;
  gap: 1rem;
  margin-bottom: var(--spacing-6);
}

.chip {
  padding: 0.75rem 1.5rem;
  border-radius: var(--roundedness-full);
  border: none;
  font-family: var(--font-body);
  font-weight: 600;
  font-size: 1rem;
  cursor: pointer;
  background-color: var(--surface-container-high); /* Highest unselected */
  color: var(--on-surface);
  transition: all 0.2s;
}

.chip.active {
  background-color: var(--primary-container);
  color: var(--on-surface);
}

.chip:hover {
  opacity: 0.9;
}

/* Horizontal Tabs */
.category-tabs-container {
  display: flex;
  gap: 0.75rem;
  overflow-x: auto;
  padding-bottom: 1rem;
  margin-bottom: 2rem;
  scrollbar-width: none;
  -ms-overflow-style: none;
}

.category-tabs-container::-webkit-scrollbar {
  display: none;
}

.tab-btn {
  padding: 0.75rem 1.5rem;
  border-radius: var(--roundedness-full);
  border: 1px solid var(--surface-container-high);
  font-family: var(--font-body);
  font-weight: 600;
  font-size: 1rem;
  cursor: pointer;
  background-color: var(--surface-container-lowest);
  color: var(--on-surface);
  white-space: nowrap;
  box-shadow: 0 2px 8px rgba(0,0,0,0.05);
  transition: all 0.3s ease;
}

.tab-btn.active {
  background-color: var(--secondary);
  color: #fff;
  border-color: var(--secondary);
  box-shadow: 0 4px 12px rgba(0, 110, 28, 0.25);
}

.tab-btn:hover:not(.active) {
  background-color: var(--surface-container-low);
  transform: translateY(-2px);
}

/* Recipe Cards & Grid */
.recipe-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 1rem;
  padding-bottom: var(--spacing-12);
}

.empty-category-msg {
  text-align: center;
  padding: 3rem 1rem;
  font-size: 1.15rem;
  font-family: var(--font-body);
  color: var(--on-surface);
  opacity: 0.6;
  font-style: italic;
  grid-column: 1 / -1;
}

.recipe-card {
  background-color: var(--surface-container-lowest);
  border-radius: var(--roundedness-lg);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  box-shadow: var(--ambient-shadow);
  transition: transform 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.recipe-card:hover {
  transform: translateY(-6px);
}

.recipe-image {
  width: 100%;
  height: 120px; /* Highly compact thumbnail */
  object-fit: cover;
  border-bottom: 3px solid var(--surface-container-low);
}

.recipe-content {
  padding: 1rem; /* Compact padding */
}

.recipe-content h3 {
  font-size: 1.15rem; /* Smaller title */
  margin-bottom: 0.5rem;
  line-height: 1.3;
}

.missing-info {
  margin-bottom: 0.5rem;
  color: var(--primary); /* using primary for missing ingredients per DO's */
  font-weight: 700;
  font-size: 0.85rem;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.ingredient-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
}

.tag {
  padding: 0.3rem 0.6rem;
  border-radius: var(--roundedness-full);
  font-size: 0.75rem;
  font-weight: 600;
  border: var(--ghost-border); /* Ghost border fallback */
  background: transparent;
}

.tag.have {
  color: var(--secondary);
  background-color: rgba(140, 251, 153, 0.2); /* very light secondary container overlay */
  border-color: transparent;
}

.tag.missing {
  color: var(--error);
  background-color: rgba(186, 26, 26, 0.1);
  border-color: transparent;
}

/* Responsive */
@media (max-width: 600px) {
  .split-layout {
    flex-direction: column;
  }
}

/* Recipe Detail View */
.float-back {
  position: absolute;
  top: 2rem;
  left: 2rem;
  z-index: 10;
  background: rgba(255, 248, 243, 0.8) !important;
  backdrop-filter: blur(10px);
}

.detail-hero {
  height: 350px;
  overflow: hidden;
  position: relative;
  background-color: var(--surface-container-low);
}

.detail-hero img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.detail-content {
  background: var(--surface-container-lowest);
  border-radius: var(--roundedness-lg);
  padding: 3rem;
  margin-top: -4rem; /* Asymmetric depth overlap */
  position: relative;
  z-index: 5;
  box-shadow: var(--ambient-shadow);
  margin-bottom: var(--spacing-12);
}

.detail-content h2 {
  font-size: 2.5rem;
  margin-bottom: 0.5rem;
}

.meta-info {
  font-size: 1.1rem;
  color: var(--secondary);
  font-weight: 600;
  margin-bottom: var(--spacing-6);
}

.detail-grid {
  display: grid;
  grid-template-columns: 1fr 1.5fr;
  gap: var(--spacing-6);
}

.detail-section h3 {
  font-size: 1.5rem;
  margin-bottom: 1.5rem;
  border-bottom: 4px solid var(--surface-container-low);
  padding-bottom: 0.5rem;
  display: inline-block;
}

@media (max-width: 768px) {
  .detail-grid {
    grid-template-columns: 1fr;
  }
}

.clean-list {
  list-style: none;
  font-size: 1.15rem;
}
.clean-list li {
  padding: 0.75rem 0;
  border-bottom: var(--ghost-border);
}
.clean-list .have-text { color: var(--secondary); }
.clean-list .missing-text { color: var(--error); font-weight: 600; }
.ing-bullet { font-weight: bold; margin-right: 8px; font-size: 1.25rem;}

.step-list {
  list-style: none;
}
.step-list li {
  display: flex;
  gap: 1.5rem;
  margin-bottom: 2rem;
}
.step-num {
  background: var(--primary-container);
  color: var(--primary);
  width: 44px;
  height: 44px;
  border-radius: var(--roundedness-full);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: bold;
  font-family: var(--font-display);
  font-size: 1.25rem;
  flex-shrink: 0;
}
.step-text {
  font-size: 1.15rem;
  line-height: 1.7;
  padding-top: 0.35rem;
}

/* Checkboxes & Search */
.search-box {
  margin-bottom: var(--spacing-6);
  background: var(--surface-container-lowest);
  padding: 0.25rem 0.5rem;
  border-radius: var(--roundedness-full);
  box-shadow: var(--ambient-shadow);
  display: flex;
}

.search-box input {
  flex: 1;
  border: none;
  background: transparent;
  padding: 1rem 1.5rem;
  font-size: 1.15rem;
  font-family: var(--font-body);
  color: var(--on-surface);
  outline: none;
}

.checklist-grid {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
  padding-bottom: var(--spacing-12);
}

/* Ingredient Categories List (No longer details) */
.category-details {
  background: var(--surface-container-lowest);
  border-radius: var(--roundedness-lg);
  padding: 1.5rem;
  box-shadow: var(--ambient-shadow);
  margin-bottom: 1rem;
}

.category-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
}

.checkbox-label {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  background: rgba(255, 255, 255, 0.7);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  padding: 0.5rem 0.85rem;
  border-radius: var(--roundedness-full);
  border: 1px solid var(--surface-container-high);
  cursor: pointer;
  transition: transform 0.2s, background 0.2s, border-color 0.2s;
  user-select: none;
}
.checkbox-label:hover {
  transform: translateY(-2px);
  background: var(--surface-container-lowest);
  border-color: var(--secondary-container);
}

.checkbox-label input[type="checkbox"] {
  display: none;
}

.custom-checkbox {
  width: 18px;
  height: 18px;
  border-radius: 4px;
  border: 2px solid var(--surface-container-high);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
  flex-shrink: 0;
}

.checkbox-label input[type="checkbox"]:checked + .custom-checkbox {
  background-color: var(--secondary);
  border-color: var(--secondary);
}

.checkbox-label input[type="checkbox"]:checked + .custom-checkbox::after {
  content: "✓";
  color: white;
  font-weight: bold;
}

.checkbox-label input[type="checkbox"]:checked ~ .ing-name {
  color: var(--secondary);
  font-weight: 700;
}

.ing-name {
  font-size: 0.95rem;
  font-weight: 600;
  transition: color 0.2s;
}
