/* =========================
   LAYOUT (CORE)
========================= */
.calorie-container {
  width: 100%;
  max-width: 1200;
  margin: 2rem auto;
  padding: 2rem 1rem;
  background: var(--card); 
  border-radius: 1rem;
  box-shadow: 0 4px 12px rgba(0,0,0,0.12);
  font-size: 1rem;
  color: var(--text); 
}

.calorie-container,
.calorie-container * {
  min-width: 0;
}

.calorie-container:hover {
  transform: translateY(-1px);
}

.calorie-container h1 {
  font-size: 2rem;
  font-weight: 800;
  margin: .4rem 0 0.5rem;
  text-align: center;
}

.calorie-container p {
  text-align: center;
  color: var(--soft);
  margin-bottom: 2rem;
}

/* =========================
   THREE-COLUMN LAYOUT
========================= */

.calorie-layout {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 1rem;
  align-items: start;
}

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

/* =========================
   FORM
========================= */
.section-title {
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--primary);
  font-weight: 700;
  text-align: center;
}

.input-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(100px, 1fr));
  gap: 12px;
}

.input-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.input-group label {
  font-size: 0.8rem;
  color: var(--text-muted);
}

/* Styled Inputs & Selects */
.calorie-form input, 
.calorie-form select {
  background: var(--muted);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 10px 12px;
  color: var(--text);
  font-size: 0.92rem;
  transition: all 0.2s ease;
  outline: none;
}

.calorie-form input:focus, 
.calorie-form select:focus {
  border-color: var(--primary);
  box-shadow: var(--muted);
}

/* =========================
   GLASS & STICKY
========================= */

.glass {
  min-width: 0;
  background: rgba(255,255,255,0.05);
  backdrop-filter: blur(14px);
  border-radius: 16px;
  padding: 1.4rem;
  border:1px solid var(--border);
}

.glass:hover {
  transform:translateY(-3px);
  box-shadow:0 10px 25px rgba(0,0,0,.2);
  border-color: var(--border);
}

.sticky {
  position: sticky;
  top: 90px;
  align-self: start;
}

@media (max-width: 768px) {
  .sticky { position: static; }
}

/* =========================
   DASHBOARD
========================= */

.big-cal { 
  text-align: center; 
  margin-bottom: 1.5rem; 
}

.big-cal strong { 
  font-size: 3rem; 
  color: var(--primary); 
  display: block; 
}

.insights-panel { 
  display: grid; 
  grid-template-columns: 1fr 1fr; 
  gap: 0.5rem; 
  margin-top: 2rem; 
}

.insight-block { 
  background: var(--muted); 
  padding: 0.8rem; 
  border-radius: 0.5rem; 
  text-align: center; 
  font-size: 0.85rem; 
} 

.insight-block strong {
  margin-left: 10px; 
  display: inline-block; 
}

/* =========================
   MACRO BARS
========================= */

.macro-cards { 
  display: grid;
  grid-template-columns: repeat(3,1fr);
  gap: 10px;
  margin-top: 1rem;
}

.macro-cards button { 
  flex: 1; 
  padding: 0.6rem; 
  font-size: 0.8rem;
}

.macro-btn {
  background: rgba(15, 23, 42, 0.6);
  border: 1px solid var(--border);
  padding: 12px;
  border-radius: 10px;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  transition: all 0.3s ease;
}

.macro-btn .m-title {
  font-weight: 600;
  font-size: 0.85rem;
  color: white;
}

.macro-btn .m-desc {
  font-size: 0.65rem;
  color: var(--text-muted);
}

.macro-btn.active {
  border-color: var(--primary);
  background: rgba(16, 185, 129, 0.1);
}

.macro-btn.active .m-title {
  color: var(--primary);
}

.btn{
  font-size: 0.8rem;
  margin: 1rem auto 1rem;
}

.btn.active {  
  background: rgba(37,99,235,.75); 
}

/* Submit Button */
.generate-btn {
  font-size: .8rem;
  cursor: pointer;
  transition: transform 0.2s ease, filter 0.2s ease;
  margin: 2rem auto 0;
  display: block;
}

.generate-btn:hover {
  filter: brightness(1.1);
  transform: translateY(-1px);
}

.generate-btn:active {
  transform: translateY(0);
}

.bar div { 
  height: 8px; 
  background: var(--border); 
  border-radius: 4px; 
  margin-top: 4px; 
  overflow: hidden; 
}

.bar i { 
  display: block; 
  height: 100%; 
  background: var(--primary); 
  width: 0; 
  transition: width 0.8s ease; 
}

#pBar { background: #3b82f6; }
#cBar { background: #ef4444; }
#fBar { background: #f59e0b; }

/* =========================
   WEEKLY PLAN
========================= */

.plan-table {
  margin-top:1.5rem;
  display:grid;
  grid-template-columns:repeat(auto-fit,minmax(120px,1fr));
  gap:.5rem;
}

.plan-table div {
  background:var(--muted);
  padding:.6rem;
  border-radius:8px;
  text-align:center;
  font-weight:600;
}
body {
  overflow-x: hidden;
}
/* =========================
   FOOD PICKER
========================= */

.food-picker-container {
    max-height: 597px; 
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.food-picker-container h3 {
    margin: 0 auto 0.5rem;
    font-weight: 800;
}

/* The scrollable area */
.picker-grid {
    flex-grow: 1;
    overflow-y: auto;
    padding-right: 8px; 
    margin-top: 1rem;
    
    /* Custom Scrollbar Styling */
    scrollbar-width: thin;
    scrollbar-color: var(--primary) rgba(255, 255, 255, 0.05);
}

/* Chrome, Edge, and Safari scrollbar */
.picker-grid::-webkit-scrollbar {
    width: 6px;
    display: block !important;
}

.picker-grid::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.05);
    border-radius: 10px;
}

.picker-grid::-webkit-scrollbar-thumb {
    background-color: var(--primary);
    border-radius: 10px;
}

.picker-group {
    margin-bottom: 1.5rem;
    position: relative;
}

.picker-group:not(:last-child) {
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    padding-bottom: 1rem;
}

.picker-group label {
    position: sticky;
    top: 0;
    background: var(--card); 
    padding: 5px 0;
    z-index: 2;
    color: var(--primary);
    font-size: 0.7rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 1.5px;
}

.scroll-hint {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px 0;
    color: var(--primary);
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 1px;
    opacity: 0.8;
    animation: pulse 2s infinite;
}

.mouse-icon {
    width: 14px;
    height: 22px;
    border: 2px solid var(--primary);
    border-radius: 10px;
    position: relative;
}

.wheel {
    width: 2px;
    height: 4px;
    background: var(--primary);
    position: absolute;
    top: 4px;
    left: 50%;
    transform: translateX(-50%);
    animation: scroll-wheel 1.5s infinite;
}

@keyframes scroll-wheel {
    0% { opacity: 1; top: 4px; }
    100% { opacity: 0; top: 12px; }
}

@keyframes pulse {
    0%, 100% { opacity: 0.5; }
    50% { opacity: 1; }
}

.chip-container {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    padding-top: 0.5rem;
}

.food-chip {
    padding: 6px 12px;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--border);
    border-radius: 8px;
    font-size: 0.8rem;
    cursor: pointer;
    transition: all 0.2s ease;
    white-space: nowrap;
}

.food-chip:hover {
    background: rgba(16, 185, 129, 0.1);
    border-color: var(--primary);
}

.food-chip.selected {
  background: var(--ring);
  color: #000;
  font-weight: 700;
  border-color: var(--ring);
}

/* ==========================================
                    MEAL PLAN 
   =========================================*/

/* --- Day Container --- */
.day-block {
  background: var(--muted);
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 18px;
  margin: 1rem auto 1rem;
  overflow: hidden;
  transition: all 0.25s ease;
}

.day-block.open {
  border-color: var(--ring);
  box-shadow: 0 10px 30px rgba(0,0,0,0.25);
}

/* --- Header --- */
.day-header {
  padding: 1.4rem 1.6rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  cursor: pointer;
}

.day-info {
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.day-label {
  font-weight: 900;
  font-size: 1.05rem;
  letter-spacing: 0.5px;
}

.day-summary {
  font-size: 0.75rem;
  color: var(--soft);
}

.day-toggle {
  font-size: 0.9rem;
  opacity: 0.6;
  transition: transform 0.25s ease;
}

.day-block.open .day-toggle {
  transform: rotate(180deg);
}

/* --- Grid --- */
.meal-grid-container {
  max-width: 100%;
  display: none;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 1rem;
  padding: 1.5rem;
}

.day-block.open .meal-grid-container {
  display: grid;
}

/* --- Meal Card --- */
.meal-card {
  background: linear-gradient(145deg, rgba(180, 220, 255, 0.15), rgba(100, 160, 230, 0.12));
  border-radius: 14px;
  padding: 1.1rem;
  position: relative;
  display: flex;
  flex-direction: column;
  transition: all 0.25s ease;
}

.meal-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 8px 20px rgba(0,0,0,0.35);
}

/* accent line */
.meal-card::before {
  content:"";
  position:absolute;
  top:0;
  left:0;
  width:4px;
  height:100%;
  background: linear-gradient(to bottom, var(--primary), transparent);
  border-radius: 4px 0 0 4px;
}

/* --- Header --- */
.meal-card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.8rem;
}

.meal-name {
  font-weight: 800;
  font-size: 0.85rem;
  letter-spacing: 0.3px;
  color: var(--primary);
}

.meal-cal-badge {
  font-size: 0.7rem;
  padding: 3px 8px;
  border-radius: 999px;
  background: var(--bg);
  color: #f09b0a; /* Orange Yellow*/
  font-weight: 700;
}

/* --- Items --- */
.meal-items {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.meal-item-row {
  display: flex;
  align-items: center;
  font-size: 0.8rem;
  gap: 8px;
  color: var(--primary);
}

.item-dot {
  width: 5px;
  height: 5px;
  background: var(--primary);
  border-radius: 50%;
  opacity: 0.7;
}

.item-name {
  flex: 1;
  color: var(--text);
  font-weight: 510;
}

.item-weight {
  font-weight: 700;
  font-size: 0.75rem;
  opacity: 0.9;
}

/* subtle divider */
.meal-item-row:not(:last-child) {
  border-bottom: 1px dashed rgba(255,255,255,0.05);
  padding-bottom: 4px;
}

/* =========================
   RESPONSIVE
========================= */

@media (max-width: 1024px) {
  .meal-grid-container {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 600px) {
  .meal-grid-container {
    grid-template-columns: 1fr;
  }

  .day-header {
    padding: 1.2rem;
  }
}

/* =========================
   GROCERY
========================= */

.grocery-card {
    margin-top: 2rem;
    padding: 2rem;
    background: var(--muted);
    border-radius: 1.5rem;
    border: 1px solid var(--border);
}

.grocery-title {
    text-align: center;
    font-size: 1.2rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 2px;
    color: var(--primary);
    margin: 0 auto 1.5rem;
    border-bottom: 1px solid var(--border);
    padding-bottom: 1rem;
}

.grocery-grid {
    column-count: 3;
    column-gap: 3rem;
    column-rule: 1px solid rgba(255, 255, 255, 0.05);
}

.grocery-item {
    display: flex;
    align-items: center;
    margin-bottom: 0.7rem;
    break-inside: avoid;
    font-size: 0.9rem;
}

.grocery-name {
    color: var(--soft);
    font-weight: 500;
    white-space: nowrap;
}

/* The "Gap Filler" Dotted Line */
.grocery-item::after {
    content: "";
    flex-grow: 1; 
    border-bottom: 1px dotted rgba(255, 255, 255, 0.15);
    margin: 0 10px;
    position: relative;
    top: -4px; 
}

.grocery-amount {
    color: var(--primary);
    font-weight: 800;
    font-family: 'Inter', monospace;
    min-width: 45px;
    text-align: right;
}

/* Responsive Scaling */
@media (max-width: 1100px) {
    .grocery-grid { column-count: 2; }
}

@media (max-width: 700px) {
    .grocery-grid { column-count: 1; }
    .grocery-title { font-size: 1rem; }
}

/* =========================
   SEO (UNCHANGED)
========================= */

.card { margin-top: 2rem; }

.seo-section h2 {
  font-size: 1.6rem;
  font-weight: 800;
  margin-bottom: 1rem;
}

.seo-highlight {
  background: var(--muted);
  padding: 1rem 1.4rem;
  border-radius: 0.8rem;
  margin-top: 1rem;
}

.seo-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 1rem;
  margin-top: 1rem;
}

.seo-box {
  background: var(--muted);
  padding: 1rem;
  border-radius: 0.8rem;
}

.seo-table {
  margin-top: 1rem;
  border-radius: 0.8rem;
  overflow: hidden;
  border: 1px solid var(--border);
}

.seo-row {
  display: grid;
  grid-template-columns: 1fr 1.5fr 2fr;
  padding: 0.8rem;
  border-bottom: 1px solid var(--border);
}

.seo-header {
  background: var(--muted);
  font-weight: 800;
}

/* =========================
       MOBILE (≤520px)
========================= */
@media (max-width: 520px) {

  .calorie-container {
    max-width: none !important; 
    width: 98% !important;
    padding: 1rem !important;
    margin: 1rem auto 1rem !important;
    border-radius: 1rem !important;
    box-shadow: 0 3px 10px rgba(0,0,0,0.15) !important;
  }

  /* Headings & Text */
  .calorie-container h1 {
    font-size: 1.4rem !important;
    font-weight: 900;
    letter-spacing: -0.02em;
    line-height: 1.3 !important;
    text-align: center !important;
  }

  .calorie-container p {
    font-size: 0.92rem !important;
    font-weight: 550 !important;
    line-height: 1.55 !important;
    text-align: center !important;
    margin-bottom: 1rem !important;
  }

  .section-title {
    font-size: 0.8rem;
    font-weight: 900;
    letter-spacing: 0.08em;
    text-align: center;
  }

  /* =========================
           INPUTS 
  ========================= */
  .calorie-form input,
  .calorie-form select {
    padding: 0.75rem 0.8rem !important;
    font-size: 0.95rem !important;
    min-height: 46px;
    border-radius: 10px;
  }

  .input-grid {
    gap: 10px;
  }

  /* =========================
     DASHBOARD
  ========================= */
  .big-cal strong {
    font-size: 2.3rem;
    line-height: 1.1;
  }

  .insights-panel {
    grid-template-columns: 1fr 1fr;
    gap: 0.6rem;
  }

  .insight-block {
    display: grid;
    gap: 10px;
    padding: 0.9rem;
    font-size: 0.82rem;
  }

  .insight-block strong {
    margin-left: 0px; 
    display: inline-block; 
  }

  /* =========================
     MACRO BUTTONS (STACKED CARDS)
  ========================= */
  .macro-cards {
    grid-template-columns: 1fr 1fr 1fr;
    gap: 4px;
  }

  .macro-btn {
    flex-direction: row;
    justify-content: space-between;
    align-items: center;
    padding: 0.5rem 0.5rem;
  }

  .macro-btn .m-title {
    font-size: 0.8rem;
  }

  .macro-btn .m-desc {
    font-size: 0.6rem;
  }

  /* =========================
     CTA (STICKY = HUGE UX BOOST)
  ========================= */
  .generate-btn {
    position: sticky;
    bottom: 10px;
    width: 100%;
    margin: 1rem 0 0 !important;
    padding: 0.9rem;
    font-size: 0.95rem;
    border-radius: 12px;
    z-index: 10;
    justify-content: center;
  }

  /* =========================
          FOOD PICKER 
  ========================= */
  .food-picker-container {
    max-height: 420px;
  }

  .food-picker-container h3 {
      margin: 0rem;
  }

  .food-picker-container p {
      margin: 0.2rem;
  }

  .scroll-hint {
      display: flex;
      align-items: center;
      justify-content: center;
      gap: 8px;
      padding: 0;
      color: var(--primary);
      font-size: 0.7rem;
      text-transform: uppercase;
      letter-spacing: 1px;
      opacity: 0.8;
      animation: pulse 2s infinite;
  }

  .picker-grid {
    padding-right: 4px;
  }

  .food-chip {
    font-size: 0.75rem;
    padding: 6px 10px;
    border-radius: 8px;
  }

  .picker-group label {
    font-size: 0.8rem;
    letter-spacing: 1px;
  }

  /* =========================
              MEALS 
  ========================= */
  .meal-grid-container {
    grid-template-columns: 1fr 1fr !important;
    gap: 0.5rem;
    padding: .5rem;
  }

  .day-block {
    margin: 0.8rem 0;
    border-radius: 14px;
  }

  .day-header {
    padding: .5rem;
  }

  .day-label {
    font-size: 0.75rem;
  }

  .day-summary {
    font-size: 0.65rem;
  }

  .meal-card {
    padding: 0.5rem;
    border-radius: 6px;
  }

  .meal-name {
    font-size: 0.7rem;
  }

  .meal-cal-badge {
    font-size: 0.55rem;
  }

  .meal-item-row {
    font-size: 0.75rem;
  }

  /* =========================
   WEEKLY PLAN
  ========================= */

  .plan-table {
    margin-top:1rem;
    display:grid;
    grid-template-columns: 1fr 1fr 1fr 1fr!important;
    gap:.5rem;
  }

  .plan-table div {
    background:var(--muted);
    padding:.6rem;
    border-radius:8px;
    text-align:center;
    font-size: .8rem;
    font-weight:900;
    margin-bottom: 1rem;
  }

  /* =========================
              RESULTS
  ========================= */
  #resultsWrapper {
    animation: fadeIn 0.4s ease-out;
}

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

  /* =========================
     GROCERY (CLEAN LIST MODE)
  ========================= */
  .grocery-card {
    padding: 1.4rem;
  }

  .grocery-title {
    font-size: 0.75rem;
    letter-spacing: .5px;
  }

  .grocery-grid {
    max-height: 300px;
    column-count: 2;
    column-gap: 0;
    overflow: auto;
  }

  .grocery-item {
    font-size: 0.7rem;
    margin-bottom: 0.6rem;
  }

  /* =========================
     SEO (CLEAN STACK)
  ========================= */
  .seo-row {
    grid-template-columns: 1fr;
    gap: 0.3rem;
    padding: 0.6rem;
  }

  .seo-header {
    display: none;
  }

  .seo-section h2 {
    font-size: 1.25rem;
  }

  .card {
    padding: 1rem !important;
    margin-bottom: 1rem !important;
  }

  .card h2 {
    font-size: 1.15rem !important;
    text-align: center !important;
    margin-bottom: 0.5rem !important;
  }

  .card p,
  .card li {
    font-size: 0.9rem !important;
    line-height: 1.5 !important;
  }

  /* =========================
     TOUCH FEEDBACK
  ========================= */
  button, .food-chip {
    -webkit-tap-highlight-color: transparent;
  }

  button:active,
  .food-chip:active {
    transform: scale(0.97);
  }

  /* =========================
     FOCUS (ACCESSIBILITY)
  ========================= */
  input:focus, 
  select:focus, 
  button:focus {
    outline: 2px solid var(--ring);
    outline-offset: 1px;
  }
}