/* ==========================================================================
   GLOBAL VARIABLES & RESET
   ========================================================================== */
:root {
  --bg-main: #F9F8F6;          /* Warm Off-White */
  --surface-white: #FFFFFF;     /* Card & Nav Backgrounds */
  --text-main: #2B2D42;         /* Deep Charcoal */
  --text-muted: #6C757D;        /* Secondary Text */
  
  --brand-sage: #3A5A40;        /* Primary Accent (Sage Green) */
  --brand-terracotta: #D96B43;  /* Secondary Accent (Warm Terracotta) */
  --brand-terracotta-hover: #C45A33;
  
  --border-light: #E2E8F0;      /* Subtle Divider Lines */
  --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.05);
}

body {
  margin: 0;
  font-family: Arial, sans-serif;
  background-color: var(--bg-main);
  color: var(--text-main);
}

/* ==========================================================================
   HEADER & NAVIGATION
   ========================================================================== */
header {
  position: sticky;       /* Pins the header when scrolling */
  top: 0;                 /* Keeps it at the very top of the window */
  z-index: 1000;          /* Keeps it layered above other page content */
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 15px 25px;
  background: var(--surface-white);
  border-bottom: 3px solid var(--brand-sage); /* Swapped plain grey border for Sage */
  box-shadow: var(--shadow-sm);
}

nav .menu {
  list-style: none;
  display: flex;
  gap: 20px;
  margin: 0;
  padding: 0;
}

nav .menu li {
  position: relative;
}

nav .menu a {
  text-decoration: none;
  color: var(--text-main);
  font-weight: 600;
  transition: color 0.2s ease;
}

nav .menu a:hover {
  color: var(--brand-terracotta);
}

/* ==========================================================================
   HEADER LOGO STYLING
   ========================================================================== */
.logo-link {
  display: flex;
  align-items: center;
  gap: 10px; /* Space between logo image and text */
  text-decoration: none;
  color: var(--brand-sage);
  font-weight: bold;
  font-size: 20px;
  font-family: Georgia, serif;
}

.header-logo-img {
  height: 36px; /* Adjust height to fit header bar height */
  width: auto;  /* Maintains image aspect ratio */
  object-fit: contain;
}

/* --- FIRST-LEVEL DROPDOWN --- */
.dropdown-menu {
  display: none;
  position: absolute;
  top: 100%;
  left: 0;
  background: var(--surface-white);
  border: 1px solid var(--border-light);
  border-top: 3px solid var(--brand-sage); /* Clean visual accent on top of menu */
  border-radius: 0 0 6px 6px;
  padding: 8px 0;
  list-style: none;
  min-width: 170px;
  box-shadow: var(--shadow-sm);
  z-index: 1000;
}

.dropdown-menu li a {
  display: block;
  padding: 8px 16px;
  color: var(--text-main);
  font-weight: 500;
}

.dropdown-menu li a:hover {
  background-color: var(--bg-main);
  color: var(--brand-terracotta);
}

.dropdown:hover .dropdown-menu {
  display: block;
}

/* --- SECOND-LEVEL DROPDOWN SUPPORT --- */
.dropdown-sub {
  position: relative;
}

.dropdown-sub > a {
  padding: 8px 16px;
  display: block;
}

.dropdown-submenu {
  display: none;
  position: absolute;
  top: 0;
  left: 100%;
  background: var(--surface-white);
  border: 1px solid var(--border-light);
  border-radius: 6px;
  list-style: none;
  min-width: 170px;
  padding: 8px 0;
  box-shadow: var(--shadow-sm);
  z-index: 1001;
}

.dropdown-sub:hover .dropdown-submenu {
  display: block;
}

/* ==========================================================================
   SEARCH CONTROLS
   ========================================================================== */
.search {
  display: flex;
  align-items: center;
  gap: 8px;
}

.search input {
  padding: 8px 12px;
  border: 1px solid var(--border-light);
  border-radius: 6px;
  margin-left: auto;
  font-size: 14px;
  outline: none;
  transition: border-color 0.2s ease;
}

.search input:focus {
  border-color: var(--brand-sage);
}

.search button {
  background: var(--brand-terracotta); /* Swapped plain teal for Terracotta */
  color: var(--surface-white);
  border: none;
  padding: 8px 12px;
  border-radius: 50%;
  cursor: pointer;
  transition: background-color 0.2s ease;
}

.search button:hover {
  background: var(--brand-terracotta-hover);
}

.search-container {
  position: relative;
  display: inline-block;
  margin-left: auto;
}

#search-input {
  padding: 8px 12px;
  font-size: 14px;
  width: 200px;
  border: 1px solid var(--border-light);
  border-radius: 6px;
  outline: none;
}

#search-input:focus {
  border-color: var(--brand-sage);
}

.search-results {
  position: absolute;
  top: 100%;
  left: 0;
  background: var(--surface-white);
  border: 1px solid var(--border-light);
  border-radius: 0 0 6px 6px;
  list-style: none;
  padding: 0;
  margin: 4px 0 0 0;
  width: 100%;
  display: none;
  z-index: 1000;
  box-shadow: var(--shadow-sm);
}

.search-results li a {
  display: block;
  padding: 10px 14px;
  color: var(--text-main);
  text-decoration: none;
}

.search-results li a:hover {
  background: var(--bg-main);
  color: var(--brand-terracotta);
}

/* ==========================================================================
   HERO / LOGO SECTION
   ========================================================================== */
.big-logo {
  text-align: center;
  padding: 40px 0;
  background-color: var(--bg-main);
}

.big-logo img {
  width: 450px;
  height: auto;
}

/* ==========================================================================
   CUPBOARD SEARCH TOOL STYLING
   ========================================================================== */
.cupboard-container {
  max-width: 1100px;
  margin: 30px auto;
  padding: 0 20px;
}

.tool-header h1 {
  font-family: Georgia, serif;
  color: var(--brand-sage);
  font-size: 32px;
  margin-bottom: 8px;
}

.tool-header p {
  color: var(--text-muted);
  font-size: 16px;
  margin-top: 0;
}

/* Category Checkbox Grid */
.ingredient-selector-box {
  background: var(--surface-white);
  border: 1px solid var(--border-light);
  border-radius: 12px;
  padding: 24px;
  margin-top: 25px;
  box-shadow: var(--shadow-sm);
}

.selector-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 18px;
  border-bottom: 2px solid var(--bg-main);
  padding-bottom: 12px;
}

.selector-title h2 {
  font-size: 20px;
  color: var(--brand-sage);
  margin: 0;
  border: none;
  padding: 0;
}

.btn-clear {
  background: transparent;
  border: 1px solid var(--border-light);
  color: var(--text-muted);
  padding: 6px 14px;
  border-radius: 20px;
  cursor: pointer;
  font-size: 13px;
  transition: all 0.2s ease;
}

.btn-clear:hover {
  background: var(--brand-terracotta);
  color: white;
  border-color: var(--brand-terracotta);
}

.category-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 20px;
}

.ingredient-cat-card {
  background: var(--bg-main);
  border-radius: 8px;
  padding: 16px;
  border: 1px solid var(--border-light);
}

.ingredient-cat-card h3 {
  font-size: 15px;
  color: var(--brand-sage);
  margin: 0 0 12px 0;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.checkbox-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.checkbox-label {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
  cursor: pointer;
  user-select: none;
}

.checkbox-label input[type="checkbox"] {
  accent-color: var(--brand-terracotta);
  width: 16px;
  height: 16px;
  cursor: pointer;
}

/* Results Grid */
.results-box {
  margin-top: 40px;
}

.results-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
}

.results-header h2 {
  font-size: 22px;
  color: var(--brand-sage);
  margin: 0;
  border: none;
}

.status-badge {
  background: #E2E8F0;
  color: var(--text-main);
  padding: 6px 14px;
  border-radius: 20px;
  font-size: 13px;
  font-weight: 600;
}

.status-badge.active {
  background: var(--brand-sage);
  color: white;
}

.recipe-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 24px;
}
.recipe-description {
  font-style: italic;
  font-size: 1.1rem;
  color: var(--text-muted);
  line-height: 1.5;
  margin: 10px 0 15px 0;
}
.recipe-result-card {
  background: var(--surface-white);
  border: 1px solid var(--border-light);
  border-radius: 10px;
  padding: 20px;
  box-shadow: var(--shadow-sm);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

.card-meta {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 10px;
}

.rank-tag {
  background: rgba(217, 107, 67, 0.12);
  color: var(--brand-terracotta);
  padding: 4px 10px;
  border-radius: 12px;
  font-size: 12px;
  font-weight: bold;
}

.cuisine-tag {
  background: rgba(58, 90, 64, 0.1);
  color: var(--brand-sage);
  padding: 4px 10px;
  border-radius: 12px;
  font-size: 12px;
  font-weight: 600;
}

.recipe-result-card h3 {
  font-family: Georgia, serif;
  color: var(--text-main);
  margin: 0 0 8px 0;
  font-size: 20px;
}

.recipe-desc {
  font-size: 14px;
  color: var(--text-muted);
  line-height: 1.4;
  margin-bottom: 18px;
}

.btn-view-recipe {
  display: inline-block;
  text-align: center;
  background: var(--brand-sage);
  color: white;
  text-decoration: none;
  padding: 10px 16px;
  border-radius: 6px;
  font-weight: 600;
  font-size: 14px;
  transition: background 0.2s ease;
}

.btn-view-recipe:hover {
  background: #2D4632;
}

.no-results {
  grid-column: 1 / -1;
  text-align: center;
  padding: 40px;
  background: var(--surface-white);
  border-radius: 10px;
  border: 1px dashed var(--border-light);
  color: var(--text-muted);
}
/* ==========================================================================
   RESPONSIVE MOBILE HEADER & HAMBURGER MENU
   ========================================================================== */

/* Hide hamburger button on desktop screens by default */
.menu-toggle {
  display: none;
  background: transparent;
  border: none;
  font-size: 26px;
  color: var(--brand-sage);
  cursor: pointer;
  padding: 4px 8px;
}

@media (max-width: 768px) {
  header {
    flex-wrap: wrap; /* Allows mobile menu to drop to a second row */
    justify-content: space-between;
    align-items: center;
    padding: 10px 15px;
  }

    .logo {
    order: 1;
    }

    .header-logo-img {
      height: 30px;
    }

    /* Reveal Hamburger Button */
  .menu-toggle {
    display: block !important;
    order: 2;
  }

    /* Keep Search Bar compact on mobile so it stays on top row */
  .search-container {
    
    order: 3;
    width: 100%;
    margin-left: 10px 0 0 0;
    max-width: calc(100% - 60px);
  }

  #search-input {
    width: 100%;
    box-sizing: border-box;
  }



  /* Hide navigation bar by default on mobile */
 #nav-menu {
    order: 4;
    display: none;
    width: 100%;
    margin-top: 10px;
    background: var(--surface-white);
    border-top: 1px solid var(--border-light);
  }

  /* Show nav when JavaScript toggles the '.active' class */
  #nav-menu.active {
    display: block !important;
  }

  /* Stack main menu items vertically on mobile */
  nav .menu {
    flex-direction: column;
    gap: 0;
  }

  nav .menu li a {
    display: block;
    padding: 12px 10px;
    border-bottom: 1px solid var(--border-light);
  }

  /* Mobile Dropdown styling */
  .dropdown-menu {
    position: static; /* Stack dropdown inline instead of floating */
    box-shadow: none;
    border: none;
    padding-left: 15px;
    background: var(--bg-main);
  }

  .dropdown:hover .dropdown-menu {
    display: block;
  }

  /* Scale down the big hero logo image on phones */
  .big-logo img {
    width: 90%;
    max-width: 450px;
  }
}