/* ═══════════════════════════════════════════════════════════════
   KIOSK CALENDAR — External Stylesheet  (kiosk.css)
   All variables and selectors documented for easy customisation.
   Override anything via Admin → Custom CSS, or edit this file
   directly and re-upload for permanent changes.
   ═══════════════════════════════════════════════════════════════ */

/* ────────────────────────────────────────────
   GLOBAL DESIGN TOKENS  — override these first
   ──────────────────────────────────────────── */
:root {
  /* Colours */
  --glass:               rgba(0, 0, 0, 0.45);
  --glass-border:        rgba(255,255,255, 0.08);
  --text:                #f0ede8;
  --text-dim:            rgba(240,237,232, 0.50);
  --accent:              #e8c97a;
  --bg-body:             #0a0a0f;

  /* Layout spacing */
  --app-padding:         26px;
  --app-gap:             18px;
  --panel-radius:        16px;
  --panel-padding:       22px;
  --panel-blur:          20px;

  /* Clock — user overrides; designed at 1080p, JS scales for other resolutions */
  --clock-size:          clamp(72px, 9vw, 95px);
  --clock-font:          'Bebas Neue', cursive;
  --clock-color:         var(--text);
  --clock-glow:          rgba(232,201,122, 0.25);
  --date-font:           'DM Mono', monospace;
  --date-size:           12px;
  --date-color:          var(--accent);

  /* Event rows */
  --ev-bg:               rgba(255,255,255, 0.04);
  --ev-radius:           9px;
  --ev-time-color:       var(--text-dim);
  --ev-time-size:        10px;
  --ev-title-size:       12px;
  --ev-cal-size:         10px;

  /* Calendar grid */
  --cal-month-font:      'Bebas Neue', cursive;
  --cal-month-size:      38px;
  --cal-year-color:      var(--accent);
  --cal-cell-bg:         rgba(255,255,255, 0.02);
  --cal-cell-today-bg:   rgba(232,201,122, 0.10);
  --cal-cell-today-line: rgba(232,201,122, 0.28);
  --cal-num-color:       var(--text-dim);
  --cal-num-today:       var(--accent);
  --cal-dow-color:       var(--text-dim);

  /* Weather bar */
  --weather-bar-height:  80px;
  --weather-temp-size:   1.5rem;
  --weather-icon-size:   1.6rem;
  --weather-day-size:    0.68rem;

  /* Panel labels — user overrides */
  --label-font:          'DM Mono', monospace;
  --label-size:          20px;
  --label-color:         var(--accent);

  /* Status bar */
  --status-font:         'DM Mono', monospace;
  --status-size:         10px;
  --status-color:        var(--text-dim);
}

/* ────────────────────────────────────────────
   FONT RENDERING — sharper text on all screens
   ──────────────────────────────────────────── */
html {
  -webkit-font-smoothing:  antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering:          optimizeLegibility;
  width: 100%;
  height: 100%;
  overflow: hidden;
}

/* ────────────────────────────────────────────
   RESETS & BASE
   ──────────────────────────────────────────── */
*, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; }

body {
  font-family: 'DM Sans', sans-serif;
  background: var(--bg-body);
  color: var(--text);
  width: 100vw;
  height: 100vh;
  overflow: hidden;
  position: relative;
  /* cursor:none set by JS so preview iframe is unaffected */
}

/* ────────────────────────────────────────────
   BACKGROUND LAYERS
   ──────────────────────────────────────────── */
#bg, #bg-next {
  position: fixed;
  inset: 0;
  z-index: 0;
  background-size: cover;
  background-position: center;
  background-color: var(--bg-body);
}
#bg::after, #bg-next::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg,
    rgba(0,0,0,0.72) 0%,
    rgba(0,0,0,0.35) 50%,
    rgba(0,0,0,0.65) 100%);
}
#bg-next { opacity: 0; transition: opacity 2s ease; }
#bg      { transition: opacity 2s ease; }

/* ────────────────────────────────────────────
   APP SHELL  — fixed 1920×1080 canvas
   JS reads actual screen size and applies a
   CSS scale() so the layout fills any display
   (1080p native, 720p scales to 0.667×, etc.)
   ──────────────────────────────────────────── */
#app {
  position: absolute;
  top: 0;
  left: 0;
  z-index: 10;
  width:  1920px;
  height: 1080px;
  padding: var(--app-padding);
  gap: var(--app-gap);
  display: grid;
  grid-template-columns: 300px 1fr;
  grid-template-rows: 1fr auto;
  align-items: stretch;
  transform-origin: top left;
  /* scale set by JS via style.transform */
}

/* Left column wrapper — clock on top, today panel fills remaining space */
#left-col {
  grid-column: 1;
  grid-row: 1;
  display: flex;
  flex-direction: column;
  gap: var(--app-gap);
  min-height: 0;
  overflow: hidden;
}

/* Clock sits at top of left-col, never stretches */
#clock-panel { flex-shrink: 0; }

/* Main calendar fills right column, full height of row 1 */
#cal-panel {
  grid-column: 2;
  grid-row: 1;
  min-height: 0;
}

/* ────────────────────────────────────────────
   GLASS PANEL — shared by all panels
   ──────────────────────────────────────────── */
.glass-panel {
  background: var(--glass);
  border: 1px solid var(--glass-border);
  border-radius: var(--panel-radius);
  backdrop-filter: blur(var(--panel-blur));
  -webkit-backdrop-filter: blur(var(--panel-blur));
  padding: var(--panel-padding);
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

/* ────────────────────────────────────────────
   PANEL LABEL  — section headings inside panels
   ──────────────────────────────────────────── */
.panel-label {
  font-family: var(--label-font);
  font-size: var(--label-size);
  letter-spacing: 4px;
  text-transform: uppercase;
  color: var(--label-color);
  margin-bottom: 14px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--glass-border);
  flex-shrink: 0;
  font-weight: 999;
}

/* ────────────────────────────────────────────
   CLOCK PANEL  (#clock-panel)
   ──────────────────────────────────────────── */
#clock {
  font-family: var(--clock-font);
  font-size: var(--clock-size);
  line-height: 0.88;
  letter-spacing: 2px;
  color: var(--clock-color);
}

/* ────────────────────────────────────────────
   TODAY PANEL  (#today-panel)
   ──────────────────────────────────────────── */
#today-panel {
  flex: 1;
  min-height: 0;
}

#today-events {
  flex: 1;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

/* Individual event row */
.ev-item {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 8px 10px;
  border-radius: var(--ev-radius);
  background: var(--ev-bg);
  border-left: 3px solid var(--ev-color, #888);
  animation: slideIn 0.35s ease both;
}
@keyframes slideIn {
  from { opacity:0; transform:translateX(-10px); }
  to   { opacity:1; transform:translateX(0);     }
}

.ev-time  { font-family:'DM Mono',monospace; font-size:var(--ev-time-size); color:var(--ev-time-color); min-width:46px; padding-top:1px; flex-shrink:0; }
.ev-body  { flex:1; min-width:0; }
.ev-title { font-size:var(--ev-title-size); line-height:1.3; }
.ev-desc  { font-size:10px; color:var(--text-dim); margin-top:3px; line-height:1.45; display:-webkit-box; -webkit-line-clamp:2; -webkit-box-orient:vertical; overflow:hidden; }
.ev-cal   { font-size:var(--ev-cal-size); color:var(--text-dim); margin-top:2px; }

/* ────────────────────────────────────────────
   MAIN CALENDAR PANEL  (#cal-panel)
   ──────────────────────────────────────────── */
.cal-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  margin-bottom: 12px;
  flex-shrink: 0;
}

.cal-month-name {
  font-family: var(--cal-month-font);
  font-size: clamp(42px, 5.5vw, 72px);
  letter-spacing: 3px;
  line-height: 1;
  color: var(--text);
}

.cal-year-label {
  font-family: var(--cal-month-font);
  font-size: clamp(36px, 4.5vw, 58px);
  letter-spacing: 3px;
  line-height: 1;
  color: var(--accent);
}

/* Day-of-week header row — sits directly above the date cells */
#cal-dow-row {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 3px;
  flex-shrink: 0;
  margin-bottom: 3px;
  background: #202020;
  border-radius: 8px;
}

#date-line { display: none; }

.cal-dow {
  font-family: 'DM Mono', monospace;
  font-size: 25px;
  font-weight: 999;
  letter-spacing: 2px;
  text-transform: uppercase;
  color: var(--accent);
  text-align: center;
  padding: 4px 0 5px;
  opacity: 0.75;
}

.cal-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 3px;
  flex: 1;
  min-height: 0;
}


.cal-cell {
  border-radius: 8px;
  padding: 5px 5px 4px;
  display: flex;
  flex-direction: column;
  gap: 1px;
  background: var(--cal-cell-bg);
  overflow: hidden;
}
.cal-cell.other-month { opacity: 0.28; }
.cal-cell.today {
  background: var(--cal-cell-today-bg);
  outline: 1px solid var(--cal-cell-today-line);
}

.cal-num { font-family:'DM Mono',monospace; font-size:16px; color:var(--cal-num-color); line-height:1; margin-bottom:1px; }
.cal-cell.today .cal-num { color:var(--cal-num-today); font-weight:500; }

.cal-ev { font-size:13px; padding:1px 4px; border-radius:3px; white-space:nowrap; overflow:hidden; text-overflow:ellipsis; line-height:1.55; }
.cal-ev-more { font-size:9px; color:var(--text-dim); padding-left:3px; }

/* ────────────────────────────────────────────
   WEATHER BAR  (#weather-bar)
   Full-width strip along the bottom of the screen.
   Only shown when weather is enabled in config.
   ──────────────────────────────────────────── */
#weather-bar {
  grid-column: 1 / -1;
  grid-row: 2;
  display: none;   /* shown via JS when weather enabled */
  flex-direction: row;
  align-items: center;
  gap: 16px;
  padding: 10px 20px;
  min-height: var(--weather-bar-height);
  /* glass styling via .glass-panel */
}

/* Current conditions: icon + temp + label on the left */
#weather-current {
  display: flex;
  align-items: center;
  gap: 10px;
  padding-right: 16px;
  border-right: 1px solid var(--glass-border);
  flex-shrink: 0;
}

#weather-icon-now   { font-size: var(--weather-icon-size); line-height: 1; }
#weather-temp-now   { font-family: 'Bebas Neue', cursive; font-size: var(--weather-temp-size); line-height: 1; }
#weather-cond-now   { font-size: 10px; color: var(--text-dim); margin-top: 2px; text-transform: capitalize; }
#weather-location   { font-family: 'DM Mono', monospace; font-size: 9px; color: var(--text-dim); letter-spacing: 2px; text-transform: uppercase; margin-top: 1px; }

/* Forecast strip: one card per day, fills remaining width */
#weather-forecast {
  display: flex;
  gap: 6px;
  flex: 1;
  align-items: center;
}

.weather-day {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 6px 8px;
  border-radius: 8px;
  background: rgba(255,255,255, 0.03);
  min-width: 0;
}

/* Day name — centered at top */
.weather-day-name {
  font-family: 'DM Mono', monospace;
  font-size: var(--weather-day-size);
  letter-spacing: 1px;
  text-transform: uppercase;
  color: var(--text-dim);
  text-align: center;
  width: 100%;
}

/* Body row: icon left, info right */
.weather-day-body {
  display: flex;
  flex-direction: row;
  align-items: stretch;
  gap: 8px;
  width: 100%;
  flex: 1;
  min-height: 0;
}

.weather-day-icon {
  font-size: 2.6rem;
  line-height: 1;
  flex-shrink: 0;
  display: flex;
  align-items: center;
}

/* Info column: temps row + condition below */
.weather-day-info {
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 2px;
  flex: 1;
  min-width: 0;
}

/* Temps row: hi large + lo small, side by side */
.weather-day-temps {
  display: flex;
  flex-direction: row;
  align-items: baseline;
  gap: 5px;
}

.weather-day-hi   { font-family:'DM Mono',monospace; font-size:15px; color:var(--text); font-weight:500; }
.weather-day-lo   { font-family:'DM Mono',monospace; font-size:10px; color:var(--text-dim); }
.weather-day-cond { font-size:9px; color:var(--text-dim); white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }

/* ────────────────────────────────────────────
   STATUS BAR
   ──────────────────────────────────────────── */
#status-bar {
  position: fixed;
  bottom: 10px;
  right: 14px;
  z-index: 20;
  display: flex;
  align-items: center;
  gap: 7px;
  font-family: var(--status-font);
  font-size: var(--status-size);
  color: var(--status-color);
}

#brand-bar {
  position: fixed;
  bottom: 10px;
  left: 14px;
  z-index: 20;
  display: flex;
  align-items: center;
  gap: 5px;
  font-family: var(--status-font);
  font-size: var(--status-size);
  color: var(--status-color);
  letter-spacing: 1px;
}

#sync-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #4ade80;
  transition: background 0.3s;
}

/* ────────────────────────────────────────────
   SETUP / ERROR OVERLAY
   ──────────────────────────────────────────── */
#setup-overlay {
  position: fixed; inset: 0; z-index: 100;
  background: rgba(0,0,0,0.96);
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  gap: 14px; text-align: center; padding: 40px;
}
#setup-overlay h2 { font-family:'Bebas Neue',cursive; font-size:36px; letter-spacing:4px; color:var(--accent); }
#setup-overlay p  { font-size:14px; color:var(--text-dim); max-width:420px; line-height:1.7; }
#setup-msg        { font-size:13px; }
#setup-detail     { font-family:'DM Mono',monospace; font-size:11px; color:rgba(240,237,232,0.4); max-width:560px; text-align:left; line-height:1.8; margin-top:4px; white-space:pre-wrap; }
#setup-overlay a  { font-family:'DM Mono',monospace; font-size:12px; color:var(--accent); text-decoration:none; border:1px solid var(--accent); padding:10px 24px; border-radius:6px; letter-spacing:2px; text-transform:uppercase; }

/* ────────────────────────────────────────────
   AGENDA PANEL — day headers & section labels
   ──────────────────────────────────────────── */
.agenda-day-header {
  font-family: 'DM Mono', monospace;
  font-size: 11px;
  letter-spacing: 2px;
  text-transform: uppercase;
  color: var(--text-dim);
  padding: 8px 0 4px;
  margin-top: 4px;
  border-bottom: 1px solid var(--glass-border);
  flex-shrink: 0;
}
.agenda-day-header.agenda-today {
  color: var(--accent);
  margin-top: 0;
}
.agenda-section-label {
  font-family: 'DM Mono', monospace;
  font-size: 9px;
  letter-spacing: 3px;
  text-transform: uppercase;
  color: var(--text-dim);
  opacity: 0.5;
  padding: 14px 0 2px;
  flex-shrink: 0;
}
.agenda-empty {
  color: var(--text-dim);
  font-size: 12px;
  padding: 6px 0 4px;
  opacity: 0.6;
}

/* ────────────────────────────────────────────
   CALENDAR — past days subtle grey
   ──────────────────────────────────────────── */
.cal-cell.past-day {
  opacity: 0.35;
}
.cal-cell.past-day .cal-ev {
  filter: saturate(0.3);
}

/* ────────────────────────────────────────────
   <style id="custom-style"> appended last —
   any rules added via Admin → Custom CSS
   automatically override everything above.
   ──────────────────────────────────────────── */
