.map-page {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.map-header {
  flex-shrink: 0;
}

.map-header-row {
  min-height: 72px;
  padding: 8px 16px;
}

.map-back {
  flex-shrink: 0;
}

.map-brand .deck-logo {
  height: 56px;
  max-width: 280px;
}

.map-header-actions {
  margin-left: auto;
}

.map-stat {
  font-family: var(--mono);
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--muted);
  padding: 6px 10px;
  border: 1px solid var(--border-strong);
  border-radius: 999px;
  white-space: nowrap;
}

.map-stat-ok {
  color: var(--lime);
  border-color: rgba(57, 255, 20, 0.3);
}

.map-layout {
  position: relative;
  z-index: 1;
  flex: 1;
  display: grid;
  grid-template-columns: 1fr min(360px, 36vw);
  min-height: 0;
}

.device-map {
  min-height: calc(100vh - 72px);
  background: #0a0c0e;
}

.map-sidebar {
  border-left: 1px solid rgba(57, 255, 20, 0.14);
  background: rgba(6, 8, 10, 0.95);
  backdrop-filter: blur(12px);
  overflow-y: auto;
  padding: 20px 18px 24px;
}

.map-sidebar h2 {
  font-size: 1.125rem;
  font-weight: 700;
  margin-bottom: 8px;
  color: var(--text);
}

.map-sidebar p {
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--muted);
  line-height: 1.55;
}

.map-sidebar-detail {
  position: relative;
}

.map-detail-close {
  position: absolute;
  top: 0;
  right: 0;
  width: 32px;
  height: 32px;
  border: 1px solid var(--border-strong);
  border-radius: 8px;
  background: transparent;
  color: var(--text);
  font-size: 1.25rem;
  cursor: pointer;
}

.map-detail-status {
  font-family: var(--mono);
  font-size: 0.6875rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  margin-bottom: 8px;
}

.map-detail-status.ok { color: var(--lime); }
.map-detail-status.bad { color: var(--bad); }
.map-detail-status.warn { color: var(--warn); }

.map-detail-meta {
  font-size: 0.75rem;
  color: var(--muted);
  margin: 6px 0 16px;
}

.map-detail-kv {
  display: grid;
  gap: 12px;
  margin-bottom: 18px;
}

.map-detail-kv div {
  display: grid;
  gap: 4px;
}

.map-detail-kv dt {
  font-family: var(--mono);
  font-size: 0.625rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
}

.map-detail-kv dd {
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--text);
}

.map-detail-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.map-unmapped-wrap {
  margin-top: 24px;
  padding-top: 18px;
  border-top: 1px solid var(--border-strong);
}

.map-unmapped-wrap h3 {
  font-size: 0.8125rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--warn);
  margin-bottom: 10px;
}

.map-unmapped-list {
  list-style: none;
  display: grid;
  gap: 6px;
  max-height: 200px;
  overflow-y: auto;
}

.map-unmapped-list li {
  font-size: 0.8125rem;
  font-weight: 500;
  color: var(--muted);
  padding: 8px 10px;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.06);
}

/* Leaflet dark overrides */
.leaflet-container {
  font-family: var(--sans);
  background: #0a0c0e;
}

.leaflet-popup-content-wrapper {
  background: rgba(8, 10, 12, 0.96);
  color: var(--text);
  border: 1px solid rgba(57, 255, 20, 0.25);
  border-radius: 10px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.5);
}

.leaflet-popup-tip {
  background: rgba(8, 10, 12, 0.96);
}

.leaflet-popup-content {
  margin: 12px 14px;
  font-size: 0.8125rem;
  font-weight: 500;
  line-height: 1.45;
}

.map-pin-icon {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  border: 2px solid #fff;
  box-shadow: 0 0 0 2px rgba(0, 0, 0, 0.35), 0 2px 8px rgba(0, 0, 0, 0.45);
}

.map-pin-icon.ok {
  background: var(--lime);
  box-shadow: 0 0 12px rgba(57, 255, 20, 0.55), 0 0 0 2px rgba(0, 0, 0, 0.35);
}

.map-pin-icon.bad {
  background: var(--bad);
  box-shadow: 0 0 10px rgba(255, 92, 92, 0.5), 0 0 0 2px rgba(0, 0, 0, 0.35);
}

.map-pin-icon.warn {
  background: var(--warn);
  box-shadow: 0 0 10px rgba(255, 192, 64, 0.45), 0 0 0 2px rgba(0, 0, 0, 0.35);
}

@media (max-width: 900px) {
  .map-layout {
    grid-template-columns: 1fr;
    grid-template-rows: 55vh auto;
  }

  .map-sidebar {
    border-left: none;
    border-top: 1px solid rgba(57, 255, 20, 0.14);
    max-height: 45vh;
  }

  .deck-page-title {
    display: none;
  }
}

.panel-map-embed--solo {
  padding: 0;
  overflow: hidden;
}

.map-embed-wrap--solo {
  border-radius: 8px;
  overflow: hidden;
}

.panel-map-embed--solo .device-map--embed {
  min-height: 420px;
  height: 420px;
  width: 100%;
  background: #0a0c0e;
}

.panel-map-embed--solo .leaflet-container {
  z-index: 1;
  font-family: var(--sans);
}

/* Ugrađena mapa sa sidebarom (map.html layout) */
.panel-map-embed {
  padding: 0;
  overflow: hidden;
}

.panel-map-embed .map-embed-head {
  padding: 12px 16px;
  margin: 0;
  border-bottom: 1px solid var(--tk-border);
}

.panel-map-embed .map-embed-head h2 {
  font-size: 0.9375rem;
  font-weight: 700;
  margin: 0;
}

.panel-map-embed .map-stat {
  font-family: var(--mono);
  font-size: 0.6875rem;
}

.map-embed-wrap {
  border-radius: 0 0 8px 8px;
  overflow: hidden;
}

.map-layout--embed {
  display: grid;
  grid-template-columns: 1fr min(320px, 34%);
  min-height: 400px;
  height: 400px;
}

.map-layout--embed .device-map--embed,
.map-layout--embed .device-map {
  min-height: 400px;
  height: 100%;
  width: 100%;
  background: #0a0c0e;
}

.map-sidebar--embed {
  max-height: 400px;
  overflow-y: auto;
}

.panel-map-embed .leaflet-container {
  z-index: 1;
  font-family: var(--sans);
}

.map-embed-head .map-header-actions,
.map-embed-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  margin-left: auto;
}

.panel-map-embed .map-embed-head {
  align-items: center;
}

@media (max-width: 900px) {
  .map-layout--embed {
    grid-template-columns: 1fr;
    grid-template-rows: 300px auto;
    height: auto;
  }

  .map-layout--embed .device-map--embed,
  .map-layout--embed .device-map {
    min-height: 300px;
  }

  .map-sidebar--embed,
  .map-layout--embed .map-sidebar {
    max-height: 260px;
  }
}

