/* Tema - isti princip kao Raddar: :root nosi TAMNU (zadanu) temu, [data-theme="light"]
   je premošćuje. Atribut se postavlja PRIJE ovog CSS-a (inline skripta u <head> u index.html),
   pa nema bljeska krive teme pri učitavanju. */
:root {
  --bg: #0b120e;
  --panel: #121b16;
  --panel-2: #182420;
  --border: #24352c;
  --text: #eef3ee;
  --text-dim: #93a89b;
  --accent: #c99a3f;
  --accent-soft: rgba(201, 154, 63, .18);
  --warn: #e0803a;
  --error: #d84545;
  --good: #6fae52;
  --float-bg: rgba(18, 27, 22, .88);
  --tile-filter: saturate(.55) brightness(.55) contrast(1.05);
}

:root[data-theme="light"] {
  --bg: #eef1ec;
  --panel: #ffffff;
  --panel-2: #e4e9e2;
  --border: #d3dbd0;
  --text: #16241a;
  --text-dim: #5b6b5a;
  --accent: #9c7a2e;
  --accent-soft: rgba(156, 122, 46, .14);
  --warn: #b85a1f;
  --error: #b23a3a;
  --good: #3f7a3f;
  --float-bg: rgba(255, 255, 255, .92);
  --tile-filter: none;
}

* { box-sizing: border-box; }

html, body {
  margin: 0; padding: 0; width: 100%; height: 100%;
  background: var(--bg); color: var(--text);
  font-family: 'Space Grotesk', system-ui, -apple-system, sans-serif;
  font-feature-settings: 'tnum' 1;
  font-variant-numeric: tabular-nums;
  overflow: hidden;
}
body { display: flex; flex-direction: column; padding-bottom: 58px; }
/* ↑ Rezervirani prostor za fiksnu kiosk traku (dolje). Bez ovoga zadnji element u toku
   (podnožje, ili donja traka Leafletovih kontrola na kartama) završi ISPOD nje, ne iznad -
   upravo to je bio prijavljeni problem preklapanja. */

/* ---------------------------------------------------------------------------------------- */
/* Ljuska - zaglavlje, tijelo (bočna traka + pozornica), donji meteogram, podnožje            */
/* ---------------------------------------------------------------------------------------- */

header.rg-header {
  display: flex; align-items: baseline; justify-content: space-between;
  padding: 12px 22px; background: var(--panel); border-bottom: 1px solid var(--border); flex: 0 0 auto;
}
.rg-header-titles { display: flex; align-items: baseline; gap: 12px; }
.rg-header h1 { font-size: 18px; font-weight: 600; margin: 0; letter-spacing: .01em; }
.rg-header .rg-subtitle, .rg-header .rg-coords { font-size: 13px; color: var(--text-dim); font-weight: 400; }
.rg-header-right { display: flex; align-items: center; gap: 14px; }
.rg-theme-toggle {
  background: var(--panel-2); border: 1px solid var(--border); color: var(--text);
  border-radius: 999px; padding: 6px 14px; cursor: pointer; font: inherit; font-size: 12px;
}
.rg-theme-toggle:hover { border-color: var(--accent); color: var(--accent); }

.rg-body { flex: 1 1 auto; display: flex; min-height: 0; }

.rg-footer-note {
  font-size: 11px; color: var(--text-dim); line-height: 1.4; padding: 6px 22px 8px;
  background: var(--panel); border-top: 1px solid var(--border); flex: 0 0 auto; margin: 0;
}

/* ---------------------------------------------------------------------------------------- */
/* Bočna traka (stalna) - Trenutno stanje                                                     */
/* ---------------------------------------------------------------------------------------- */

.rg-sidebar {
  flex: 0 0 240px; padding: 16px 18px; overflow: auto;
  background: var(--panel); border-right: 1px solid var(--border);
  display: flex; flex-direction: column; gap: 14px;
}
.sc-title { font-size: 11px; text-transform: uppercase; letter-spacing: .06em; color: var(--text-dim); }
.sc-icon-row { display: flex; align-items: center; gap: 12px; }
.sc-icon { font-size: 40px; line-height: 1; }
.sc-temp { font-size: 38px; font-weight: 700; line-height: 1; }
.sc-feels { font-size: 12px; color: var(--text-dim); margin-top: 2px; }
.sc-label { font-size: 13px; color: var(--text-dim); }

.sc-stats { display: flex; flex-direction: column; gap: 8px; }
.sc-stat { background: var(--panel-2); border: 1px solid var(--border); border-radius: 8px; padding: 8px 10px;
  display: flex; align-items: baseline; justify-content: space-between; gap: 6px; flex-wrap: wrap; }
.sc-stat-label { font-size: 11px; color: var(--text-dim); }
.sc-stat-value { font-size: 15px; font-weight: 600; }
.sc-stat-sub { font-size: 10px; color: var(--text-dim); width: 100%; text-align: right; }

.sc-comfort { display: flex; align-items: center; gap: 8px; padding-top: 10px; border-top: 1px solid var(--border); }
.sc-comfort-icon { font-size: 24px; line-height: 1; }
.sc-comfort-label { font-size: 12px; color: var(--text-dim); }

.sc-updated { font-size: 10px; color: var(--text-dim); margin-top: auto; }

@media (max-width: 820px) {
  .rg-body { flex-direction: column; }
  .rg-sidebar { flex: 0 0 auto; flex-direction: row; flex-wrap: wrap; align-items: center; border-right: none; border-bottom: 1px solid var(--border); }
  .sc-stats { flex-direction: row; flex-wrap: wrap; }
  .sc-stat { flex: 1 1 45%; }
  .sc-updated { margin-top: 0; }
}

/* --- mobitel: uski zaslon - sažmi bočnu traku, smanji plutajuće kontrole, razmakni ih od
   fiksne donje kiosk trake da se ne preklapaju (upravo to je bio prijavljeni problem) -------- */
@media (max-width: 600px) {
  .rg-header { flex-wrap: wrap; row-gap: 4px; padding: 8px 14px; }
  .rg-header h1 { font-size: 15px; }
  .rg-header-right { gap: 8px; }
  .rg-theme-toggle { font-size: 11px; padding: 4px 10px; }

  .rg-sidebar { padding: 8px 12px; gap: 8px; }
  .sc-title { display: none; }
  .sc-icon { font-size: 30px; }
  .sc-temp { font-size: 28px; }
  .sc-stats { gap: 6px; }
  .sc-stat { padding: 5px 8px; flex: 1 1 47%; }
  .sc-stat-value { font-size: 13px; }
  .sc-comfort-icon { font-size: 18px; }
  .sc-updated { display: none; }

  /* Napomena: razmak od fiksne kiosk trake sad rješava `body { padding-bottom }` gore (cijela
     stranica se smanji za tu visinu, pa Leafletove kontrole prirodno završe iznad nje) - ovdje
     ostaje samo smanjenje veličine, ne dodatni razmak (dvostruko razmicanje bi nepotrebno
     smanjilo prostor za kartu). */
  .rg-legend, .rg-timeline, .rg-panel { min-width: 0; max-width: 44vw; font-size: 11px; padding: 7px 9px; }
  .rg-geo-import { max-width: 62vw; }
  .rg-geo-legend { max-width: 62vw; }
  .rg-timeline-body { min-width: 90px; }

  .rg-kiosk-nav { padding: 5px 10px; gap: 6px; bottom: 8px; }
  .rg-kiosk-counter { display: none; }

  .bio-columns { padding: 12px 14px; gap: 10px; }
  .bio-figure { font-size: 36px; margin: 8px 0; }

  #meteogramBottomChart { height: 210px; }
  .rg-meteogram-bottom { padding: 8px 14px 4px; }
  body { padding-bottom: 46px; }
}

@media (max-height: 680px) {
  #meteogramBottomChart { height: 190px; }
  .rg-stage { min-height: 160px; }
}

/* ---------------------------------------------------------------------------------------- */
/* Pozornica (rotira) - tri pogleda, jedan aktivan                                            */
/* ---------------------------------------------------------------------------------------- */

.rg-stage { position: relative; flex: 1 1 auto; min-width: 0; }
.stage-view { display: none; position: absolute; inset: 0; flex-direction: column; }
.stage-view.active { display: flex; }
.stage-map { position: absolute; inset: 0; background: #0e1512; }

#stageRadar .stage-map { inset: 0 0 40px 0; }
.st-map-foot {
  position: absolute; left: 0; right: 0; bottom: 0; height: 40px; z-index: 10;
  display: flex; justify-content: space-between; align-items: center; padding: 0 16px;
  background: var(--panel); border-top: 1px solid var(--border); font-size: 12px; color: var(--text-dim);
}
.st-thunder-badge.risk { color: var(--warn); font-weight: 600; }
.st-thunder-badge.clear { color: var(--good); }

#stageWind .stage-map { inset: 0; }

/* --- biometeo (pozornica 3) -------------------------------------------------------------- */
.bio-columns { flex: 1 1 auto; display: grid; grid-template-columns: repeat(3, 1fr); gap: 18px;
  padding: 22px 26px; overflow: auto; align-content: center; }
.bio-col { background: var(--panel); border: 1px solid var(--border); border-radius: 14px; padding: 20px; text-align: center; }
.bio-col-head { display: flex; justify-content: center; align-items: center; gap: 8px; }
.bio-day { font-size: 15px; font-weight: 600; }
.bio-icon { font-size: 22px; }
.bio-figure { font-size: 48px; line-height: 1; margin: 14px 0; }
.bio-row { display: flex; flex-direction: column; align-items: center; gap: 4px; font-size: 12px; margin-top: 10px; }
.bio-row-label { color: var(--text-dim); }
.bio-row-word { color: var(--text-dim); font-size: 11px; }
.rg-dots-lg .rg-dot { width: 12px; height: 12px; }

@media (max-width: 900px) {
  .bio-columns { grid-template-columns: 1fr; }
}

/* ---------------------------------------------------------------------------------------- */
/* Leaflet tamna/svijetla podloga (dijele radar i vjetar pozornice)                           */
/* ---------------------------------------------------------------------------------------- */

.leaflet-control-attribution { background: rgba(11,18,14,.75) !important; color: var(--text-dim) !important; font-size: 10px !important; }
.leaflet-control-attribution a { color: var(--text-dim) !important; }
.leaflet-bar a { background: var(--panel) !important; color: var(--text) !important; border-color: var(--border) !important; }
.leaflet-tile-pane { filter: var(--tile-filter); }

.rg-course-tip { background: var(--panel-2); color: var(--text); border: 1px solid var(--border); font-size: 11px; }

/* ---------------------------------------------------------------------------------------- */
/* Plutajuće kontrole na karti (legenda / vremenska crta / info panel / uvoz geometrije)      */
/* ---------------------------------------------------------------------------------------- */

.rg-legend, .rg-timeline, .rg-panel, .rg-geo-import {
  background: var(--float-bg); border: 1px solid var(--border); border-radius: 8px;
  padding: 10px 12px; color: var(--text); font-family: inherit; box-shadow: 0 4px 16px rgba(0,0,0,.25);
}
.rg-legend { min-width: 190px; }
.rg-legend-title { font-size: 11px; color: var(--text-dim); margin-bottom: 6px; }
.rg-legend-bar { display: block; height: 8px; border-radius: 4px; }
.rg-legend-ticks { display: flex; justify-content: space-between; font-size: 11px; color: var(--text-dim); margin-top: 4px; }

.rg-timeline { display: flex; align-items: center; gap: 10px; min-width: 250px; }
.rg-play-btn { flex: 0 0 auto; width: 30px; height: 30px; border-radius: 50%; border: 1px solid var(--border);
  background: var(--accent-soft); color: var(--accent); cursor: pointer; font-size: 12px; display: flex; align-items: center; justify-content: center; }
.rg-play-btn:hover { background: var(--accent); color: #1a1408; }
.rg-play-btn:disabled, .rg-timeline-slider:disabled { opacity: .4; cursor: default; }
.rg-play-btn:disabled:hover { background: var(--accent-soft); color: var(--accent); }
.rg-timeline-body { flex: 1 1 auto; min-width: 0; }
.rg-timeline-top { display: flex; justify-content: space-between; font-size: 12px; margin-bottom: 4px; }
.rg-timeline-label { color: var(--text-dim); }
.rg-timeline-time { font-weight: 600; }
.rg-timeline-slider { width: 100%; accent-color: var(--accent); }

.rg-panel { min-width: 175px; }
.rg-panel-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; font-size: 12px; padding: 3px 0; }
.rg-panel-label { color: var(--text-dim); }
.rg-panel-value { font-weight: 600; }
.rg-panel-toggle { cursor: pointer; border-top: 1px solid var(--border); margin-top: 4px; padding-top: 7px; }
.rg-panel input[type="range"] { width: 100%; accent-color: var(--accent); }
.rg-refresh-btn { width: 100%; margin-top: 8px; padding: 6px 8px; border-radius: 6px; border: 1px solid var(--border);
  background: transparent; color: var(--text); cursor: pointer; font: inherit; font-size: 12px; }
.rg-refresh-btn:hover { border-color: var(--accent); color: var(--accent); }

.rg-banner {
  position: absolute; top: 12px; left: 50%; transform: translateX(-50%); z-index: 1000;
  padding: 8px 16px; border-radius: 7px; font-size: 13px; background: var(--panel-2);
  border: 1px solid var(--border); color: var(--text); box-shadow: 0 4px 16px rgba(0,0,0,.4);
  max-width: min(90vw, 520px); text-align: center;
}
.rg-banner-warn { border-color: var(--warn); color: var(--warn); }
.rg-banner-error { border-color: var(--error); color: var(--error); }

/* --- uvoz geometrije terena ---------------------------------------------------------------- */
.rg-geo-import { max-width: 300px; }
.rg-geo-toggle { width: 100%; background: transparent; border: 1px solid var(--border); color: var(--text);
  border-radius: 6px; padding: 6px 8px; cursor: pointer; font: inherit; font-size: 12px; }
.rg-geo-toggle:hover { border-color: var(--accent); color: var(--accent); }
.rg-geo-panel { margin-top: 8px; font-size: 11px; line-height: 1.5; color: var(--text-dim); }
.rg-geo-panel ol { padding-left: 18px; margin: 6px 0; }
.rg-geo-panel li { margin-bottom: 6px; }
.rg-geo-open-turbo { background: var(--accent-soft); color: var(--accent); border: 1px solid var(--border);
  border-radius: 6px; padding: 4px 8px; cursor: pointer; font: inherit; font-size: 11px; }
.rg-geo-file { font-size: 11px; color: var(--text-dim); max-width: 100%; }
.rg-geo-status { color: var(--text); margin: 6px 0; }
.rg-geo-reset { width: 100%; background: transparent; border: 1px solid var(--error); color: var(--error);
  border-radius: 6px; padding: 5px 8px; cursor: pointer; font: inherit; font-size: 11px; }

.rg-geo-legend { display: flex; flex-wrap: wrap; gap: 6px 10px; font-size: 10px; color: var(--text-dim);
  background: var(--float-bg); border: 1px solid var(--border); border-radius: 8px; padding: 6px 10px; margin-top: 6px; }
.rg-geo-legend-item { display: flex; align-items: center; gap: 4px; }
.rg-geo-legend-item i { width: 9px; height: 9px; border-radius: 2px; display: inline-block; }

/* ---------------------------------------------------------------------------------------- */
/* Donja traka (stalna) - 3 dana prognoza, meteogram (temp / oborina / vjetar)                */
/* ---------------------------------------------------------------------------------------- */

.rg-meteogram-bottom { flex: 0 0 auto; background: var(--panel); border-top: 1px solid var(--border); padding: 10px 22px 6px; }
.rg-meteogram-head { display: flex; align-items: baseline; justify-content: space-between; margin-bottom: 4px; flex-wrap: wrap; gap: 6px; }
.rg-meteogram-head h2 { font-size: 13px; font-weight: 600; margin: 0; color: var(--text-dim); }
.rg-meteogram-head h2 span { font-weight: 400; font-size: 11px; }
.rg-meteogram-now { font-size: 13px; color: var(--accent); font-weight: 500; }
#meteogramBottomChart { width: 100%; height: 260px; }
#meteogramBottomChart svg { width: 100%; height: 100%; display: block; }

.rg-mgrid { stroke: var(--border); stroke-width: 1; }
.rg-maxis { fill: var(--text-dim); font-size: 10px; font-family: inherit; }
.rg-maxis-title { fill: var(--text-dim); font-size: 10px; font-family: inherit; }
.rg-mpanel-title { fill: var(--text-dim); font-size: 10px; font-family: inherit; text-transform: uppercase; letter-spacing: .04em; }
.rg-mtempline { fill: none; stroke: var(--text); stroke-width: 1.6; opacity: .85; }
.rg-mfeelsline { fill: none; stroke: var(--accent); stroke-width: 1.3; stroke-dasharray: 4 3; opacity: .7; }
.rg-mline { fill: none; stroke: var(--text); stroke-width: 1.6; opacity: .5; }
.rg-mgust { fill: none; stroke: var(--text-dim); stroke-width: 1.2; stroke-dasharray: 3 3; opacity: .55; }
.rg-mprecipbar { fill: var(--accent); opacity: .55; }
.rg-mdaybreak { stroke: var(--text-dim); stroke-width: 1; stroke-dasharray: 4 3; opacity: .5; }

.rg-dots { display: inline-flex; gap: 3px; }
.rg-dot { width: 9px; height: 9px; border-radius: 50%; background: var(--border); display: inline-block; }
.rg-dot.filled { background: var(--accent); }
.rg-dots-na { color: var(--text-dim); font-size: 11px; }

.rg-error-text { color: var(--error); padding: 20px; }

/* ---------------------------------------------------------------------------------------- */
/* Kiosk rotacija - točkice, strelice, brojač (isto "1/3 · 10s" kao na nacrtu)                */
/* ---------------------------------------------------------------------------------------- */

.rg-kiosk-nav {
  position: fixed; left: 50%; bottom: 14px; transform: translateX(-50%); z-index: 2000;
  display: flex; align-items: center; gap: 10px; background: var(--float-bg);
  border: 1px solid var(--border); border-radius: 999px; padding: 6px 14px; box-shadow: 0 6px 20px rgba(0,0,0,.4);
}
.rg-kiosk-arrow { background: transparent; border: none; color: var(--text-dim); font-size: 18px; cursor: pointer; padding: 0 4px; line-height: 1; }
.rg-kiosk-arrow:hover { color: var(--accent); }
.rg-kiosk-dots { display: flex; gap: 6px; }
.rg-kiosk-dot { width: 8px; height: 8px; border-radius: 50%; border: none; background: var(--border); cursor: pointer; padding: 0; }
.rg-kiosk-dot.active { background: var(--accent); }
.rg-kiosk-counter { font-size: 11px; color: var(--text-dim); min-width: 44px; text-align: center; }
.rg-kiosk-auto { background: transparent; border: 1px solid var(--border); border-radius: 50%; width: 22px; height: 22px;
  color: var(--text-dim); cursor: pointer; font-size: 10px; display: flex; align-items: center; justify-content: center; }
.rg-kiosk-auto:hover { color: var(--accent); border-color: var(--accent); }
