/**
 * OZARK ORACLE - Map Page Styles
 * Page-specific CSS for geographic maps and territorial visualizations
 *
 * Used by: resource_map.html, arkansas_map.html, investigation_map.html, etc.
 * Requires: quantum-theme.css loaded first
 */

/* === MAP CONTAINER (fills viewport) === */

.map-fullscreen {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    z-index: var(--z-base);
}

.map-container {
    width: 100%;
    height: 100%;
}

/* === MAP CONTROLS PANEL === */

.map-controls {
    position: fixed;
    top: 65px;
    left: var(--sp-md);
    z-index: var(--z-content);
    background: rgba(0, 0, 0, 0.85);
    border: 1px solid var(--glass-border-dim);
    border-radius: var(--radius-md);
    padding: var(--sp-md);
    backdrop-filter: blur(10px);
    max-width: 280px;
}

.map-controls h3 {
    font-size: var(--text-sm);
    color: var(--gold);
    margin-bottom: var(--sp-sm);
}

.map-controls select,
.map-controls input {
    width: 100%;
    font-size: var(--text-sm);
    margin-bottom: var(--sp-sm);
}

/* === MAP INFO PANEL === */

.map-info {
    position: fixed;
    bottom: 60px;
    left: var(--sp-md);
    right: var(--sp-md);
    z-index: var(--z-content);
    background: rgba(0, 0, 0, 0.85);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-md);
    padding: var(--sp-lg);
    backdrop-filter: blur(10px);
    max-width: 400px;
    display: none;
}

.map-info.visible {
    display: block;
}

.map-info h3 {
    color: var(--gold);
    margin-bottom: var(--sp-sm);
}

/* === MAP LEGEND === */

.map-legend {
    position: fixed;
    bottom: 60px;
    right: var(--sp-md);
    z-index: var(--z-content);
    background: rgba(0, 0, 0, 0.8);
    border: 1px solid var(--glass-border-dim);
    border-radius: var(--radius-md);
    padding: var(--sp-md);
    backdrop-filter: blur(5px);
}

.map-legend h4 {
    font-size: var(--text-xs);
    color: var(--gold);
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-bottom: var(--sp-sm);
}

.map-legend-item {
    display: flex;
    align-items: center;
    gap: var(--sp-sm);
    margin-bottom: var(--sp-xs);
    font-size: var(--text-sm);
    color: var(--silver);
}

.map-legend-color {
    width: 14px;
    height: 14px;
    border-radius: 3px;
    flex-shrink: 0;
}

/* === TIMELINE SLIDER (for map_through_time) === */

.map-timeline {
    position: fixed;
    bottom: 50px;
    left: 50%;
    transform: translateX(-50%);
    z-index: var(--z-content);
    background: rgba(0, 0, 0, 0.85);
    border: 1px solid var(--glass-border-dim);
    border-radius: var(--radius-md);
    padding: var(--sp-sm) var(--sp-lg);
    backdrop-filter: blur(5px);
    display: flex;
    align-items: center;
    gap: var(--sp-md);
    min-width: 300px;
}

.map-timeline input[type="range"] {
    flex: 1;
    accent-color: var(--gold);
    background: var(--black-lighter);
}

.map-timeline-label {
    color: var(--gold);
    font-size: var(--text-sm);
    font-weight: 600;
    white-space: nowrap;
}

/* === MARKER POPUP === */

.map-popup {
    background: var(--black-panel);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-md);
    padding: var(--sp-md);
    color: var(--silver);
    max-width: 300px;
}

.map-popup h4 {
    color: var(--gold);
    margin-bottom: var(--sp-xs);
}

/* === LEAFLET POPUP OVERRIDES === */

.leaflet-popup-content-wrapper {
    background: var(--black-lighter);
    color: var(--silver);
    border: 2px solid var(--gold);
    border-radius: 0;
    max-width: 420px;
}

.leaflet-popup-tip {
    background: var(--black-lighter);
}

.leaflet-popup-content h3 {
    color: var(--gold);
    margin: 0 0 8px 0;
    font-size: var(--text-lg);
    border-bottom: 1px solid var(--silver-faint);
    padding-bottom: 5px;
}

.leaflet-popup-content .field {
    margin: 5px 0;
    font-size: var(--text-sm);
}

.leaflet-popup-content .label {
    color: var(--silver-dark);
    display: inline-block;
    min-width: 100px;
}

.leaflet-popup-content .value {
    color: var(--white);
}

.leaflet-popup-content .real-reason {
    color: var(--error);
    font-weight: bold;
    margin: 8px 0;
    padding: 8px;
    background: rgba(255, 107, 107, 0.1);
    border-left: 3px solid var(--error);
}

.leaflet-popup-content .evidence {
    color: var(--info);
    font-size: var(--text-sm);
    margin: 5px 0;
    padding: 5px;
    background: rgba(135, 206, 235, 0.1);
}

.leaflet-popup-content .confidence {
    color: var(--success);
    font-weight: bold;
}

.leaflet-popup-content .dossier-link {
    display: inline-block;
    margin-top: 8px;
    padding: 6px 12px;
    background: var(--gold);
    color: var(--black);
    text-decoration: none;
    font-weight: bold;
    font-size: var(--text-sm);
}

.leaflet-popup-content .dossier-link:hover {
    background: var(--white);
}

.field--connections {
    margin-top: 8px;
}

/* === MAP TITLE BOX (investigation_map) === */

.map-title-box {
    position: absolute;
    top: 20px;
    left: 20px;
    z-index: var(--z-sticky);
    background: rgba(0, 0, 0, 0.95);
    padding: 15px;
    border: 2px solid var(--gold);
    max-width: 350px;
}

.map-title-box h1 {
    font-size: var(--text-base);
    margin: 0 0 8px 0;
    letter-spacing: 2px;
}

.map-title-box .map-subtitle {
    font-size: var(--text-xs);
    color: var(--silver-dark);
    margin: 3px 0;
}

.map-title-box .map-stats {
    margin-top: 10px;
    font-size: var(--text-xs);
    color: var(--silver);
}

/* === MAP TITLE BOX (mobile) === */

@media (max-width: 768px) {
    .map-title-box {
        top: 52px;
        left: 5px;
        right: 5px;
        max-width: none;
        padding: 10px;
    }

    .map-title-box h1 {
        font-size: var(--text-sm);
    }
}

/* === LEAFLET CONTROLS (clear fixed nav) === */

@media (max-width: 768px) {
    .leaflet-top.leaflet-left {
        top: 52px;
    }

    .leaflet-top.leaflet-right {
        top: 52px;
    }
}

/* === LEAFLET POPUP (fit small screens) === */

@media (max-width: 768px) {
    .leaflet-popup-content-wrapper {
        max-width: calc(100vw - 60px);
    }

    .leaflet-popup-content {
        max-width: calc(100vw - 80px);
    }
}

/* === MOBILE === */

@media (max-width: 768px) {
    .map-controls {
        top: auto;
        bottom: 50px;
        left: 0;
        right: 0;
        max-width: none;
        border-radius: var(--radius-md) var(--radius-md) 0 0;
        max-height: 40vh;
        overflow-y: auto;
    }

    .map-legend {
        bottom: auto;
        top: 60px;
        right: var(--sp-sm);
        max-width: 160px;
        font-size: var(--text-xs);
    }

    .map-info {
        bottom: 50px;
        left: 0;
        right: 0;
        max-width: none;
        border-radius: var(--radius-md) var(--radius-md) 0 0;
    }

    .map-timeline {
        left: var(--sp-sm);
        right: var(--sp-sm);
        transform: none;
        min-width: auto;
    }
}
