/* korum_map.css — KORUM Operational Intelligence Map styles */

/* -----------------------------------------------------------------------
   Inline map result card
----------------------------------------------------------------------- */

#pane-map {
    display: none;
}

.map-card.korum-map-card {
    margin: 18px 18px 20px;
    border: 1px solid rgba(245, 168, 0, 0.24);
    border-radius: 8px;
    background: linear-gradient(180deg, rgba(17, 24, 39, 0.78), rgba(8, 10, 14, 0.96));
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.05);
    overflow: hidden;
    flex-shrink: 0; /* prevent dock flex compression from clipping the map */
}

.map-card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 14px 16px 10px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

.map-card-kicker {
    color: #f59e0b;
    font-family: var(--font-head, 'Courier New', monospace);
    font-size: 10px;
    font-weight: 800;
    letter-spacing: 0.16em;
    text-transform: uppercase;
}

.map-card-title {
    margin: 4px 0 0;
    color: #f9fafb;
    font-family: var(--font-head, 'Courier New', monospace);
    font-size: 15px;
    line-height: 1.35;
    letter-spacing: 0;
}

.map-card-controls {
    display: flex;
    flex-direction: column;
    background: rgba(0, 0, 0, 0.24);
}

.map-card-body {
    padding: 12px;
    background: rgba(0, 0, 0, 0.22);
}

.korum-map-container {
    height: 620px;
    width: 100%;
    background: #111827;
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 6px;
    overflow: hidden;
}

.korum-map-placeholder {
    min-height: 260px;
    max-height: 400px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 12px;
    padding: 28px;
    border: 1px dashed rgba(245, 168, 0, 0.35);
    border-radius: 6px;
    background:
        linear-gradient(rgba(245, 168, 0, 0.04) 1px, transparent 1px),
        linear-gradient(90deg, rgba(245, 168, 0, 0.04) 1px, transparent 1px),
        rgba(8, 10, 14, 0.92);
    background-size: 28px 28px;
}

.korum-map-placeholder-title {
    color: #f59e0b;
    font-family: var(--font-head, 'Courier New', monospace);
    font-size: 13px;
    font-weight: 800;
    letter-spacing: 0.12em;
    text-transform: uppercase;
}

.korum-map-placeholder-copy,
.korum-map-placeholder-list {
    color: #cbd5e1;
    font-size: 12px;
    line-height: 1.6;
}

.korum-map-placeholder-list {
    display: grid;
    gap: 6px;
    color: #94a3b8;
    font-family: 'Courier New', monospace;
}

.korum-map-placeholder-list span::before {
    content: '› ';
    color: #00ff9d;
}

.korum-map-feature-list {
    display: grid;
    gap: 6px;
    max-height: 180px;
    overflow-y: auto;
    padding-top: 6px;
}

.korum-map-feature-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding: 7px 9px;
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 4px;
    background: rgba(0, 0, 0, 0.28);
    color: #cbd5e1;
    font-family: 'Courier New', monospace;
    font-size: 10px;
}

.korum-map-feature-row strong {
    color: #f59e0b;
    font-size: 9px;
    font-weight: 700;
    text-transform: uppercase;
    text-align: right;
}

.map-card-legend {
    padding: 0 14px 14px;
}

.korum-map-legend {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 10px 12px;
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 6px;
    background: rgba(0, 0, 0, 0.28);
}

.korum-map-legend-label {
    flex: 0 0 auto;
    color: #f59e0b;
    font-family: 'Courier New', monospace;
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 0.1em;
    text-transform: uppercase;
}

.korum-map-legend-list {
    display: flex;
    flex-wrap: wrap;
    gap: 8px 12px;
    min-width: 0;
}

.korum-map-legend-item {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    color: #9ca3af;
    font-family: 'Courier New', monospace;
    font-size: 10px;
    text-transform: uppercase;
}

.korum-map-legend-dot,
.korum-map-legend-line {
    display: inline-block;
    width: 9px;
    height: 9px;
    border-radius: 50%;
    background: #6b7280;
    border: 1px solid rgba(255, 255, 255, 0.22);
}

.korum-map-legend-line {
    width: 16px;
    height: 2px;
    border-radius: 2px;
    border: 0;
    background: #f59e0b;
}

.korum-map-legend-muted {
    color: #6b7280;
    font-family: 'Courier New', monospace;
    font-size: 10px;
}

.korum-map-legend-item.state-stable .korum-map-legend-dot { background: #22c55e; }
.korum-map-legend-item.state-degraded .korum-map-legend-dot { background: #f59e0b; }
.korum-map-legend-item.state-fragile .korum-map-legend-dot { background: #f97316; }
.korum-map-legend-item.state-temporary .korum-map-legend-dot { background: #eab308; }
.korum-map-legend-item.state-hard-down .korum-map-legend-dot { background: #4b5563; }
.korum-map-legend-item.state-denied .korum-map-legend-dot { background: #7f1d1d; }
.korum-map-legend-item.state-contested .korum-map-legend-dot { background: #ef4444; }
.korum-map-legend-item.state-risk-corridor .korum-map-legend-dot { background: #7c3aed; }

/* -----------------------------------------------------------------------
   Status bar
----------------------------------------------------------------------- */

.korum-map-status-bar {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 6px 14px;
    background: #0d1117;
    border-bottom: 1px solid #1f2937;
    font-family: 'Courier New', monospace;
    font-size: 11px;
    flex-shrink: 0;
}

.korum-map-meta {
    color: #f59e0b;
    font-weight: 700;
    letter-spacing: 0.08em;
}

.korum-map-type {
    color: #6b7280;
    letter-spacing: 0.05em;
}

.korum-map-count {
    color: #9ca3af;
}

.korum-map-ts {
    color: #4b5563;
    margin-left: auto;
}

/* -----------------------------------------------------------------------
   Layer toggles
----------------------------------------------------------------------- */

.korum-layer-toggles {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    padding: 6px 12px;
    background: #111827;
    border-bottom: 1px solid #1f2937;
    flex-shrink: 0;
}

@media (max-width: 760px) {
    .map-card.korum-map-card {
        margin: 12px;
    }

    .korum-map-status-bar,
    .korum-map-legend {
        flex-wrap: wrap;
    }

    .korum-map-ts {
        margin-left: 0;
    }

    .korum-map-container {
        height: 460px;
    }
}

.korum-layer-toggle {
    padding: 3px 10px;
    font-size: 10px;
    font-family: 'Courier New', monospace;
    font-weight: 600;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    border: 1px solid #374151;
    border-radius: 3px;
    background: transparent;
    color: #4b5563;
    cursor: pointer;
    transition: all 0.15s;
}

.korum-layer-toggle.active {
    background: rgba(245, 158, 11, 0.12);
    border-color: #f59e0b;
    color: #f59e0b;
}

.korum-layer-toggle:hover {
    border-color: #6b7280;
    color: #9ca3af;
}

/* -----------------------------------------------------------------------
   Popup styles
   Field order: Label → State → Confidence → Operational Implication → Verified → Evidence
----------------------------------------------------------------------- */

.korum-map-popup-wrap .leaflet-popup-content-wrapper {
    background: #111827;
    border: 1px solid #374151;
    border-radius: 4px;
    box-shadow: 0 4px 16px rgba(0,0,0,0.6);
    padding: 0;
}

.korum-map-popup-wrap .leaflet-popup-tip {
    background: #374151;
}

.korum-map-popup-wrap .leaflet-popup-content {
    margin: 0;
    font-family: 'Courier New', monospace;
    font-size: 12px;
    color: #d1d5db;
    min-width: 220px;
    max-width: 320px;
}

.korum-popup {
    padding: 12px 14px;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.korum-popup-label {
    font-size: 13px;
    font-weight: 700;
    color: #f9fafb;
    letter-spacing: 0.04em;
    border-bottom: 1px solid #1f2937;
    padding-bottom: 6px;
    margin-bottom: 2px;
}

/* State badge */
.korum-popup-state {
    display: inline-block;
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 0.1em;
    padding: 2px 8px;
    border-radius: 2px;
    text-transform: uppercase;
    align-self: flex-start;
}

.korum-popup-state.state-stable        { background: rgba(34, 197, 94, 0.18);  color: #22c55e; border: 1px solid #22c55e; }
.korum-popup-state.state-degraded      { background: rgba(245, 158, 11, 0.18); color: #f59e0b; border: 1px solid #f59e0b; }
.korum-popup-state.state-fragile       { background: rgba(249, 115, 22, 0.18); color: #f97316; border: 1px solid #f97316; }
.korum-popup-state.state-temporary     { background: rgba(234, 179, 8, 0.18);  color: #eab308; border: 1px solid #eab308; }
.korum-popup-state.state-hard-down     { background: rgba(55, 65, 81, 0.4);    color: #9ca3af; border: 1px solid #4b5563; }
.korum-popup-state.state-denied        { background: rgba(127, 29, 29, 0.3);   color: #fca5a5; border: 1px solid #7f1d1d; }
.korum-popup-state.state-unknown       { background: rgba(107, 114, 128, 0.2); color: #6b7280; border: 1px solid #4b5563; }
.korum-popup-state.state-pending       { background: rgba(156, 163, 175, 0.15);color: #9ca3af; border: 1px solid #6b7280; }
.korum-popup-state.state-contested     { background: rgba(239, 68, 68, 0.18);  color: #ef4444; border: 1px solid #ef4444; }
.korum-popup-state.state-risk-corridor { background: rgba(124, 58, 237, 0.18); color: #a78bfa; border: 1px solid #7c3aed; }

.korum-popup-confidence {
    font-size: 11px;
    color: #9ca3af;
}

/* The primary KORUM-native field */
.korum-popup-implication {
    font-size: 12px;
    color: #f9fafb;
    background: rgba(245, 158, 11, 0.07);
    border-left: 2px solid #f59e0b;
    padding: 6px 8px;
    line-height: 1.5;
    border-radius: 0 2px 2px 0;
}

.korum-popup-verified {
    font-size: 10px;
    color: #6b7280;
}

.korum-popup-evidence {
    font-size: 10px;
    color: #4b5563;
    font-style: italic;
}

.korum-popup-risk {
    font-size: 11px;
    color: #f97316;
    background: rgba(249, 115, 22, 0.06);
    padding: 4px 6px;
    border-radius: 2px;
}

/* -----------------------------------------------------------------------
   Decay badges (inline in popup)
----------------------------------------------------------------------- */

.korum-decay-badge {
    display: inline-block;
    font-size: 9px;
    font-weight: 700;
    letter-spacing: 0.08em;
    padding: 1px 5px;
    border-radius: 2px;
    vertical-align: middle;
    margin-left: 4px;
}

.decay-critical {
    background: rgba(239, 68, 68, 0.2);
    color: #ef4444;
    border: 1px solid #ef4444;
}

.decay-high {
    background: rgba(249, 115, 22, 0.2);
    color: #f97316;
    border: 1px solid #f97316;
}

.decay-medium {
    background: rgba(234, 179, 8, 0.15);
    color: #eab308;
    border: 1px solid #eab308;
}

/* -----------------------------------------------------------------------
   Leaflet overrides to match dark theme
----------------------------------------------------------------------- */

#korum-map-container .leaflet-control-zoom a {
    background: #1f2937;
    color: #d1d5db;
    border: 1px solid #374151;
}

#korum-map-container .leaflet-control-zoom a:hover {
    background: #374151;
    color: #f9fafb;
}

#korum-map-container .leaflet-control-attribution {
    background: rgba(13, 17, 23, 0.8);
    color: #4b5563;
    font-size: 9px;
}

#korum-map-container .leaflet-control-attribution a {
    color: #6b7280;
}
