@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&display=swap');

:root {
    --bg-color: #0b0f19;
    --panel-bg: rgba(20, 26, 39, 0.85);
    --text-main: #e2e8f0;
    --text-muted: #94a3b8;
    --border-color: #334155;
    
    --safe-color: #10b981;
    --warning-color: #f59e0b;
    --danger-color: #ef4444;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    font-family: 'Inter', sans-serif;
}

body {
    background-color: var(--bg-color);
    color: var(--text-main);
    overflow: hidden; /* App-like feel */
}

#app-container {
    display: flex;
    height: 100vh;
    width: 100vw;
    position: relative;
}

/* Sidebar / Situation Deck */
#situation-deck {
    width: 340px;
    background: var(--panel-bg);
    backdrop-filter: blur(10px);
    border-right: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    z-index: 2000;
    box-shadow: 2px 0 15px rgba(0,0,0,0.5);
    position: absolute;
    top: 0;
    left: 0;
    height: 100%;
    transform: translateX(-100%);
    transition: transform 0.3s ease-in-out;
}

#situation-deck.open {
    transform: translateX(0);
}

/* Sources Sidebar (Right) */
#sources-deck {
    width: 340px;
    background: var(--panel-bg);
    backdrop-filter: blur(10px);
    border-left: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    z-index: 2000;
    box-shadow: -2px 0 15px rgba(0,0,0,0.5);
    position: absolute;
    top: 0;
    right: 0;
    height: 100%;
    transform: translateX(100%);
    transition: transform 0.3s ease-in-out;
}

#sources-deck.open {
    transform: translateX(0);
}

.deck-header {
    padding: 24px;
    border-bottom: 1px solid var(--border-color);
}

.deck-title-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
}

.deck-header h1 {
    font-size: 1.5rem;
    font-weight: 600;
    letter-spacing: 0.5px;
    text-transform: uppercase;
}

.status-meta {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.85rem;
    color: var(--text-muted);
}

.refresh-indicator {
    display: inline-block;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background-color: var(--safe-color);
    box-shadow: 0 0 8px var(--safe-color);
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0% { opacity: 1; box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.7); }
    70% { opacity: 0.6; box-shadow: 0 0 0 6px rgba(16, 185, 129, 0); }
    100% { opacity: 1; box-shadow: 0 0 0 0 rgba(16, 185, 129, 0); }
}

.deck-content {
    flex-grow: 1;
    overflow-y: auto;
    padding: 24px 0;
}

/* Details and Summary for City Groups */
details.city-group summary {
    cursor: pointer;
    outline: none;
    list-style: none; /* remove default arrow */
    display: flex;
    align-items: center;
    padding: 0 24px;
    margin-bottom: 12px;
}
details.city-group summary::-webkit-details-marker {
    display: none;
}
details.city-group summary h2 {
    font-size: 0.9rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 1px;
    padding: 0;
    margin-bottom: 0;
    flex-grow: 1;
}
details.city-group summary::after {
    content: '▼';
    font-size: 0.7rem;
    color: var(--text-muted);
    transition: transform 0.3s;
}
details.city-group[open] summary::after {
    transform: rotate(180deg);
}

.city-list {
    list-style: none;
}

.city-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 24px;
    border-bottom: 1px solid rgba(255,255,255,0.05);
    transition: background 0.2s;
    cursor: pointer;
}

.city-item:hover {
    background: rgba(255,255,255,0.05);
}

.city-name {
    font-size: 0.95rem;
    font-weight: 500;
}

.city-status {
    font-size: 0.75rem;
    padding: 4px 8px;
    border-radius: 4px;
    font-weight: 600;
    text-transform: uppercase;
}

.status-safe {
    background-color: rgba(16, 185, 129, 0.2);
    color: var(--safe-color);
    border: 1px solid rgba(16, 185, 129, 0.3);
}

.status-warning {
    background-color: rgba(245, 158, 11, 0.2);
    color: var(--warning-color);
    border: 1px solid rgba(245, 158, 11, 0.3);
}

.status-danger {
    background-color: rgba(239, 68, 68, 0.2);
    color: var(--danger-color);
    border: 1px solid rgba(239, 68, 68, 0.3);
}

/* Map Area */
#map-wrapper {
    flex-grow: 1;
    position: relative;
    background-color: #0b0f19;
}

#map {
    width: 100%;
    height: 100%;
    /* Subtle filter to make map tiles darker if needed */
    filter: brightness(0.7) contrast(1.2);
}

/* Leaflet Overrides for Dark Mode popups */
.leaflet-popup-content-wrapper, .leaflet-popup-tip {
    background: var(--panel-bg);
    color: var(--text-main);
    box-shadow: 0 3px 14px rgba(0,0,0,0.4);
    backdrop-filter: blur(5px);
}
.leaflet-popup-content h3 {
    margin: 0 0 8px 0;
    font-size: 1.1rem;
    color: white;
}
.leaflet-popup-content p {
    margin: 4px 0;
    font-size: 0.9rem;
}
.leaflet-container a.leaflet-popup-close-button {
    color: var(--text-muted);
}

#close-deck-btn, #close-sources-btn {
    background: none;
    border: none;
    color: var(--text-main);
    font-size: 1.5rem;
    cursor: pointer;
}

#open-deck-btn {
    position: absolute;
    top: 15px;
    left: 15px;
    z-index: 1000;
    background: var(--panel-bg);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 8px 12px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.5);
    backdrop-filter: blur(5px);
    color: var(--text-main);
    font-size: 1.5rem;
    cursor: pointer;
}

#open-sources-btn {
    position: absolute;
    top: 15px;
    right: 15px;
    z-index: 1000;
    background: var(--panel-bg);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 8px 12px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.5);
    backdrop-filter: blur(5px);
    color: var(--text-main);
    font-size: 1.5rem;
    cursor: pointer;
}

#language-switcher {
    position: absolute;
    top: 15px;
    right: 70px; /* Position next to the info button */
    z-index: 1000;
    display: flex;
    gap: 4px;
    background: var(--panel-bg);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 6px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.5);
    backdrop-filter: blur(5px);
}

#lang-select {
    background: transparent;
    color: var(--text-color);
    border: none;
    font-size: 0.9rem;
    cursor: pointer;
    outline: none;
    padding: 2px 4px;
}
#lang-select option {
    background: var(--panel-bg);
    color: var(--text-color);
}

/* Source Panel Specific Styles */
.source-group {
    margin-bottom: 24px;
}

.source-group h2 {
    font-size: 0.9rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 1px;
    padding: 0 24px;
    margin-bottom: 12px;
}

.source-item {
    padding: 12px 24px;
    border-bottom: 1px solid rgba(255,255,255,0.05);
}

.source-item strong {
    display: block;
    font-size: 0.95rem;
    margin-bottom: 4px;
}

.source-desc {
    font-size: 0.8rem;
    color: var(--text-muted);
}

.app-links a {
    color: var(--safe-color);
    text-decoration: none;
    font-size: 0.85rem;
    margin: 0 4px;
}

.app-links a:first-child {
    margin-left: 0;
}

.app-links a:hover {
    text-decoration: underline;
}

/* Map Legend */
#map-legend {
    position: absolute;
    bottom: 20px;
    left: 20px;
    background: rgba(15, 23, 42, 0.9);
    border: 1px solid #334155;
    padding: 10px 15px;
    border-radius: 8px;
    z-index: 1000;
    color: #e2e8f0;
    font-size: 0.85rem;
    backdrop-filter: blur(5px);
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.5);
}
.legend-item {
    display: flex;
    align-items: center;
    margin-bottom: 5px;
}
.legend-color {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    display: inline-block;
    margin-right: 8px;
}
.color-safe { background-color: #10b981; }
.color-warning { background-color: #f97316; }
.color-danger { background-color: #ef4444; }
.color-offline { background-color: #eab308; }
#legend-time {
    margin-top: 8px;
    padding-top: 5px;
    border-top: 1px solid #334155;
    font-size: 0.75rem;
    color: #94a3b8;
}

/* Offline UI Status */
.status-offline {
    background-color: rgba(234, 179, 8, 0.1);
    color: #eab308;
    border: 1px solid rgba(234, 179, 8, 0.2);
}
