* { box-sizing: border-box; }

:root {
  --bg: #020617;
  --glass: rgba(8,20,34,.78);
  --line: rgba(148,163,184,.25);
  --text: #f8fafc;
  --muted: #cbd5e1;
  --green: #39d353;
  --red: #ef4444;
  --blue: #2563eb;
}

html, body {
  height: 100%;
}

body {
  margin: 0;
  overflow: hidden;
  background: var(--bg);
  color: var(--text);
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

.topbar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;

  height: 92px;
  z-index: 1000;

  display: flex;
  justify-content: space-between;
  align-items: center;

  padding: 14px 28px;

  background: linear-gradient(90deg, rgba(2,6,23,.97), rgba(8,20,34,.9));
  border-bottom: 1px solid var(--line);
  box-shadow: 0 12px 35px rgba(0,0,0,.35);
}

.brand {
  display: flex;
  align-items: center;
  gap: 20px;
}

.logo-crossnet {
  max-height: 62px;
  max-width: 260px;
  object-fit: contain;
}

.logo-eu {
  max-height: 58px;
  max-width: 330px;
  object-fit: contain;
}

.brand h1 {
  margin: 0;
  font-size: 25px;
}

.brand p {
  margin: 5px 0 0;
  color: var(--muted);
  font-size: 15px;
}

.top-right {
  display: flex;
  align-items: center;
  gap: 18px;
}

.clock {
  font-weight: 700;
}

.live-pill {
  border-radius: 999px;
  padding: 7px 12px;
  font-weight: 800;
  font-size: 13px;
}

.live-pill.online {
  background: rgba(57,211,83,.16);
  color: var(--green);
  border: 1px solid rgba(57,211,83,.35);
}

.live-pill.offline {
  background: rgba(239,68,68,.18);
  color: #fecaca;
  border: 1px solid rgba(239,68,68,.35);
}

.stage {
  position: fixed;
  inset: 92px 0 0 0;
}

#map {
  position: absolute;
  inset: 0;
  z-index: 0;
  background: #07111f;
}

.glass {
  background: var(--glass);
  border: 1px solid var(--line);
  box-shadow: 0 20px 55px rgba(0,0,0,.42);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
}

.station-panel {
  position: absolute;
  left: 20px;
  top: 24px;
  width: 255px;
  max-height: calc(100vh - 150px);
  z-index: 700;

  border-radius: 18px;
  padding: 14px;
  overflow: hidden;
}

.station-panel h2,
.status-panel h2 {
  margin: 0 0 12px;
  font-size: 18px;
}

.search {
  width: 100%;
  padding: 10px 12px;
  margin-bottom: 12px;
  border: 1px solid rgba(255,255,255,.12);
  border-radius: 12px;
  background: rgba(255,255,255,.08);
  color: var(--text);
  outline: none;
}

.search::placeholder {
  color: rgba(226,232,240,.75);
}

.station-list {
  max-height: calc(100vh - 310px);
  overflow: auto;
  padding-right: 2px;
}

.station-row {
  width: 100%;
  display: grid;
  grid-template-columns: 13px 1fr auto;
  grid-template-areas:
    "dot name id"
    "dot age age";
  gap: 3px 8px;
  align-items: center;

  background: transparent;
  color: var(--text);

  border: none;
  border-radius: 10px;
  padding: 9px 10px;
  margin-bottom: 4px;

  text-align: left;
  cursor: pointer;
}

.station-row:hover {
  background: rgba(255,255,255,.08);
}

.station-row.selected-row {
  background: linear-gradient(90deg, rgba(37,99,235,.72), rgba(14,165,233,.34));
}

.station-row .dot { grid-area: dot; }
.station-row strong { grid-area: name; font-size: 16px; }
.station-row .station-id { grid-area: id; color: var(--muted); font-size: 12px; }
.station-row .station-age { grid-area: age; color: var(--muted); font-size: 12px; }

.dot {
  width: 11px;
  height: 11px;
  border-radius: 50%;
}

.dot-online {
  background: var(--green);
  box-shadow: 0 0 12px rgba(57,211,83,.7);
}

.dot-offline {
  background: var(--red);
}

.view-all {
  width: 100%;
  margin-top: 10px;
  padding: 10px;
  border: none;
  border-radius: 12px;
  color: var(--text);
  background: rgba(255,255,255,.10);
  cursor: pointer;
}

.status-panel {
  position: absolute;
  right: 24px;
  top: 26px;
  width: 285px;
  z-index: 700;
  border-radius: 18px;
  padding: 18px;
}

.donut-wrap {
  display: flex;
  justify-content: center;
  margin: 16px 0;
}

.donut {
  width: 145px;
  height: 145px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: conic-gradient(var(--green) 0deg 300deg, var(--red) 300deg 360deg);
  position: relative;
}

.donut::after {
  content: "";
  position: absolute;
  width: 96px;
  height: 96px;
  border-radius: 50%;
  background: rgba(4,13,24,.98);
}

.donut div {
  position: relative;
  z-index: 2;
  text-align: center;
}

.donut strong {
  display: block;
  font-size: 34px;
}

.donut span {
  color: var(--muted);
}

.legend {
  display: grid;
  gap: 10px;
}

.legend div {
  display: grid;
  grid-template-columns: 14px 1fr auto;
  gap: 9px;
  align-items: center;
}

.live-panel {
  position: absolute;
  left: 285px;
  right: 105px;
  bottom: 30px;
  min-height: 260px;
  max-height: 44vh;
  z-index: 720;
  border-radius: 18px;
  overflow: auto;
}

.live-panel.hidden {
  display: none;
}

.live-header {
  display: flex;
  justify-content: space-between;
  align-items: center;

  padding: 14px 18px;
  border-bottom: 1px solid var(--line);
}

.live-header h2 {
  margin: 0;
  font-size: 24px;
}

.live-header p {
  margin: 4px 0 0;
  color: var(--muted);
}

#closeLive {
  border: none;
  background: rgba(255,255,255,.10);
  color: white;
  border-radius: 8px;
  width: 30px;
  height: 30px;
  font-size: 20px;
  cursor: pointer;
}

.live-status {
  padding: 9px 18px;
  color: var(--muted);
  border-bottom: 1px solid var(--line);
  font-size: 13px;
}

.live-content {
  display: grid;
  grid-template-columns: 1fr 245px;
  min-height: 220px;
}

.plots-column {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(420px, 1fr));
}

.plot-card {
  border-right: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}

.plot-title {
  display: flex;
  justify-content: space-between;
  padding: 9px 14px;
  color: var(--text);
  font-size: 13px;
}

.plot-title span {
  color: var(--muted);
}

.plot {
  width: 100%;
}

.station-info {
  padding: 14px 18px;
  border-left: 1px solid var(--line);
}

.station-info h3 {
  margin: 0 0 12px;
}

.info-row {
  display: flex;
  justify-content: space-between;
  padding: 7px 0;
  color: var(--muted);
}

.info-row b {
  color: var(--text);
}

.leaflet-tooltip.station-label {
  background: rgba(8,20,34,.88);
  color: white;
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: 0 8px 22px rgba(0,0,0,.34);
}

.leaflet-control-zoom a {
  background: rgba(8,20,34,.75) !important;
  color: white !important;
  border-color: var(--line) !important;
}

@media (max-width: 1100px) {
  .status-panel {
    display: none;
  }

  .live-panel {
    left: 285px;
    right: 20px;
    bottom: 20px;
    max-height: 42vh;
  }
}

@media (max-width: 800px) {
  body {
    overflow: auto;
  }

  .topbar {
    position: relative;
    height: auto;
    flex-direction: column;
    align-items: flex-start;
    gap: 12px;
  }

  .top-right {
    width: 100%;
    justify-content: space-between;
    flex-wrap: wrap;
  }

  .logo-crossnet {
    max-width: 210px;
    max-height: 52px;
  }

  .logo-eu {
    max-width: 260px;
    max-height: 48px;
  }

  .stage {
    position: relative;
    inset: auto;
    height: auto;
  }

  #map {
    position: relative;
    height: 55vh;
    min-height: 360px;
  }

  .station-panel {
    position: relative;
    left: auto;
    top: auto;
    width: auto;
    max-height: none;
    margin: 12px;
  }

  .station-list {
    max-height: 260px;
  }

  .status-panel {
    display: block;
    position: relative;
    right: auto;
    top: auto;
    width: auto;
    margin: 12px;
  }

  .live-panel {
    position: relative;
    left: auto;
    right: auto;
    bottom: auto;
    width: auto;
    max-height: none;
    margin: 12px;
  }

  .live-content {
    display: block;
  }

  .station-info {
    border-left: none;
    border-top: 1px solid var(--line);
  }

  .plots-column {
    display: block;
  }
}

.station-div-icon {
  background: transparent;
  border: none;
}

.station-symbol {
  display: block;
  width: var(--station-size);
  height: var(--station-size);
  box-sizing: border-box;
}

/* HNZ – kružić */
.station-symbol-circle {
  background: var(--station-color);
  border: var(--station-border-width) solid rgba(255, 255, 255, 0.95);
  border-radius: 50%;
  box-shadow:
    0 0 0 1px rgba(0, 0, 0, 0.6),
    0 3px 8px rgba(0, 0, 0, 0.45);
}

/* HHZ – invertirani trokut */
.station-symbol-triangle {
  width: 0;
  height: 0;

  border-left: calc(var(--station-size) * 0.65) solid transparent;
  border-right: calc(var(--station-size) * 0.65) solid transparent;
  border-top: var(--station-size) solid var(--station-color);

  filter:
    drop-shadow( 1px  0   rgba(255,255,255,0.9))
    drop-shadow(-1px  0   rgba(255,255,255,0.9))
    drop-shadow( 0    1px rgba(255,255,255,0.9))
    drop-shadow( 0   -1px rgba(255,255,255,0.9))
    drop-shadow( 0    3px 3px rgba(0,0,0,0.55));
}
