/* Descriptive Color Scheme and Text Color Variables */
:root {
  --header-color: #141141e7;
  --link-color: #0039aa;
  --body-color: #ffffff00;
  --bento-color: #3cff00ea;
  --text-header: #ffffff;
  --text-H3: #000000;
  --text-body: #1a3a28;
  --text-link: #ffffff;
  --button-color: #506182;
  --button-hover-color: #618250;
  --body-bg: #23272f;
  --body-text: #f3f4f6;
}

/* Reset and Basic Styling */
.main-container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 15px;
  background: var(--body-color);
}

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

/* --- Modern Gradient Background: dark blue-grey to lime green center --- */
body {
  font-family: 'Inter', 'Trebuchet MS', Arial, sans-serif;
  background: var(--body-bg);
  min-height: 100vh;
  color: var(--body-text);
  line-height: 1.6;
}

/* --- Headline and Subheadline --- */
h1 {
  font-size: 2.8rem;
  font-weight: 800;
  color: #fff;
  text-align: center;
  margin-bottom: 0.5rem;
  letter-spacing: -1px;
}

h2, .subheadline {
  font-size: 1.3rem;
  font-weight: 400;
  color: #e0e0e0;
  text-align: center;
  margin-bottom: 0.5rem;
  text-shadow: 0 0 8px #3cff00, 0 0 2px #3cff00;
}

a {
  color: var(--link-color);
  font-size: 1em;
  text-decoration: none;
}

img {
  max-width: 100%;
  border-radius: 15px;
  height: auto;
}

/* Header and Footer */
header, footer {
  background: var(--header-color);
  color: var(--text-header);
  text-align: center;
  padding: .4em 0;
}

/* --- Footer --- */
footer {
  background: transparent;
  color: #b0b0b0;
  text-align: center;
  padding: 2rem 0 1rem 0;
  font-size: 1rem;
}

/* Navigation Bar */
nav {
  display: flex;
  justify-content: left;
  padding: .3em;
}

nav a {
  margin: 0 40px;
  color: var(--text-link);
  font-weight: bold;
}

/* --- Top Navigation Bar --- */
.top-nav {
  width: 100%;
  max-width: 1200px;
  margin: 0 auto 2.5rem auto;
  display: flex;
  justify-content: flex-end;
  align-items: center;
  padding: 1.2rem 2rem 0.5rem 2rem;
  background: rgba(24, 26, 32, 0.85);
  border-radius: 32px;
  box-shadow: 0 4px 24px 0 rgba(0,0,0,0.18);
  position: relative;
  z-index: 10;
}

.top-nav .tool-button {
  margin: 0 0.5em;
  padding: 0.7em 1.7em;
  font-size: 1rem;
  border-radius: 999px;
  background: #23272f;
  color: #fff;
  font-weight: 600;
  box-shadow: 0 2px 8px 0 rgba(0,0,0,0.10);
  transition: background 0.2s, color 0.2s, box-shadow 0.2s;
}

.top-nav .tool-button:hover {
  background: #3cff00;
  color: #23272f;
  box-shadow: 0 4px 16px 0 rgba(60,255,0,0.15);
}

/* Main Content Styling */
.container {
  width: 100%;
  max-width: 900px;
  margin: 0 auto;
  padding: 0 1.5rem;
}

/* --- Utility & Shared Card-like Elements --- */
:where(.card, .bento-box, .main-card, .recipe-card) {
  background: linear-gradient(135deg, rgba(60,255,0,0.10) 0%, rgba(24,26,32,0.97) 80%);
  border-radius: 18px;
  box-shadow: 0 6px 32px 0 rgba(60,255,0,0.04), 0 6px 32px 0 rgba(0,0,0,0.25);
  padding: 0.5rem 0.5rem;
  margin: 0.5rem auto;
  max-width: 700px;
  width: 100%;
  border: 1.5px solid rgba(60,255,0,0.13);
}

.bento-box.main-card:first-of-type {
  background: none;
  box-shadow: none;
  border: none;
  padding: 0;
  margin-top: 1.2rem;
  margin-bottom: 1.2rem;
}

/* Grid System */
.grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  grid-gap: 20px;
}

.grid-item {
  border: none;
  padding: 10px;
  text-align: center;
  box-shadow: 0 6px 32px 0 rgba(0,0,0,0.18);
}

.grid-item h3 {
  margin-top: 0.5rem;
  color: var(--text-H3);
}

/* 🔥 NEW: Weekday Grid */
.week-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  grid-template-rows: repeat(2, 1fr);
  gap: 1.2rem;
  margin: 0 auto 1.5rem auto;
  max-width: 600px;
  justify-items: center;
  align-items: stretch;
}

.week-grid .grid-item {
  background: rgba(24,26,32,0.97);
  border-radius: 18px;
  box-shadow: 0 4px 24px 0 rgba(60,255,0,0.07), 0 2px 8px 0 rgba(0,0,0,0.18);
  border: 1.5px solid rgba(60,255,0,0.13);
  min-height: 110px;
  height: 110px;
  width: 170px;
  max-width: 170px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  padding: 0.7em 0.5em 0.7em 0.5em;
  margin: 0 auto;
  transition: box-shadow 0.2s;
}

.week-grid .grid-item.empty {
  background: none;
  border: none;
  box-shadow: none;
  pointer-events: none;
}

.week-grid .grid-item h3, .week-grid .grid-item .weekday {
  color: #fff;
  font-size: 1.15rem;
  font-weight: 700;
  margin-bottom: 0.3em;
  margin-top: 0;
  text-align: center;
}

.week-grid .grid-item .recipe, .week-grid .grid-item a {
  color: #7fff7f !important;
  font-size: 1.02rem;
  font-weight: 500;
  text-align: center;
  word-break: break-word;
  text-decoration: none;
  margin: 0;
  line-height: 1.18;
  letter-spacing: 0.01em;
  transition: color 0.18s;
}

.week-grid .grid-item .recipe:hover, .week-grid .grid-item a:hover {
  color: #baffba !important;
  text-decoration: underline;
}

.week-grid .grid-item a:visited {
  color: #7fff7f !important;
}

.week-grid .grid-item p,
.week-grid .grid-item .recipe,
.week-grid .grid-item a,
.week-grid .grid-item-link {
  color: #7fff7f !important;
  font-size: 1.02rem;
  font-weight: 500;
  text-align: center;
  word-break: break-word;
  text-decoration: none;
  margin: 0;
  line-height: 1.18;
  letter-spacing: 0.01em;
  transition: color 0.18s;
}

.week-grid .grid-item a:visited,
.week-grid .grid-item-link:visited {
  color: #7fff7f !important;
}

.week-grid .grid-item a:hover,
.week-grid .grid-item-link:hover {
  color: #baffba !important;
  text-decoration: underline;
}

@media (max-width: 700px) {
  .week-grid {
    grid-template-columns: 1fr 1fr;
    grid-template-rows: repeat(3, 1fr);
    max-width: 400px;
  }
  .week-grid .grid-item {
    max-width: 100%;
    min-width: 120px;
    width: 100%;
    height: 110px;
  }
}

/* 🔥 NEW: Week Dates Line */
#week-dates {
  font-size: 1.1rem;
  font-weight: bold;
  text-align: center;
  margin-bottom: 0.5rem;
}

/* Responsive Design - Non-navigation elements */
@media (max-width: 768px) {
  .container,
  nav {
    width: 90%;
  }

  nav a {
    margin: 0 10px;
  }
  
  .top-nav {
    flex-direction: column;
    align-items: stretch;
    padding: 0.7rem 0.5rem 0.5rem;
    border-radius: 0 0 24px 24px;
  }
  
  .top-nav .tool-button {
    margin: 0.3em 0;
    width: 100%;
  }
}

/* --- Responsive --- */
@media (max-width: 600px) {
  h1 { font-size: 2rem; }
  .bento-box, .main-card { padding: 1.2rem 0.5rem; }
}

/* Dropdown Button */
.dropbtn {
  font-family: 'Trebuchet MS', 'Lucida Sans Unicode', 'Lucida Grande', 'Lucida Sans', Arial, sans-serif;
  background-color: var(--header-color);
  color: var(--text-link);
  padding: 6px;
  font-size: 16px;
  font-weight: bold;
  border: none;
  cursor: pointer;
}

/* Dropdown Content */
.dropdown {
  position: relative;
  display: inline-block;
}

.dropdown-content {
  display: none;
  position: absolute;
  background-color: var(--bento-color);
  min-width: 160px;
  box-shadow: 0px 8px 16px 0px rgba(0,0,0,0.2);
  z-index: 1;
}

.dropdown-content a {
  color: var(--text-body);
  padding: 12px 16px;
  text-decoration: none;
  display: block;
}

.dropdown-content a:hover {
  background-color: var(--button-hover-color);
}

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

.dropdown:hover .dropbtn {
  background-color: var(--button-color);
}

/* Styles for Input Boxes in the Multiplication Form */
#multiplicationForm input[type="number"] {
  width: 60px; 
  height: 27px; 
  border-radius: 5px;
  text-align: center;
}

@media (max-width: 768px) {
  #multiplicationForm input[type="number"] {
    width: 80px;
    border-radius: 5px;
  }
}

/* Button Styles */
#multiplicationForm .button {
  padding: 5px 10px;
  font-size: 14px;
  background-color: var(--button-color);
  color: var(--text-link);
  border: none;
  border-radius: 5px;
  cursor: pointer;
}

/* --- Tool Buttons --- */
.tool-button {
  background: #23272f;
  color: #fff;
  border: none;
  border-radius: 999px;
  font-size: 1.1rem;
  font-weight: 600;
  padding: 0.8em 2.2em;
  margin: 0.5em 0.4em;
  box-shadow: 0 2px 8px 0 rgba(0,0,0,0.10);
  transition: background 0.2s, color 0.2s, box-shadow 0.2s;
  display: inline-block;
}
.tool-button:hover {
  background: #ff6a3d;
  color: #fff;
  box-shadow: 0 4px 16px 0 rgba(255,106,61,0.15);
}

.logout-button {
  float: right;
  padding: 6px 12px;
  margin: 8px;
  border-radius: 6px;
  border: none;
  background-color: #f3f3f3;
  color: #333;
  cursor: pointer;
  transition: background-color 0.2s ease;
}

.logout-button:hover {
  background-color: #ddd;
}

/* Recipe display styling */
.recipe-display {
  text-align: left;
  background-color: #f9f9f9;
  padding: 15px;
  border-radius: 8px;
  margin-top: 20px;
}
.recipe-display h2 {
  margin-top: 0;
  color: var(--primary-color);
}
.recipe-display h3 {
  margin-top: 15px;
  color: var(--secondary-color);
  border-bottom: 1px solid #eee;
  padding-bottom: 5px;
}
.recipe-display ul {
  list-style-type: disc;
  margin-left: 20px;
  padding-left: 0;
}
.recipe-display li {
  margin-bottom: 5px;
  line-height: 1.6;
}
.recipe-display p {
  white-space: pre-wrap;
}

/* Meal AI layout overrides */
#mainContent {
  display: none;
}
#mainContent.active {
  display: block;
}
.container {
  text-align: center;
}
.ai-instructions {
  background: #f3f7fa;
  color: #8a0404;
  border-radius: 8px;
  padding: 1em;
  margin-bottom: 1em;
  text-align: left;
  max-width: 600px;
  margin: 0 auto;
  font-size: 1em;
}
.ai-input-box {
  width: 100%;
  border-radius: 12px;
  padding: 1rem;
  font-family: monospace;
  font-size: 1rem;
  resize: vertical;
}
#result {
  margin-top: 2rem;
}
.footer {
  text-align: center;
  padding: 20px;
  margin-top: auto;
}
.api-info {
  font-size: 0.8em;
  color: var(--text-muted);
}

/* --- Hide unused elements for clean look --- */
/* header, nav, .logout-button, .dropbtn, .dropdown, .dropdown-content {
  display: none !important;
} */

/* Modern Horizontal Nav Bar */
.top-nav.menu-bar {
  background: transparent;
  box-shadow: none;
  border-radius: 0;
  padding: 0;
  margin-bottom: 2.5rem;
  width: 100%;
  max-width: 100vw;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

/* Hide logo on desktop since original design didn't include it */
.top-nav.menu-bar .logo-link {
  display: none;
}

/* Desktop Menu List */
.menu-list {
  display: flex;
  flex-direction: row;
  align-items: center;
  justify-content: center;
  gap: 48px;
  list-style: none;
  margin: 0 auto;
  padding: 0;
  width: 100%;
}

.menu-list li {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  line-height: 1.1;
}

.menu-list li a {
  color: #fff;
  font-weight: bold;
  font-size: 1.15rem;
  letter-spacing: 0.01em;
  text-align: center;
  margin: 0;
  padding: 0;
  text-decoration: none;
}

.menu-list li a strong {
  font-weight: bold;
}

.menu-list li a:hover {
  color: #3cff00;
}

.menu-list li.has-dropdown > a:after {
  content: ' \25BC';
  font-size: 0.7em;
  margin-left: 0.3em;
  vertical-align: middle;
}

/* Hamburger menu styles - hidden on desktop */
.hamburger {
  display: none;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  width: 44px;
  height: 44px;
  background: none;
  border: none;
  cursor: pointer;
  margin-left: auto;
  position: static;
  z-index: 1001;
}

.hamburger span {
  display: block;
  width: 28px;
  height: 3px;
  margin: 5px 0;
  background: linear-gradient(90deg, #7fff7f 0%, #00c853 100%);
  border-radius: 2px;
  transition: 0.3s;
}

/* Hamburger animation when open */
.menu-bar.open .hamburger span:nth-child(1) {
  transform: translateY(8px) rotate(45deg);
}
.menu-bar.open .hamburger span:nth-child(2) {
  opacity: 0;
}
.menu-bar.open .hamburger span:nth-child(3) {
  transform: translateY(-8px) rotate(-45deg);
}

/* Medium screens */
@media (max-width: 900px) {
  .menu-list {
    gap: 24px;
  }
}

/* Mobile Navigation */
@media (max-width: 768px) {
  /* Override the general .top-nav mobile rule for pages using .menu-bar */
  .top-nav.menu-bar {
    flex-direction: row !important;
    align-items: center !important;
    justify-content: space-between !important;
    padding: 0.7rem 0.5rem 0.5rem !important;
  }
  
  /* Show logo on mobile */
  .top-nav.menu-bar .logo-link {
    display: block !important;
  }
  
  /* Show hamburger on mobile */
  .hamburger {
    display: flex !important;
    margin-left: auto;
    position: static;
    top: unset;
    right: unset;
  }
  
  /* Mobile menu list styling */
  .menu-list {
    display: none;
    position: absolute;
    top: 56px;
    left: 0;
    right: 0;
    background: #181f2a;
    box-shadow: 0 8px 24px rgba(0,0,0,0.2);
    border-radius: 0 0 16px 16px;
    flex-direction: column;
    align-items: center;
    padding: 16px 0;
    z-index: 1000;
    transition: max-height 0.3s ease;
    gap: 8px;
  }
  
  .menu-list li {
    margin: 0.5rem 0;
  }
  
  .menu-list.open {
    display: flex;
  }
}

.menu-bar.open .hamburger span:nth-child(1) {
  transform: translateY(8px) rotate(45deg);
}
.menu-bar.open .hamburger span:nth-child(2) {
  opacity: 0;
}
.menu-bar.open .hamburger span:nth-child(3) {
  transform: translateY(-8px) rotate(-45deg);
}

/* --- Schedule Builder Styles --- */
.schedule-title {
  line-height: 1.1;
}
.schedule-container {
  max-width: 500px;
  margin: 2em auto;
  background: #f9f9f9;
  border-radius: 10px;
  padding: 2em 2em 1.5em 2em;
  box-shadow: 0 2px 8px rgba(0,0,0,0.07);
}
.schedule-container h1 {
  text-align: center;
  margin-bottom: 1em;
  color: var(--text-color, #222);
}
.schedule-form label,
.schedule-form div[style*='font-weight: bold'] {
  color: var(--text-color, #222);
}
.schedule-form strong {
  color: var(--text-color, #222);
}
.schedule-form select,
.schedule-form input[type="date"] {
  width: 100%;
  padding: 0.5em;
  margin-top: 0.2em;
  border-radius: 6px;
  border: 1px solid #ccc;
  font-size: 1em;
}
.schedule-form button {
  margin-top: 2em;
  width: 100%;
  padding: 0.8em;
  font-size: 1.1em;
  border-radius: 8px;
  background: var(--primary-color, #2a7cff);
  color: #fff;
  border: none;
  cursor: pointer;
  font-weight: bold;
  transition: background 0.2s;
}
.schedule-form button:hover {
  background: #174ea6;
}
.result-box {
  margin-top: 2em;
  background: #eaf6ff;
  border-radius: 8px;
  padding: 1em;
  font-size: 1em;
  word-break: break-all;
}

/* Tooltip container for inline help */
.tooltip {
  position: relative;
  cursor: help;
  border-bottom: 1px dotted var(--text-link);
}
.tooltip .tooltiptext {
  visibility: hidden;
  width: 300px;
  background-color: rgba(0, 0, 0, 0.8);
  color: #fff;
  text-align: left;
  border-radius: 6px;
  padding: 10px;
  position: absolute;
  z-index: 10;
  bottom: 125%;
  left: 50%;
  transform: translateX(-50%);
  opacity: 0;
  transition: opacity 0.3s;
}
.tooltip .tooltiptext::after {
  content: "";
  position: absolute;
  top: 100%;
  left: 50%;
  margin-left: -5px;
  border-width: 5px;
  border-style: solid;
  border-color: rgba(0, 0, 0, 0.8) transparent transparent transparent;
}
.tooltip:hover .tooltiptext {
  visibility: visible;
  opacity: 1;
}

/* All Recipes page styling */
.recipe-list {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  row-gap: 0.5rem;
  column-gap: 1.5rem;
  padding: 1rem;
}
.recipe-card {
  padding: 1.5rem 1rem;
  background: linear-gradient(135deg, rgba(60,255,0,0.10) 0%, rgba(24,26,32,0.97) 80%);  border-radius: 24px;
  box-shadow: 0 6px 32px 0 rgba(60,255,0,0.04), 0 6px 32px 0 rgba(0,0,0,0.25);
  border: 1.5px solid rgba(60,255,0,0.13);
  color: #fff;
  margin-bottom: 0;
  transition: box-shadow 0.2s, transform 0.2s;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
}
.recipe-card:hover {
  transform: scale(1.02);
}
.recipe-card h3 {
  font-size: 1.25rem;
  font-weight: 700;
  margin: 0 0 0.5em 0;
}
.recipe-card h3 a {
  color: #7fff7f;
  text-decoration: none;
  transition: color 0.18s;
}
.recipe-card a {
  color: #7fff7f;
  font-weight: 600;
  text-decoration: none;
  font-size: 1.05rem;
  transition: color 0.18s;
}
.recipe-card a:hover {
  color: #baffba;
  text-decoration: underline;
}
.recipe-card p {
  color: #e0e0e0;
  margin: 0.3em 0 0 0;
  font-size: 1rem;
}

@media (max-width: 700px) {
  .recipe-list {
    grid-template-columns: 1fr;
  }
}

/* --- Utility: text alignment --- */
.text-center {
  text-align: center !important;
}

/* --- Utility: spacing helpers --- */
.mb-1-2em { margin-bottom: 1.2em !important; }
.mb-0-5em { margin-bottom: 0.5em !important; }

/* --- Utility: hidden elements --- */
.hidden { display: none !important; }

/* Grocery List Styling - Enhanced for Checkable Checklists */
.bento-box ul.grocery-list,
.bento-box ul.grocery-checklist {
  list-style: none !important;
  margin: 1em 0 1em 0 !important;
  padding: 0 !important;
  background: transparent;
  width: auto;
  box-sizing: border-box;
}

.grocery-item {
  display: flex !important;
  align-items: flex-start !important;
  margin: 0 0 0.8em 0 !important;
  padding: 0 !important;
  transition: opacity 0.3s ease, text-decoration 0.3s ease !important;
}

.grocery-checkbox {
  appearance: none !important;
  width: 20px !important;
  height: 20px !important;
  border: 2px solid #7fff7f !important;
  border-radius: 4px !important;
  margin: 0 0.75em 0 0 !important;
  padding: 0 !important;
  cursor: pointer !important;
  position: relative !important;
  flex-shrink: 0 !important;
  background: transparent !important;
  transition: all 0.2s ease !important;
}

.grocery-checkbox:hover {
  border-color: #baffba !important;
  background: rgba(122, 255, 122, 0.1) !important;
}

.grocery-checkbox:checked {
  background: #7fff7f !important;
  border-color: #7fff7f !important;
}

.grocery-checkbox:checked::after {
  content: '✓' !important;
  position: absolute !important;
  top: 50% !important;
  left: 50% !important;
  transform: translate(-50%, -50%) !important;
  color: #23272f !important;
  font-size: 14px !important;
  font-weight: bold !important;
}

.grocery-label {
  flex: 1 !important;
  cursor: pointer !important;
  line-height: 1.4 !important;
  color: #e0e0e0 !important;
  transition: all 0.3s ease !important;
  margin: 0 !important;
  padding: 0 !important;
  user-select: none !important;
  text-align: left !important;
}

.grocery-item.checked .grocery-label {
  opacity: 0.6 !important;
  text-decoration: line-through !important;
  color: #a0a0a0 !important;
}

.grocery-label .note {
  color: #b0b0b0 !important;
  font-style: italic !important;
}

.grocery-item.checked .grocery-label .note {
  color: #808080 !important;
}

/* Mobile responsiveness for checkboxes */
@media (max-width: 768px) {
  .grocery-checkbox {
    width: 18px !important;
    height: 18px !important;
    margin-right: 0.6em !important;
  }

  .grocery-label {
    font-size: 0.95rem !important;
  }
}

/* Additional fix for the section container to ensure proper containment */
.bento-box {
  overflow-x: hidden;
  padding-left: 0.5rem;
  padding-right: 0.5rem;
}

/* Style to remove background from the main recipe container on all-recipes page */
#all-recipes-container {
  background: none !important;
  border: none !important;
  box-shadow: none !important;
  padding: 0 !important; /* Reset padding, direct children like .recipe-list will control inner spacing */
  margin: 0.5rem auto !important; /* Retain original auto horizontal centering and vertical margin */
}

/* Optional: Adjust padding on the recipe list itself if needed after removing container padding */
/*
#all-recipes-container .recipe-list {
  padding-top: 0;
  padding-bottom: 0;
}
*/