/* ==========================================================================
   Mensa Kiosk Dashboard - Lean Production Stylesheet
   Theme: High-Legibility Dark Theme (100% Scroll-Free, Sweet-Spot Scaling)
   ========================================================================== */

:root {
  /* Surfaces & Backgrounds */
  --bg-page: #0b0f19;
  --bg-header: #111827;
  --bg-column: rgba(22, 32, 50, 0.65);
  --bg-card: #162032;
  --bg-card-hover: #1c2a42;
  --bg-card-selected: rgba(56, 189, 248, 0.16);
  --bg-drawer: #0f192b;

  /* Borders & Outlines */
  --border-subtle: rgba(255, 255, 255, 0.08);
  --border-card: #23334d;
  --border-header: #1f293d;

  /* Typography Colors */
  --text-primary: #f8fafc;
  --text-secondary: #94a3b8;
  --text-muted: #64748b;

  /* Accent & Highlight Colors */
  --color-accent-blue: #38bdf8;
  --color-accent-emerald: #34d399;
  --color-accent-purple: #c084fc;
  --color-accent-amber: #fbbf24;

  /* Dietary Badges */
  --badge-vegan-text: #10b981;
  --badge-vegan-bg: rgba(16, 185, 129, 0.16);
  --badge-veggie-text: #f59e0b;
  --badge-veggie-bg: rgba(245, 158, 11, 0.16);
  --badge-fish-text: #06b6d4;
  --badge-fish-bg: rgba(6, 182, 212, 0.16);
}

/* Base Reset & Lock */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  /* Sweet-Spot Basis-Skalierung (optimal lesbar aus 3-5m Distanz) */
  font-size: clamp(17px, 1.06vw, 19.5px);
}

body {
  width: 100vw;
  height: 100vh;
  overflow: hidden;
  background-color: var(--bg-page);
  color: var(--text-primary);
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  user-select: none;
  -webkit-font-smoothing: antialiased;
  display: flex;
  flex-direction: column;
}

body.idle {
  cursor: none;
}

/* ==========================================================================
   1. Top Header Bar
   ========================================================================== */
.header {
  height: 75px;
  flex-shrink: 0;
  background: var(--bg-header);
  border-bottom: 2px solid var(--border-header);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 30px;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.4);
  z-index: 10;
}

.title-group {
  display: flex;
  flex-direction: column;
}

.institution-subline {
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  color: var(--color-accent-blue);
  text-transform: uppercase;
}

.canteen-title-row {
  display: flex;
  align-items: center;
  gap: 12px;
}

.canteen-title-row h1 {
  font-size: clamp(1.52rem, 1.9vw, 2.15rem);
  font-weight: 800;
  letter-spacing: -0.02em;
  color: #fff;
  line-height: 1.1;
}

.status-pill {
  font-size: 0.78rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  padding: 2px 10px;
  border-radius: 9999px;
  background: rgba(16, 185, 129, 0.2);
  color: #34d399;
  border: 1px solid rgba(16, 185, 129, 0.4);
}

.status-pill.mode-tomorrow {
  background: rgba(245, 158, 11, 0.2);
  color: #fbbf24;
  border-color: rgba(245, 158, 11, 0.4);
}

.status-pill.mode-next_week {
  background: rgba(192, 132, 252, 0.2);
  color: #c084fc;
  border-color: rgba(192, 132, 252, 0.4);
}

.date-text {
  font-size: clamp(1.05rem, 1.25vw, 1.4rem);
  color: var(--text-primary);
  font-weight: 600;
}

.header-right {
  display: flex;
  align-items: center;
  gap: 18px;
}

.live-clock {
  font-size: clamp(2.15rem, 2.7vw, 3.25rem);
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.02em;
  color: #fff;
  text-shadow: 0 0 14px rgba(255, 255, 255, 0.18);
}

.offline-notice {
  background: #991b1b;
  color: #fff;
  text-align: center;
  padding: 7px 15px;
  font-weight: 700;
  font-size: 0.95rem;
  flex-shrink: 0;
}

.hidden {
  display: none !important;
}

/* Loading Overlay */
.loading-overlay {
  position: absolute;
  top: 75px;
  left: 0;
  right: 0;
  bottom: 37px;
  background: rgba(11, 15, 25, 0.92);
  backdrop-filter: blur(8px);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  z-index: 50;
  gap: 12px;
  font-size: 1.05rem;
}

.spinner {
  width: 42px;
  height: 42px;
  border: 4px solid #1e293b;
  border-top-color: var(--color-accent-blue);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* ==========================================================================
   2. Main Grid Layout (2, 3 oder 4 Spalten, 100% Scroll-Frei)
   ========================================================================== */
.main-content {
  flex: 1;
  min-height: 0;
  padding: 10px 22px;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 15px;
  overflow: hidden;
}

.main-content.cols-1 { grid-template-columns: 1fr; max-width: 600px; margin: 0 auto; }
.main-content.cols-2 { grid-template-columns: repeat(2, 1fr); }
.main-content.cols-3 { grid-template-columns: repeat(3, 1fr); }
.main-content.cols-4 {
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
  padding: 10px 16px;
}

/* 4-Spalten Typografie-Anpassungen */
.main-content.cols-4 .category-column { padding: 9px 12px; }
.main-content.cols-4 .category-title { font-size: clamp(1.02rem, 1.15vw, 1.35rem); }
.main-content.cols-4 .meal-card { padding: 6px 9px; gap: 8px; }
.main-content.cols-4 .meal-title { font-size: clamp(0.88rem, 0.98vw, 1.12rem); margin-bottom: 3px; }
.main-content.cols-4 .nutrition-strip { font-size: 0.68rem; padding: 1px 5px; gap: 4px; }
.main-content.cols-4 .badge { font-size: 0.68rem; padding: 1px 5px; }
.main-content.cols-4 .price-student { font-size: clamp(1.2rem, 1.4vw, 1.62rem); }
.main-content.cols-4 .price-staff { font-size: clamp(0.68rem, 0.74vw, 0.85rem); }
.main-content.cols-4 .sides-box { height: 128px; }
.main-content.cols-4 .side-chip { font-size: 0.76rem; padding: 2px 6px; }

.category-column {
  background: var(--bg-column);
  border: 1px solid var(--border-card);
  border-radius: 15px;
  padding: 11px 15px;
  display: flex;
  flex-direction: column;
  height: 100%;
  min-height: 0;
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.25);
  backdrop-filter: blur(8px);
  overflow: hidden;
}

.category-header {
  height: 44px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-bottom: 7px;
  margin-bottom: 7px;
  border-bottom: 1px solid var(--border-subtle);
  flex-shrink: 0;
}

.category-title {
  font-size: clamp(1.15rem, 1.38vw, 1.58rem);
  font-weight: 800;
  letter-spacing: -0.01em;
  color: #fff;
  display: flex;
  align-items: center;
  gap: 9px;
}

.category-title::before {
  content: "";
  display: inline-block;
  width: 7px;
  height: 20px;
  border-radius: 3px;
  background: var(--color-accent-blue);
}

.theme-life .category-title::before { background: var(--color-accent-emerald); }
.theme-pasta .category-title::before { background: var(--color-accent-purple); }
.theme-classic .category-title::before { background: var(--color-accent-blue); }
.theme-aktion .category-title::before { background: var(--color-accent-amber); }

.category-badge-count {
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--text-muted);
  background: rgba(255, 255, 255, 0.06);
  padding: 2px 9px;
  border-radius: 999px;
}

.mains-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  flex: 1;
  min-height: 0;
  overflow: hidden;
  justify-content: flex-start;
}

/* ==========================================================================
   3. Meal Card & Typography
   ========================================================================== */
.meal-card {
  position: relative;
  background: var(--bg-card);
  border: 1px solid var(--border-card);
  border-radius: 10px;
  padding: 8px 12px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  flex-shrink: 0;
  cursor: pointer;
  transition: transform 0.1s ease, border-color 0.15s ease, background 0.15s ease;
}

.meal-card:hover {
  border-color: rgba(56, 189, 248, 0.45);
  background: var(--bg-card-hover);
}

.meal-card:active {
  transform: scale(0.99);
}

.meal-card.selected {
  border-color: var(--color-accent-blue);
  background: var(--bg-card-selected);
  box-shadow: 0 0 11px rgba(56, 189, 248, 0.3);
}

.meal-main {
  flex: 1;
  min-width: 0;
}

.meal-title {
  font-size: clamp(1.0rem, 1.18vw, 1.32rem);
  font-weight: 700;
  line-height: 1.22;
  color: var(--text-primary);
  margin-bottom: 4px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.meal-meta {
  display: flex;
  align-items: center;
  gap: 7px;
  flex-wrap: wrap;
}

/* Nährwert-Strip: Startet ganz links */
.nutrition-strip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border-subtle);
  border-radius: 4px;
  padding: 1px 7px;
  font-size: 0.74rem;
  color: var(--text-secondary);
  white-space: nowrap;
}

.nutri-cal {
  color: var(--color-accent-amber);
  font-weight: 700;
}

.nutri-sep {
  opacity: 0.35;
  font-size: 0.65rem;
}

/* Badges & Allergene */
.badge {
  font-size: 0.74rem;
  font-weight: 700;
  padding: 2px 6px;
  border-radius: 4px;
  display: inline-flex;
  align-items: center;
  gap: 3px;
  white-space: nowrap;
}

.badge-vegan {
  background: var(--badge-vegan-bg);
  color: var(--badge-vegan-text);
  border: 1px solid rgba(16, 185, 129, 0.3);
}

.badge-veggie {
  background: var(--badge-veggie-bg);
  color: var(--badge-veggie-text);
  border: 1px solid rgba(245, 158, 11, 0.3);
}

.badge-fish {
  background: var(--badge-fish-bg);
  color: var(--badge-fish-text);
  border: 1px solid rgba(6, 182, 212, 0.3);
}

.additives-tag {
  font-size: 0.72rem;
  color: var(--text-muted);
  font-weight: 500;
  white-space: nowrap;
}

.meal-price-box {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  text-align: right;
  flex-shrink: 0;
  min-width: 80px;
}

.price-student {
  font-size: clamp(1.38rem, 1.68vw, 1.98rem);
  font-weight: 800;
  color: var(--color-accent-blue);
  font-variant-numeric: tabular-nums;
  line-height: 1;
}

.price-staff {
  font-size: clamp(0.75rem, 0.86vw, 0.96rem);
  color: var(--text-muted);
  margin-top: 2px;
  font-weight: 600;
}

/* ==========================================================================
   4. Tagesbeilagen & Saucen (Horizontale Baseline-Ausrichtung)
   ========================================================================== */
.sides-box {
  height: 128px;
  flex-shrink: 0;
  margin-top: auto;
  padding-top: 7px;
  border-top: 1px solid var(--border-subtle);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.sides-header {
  font-size: 0.76rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
  margin-bottom: 5px;
  display: flex;
  align-items: center;
  gap: 5px;
  flex-shrink: 0;
}

.sides-chips {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  align-content: flex-start;
  overflow-y: hidden;
}

.side-chip {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border-subtle);
  border-radius: 5px;
  padding: 3px 8px;
  font-size: 0.82rem;
  color: #cbd5e1;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  cursor: pointer;
  transition: all 0.15s ease;
}

.side-chip:hover {
  border-color: rgba(56, 189, 248, 0.4);
  background: rgba(255, 255, 255, 0.08);
}

.side-chip.selected {
  background: rgba(56, 189, 248, 0.22);
  border-color: var(--color-accent-blue);
  color: #fff;
  font-weight: 700;
}

.side-chip strong {
  color: var(--color-accent-blue);
  font-weight: 700;
}

/* Empty State */
.empty-state {
  grid-column: 1 / -1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 100%;
  color: var(--text-muted);
  text-align: center;
  gap: 12px;
}

.empty-icon {
  width: 58px;
  height: 58px;
  opacity: 0.4;
}

.empty-state h2 {
  font-size: 1.65rem;
  color: var(--text-secondary);
}

/* ==========================================================================
   5. Footer Bar (Passiver Dashboard-Zustand)
   ========================================================================== */
.footer {
  height: 37px;
  flex-shrink: 0;
  background: var(--bg-header);
  border-top: 1px solid var(--border-header);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 30px;
  font-size: 0.88rem;
  color: var(--text-muted);
  transition: height 0.22s cubic-bezier(0.16, 1, 0.3, 1), opacity 0.2s ease, padding 0.22s ease;
}

body.tray-active .footer {
  height: 0;
  min-height: 0;
  padding-top: 0;
  padding-bottom: 0;
  overflow: hidden;
  border-top: none;
  opacity: 0;
  pointer-events: none;
}

.highlight-stud {
  color: var(--color-accent-blue);
}

.legend-sep {
  margin: 0 7px;
  opacity: 0.4;
}

.kiosk-hint kbd {
  background: #1e293b;
  border: 1px solid #334155;
  border-radius: 4px;
  padding: 1px 5px;
  color: var(--text-secondary);
}

/* ==========================================================================
   6. Interaktives Tablett / Rechner Drawer
   (Liegt im Layout-Fluss – überdeckt NIEMALS Beilagen oder Gerichte!)
   ========================================================================== */
.tray-drawer {
  height: 0;
  min-height: 0;
  overflow: hidden;
  background: var(--bg-drawer);
  border-top: 2px solid transparent;
  box-shadow: 0 -6px 20px rgba(0, 0, 0, 0.5);
  flex-shrink: 0;
  display: flex;
  align-items: center;
  padding: 0 30px;
  opacity: 0;
  transition: height 0.25s cubic-bezier(0.16, 1, 0.3, 1), 
              opacity 0.22s ease, 
              border-color 0.25s ease,
              padding 0.25s ease;
  z-index: 20;
}

body.tray-active .tray-drawer {
  height: 70px;
  opacity: 1;
  border-top-color: var(--color-accent-blue);
}

.tray-content {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
}

.tray-left {
  display: flex;
  align-items: center;
  gap: 12px;
}

.tray-badge {
  font-size: 0.88rem;
  font-weight: 800;
  background: rgba(56, 189, 248, 0.15);
  color: var(--color-accent-blue);
  border: 1px solid rgba(56, 189, 248, 0.35);
  padding: 4px 11px;
  border-radius: 8px;
}

.tray-items-summary {
  font-size: 0.98rem;
  font-weight: 600;
  color: #fff;
}

.tray-center {
  display: flex;
  align-items: center;
  gap: 11px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border-subtle);
  border-radius: 8px;
  padding: 6px 14px;
}

.tray-nutri-label {
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
}

.tray-nutrition-strip {
  display: flex;
  align-items: center;
  gap: 9px;
  font-size: 0.88rem;
  color: #cbd5e1;
}

.tray-nutri-item strong {
  color: #fff;
}

.tray-nutri-item:first-child strong {
  color: var(--color-accent-amber);
}

.tray-sep {
  opacity: 0.4;
  font-size: 0.75rem;
}

.tray-right {
  display: flex;
  align-items: center;
  gap: 20px;
}

.tray-prices {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
}

.tray-price-stud-row {
  display: flex;
  align-items: baseline;
  gap: 9px;
}

.tray-price-label {
  font-size: 0.84rem;
  color: var(--text-secondary);
  font-weight: 600;
}

.tray-price-val {
  font-size: 1.48rem;
  font-weight: 800;
  color: var(--color-accent-blue);
  font-variant-numeric: tabular-nums;
}

.tray-price-bed-row {
  font-size: 0.82rem;
  color: var(--text-muted);
  font-weight: 500;
}

.tray-reset-btn {
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.15);
  color: #cbd5e1;
  padding: 7px 14px;
  border-radius: 7px;
  font-size: 0.86rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s ease;
}

.tray-reset-btn:hover {
  background: rgba(239, 68, 68, 0.2);
  border-color: rgba(239, 68, 68, 0.4);
  color: #fca5a5;
}
