/**
 * OZARK ORACLE - Resource War Map Styles
 * Page-specific CSS for Leaflet-based resource maps and timeline maps
 *
 * Used by: resource_map.html, map_through_time.html, arkansas_map.html, arkansas_timeline_map.html
 * Requires: quantum-theme.css loaded first
 */

/* === MAP FILL === */
#map {
    width: 100vw;
    height: 100vh;
    position: fixed;
    top: 0;
    left: 0;
    z-index: 1;
}

/* === LEAFLET POPUP OVERRIDES === */
.leaflet-popup-content-wrapper {
    background: #111;
    color: #ccc;
    border: 1px solid #d4af37;
    border-radius: 0;
    max-width: 400px;
}

.leaflet-popup-tip {
    background: #111;
}

.leaflet-popup-content h3 {
    color: #d4af37;
    margin: 0 0 5px 0;
    border-bottom: 1px solid #333;
    padding-bottom: 5px;
    font-size: var(--text-sm);
}

.leaflet-popup-content b {
    color: #aaa;
    font-size: var(--text-xs);
}

.leaflet-popup-content {
    font-size: var(--text-xs);
    line-height: 1.5;
}

.leaflet-popup-content .real-reason {
    color: #ff4444;
    font-weight: bold;
    margin-top: 6px;
    padding-top: 6px;
    border-top: 1px solid #333;
}

.leaflet-popup-content .death-toll {
    color: #ff0000;
    font-weight: bold;
    font-size: var(--text-sm);
}

.leaflet-popup-content .nexus-type {
    color: #ff4444;
    font-weight: bold;
    margin-top: 6px;
    padding-top: 6px;
    border-top: 1px solid #333;
    text-transform: uppercase;
    font-size: var(--text-2xs);
}

/* === ERA OVERLAY (Info panel, top-left) === */
.era-overlay {
    position: absolute;
    top: 20px;
    left: 20px;
    z-index: 1000;
    background: rgba(0, 0, 0, 0.88);
    padding: 15px 20px;
    border: 2px solid #d4af37;
    max-width: 350px;
    pointer-events: auto;
}

.era-title {
    font-size: var(--text-base);
    color: #d4af37;
    text-transform: uppercase;
    letter-spacing: 2px;
    margin-bottom: 5px;
}

.era-year {
    font-size: var(--text-sm);
    color: #fff;
    margin-bottom: 3px;
}

.era-desc {
    font-size: var(--text-xs);
    color: #aaa;
    margin-bottom: 3px;
}

.era-deaths {
    font-size: var(--text-sm);
    color: #ff0000;
    font-weight: bold;
    margin: 4px 0;
}

.era-count {
    font-size: var(--text-xs);
    color: #888;
    margin-top: 4px;
}

.era-overlay a {
    color: #d4af37;
    text-decoration: none;
    font-size: var(--text-xs);
}

.era-overlay a:hover {
    text-decoration: underline;
}

/* === GENOCIDE OVERLAY STATE === */
.era-overlay.genocide {
    border-color: #ff0000;
    background: rgba(80, 0, 0, 0.92);
    animation: pulse-border 2s infinite;
}

.era-overlay.genocide .era-title {
    color: #ff0000;
    animation: pulse-text 2s infinite;
}

@keyframes pulse-text {
    0%, 100% { text-shadow: 0 0 20px rgba(255, 0, 0, 0.6); }
    50% { text-shadow: 0 0 40px rgba(255, 0, 0, 1); }
}

@keyframes pulse-border {
    0%, 100% { border-color: #ff0000; box-shadow: 0 0 10px rgba(255, 0, 0, 0.2); }
    50% { border-color: #ff6666; box-shadow: 0 0 25px rgba(255, 0, 0, 0.4); }
}

@keyframes pulse-red {
    0%, 100% { text-shadow: 0 0 30px rgba(255, 0, 0, 0.8); }
    50% { text-shadow: 0 0 60px rgba(255, 0, 0, 1); }
}

/* === DEATH TOLL (standalone) === */
.death-toll {
    font-size: var(--text-sm);
    color: #ff0000;
    font-weight: bold;
    margin: 5px 0;
}

/* === MAP CONTROLS BAR === */
.controls {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 10000;
    background: rgba(0, 0, 0, 0.95);
    border-top: 2px solid #d4af37;
    padding: 12px 20px;
    display: flex;
    gap: 10px;
    align-items: center;
}

.controls .btn,
.controls button.btn {
    background: #1a1a1a;
    border: 1px solid #d4af37;
    color: #d4af37;
    padding: 8px 14px;
    cursor: pointer;

    font-size: var(--text-xs);
    text-transform: uppercase;
    white-space: nowrap;
}

.controls .btn:hover {
    background: #d4af37;
    color: #000;
}

.controls .btn.active {
    background: #d4af37;
    color: #000;
}

#timeline-slider {
    flex: 1;
    cursor: pointer;
    accent-color: #d4af37;
}

.year-display {
    color: #d4af37;
    font-size: var(--text-sm);
    font-weight: bold;
    min-width: 80px;
    text-align: center;
}

.progress {
    color: #666;
    font-size: var(--text-xs);
    min-width: 50px;
    text-align: right;
}

/* === PIN MARKERS (small, supplementary) === */
.pin-marker {
    color: #d4af37;
    font-size: var(--text-2xs);
    font-weight: bold;
    text-shadow: 0 0 3px #000, 0 0 6px #000;
    white-space: nowrap;
}

/* === TERRITORY HOVER TOOLTIPS === */
.territory-tooltip {
    background: rgba(0, 0, 0, 0.9) !important;
    border: 1px solid #d4af37 !important;
    color: #d4af37 !important;

    font-size: var(--text-xs) !important;
    padding: 4px 8px !important;
    border-radius: 0 !important;
    box-shadow: 0 0 8px rgba(212, 175, 55, 0.3) !important;
}

.territory-tooltip .leaflet-tooltip-left::before {
    border-left-color: #d4af37 !important;
}

.territory-tooltip .leaflet-tooltip-right::before {
    border-right-color: #d4af37 !important;
}

/* === ARK HUB LINK === */
.ark-hub-link {
    display: block;
    border: 1px solid #d4af37;
    padding: 10px;
    text-align: center;
    color: #d4af37;
    background: #111;
    font-weight: bold;
    letter-spacing: 1px;
    margin-bottom: 10px;
    text-decoration: none;
}

.ark-hub-link:hover {
    background: #d4af37;
    color: #000;
}

/* === HUB OVERLAY (arkansas_map.html) === */
.hub-overlay {
    position: absolute;
    top: 20px;
    left: 20px;
    z-index: 1000;
    background: rgba(0, 0, 0, 0.9);
    padding: 15px 20px;
    border: 2px solid #d4af37;
    max-width: 300px;
    pointer-events: auto;
}

.hub-title {
    font-size: var(--text-lg);
    color: #d4af37;
    text-transform: uppercase;
    letter-spacing: 2px;
    margin-bottom: 10px;
}

.hub-desc {
    font-size: var(--text-xs);
    color: #aaa;
    margin-bottom: 10px;
}

.hub-links a {
    display: block;
    color: #fff;
    text-decoration: none;
    font-size: var(--text-xs);
    margin-bottom: 5px;
    border-left: 2px solid #d4af37;
    padding-left: 8px;
}

.hub-links a:hover {
    color: #d4af37;
    background: #111;
}

/* === LEGEND (arkansas_map.html) === */
.legend {
    position: absolute;
    bottom: 80px;
    right: 20px;
    z-index: 1000;
    background: rgba(0, 0, 0, 0.9);
    padding: 10px;
    border: 1px solid #d4af37;
    font-size: var(--text-xs);
}

.legend-item {
    display: flex;
    align-items: center;
    margin-bottom: 5px;
}

.legend-color {
    width: 12px;
    height: 12px;
    margin-right: 8px;
}

/* Legend color classes */
.legend-bg-red { background: #ff0000; }
.legend-bg-green { background: #00ff00; }
.legend-bg-blue { background: #0000ff; }
.legend-bg-yellow { background: #ffff00; }
.legend-bg-magenta { background: #ff00ff; }

/* === NEXUS PULSE ANIMATION === */
.nexus-pulse {
    width: 12px;
    height: 12px;
    background: rgba(255, 0, 0, 0.6);
    border-radius: 50%;
    box-shadow: 0 0 0 rgba(255, 0, 0, 0.4);
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0% { box-shadow: 0 0 0 0 rgba(255, 0, 0, 0.7); }
    70% { box-shadow: 0 0 0 15px rgba(255, 0, 0, 0); }
    100% { box-shadow: 0 0 0 0 rgba(255, 0, 0, 0); }
}

/* === JS-GENERATED COLOR CLASSES === */
.color-red { color: #ff0000; }
.color-gold { color: #d4af37; }

/* === CURRENT YEAR DISPLAY === */
.current-year {
    font-size: var(--text-2xl);
    font-weight: bold;
    color: #FFD700;
    margin-right: 10px;
}

/* === CENTERED CONTROLS VARIANT === */
.controls-centered {
    position: fixed;
    bottom: 25px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 10000;
    background: rgba(0, 0, 0, 0.95);
    padding: 15px 30px;
    border: 2px solid #d4af37;
    display: flex;
    gap: 20px;
    align-items: center;
    width: auto;
    height: auto;
}

.controls-centered .btn {
    background: #1a1a1a;
    border: 1px solid #d4af37;
    color: #d4af37;
    padding: 10px 20px;
    cursor: pointer;

    font-size: var(--text-sm);
    text-transform: uppercase;
}

.controls-centered .btn:hover {
    background: #d4af37;
    color: #000;
}

.controls-centered .btn.active {
    background: #d4af37;
    color: #000;
}

.controls-centered .progress {
    color: #d4af37;
    font-size: var(--text-sm);
    min-width: 60px;
}

.controls-centered #timeline-slider {
    width: 300px;
    margin: 0 15px;
    accent-color: #d4af37;
    cursor: pointer;
}

/* === SLIDER FLEX === */
.slider-flex {
    flex: 1;
    margin: 0 15px;
    cursor: pointer;
}

/* === SIDEBAR MAP LAYOUT (resource_map.html only) === */
.map-with-sidebar {
    display: flex;
    position: fixed;
    top: 48px;
    left: 0;
    right: 0;
    bottom: 58px;
    z-index: 1;
}

.map-with-sidebar .era-overlay {
    position: static;
    width: 280px;
    min-width: 240px;
    max-width: none;
    background: rgba(0, 0, 0, 0.95);
    border: none;
    border-right: 2px solid #d4af37;
    padding: 15px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    pointer-events: auto;
}

.map-with-sidebar .era-overlay.genocide {
    border-right-color: #ff0000;
    background: rgba(40, 0, 0, 0.95);
}

.map-area {
    flex: 1;
    position: relative;
}

.map-with-sidebar .map-area #map {
    position: absolute;
    width: 100%;
    height: 100%;
    top: 0;
    left: 0;
}

.sidebar-links {
    margin-top: auto;
    padding-top: 15px;
    border-top: 1px solid #333;
}

.sidebar-links a {
    display: block;
    margin-bottom: 8px;
}

.sidebar-links a:last-child {
    color: #888;
    font-size: var(--text-xs);
    margin-top: 5px;
}

/* === MOBILE RESPONSIVE === */
@media (max-width: 768px) {
    .era-overlay {
        top: 52px;
        left: 5px;
        right: auto;
        max-width: 65%;
        padding: 8px 10px;
    }

    .era-title {
        font-size: var(--text-sm);
        margin-bottom: 3px;
    }

    .era-year,
    .era-desc {
        font-size: var(--text-xs);
    }

    .era-count {
        display: none;
    }

    .controls {
        padding: 6px 8px;
        gap: 5px;
        flex-wrap: wrap;
        justify-content: center;
    }

    .controls .btn {
        padding: 6px 10px;
        font-size: var(--text-xs);
    }

    .controls-centered {
        bottom: 5px;
        padding: 8px 12px;
        gap: 8px;
        left: 5px;
        right: 5px;
        transform: none;
        width: auto;
        flex-wrap: wrap;
        justify-content: center;
    }

    .controls-centered .btn {
        padding: 6px 10px;
        font-size: var(--text-xs);
    }

    .controls-centered #timeline-slider {
        width: 100%;
        min-width: 80px;
        flex: 1;
    }

    .current-year {
        font-size: var(--text-lg);
    }

    .hub-overlay {
        top: 52px;
        left: 5px;
        right: auto;
        max-width: 65%;
        padding: 8px 10px;
    }

    .legend {
        bottom: auto;
        top: 52px;
        right: 5px;
        left: auto;
        font-size: var(--text-xs);
        max-width: 30%;
    }

    /* Sidebar collapses to top strip on mobile */
    .map-with-sidebar {
        flex-direction: column;
        top: 48px;
        bottom: 52px;
    }

    .map-with-sidebar .era-overlay {
        width: 100%;
        min-width: auto;
        max-height: 110px;
        border-right: none;
        border-bottom: 2px solid #d4af37;
        flex-direction: column;
        padding: 8px 10px;
    }

    .map-with-sidebar .era-overlay .sidebar-links {
        display: flex;
        gap: 8px;
        padding-top: 8px;
        flex-wrap: wrap;
    }

    .map-with-sidebar .era-overlay .sidebar-links a {
        margin-bottom: 0;
        font-size: var(--text-xs);
        padding: 4px 8px;
    }
}
