/*
 * map.css — v1.0.0
 * Shared map layout for Pelorus platform apps.
 * Consumed by: pelorus (map page), skycam-registry.
 *
 * Load order: pelorus.css → map.css → (app-specific.css)
 */

/* ─────────────────────────────────────────────────────────
   MAP PAGE LAYOUT
   Two-column: left info panel + right map stage.
   Used by Pelorus app's map page.
   SkyCam overrides .sc-map-stage to absolute-fill.
───────────────────────────────────────────────────────── */

.pl-map-layout {
  display: grid;
  grid-template-columns: 300px minmax(0, 1fr);
  gap: var(--sp-4);
  min-height: calc(100vh - var(--topbar-h) - var(--footer-h));
  align-items: start;
}

/* Left info panel — scrolls independently */
.pl-map-panel {
  display: flex;
  flex-direction: column;
  gap: var(--sp-4);
  position: sticky;
  top: var(--sp-4);
  max-height: calc(100vh - var(--topbar-h) - var(--footer-h) - var(--sp-8));
  overflow-y: auto;
}

/* Map stage — min-height only applies on Pelorus info-panel layout.
   SkyCam overrides this with sc-map-stage (position:absolute inset:0). */
.pl-map-stage {
  border-radius: var(--r-lg);
  overflow: hidden;
  border: 1px solid var(--pl-line);
  box-shadow: var(--shadow-md);
  min-height: 0;
  display: flex;
  flex-direction: column;
  background: var(--pl-panel-dark);
  position: relative;
}

/* Map element fills the stage */
#map {
  flex: 1 1 auto;
  width: 100%;
  min-height: 0;
}

/* ─────────────────────────────────────────────────────────
   MAP TOOLBAR  (above the map, optional)
───────────────────────────────────────────────────────── */

.pl-map-toolbar {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  padding: var(--sp-2) var(--sp-3);
  border-bottom: 1px solid var(--pl-line);
  background: var(--pl-panel);
  flex-wrap: wrap;
}

.pl-map-toolbar-label {
  font-size: 12px;
  font-weight: 600;
  color: var(--pl-muted);
  margin-right: var(--sp-1);
}

/* ─────────────────────────────────────────────────────────
   MAP INFO BLOCKS  (inside .pl-map-panel)
───────────────────────────────────────────────────────── */

.pl-map-info-block {
  background: var(--pl-panel);
  border: 1px solid rgba(255,255,255,.05);
  border-radius: var(--r-md);
  overflow: hidden;
}

.pl-map-info-block-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--sp-2) var(--sp-3);
  border-bottom: 1px solid rgba(255,255,255,.05);
}

.pl-map-info-block h4 {
  margin: 0;
  font-size: 13px;
  font-weight: 600;
  color: var(--pl-text);
}

.pl-map-info-body {
  padding: var(--sp-3);
}

/* List of items inside an info block */
.pl-map-info-list {
  display: grid;
  gap: var(--sp-2);
}

/* Stats row */
#map-stats {
  font-size: 13px;
  color: var(--pl-muted);
  padding: var(--sp-2) var(--sp-3);
}

/* ─────────────────────────────────────────────────────────
   REGION ROWS
───────────────────────────────────────────────────────── */

.pl-region-row {
  padding: var(--sp-2) var(--sp-3);
  border: 1px solid rgba(255,255,255,.05);
  border-radius: var(--r-sm);
  background: rgba(0,0,0,.12);
  transition: background var(--t-fast), border-color var(--t-fast);
  cursor: pointer;
}
.pl-region-row:hover {
  background: rgba(0,0,0,.2);
  border-color: rgba(255,255,255,.09);
}

.pl-region-name {
  color: var(--pl-text);
  font-weight: 600;
  font-size: 13px;
}

.pl-region-meta {
  color: var(--pl-muted);
  font-size: 12px;
  margin-top: 3px;
}

.pl-region-badges {
  display: flex;
  gap: 4px;
  flex-wrap: wrap;
  margin-top: var(--sp-1);
}

/* ─────────────────────────────────────────────────────────
   MAP LOADING STATE
───────────────────────────────────────────────────────── */

.pl-map-loading {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  gap: var(--sp-3);
  background: var(--pl-panel-dark);
  z-index: 10;
  color: var(--pl-muted);
  font-size: 13px;
  pointer-events: none;
  transition: opacity var(--t-slow);
}
.pl-map-loading.is-done { opacity: 0; }

/* ─────────────────────────────────────────────────────────
   MAP ATTRIBUTION OVERRIDE  (Leaflet)
───────────────────────────────────────────────────────── */

.leaflet-control-attribution {
  background: rgba(49,56,64,.88) !important;
  color: var(--pl-muted) !important;
  font-size: 10px !important;
  border-radius: var(--r-sm) 0 0 0 !important;
}
.leaflet-control-attribution a { color: var(--pl-cyan) !important; }

.leaflet-control-zoom a {
  background: rgba(49,56,64,.92) !important;
  color: var(--pl-text) !important;
  border-color: rgba(255,255,255,.1) !important;
  transition: background var(--t-fast) !important;
}
.leaflet-control-zoom a:hover { background: rgba(70,81,93,.95) !important; }

/* ─────────────────────────────────────────────────────────
   RESPONSIVE
───────────────────────────────────────────────────────── */

@media (max-width: 1100px) {
  .pl-map-layout {
    grid-template-columns: 260px minmax(0, 1fr);
  }
  .pl-map-stage, #map { min-height: 0; }
}

@media (max-width: 900px) {
  .pl-map-layout {
    grid-template-columns: 1fr;
  }
  .pl-map-panel {
    position: static;
    max-height: none;
    overflow-y: visible;
  }
  .pl-map-stage, #map { min-height: 0; }
}

@media (max-width: 600px) {
  .pl-map-stage, #map { min-height: 0; }
}
