:root {
  --primary: #008080;
  /* Teal */
  --primary-dark: #006666;
  --accent: #f23d3d;
  /* Original Red */
  --text-dark: #333;
  --text-light: #555;
  --bg-off-white: #f8f9fa;
  --card-shadow: 0 4px 6px rgba(0, 0, 0, 0.05);
  /* Softer shadow */
  --glass-bg: rgba(255, 255, 255, 0.95);
  --glass-border: 1px solid rgba(0, 0, 0, 0.05);
}

body {
  font-family: 'Nunito', sans-serif;
  background-color: var(--bg-off-white);
  color: var(--text-dark);
}

/* Typography Overrides */
h1,
h2,
h3,
h4 {
  letter-spacing: normal;
}

/* Hero Section */
.hero-section {
  position: relative;
  background: white;
  color: #333;
  padding: 40px 20px 20px;
  text-align: center;
  border-bottom: 1px solid #eee;
  margin-bottom: 0;
}

.hero-title {
  font-weight: 700;
  font-size: 2.5rem;
  margin-bottom: 0.5rem;
  color: var(--primary);
}

.hero-subtitle {
  font-size: 1.1rem;
  opacity: 0.8;
  font-weight: 400;
}

/* Glassmorphic Sticky Header (Mobile First) */
.menu-header-sticky {
  position: sticky;
  top: 56px;
  /* Offset for main navbar */
  z-index: 999;
  padding: 10px 0 5px;
  background: rgba(255, 255, 255, 0.95);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid rgba(0, 0, 0, 0.05);
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.03);
}

/* Row 1: Search & Toggle */
.header-row-top {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0 15px 10px;
  justify-content: space-between;
}

.search-wrapper {
  position: relative;
  flex-grow: 1;
}

.search-icon {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  color: #999;
  font-size: 0.9rem;
}

.search-wrapper input {
  width: 100%;
  padding: 8px 12px 8px 35px;
  /* Left padding for icon */
  border: 1px solid #e0e0e0;
  border-radius: 50px;
  /* Pill shape */
  font-size: 0.95rem;
  background: #f8f9fa;
  transition: all 0.2s ease;
}

.search-wrapper input:focus {
  outline: none;
  background: #fff;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(0, 128, 128, 0.1);
}

/* Compact Toggle */
.toggle-wrapper {
  display: none !important;
  /* TEMPORARY HIDE per user request */
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

.toggle-switch-compact {
  position: relative;
  display: inline-block;
  width: 40px;
  height: 22px;
  margin: 0;
}

.toggle-switch-compact input {
  opacity: 0;
  width: 0;
  height: 0;
}

.slider-compact {
  position: absolute;
  cursor: pointer;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: #ddd;
  border-radius: 34px;
  transition: .3s;
}

.slider-compact:before {
  position: absolute;
  content: "";
  height: 16px;
  width: 16px;
  left: 3px;
  bottom: 3px;
  background-color: white;
  border-radius: 50%;
  transition: .3s;
}

input:checked+.slider-compact {
  background-color: var(--primary);
}

input:checked+.slider-compact:before {
  transform: translateX(18px);
}

.toggle-icon-visual {
  color: #666;
  font-size: 1.1rem;
}

/* Row 2: Categories (Nav) */
.menu-nav {
  display: flex;
  overflow-x: auto;
  gap: 8px;
  padding: 0 15px 10px;
  /* Reduced vertical padding */
  scrollbar-width: none;
  -webkit-overflow-scrolling: touch;
}

.menu-nav::-webkit-scrollbar {
  display: none;
}

.menu-nav .nav-pill {
  flex-shrink: 0;
  padding: 6px 14px;
  background: #f3f3f2;
  border-radius: 20px;
  color: #444;
  font-size: 0.9rem;
  font-weight: 700;
  text-decoration: none;
  white-space: nowrap;
  transition: all 0.2s ease;
}

.menu-nav .nav-pill.active {
  background: var(--primary);
  color: white;
  box-shadow: 0 2px 6px rgba(0, 128, 128, 0.25);
}

/* Row 3: Filters */
.filter-buttons {
  display: flex;
  overflow-x: auto;
  gap: 6px;
  padding: 0 15px 10px;
  scrollbar-width: none;
  -webkit-overflow-scrolling: touch;
}

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

.filter-btn {
  flex-shrink: 0;
  font-size: 0.75rem;
  padding: 4px 10px;
  border-radius: 12px;
  border: 1px solid #eee;
  background: white;
  color: #666;
  font-weight: 600;
  white-space: nowrap;
}

.filter-btn.active {
  background: var(--primary-dark);
  color: white;
  border-color: var(--primary-dark);
}

/* =========================================
   Desktop Optimization (min-width: 900px)
   ========================================= */
@media (min-width: 900px) {

  /* Turn the sticky header into a Grid */
  .menu-header-sticky {
    display: grid;
    grid-template-columns: 350px 1fr auto;
    /* Col 1: Search, Col 2: Filters, Col 3: Toggle */
    grid-template-rows: auto auto;
    grid-template-areas:
      "search filters toggle"
      "nav nav nav";
    align-items: center;
    padding-bottom: 5px;
  }

  /* Area 1: Search (Shrink it) */
  .header-row-top {
    grid-area: search;
    display: flex;
    padding: 10px 0 10px 15px;
    /* Remove right padding, kept left */
    width: 100%;
  }

  .search-wrapper {
    flex: 1;
    /* Take full width of the 350px column */
  }

  .toggle-wrapper {
    /* Originally in header-row-top, but we want it in 'toggle' area? 
       Actually, header-row-top contains BOTH. 
       Use 'contents' display to unwrap them into the grid? 
       No, cleaner to just absolute position or let them stay in header-row-top 
       and make header-row-top span 'search' area?
       Wait, header-row-top has Search AND Toggle. 
       If I want Filters in betwen...
       Better Approach: Display: contents on header-row-top
    */
    display: contents;
    /* Unwraps children (Search & Toggle) to be grid items */
  }

  /* Now Search & Toggle are direct children of grid */
  .search-wrapper {
    grid-area: search;
    margin: 10px 0 10px 15px;
  }

  .toggle-wrapper {
    grid-area: toggle;
    /* display: flex !important; */
    /* Restore flex from 'contents' if needed, or just block */
    margin: 10px 15px 10px 0;
    justify-content: flex-end;
  }

  /* Area 2: Filters (Move up) */
  .filter-buttons {
    grid-area: filters;
    padding: 10px 15px;
    margin: 0;
    overflow-x: auto;
    /* Ensure it doesn't break layout */
    max-width: 100%;
    scrollbar-width: thin;
    /* Allow scroll if needed */
  }

  /* Area 3: Categories (Row 2) */
  .menu-nav {
    grid-area: nav;
    border-top: 1px solid #f0f0f0;
    /* Subtle separator */
    padding-top: 5px;
  }
}


/* Menu Sections */
.menu-section {
  padding: 25px 0 15px;
  border-bottom: 1px solid #eee;
}

.menu-section:last-child {
  border-bottom: none;
}

/* Category Headers */
/* Category Headers (Sticky) */
.menu-section h2,
.sticky-cat-header {
  color: var(--primary-dark);
  font-size: 1.4rem;
  font-weight: 800;
  margin-bottom: 20px;
  padding: 12px 15px;
  background: rgba(235, 248, 248, 0.97);
  /* Light Teal Opaque */
  /* Solid/Alpha bg to hide scroll items */
  border-radius: 0 0 8px 8px;
  /* Rounded only at bottom */
  display: block;
  width: 100%;
  border-left: 5px solid var(--primary);
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.05);

  /* Sticky Magic */
  position: sticky;
  top: 140px;
  /* Aligns below the 3-row command deck */
  z-index: 900;
  backdrop-filter: blur(5px);
  -webkit-backdrop-filter: blur(5px);
}

.category-subtitle {
  display: block;
  font-size: 0.85rem;
  font-weight: 600;
  color: #666;
  margin-top: 4px;
  text-transform: none;
  font-family: 'Nunito', sans-serif;
  opacity: 0.9;
}

/* Modern Card Grid */
.menu-items-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 20px;
  padding: 0 5px;
  /* Prevent shadow cutout */
}

@media (min-width: 768px) {
  .menu-items-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 25px;
  }
}

@media (min-width: 1400px) {
  .menu-items-grid {
    grid-template-columns: repeat(3, 1fr);
  }
}

/* Card Improvements */
.menu-item {
  padding: 0;
  /* Remove default padding, use inner containers */
  overflow: hidden;
  border: 1px solid #eee;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.03);
  position: relative;
  background: #fff;
  border-radius: 8px;
  transition: all 0.2s ease;
}

.menu-item:hover {
  transform: translateY(-2px);
  box-shadow: 0 5px 15px rgba(0, 0, 0, 0.05);
  border-color: #ddd;
}

.menu-item-content {
  padding: 15px;
  display: flex;
  flex-direction: column;
  height: 100%;
}

/* Primary Info Box (Title + Price) */
.menu-item-primary {
  background: #fdfdfd;
  border-bottom: 1px solid #f0f0f0;
  padding-bottom: 10px;
  margin-bottom: 10px;
}

.menu-item-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 8px;
}

.menu-item-name {
  font-size: 1.25rem;
  /* Larger Title */
  font-weight: 800;
  color: #2c3e50;
  margin: 0;
  line-height: 1.2;
  margin-bottom: 5px;
}

.menu-item-prices {
  margin-top: 5px;
  background: transparent;
  padding: 0;
  border-radius: 0;
}

.menu-item-price {
  font-family: 'Nunito', sans-serif;
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  font-size: 0.9rem;
  margin-bottom: 6px;
  gap: 10px;
}

.menu-item-price:last-child {
  margin-bottom: 0;
}

.menu-item-price .amount {
  font-weight: 700;
  color: var(--accent);
  font-size: 1.1rem;
}

.menu-item-price .size {
  color: #888;
  font-weight: 400;
  font-size: 0.85rem;
}

/* Secondary Info (Ingredients/Notes) */
.menu-item-details {
  font-size: 0.9rem;
  color: #666;
}

.menu-item-description {
  margin-bottom: 8px;
  line-height: 1.5;
  font-size: 0.85rem;
  color: var(--primary);
  /* Teal text for description per original */
}

.menu-item-description .sep {
  color: var(--accent);
  opacity: 1;
  padding: 0 4px;
  font-weight: 300;
}

.menu-item-note {
  font-size: 0.8rem;
  opacity: 0.9;
  color: var(--primary);
  background: rgba(0, 128, 128, 0.05);
  display: inline-block;
  padding: 6px 10px;
  border-radius: 4px;
  margin-top: 8px;
  font-weight: 400;
  font-style: italic;
}

/* Dietary Badges */
.dietary-badges {
  margin-top: 5px;
  display: flex;
  gap: 5px;
}

.badge-pill {
  font-size: 0.7rem;
  padding: 2px 8px;
  border-radius: 4px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.badge-v {
  background: #e6fffa;
  color: #008080;
  border: 1px solid #b2f5ea;
}

/* Veg */
.badge-gf {
  background: #fff5f5;
  color: #e53e3e;
  border: 1px solid #fed7d7;
}

/* GF */
.badge-vg {
  background: #f0fff4;
  color: #2f855a;
  border: 1px solid #c6f6d5;
}

/* Vegan */
.badge-p {
  background: #f0fff4;
  color: #2c7a7b;
  border: 1px solid #c6f6d5;
}

/* Poultry */
.badge-b {
  background: #fff5f5;
  color: #9b2c2c;
  border: 1px solid #fed7d7;
}

/* Beef */
.badge-l {
  background: #fffff0;
  color: #744210;
  border: 1px solid #fefcbf;
}

/* Lamb */
.badge-pk {
  background: #fff5f7;
  color: #9b2c2c;
  border: 1px solid #fed7e2;
}

/* Pork */
.badge-f {
  background: #ebf8ff;
  color: #2b6cb0;
  border: 1px solid #bee3f8;
}

/* Fish */

.no-results {
  text-align: center;
  padding: 60px 20px;
  color: var(--text-light);
  display: none;
}

.hidden {
  display: none !important;
}

/* Global Menu Item Image Styles */
.menu-item-image {
  width: 100%;
  height: 200px;
  object-fit: cover;
  border-radius: 6px;
  margin-bottom: 12px;
  display: none;
  /* Hidden by default */
  background-color: #f0f0f0;
}

/* Mobile adjustments */
@media (max-width: 576px) {
  .hero-section {
    padding: 80px 15px 50px;
  }

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

  .menu-nav-wrapper {
    top: 50px;
  }

  /* Toggle Switch */
  .toggle-container {
    display: flex;
    align-items: center;
    justify-content: center;
    margin-top: 10px;
    gap: 10px;
  }

  .toggle-switch {
    position: relative;
    display: inline-block;
    width: 48px;
    height: 24px;
  }

  .toggle-switch input {
    opacity: 0;
    width: 0;
    height: 0;
  }

  .slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: #ccc;
    transition: .4s;
    border-radius: 24px;
  }

  .slider:before {
    position: absolute;
    content: "";
    height: 18px;
    width: 18px;
    left: 3px;
    bottom: 3px;
    background-color: white;
    transition: .4s;
    border-radius: 50%;
  }

  input:checked+.slider {
    background-color: var(--primary);
  }

  input:checked+.slider:before {
    transform: translateX(24px);
  }

  .toggle-label {
    font-size: 0.9rem;
    font-weight: 600;
    color: #666;
  }

  .menu-item-image {
    height: 180px;
    /* Slightly smaller on mobile */
  }
}