/* Minimalist Monochrome Single-Screen Dashboard */

/* 1. Imports & Fonts */
@import url('https://fonts.googleapis.com/css2?family=JetBrains+Mono:wght@400;500&family=Playfair+Display:wght@700&family=Source+Serif+4:wght@400;600&display=swap');

/* 2. Design Tokens */
:root {
    --bg: #FFFFFF;
    --fg: #000000;
    --border-color: #000000;
    
    --font-display: "Playfair Display", serif;
    --font-body: "Source Serif 4", serif;
    --font-mono: "JetBrains Mono", monospace;
    
    --border-thin: 1px solid var(--border-color);
    --border-thick: 3px solid var(--border-color);
}

/* 3. Global Reset */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    border-radius: 0 !important;
}

body {
    background-color: var(--bg);
    color: var(--fg);
    font-family: var(--font-body);
    height: 100vh;
    width: 100vw;
    overflow: hidden; /* No page scroll */
    display: flex;
    flex-direction: column;
}

/* 4. Top Bar (Header + Controls + Stats) */
header.site-header {
    flex: 0 0 auto;
    border-bottom: var(--border-thick);
    padding: 0.75rem 1.5rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: var(--bg);
    z-index: 10;
}

.header-left {
    display: flex;
    align-items: center;
    gap: 1.5rem;
}

.site-title {
    font-family: var(--font-display);
    font-size: 1.5rem;
    line-height: 1;
    text-transform: uppercase;
    letter-spacing: -0.02em;
}

.site-subtitle {
    font-family: var(--font-mono);
    font-size: 0.75rem;
    border: var(--border-thin);
    padding: 0.2rem 0.5rem;
}

.date-badge {
    font-family: var(--font-mono);
    font-size: 0.75rem;
    background: var(--fg);
    color: var(--bg);
    padding: 0.2rem 0.6rem;
}

.controls-area {
    display: flex;
    align-items: center;
    gap: 1.5rem;
    margin-bottom: 0; /* Override old style */
}

.filter-bar {
    display: flex;
    gap: 0.5rem;
}

/* Buttons */
.btn, .filter-btn {
    font-family: var(--font-mono);
    font-size: 0.7rem;
    text-transform: uppercase;
    cursor: pointer;
    background: transparent;
    border: var(--border-thin);
    color: var(--fg);
    padding: 0.3rem 0.8rem;
    transition: all 0s;
}

.btn:hover, .filter-btn:hover, .filter-btn.active {
    background: var(--fg);
    color: var(--bg);
}

.btn-primary {
    background: var(--fg);
    color: var(--bg);
    font-weight: bold;
}

.btn-primary:hover {
    background: var(--bg);
    color: var(--fg);
}

/* 5. Main Content (Split Screen) */
.container {
    flex: 1;
    display: flex;
    flex-direction: row;
    width: 100%;
    max-width: 100%;
    padding: 0;
    margin: 0;
    overflow: hidden;
}

.locations-grid {
    display: flex;
    flex: 1;
    width: 100%;
    height: 100%;
}

.location-card {
    flex: 1;
    display: flex;
    flex-direction: column;
    border-right: var(--border-thick);
    height: 100%;
    overflow: hidden;
    background: var(--bg);
    padding: 0;
    transition: none;
    box-shadow: none;
}

.location-card:last-child {
    border-right: none;
}

.location-card:hover {
    transform: none;
    box-shadow: none;
    border: none;
    border-right: var(--border-thick);
}

.location-card:last-child:hover {
    border-right: none;
}

.location-header {
    flex: 0 0 auto;
    padding: 1rem 1.5rem;
    border-bottom: var(--border-thin);
    background: var(--fg);
    color: var(--bg);
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0;
}

.location-header h2 {
    font-size: 1.25rem;
    margin: 0;
    color: var(--bg);
}

/* Scrollable Menu Area */
.menu-scroll-area {
    flex: 1;
    overflow-y: auto;
    padding: 1.5rem;
}

/* Hide scrollbar but keep functionality */
.menu-scroll-area::-webkit-scrollbar {
    width: 6px;
}
.menu-scroll-area::-webkit-scrollbar-thumb {
    background: var(--fg);
}
.menu-scroll-area::-webkit-scrollbar-track {
    background: var(--bg);
    border-left: 1px solid var(--fg);
}

.meal-section {
    margin-bottom: 2rem;
}

.meal-title {
    font-family: var(--font-mono);
    font-size: 0.9rem;
    font-weight: bold;
    text-transform: uppercase;
    border-bottom: var(--border-thick);
    padding-bottom: 0.25rem;
    margin-bottom: 1rem;
    display: block; /* Remove old flex/icon */
    background: transparent;
    color: var(--fg);
}

.meal-title::before { content: none !important; }

.category-section {
    margin-bottom: 1.5rem;
    padding-left: 0;
    border-left: none;
}

.category-title {
    font-size: 0.9rem;
    font-weight: bold;
    font-style: italic;
    color: var(--fg);
    margin-bottom: 0.5rem;
    text-decoration: underline;
}

.menu-list {
    list-style: none;
}

.menu-item {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    padding: 0.4rem 0;
    border-bottom: 1px dotted #999;
    background: transparent;
    margin-bottom: 0;
}

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

.menu-item:hover {
    background: #000;
    color: #fff;
    padding-left: 0.5rem;
    padding-right: 0.5rem;
    border-bottom: 1px solid #000;
}

.item-name {
    font-size: 0.9rem;
    font-weight: 500;
    color: inherit;
}

.protein-tag {
    font-family: var(--font-mono);
    font-size: 0.6rem;
    border: 1px solid currentColor;
    padding: 0.1rem 0.3rem;
    margin-left: 0.5rem;
}

/* 6. Footer / Status */
.update-info {
    display: none; /* Hide footer to save space */
}

.status-bar {
    font-family: var(--font-mono);
    font-size: 0.7rem;
    position: fixed;
    bottom: 0;
    right: 0;
    background: var(--fg);
    color: var(--bg);
    padding: 0.2rem 0.5rem;
    z-index: 100;
}

.empty-state {
    padding: 2rem;
    text-align: center;
}

/* Stats (Top Right) */
.stats-bar {
    border: none;
    margin: 0;
    background: transparent;
    color: var(--fg);
    display: flex;
    gap: 1.5rem;
}

.stat-item {
    padding: 0;
    border: none;
    text-align: right;
    background: transparent;
}

.stat-value {
    font-size: 1.2rem;
    font-weight: bold;
    display: inline-block;
}

.stat-label {
    font-size: 0.6rem;
    display: block;
    line-height: 1;
}

/* Hide unused elements from previous template structure if needed via CSS */
.container > header,
.container > .update-info {
    /* We are restyling the existing HTML structure, so we need to target correctly */
}

/*
   Adapt existing HTML structure to this layout:
   The existing HTML has:
   .container
     header.site-header
     .controls-area
     .stats-bar
     .locations-grid
     footer.update-info
*/

/* Re-layout the container children for grid */
body > .container {
    display: grid;
    grid-template-rows: auto auto 1fr auto;
    width: 100vw;
    height: 100vh;
    max-width: none;
    padding: 0;
}

/* Force header to be row 1 */
/* .site-header { display: none; } REMOVED */

/* We need to be clever with the existing HTML structure which is:
   <div class="container">
      <header>...</header>
      <div class="controls-area">...</div>
      <div class="stats-bar">...</div>
      <div class="locations-grid">...</div>
      <footer>...</footer>
   </div>
*/

/* Redefine Layout Strategy for existing HTML */

.container {
    display: flex;
    flex-direction: column;
    height: 100vh;
    padding: 0 !important;
}

/* 1. COMPACT HEADER AREA */
/* Combine header, controls, and stats visually into one top bar */
header.site-header {
    display: flex;
    flex-direction: row;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 2rem;
    margin-bottom: 0;
    border-bottom: var(--border-thick);
    height: auto;
    background: #fff;
}

.site-title {
    font-size: 1.5rem;
    margin-bottom: 0;
    text-align: left;
    line-height: 1;
}

.site-title br { display: none; }
.site-title::after { content: " PROVISIONS"; }

.site-subtitle, .date-badge, header p {
    display: none; /* Hide clutter */
}

/* 2. CONTROLS BAR */
.controls-area {
    padding: 0.5rem 2rem;
    border-bottom: var(--border-thin);
    margin-bottom: 0;
    background: #fff;
    justify-content: space-between;
}

.filter-bar {
    gap: 0; /* Attach buttons */
}

.filter-btn {
    border-right: none;
}
.filter-btn:last-child {
    border-right: var(--border-thin);
}

.stats-bar {
    display: none; /* Hide stats bar to save vertical space, or move it */
}

/* 3. MAIN CONTENT GRID */
.locations-grid {
    flex: 1;
    display: flex; /* Side by side */
    gap: 0;
    overflow: hidden; /* Prevent grid scroll */
}

.location-card {
    flex: 1;
    border: none;
    border-right: var(--border-thick);
    border-radius: 0;
    padding: 0;
    margin: 0;
    display: flex;
    flex-direction: column;
    background: #fff;
    backdrop-filter: none;
    box-shadow: none;
    transition: none;
}

.location-card:last-child {
    border-right: none;
}

.location-card:hover {
    transform: none;
    box-shadow: none;
}

.location-header {
    margin: 0;
    padding: 1rem;
    background: #000;
    color: #fff;
    border-bottom: none;
}

.location-header h2 {
    color: #fff;
    font-size: 1.2rem;
    font-style: normal;
    text-transform: uppercase;
    font-weight: 700;
}

/* Location content wrapper */
/* We need to make the content inside scrollable */
.location-card > div:not(.location-header) {
    /* This targets the meal sections */
    /* Since there isn't a wrapper div in the HTML for content, we target the card itself for scrolling?
       Wait, the HTML structure is:
       .location-card
          .location-header
          .meal-section (multiple)
    */
    /* display: none; REMOVED */
}

/* Fix: The HTML has multiple .meal-section children.
   We will make .location-card overflow-y: auto */
.location-card {
    overflow-y: auto;
}

/* Sticky Header inside card */
.location-header {
    position: sticky;
    top: 0;
    z-index: 5;
}

/* Adjust meal sections */
.meal-section {
    padding: 1.5rem;
    margin-bottom: 0;
    border-bottom: var(--border-thick);
}

.meal-title {
    font-size: 1rem;
    background: transparent;
    padding: 0;
    margin-bottom: 1rem;
    color: #000;
}
.meal-title::before { display: none; }

.category-section {
    margin-bottom: 1.5rem;
    padding-left: 0;
    border-left: none;
}

.category-title {
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: #000;
    border-bottom: 1px solid #000;
    display: inline-block;
    margin-bottom: 0.5rem;
}

.menu-item {
    padding: 0.25rem 0;
    background: transparent;
    border-left: none;
    margin-bottom: 0;
}

.menu-item:hover {
    background: #000;
    color: #fff;
    transform: none;
    padding-left: 0.5rem;
    padding-right: 0.5rem;
}

.update-info {
    display: none;
}

/* Mobile */
@media (max-width: 768px) {
    .container {
        height: auto;
        overflow: auto;
    }
    .locations-grid {
        flex-direction: column;
    }
    .location-card {
        border-right: none;
        border-bottom: var(--border-thick);
        height: auto;
    }
    header.site-header {
        flex-direction: column;
        gap: 1rem;
    }
}

/* Menu-first controls and responsive status treatment. */
body > .container { display: flex; flex-direction: column; min-height: 0; height: 100dvh; }
.site-title::after { content: none; }
.site-subtitle, .date-badge { display: inline-block; }
.locations-grid { min-height: 0; height: auto; }
.location-card { min-width: 0; min-height: 0; overflow: hidden; }
.location-header .freshness { display: block; }
.meal-section { padding: 1rem; border-bottom: none; }
.meal-title { margin-bottom: .75rem; }
.category-section { margin-bottom: 1rem; }
.protein-filters, .controls-area, .refresh-status { flex-shrink: 0; }
.protein-filters .filter-btn { border: var(--border-thin); flex-shrink: 0; }
.btn, .meal-btn, .filter-btn { min-height: 36px; }
button:focus-visible, input:focus-visible { outline: 3px solid #bf5700; outline-offset: 3px; }
.btn:disabled { cursor: wait; opacity: .65; }
.brand { display: flex; align-items: baseline; gap: 1rem; }
.controls-area { flex-wrap: wrap; }
.meal-switcher, .protein-filters, .control-actions { display: flex; align-items: center; gap: .35rem; }
.meal-btn { font: 500 .72rem var(--font-mono); text-transform: uppercase; border: var(--border-thin); background: transparent; padding: .45rem .7rem; cursor: pointer; }
.meal-btn.active, .meal-btn:hover { background: var(--fg); color: var(--bg); }
.staple-toggle { display: flex; align-items: center; gap: .4rem; font: .7rem var(--font-mono); white-space: nowrap; }
.staple-toggle input { accent-color: #000; }
.protein-filters { padding: .35rem 2rem; border-bottom: var(--border-thin); overflow-x: auto; white-space: nowrap; }
.filter-label { font: .65rem var(--font-mono); text-transform: uppercase; margin-right: .25rem; }
.refresh-status { min-height: 0; padding: 0 2rem; font: .7rem var(--font-mono); }
.refresh-status.is-error { padding-top: .4rem; padding-bottom: .4rem; color: #900; background: #fff4f4; }
.location-body { flex: 1; min-height: 0; overflow-y: auto; }
.location-header { padding: .75rem 1rem; }
.location-header h2 { font-size: 1.1rem; }
.freshness { font: .62rem var(--font-mono); opacity: .8; margin-top: .25rem; }
.status-chip { font: .58rem var(--font-mono); text-transform: uppercase; border: 1px solid currentColor; padding: .2rem .35rem; }
.status-error { color: #ffb3b3; }
.status-empty, .status-unavailable { color: #ddd; }
.hall-message, .hall-empty { margin: 1rem; padding: .75rem; border: var(--border-thin); font: .75rem var(--font-mono); }
.error-message { color: #900; border-color: #900; }
.refresh-status.is-partial { padding-top: .4rem; padding-bottom: .4rem; background: #fff7e6; color: #754600; }
.item-description { font-size: .72rem; opacity: .7; margin-top: .15rem; }
.menu-item[hidden], .meal-section[hidden], .hall-empty[hidden] { display: none !important; }
*[hidden] { display: none !important; }
@media (max-width: 768px) {
  body { overflow: auto; height: auto; }
  body > .container { min-height: 100dvh; height: auto; overflow: visible; }
  header.site-header { padding: .75rem 1rem; align-items: flex-start; }
  .brand { flex-wrap: wrap; gap: .4rem .75rem; }
  .controls-area, .protein-filters { padding-left: 1rem; padding-right: 1rem; }
  .control-actions { width: 100%; justify-content: space-between; }
  .controls-area { position: sticky; top: 0; z-index: 20; gap: .5rem; }
  .btn, .meal-btn, .filter-btn { min-height: 44px; }
  .locations-grid { overflow: visible; }
  .location-card { min-height: 0; flex: none; overflow: visible; }
  .location-header { position: static; }
  .location-body { overflow: visible; }
}
