:root {
  --bg: #f4f1ea;
  --panel: #ffffff;
  --ink: #1f2a24;
  --muted: #68726b;
  --line: #ded8cc;
  --accent: #2f6f4e;
  --accent-dark: #214f38;
  --soft: #e8efe7;
  --warning: #a36521;
  --danger: #9b2f2f;
  --shadow: 0 18px 45px rgba(31,42,36,.12);
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: var(--bg);
  color: var(--ink);
}

.hero {
  position: relative;
  min-height: 620px;
  display: grid;
  align-items: center;
  background:
    linear-gradient(120deg, rgba(19,33,26,.75), rgba(19,33,26,.25)),
    url('assets/hero-forest-cyclist.jpg') center/cover;
}
.hero-content {
  position: relative;
  z-index: 1;
  width: min(1080px, calc(100% - 40px));
  margin: 0 auto;
  color: #fff;
}
.eyebrow {
  text-transform: uppercase;
  letter-spacing: .15em;
  font-size: .78rem;
  font-weight: 700;
  margin: 0 0 12px;
  opacity: .85;
}
.eyebrow.dark { color: var(--accent); opacity: 1; }
h1 {
  font-size: clamp(2.6rem, 6vw, 5.2rem);
  line-height: .96;
  margin: 0 0 22px;
  max-width: 820px;
}
.lead {
  font-size: clamp(1.1rem, 2vw, 1.35rem);
  line-height: 1.55;
  max-width: 720px;
  margin: 0 0 30px;
}
.hero-button, .primary-button, button {
  border: 0;
  border-radius: 999px;
  padding: 14px 22px;
  font-weight: 700;
  cursor: pointer;
}
.hero-button {
  display: inline-block;
  color: var(--ink);
  background: #fff;
  text-decoration: none;
}
.primary-button, button {
  background: var(--accent);
  color: #fff;
}
button:hover, .primary-button:hover { background: var(--accent-dark); }

.section {
  width: min(1120px, calc(100% - 32px));
  margin: 0 auto;
  padding: 64px 0;
}
.section-head { max-width: 760px; margin-bottom: 28px; }
.section-head.compact { margin-bottom: 20px; }
h2 { font-size: clamp(2rem, 4vw, 3.2rem); line-height: 1.05; margin: 0 0 14px; }
h3 { margin: 0 0 6px; font-size: 1.25rem; }
p { color: inherit; }
.muted { color: var(--muted); font-weight: 400; }

.upload-card, .panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 28px;
  box-shadow: var(--shadow);
}
.upload-card { padding: 24px; }
.drop-zone {
  display: grid;
  place-items: center;
  min-height: 230px;
  padding: 28px;
  border: 2px dashed #b8c6b7;
  border-radius: 22px;
  background: var(--soft);
  text-align: center;
  cursor: pointer;
  transition: .2s ease;
}
.drop-zone.dragover { background: #dbeadd; border-color: var(--accent); }
.drop-zone input { display: none; }
.drop-icon {
  display: grid;
  place-items: center;
  width: 74px;
  height: 74px;
  margin-bottom: 14px;
  border-radius: 22px;
  background: #fff;
  color: var(--accent);
  font-weight: 900;
  box-shadow: 0 10px 25px rgba(31,42,36,.1);
}
.form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
  margin: 22px 0;
}
label { display: grid; gap: 8px; font-weight: 700; }
input, select {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 13px 14px;
  font: inherit;
  background: #fff;
  color: var(--ink);
}
.status { color: var(--muted); margin: 14px 0 0; }
.status.error { color: var(--danger); font-weight: 700; }
.status.success { color: var(--accent); font-weight: 700; }

.hidden { display: none !important; }
.stats-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
  margin-bottom: 20px;
}
.stat-card {
  padding: 18px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 22px;
  box-shadow: 0 10px 28px rgba(31,42,36,.08);
}
.stat-card small { color: var(--muted); display: block; margin-bottom: 8px; }
.stat-card strong { font-size: 1.55rem; }
.panel { padding: 20px; margin-bottom: 20px; }
.panel-head { margin-bottom: 16px; }
.panel-head p { margin: 0; color: var(--muted); }
#map {
  position: relative;
  display: block;
  width: 100%;
  height: 500px;
  min-height: 500px;
  border-radius: 22px;
  overflow: hidden;
  background: #d8ddd5;
}

/* Zaščita pred globalnimi CSS pravili strežnika ali predloge, ki lahko pokvarijo Leaflet ploščice. */
#map.leaflet-container,
#map .leaflet-container {
  width: 100% !important;
  height: 100% !important;
}
#map .leaflet-tile,
#map .leaflet-marker-icon,
#map .leaflet-marker-shadow {
  max-width: none !important;
  max-height: none !important;
}
.chart-wrap { position: relative; min-height: 260px; }
.chart-tooltip {
  position: absolute;
  pointer-events: none;
  background: rgba(31,42,36,.92);
  color: #fff;
  border-radius: 12px;
  padding: 8px 10px;
  font-size: .86rem;
  transform: translate(-50%, -120%);
}
.analysis-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
}
.difficulty-box {
  display: grid;
  gap: 12px;
}
.badge {
  display: inline-flex;
  align-items: center;
  width: fit-content;
  border-radius: 999px;
  padding: 8px 12px;
  background: var(--soft);
  color: var(--accent-dark);
  font-weight: 800;
}
.password-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 10px;
}
.locked-content {
  margin-top: 16px;
  border-radius: 18px;
  padding: 14px;
  background: var(--soft);
}
.footer {
  text-align: center;
  padding: 34px 16px;
  color: var(--muted);
}

@media (max-width: 850px) {
  .form-grid, .analysis-grid { grid-template-columns: 1fr; }
  .stats-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  #map { height: 380px; min-height: 380px; }
}
@media (max-width: 520px) {
  .stats-grid { grid-template-columns: 1fr; }
  .password-row { grid-template-columns: 1fr; }
  .section { width: min(100% - 22px, 1120px); padding: 42px 0; }
}

/* Leaflet hard fallback: če se zunanji Leaflet CSS ne naloži ali ga prepiše predloga strežnika,
   ta pravila ohranijo pravilno pozicioniranje ploščic, markerjev, SVG poti in kontrol. */
#map.leaflet-container {
  position: relative !important;
  overflow: hidden !important;
  touch-action: pan-x pan-y !important;
  font-family: inherit !important;
  background: #d8ddd5 !important;
}
#map .leaflet-pane,
#map .leaflet-tile,
#map .leaflet-marker-icon,
#map .leaflet-marker-shadow,
#map .leaflet-tile-container,
#map .leaflet-pane > svg,
#map .leaflet-pane > canvas,
#map .leaflet-zoom-box,
#map .leaflet-image-layer,
#map .leaflet-layer {
  position: absolute !important;
  left: 0 !important;
  top: 0 !important;
}
#map .leaflet-container { overflow: hidden !important; }
#map .leaflet-tile {
  width: 256px !important;
  height: 256px !important;
  max-width: none !important;
  max-height: none !important;
  min-width: 0 !important;
  min-height: 0 !important;
  padding: 0 !important;
  border: 0 !important;
  box-sizing: content-box !important;
  user-select: none !important;
  -webkit-user-drag: none !important;
}
#map .leaflet-tile-container,
#map .leaflet-layer,
#map .leaflet-map-pane,
#map .leaflet-pane {
  transform-origin: 0 0 !important;
}
#map .leaflet-map-pane { z-index: auto !important; }
#map .leaflet-tile-pane { z-index: 200 !important; }
#map .leaflet-overlay-pane { z-index: 400 !important; }
#map .leaflet-shadow-pane { z-index: 500 !important; }
#map .leaflet-marker-pane { z-index: 600 !important; }
#map .leaflet-tooltip-pane { z-index: 650 !important; }
#map .leaflet-popup-pane { z-index: 700 !important; }
#map .leaflet-control-container .leaflet-top,
#map .leaflet-control-container .leaflet-bottom {
  position: absolute !important;
  z-index: 1000 !important;
  pointer-events: none !important;
}
#map .leaflet-top { top: 0 !important; }
#map .leaflet-right { right: 0 !important; }
#map .leaflet-bottom { bottom: 0 !important; }
#map .leaflet-left { left: 0 !important; }
#map .leaflet-control { pointer-events: auto !important; }
#map svg { max-width: none !important; max-height: none !important; }
#map path.leaflet-interactive { pointer-events: auto !important; }

/* Vidnejše Leaflet kontrole za zoom. */
#map .leaflet-control-zoom {
  margin: 14px 0 0 14px !important;
  border: 0 !important;
  box-shadow: 0 8px 20px rgba(31,42,36,.20) !important;
}
#map .leaflet-control-zoom a {
  width: 34px !important;
  height: 34px !important;
  line-height: 34px !important;
  font-size: 20px !important;
  color: var(--ink) !important;
  background: #ffffff !important;
  border-bottom: 1px solid var(--line) !important;
}
#map .leaflet-control-zoom a:hover {
  background: var(--soft) !important;
}

/* Mozaik poti – izboljšan videz zemljevida in Leaflet kontrol */
#map {
  border: 1px solid rgba(31,42,36,.16);
  box-shadow: inset 0 0 0 1px rgba(255,255,255,.45), 0 14px 34px rgba(31,42,36,.10);
}

#map .leaflet-control-container .leaflet-top.leaflet-left {
  top: 16px !important;
  left: 16px !important;
}

#map .leaflet-control-zoom {
  display: grid !important;
  gap: 8px !important;
  margin: 0 !important;
  padding: 7px !important;
  border: 1px solid rgba(255,255,255,.22) !important;
  border-radius: 18px !important;
  background: rgba(31,42,36,.72) !important;
  backdrop-filter: blur(14px) saturate(130%) !important;
  -webkit-backdrop-filter: blur(14px) saturate(130%) !important;
  box-shadow: 0 18px 38px rgba(31,42,36,.30) !important;
  overflow: visible !important;
}

#map .leaflet-control-zoom a,
#map .leaflet-control-zoom a:first-child,
#map .leaflet-control-zoom a:last-child {
  width: 42px !important;
  height: 42px !important;
  line-height: 40px !important;
  border: 0 !important;
  border-radius: 13px !important;
  background: rgba(255,255,255,.94) !important;
  color: var(--accent-dark) !important;
  font-size: 24px !important;
  font-weight: 900 !important;
  text-align: center !important;
  text-decoration: none !important;
  box-shadow: 0 8px 18px rgba(0,0,0,.16) !important;
  transition: transform .16s ease, background .16s ease, color .16s ease, box-shadow .16s ease !important;
}

#map .leaflet-control-zoom a:hover,
#map .leaflet-control-zoom a:focus-visible {
  background: var(--accent) !important;
  color: #fff !important;
  transform: translateY(-1px) !important;
  box-shadow: 0 12px 24px rgba(47,111,78,.28) !important;
}

#map .leaflet-control-zoom a:active {
  transform: translateY(0) scale(.97) !important;
}

#map .leaflet-disabled,
#map .leaflet-control-zoom a.leaflet-disabled {
  opacity: .45 !important;
  cursor: default !important;
  transform: none !important;
}

#map .leaflet-control-attribution {
  margin: 0 12px 10px 0 !important;
  padding: 5px 9px !important;
  border-radius: 999px !important;
  background: rgba(255,255,255,.82) !important;
  color: rgba(31,42,36,.72) !important;
  font-size: 11px !important;
  box-shadow: 0 6px 18px rgba(31,42,36,.12) !important;
}

#map .leaflet-control-attribution a {
  color: var(--accent-dark) !important;
  font-weight: 700 !important;
}

#map .leaflet-popup-content-wrapper {
  border-radius: 16px !important;
  background: rgba(255,255,255,.96) !important;
  color: var(--ink) !important;
  box-shadow: 0 16px 34px rgba(31,42,36,.22) !important;
}

#map .leaflet-popup-content {
  margin: 10px 14px !important;
  font-weight: 700 !important;
}

#map .leaflet-popup-tip {
  background: rgba(255,255,255,.96) !important;
}

@media (max-width: 520px) {
  #map .leaflet-control-container .leaflet-top.leaflet-left {
    top: 10px !important;
    left: 10px !important;
  }
  #map .leaflet-control-zoom {
    gap: 6px !important;
    padding: 6px !important;
    border-radius: 16px !important;
  }
  #map .leaflet-control-zoom a,
  #map .leaflet-control-zoom a:first-child,
  #map .leaflet-control-zoom a:last-child {
    width: 38px !important;
    height: 38px !important;
    line-height: 36px !important;
    font-size: 22px !important;
  }
}
