* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --bg: #0f0f1a;
    --bg-panel: #1a1a2e;
    --bg-section: #16213e;
    --text: #e0e0e0;
    --text-dim: #8888aa;
    --accent: #4fc3f7;
    --accent-dim: #2a7a9e;
    --border: #2a2a4a;
    --success: #66bb6a;
    --warning: #ffa726;
    --error: #ef5350;
}

html, body {
    height: 100%;
    width: 100%;
    overflow: hidden;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif;
    background: var(--bg);
    color: var(--text);
}

#map {
    width: 100%;
    height: 100%;
    background: var(--bg);
}

.leaflet-tile-pane {
    filter: brightness(0.85) contrast(1.1) saturate(0.8);
}

.camera-marker {
    width: 12px;
    height: 12px;
    background: var(--accent);
    border: 2px solid #fff;
    border-radius: 50%;
    box-shadow: 0 0 6px rgba(79, 195, 247, 0.5);
    cursor: pointer;
    transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.camera-marker:hover {
    transform: scale(1.4);
    box-shadow: 0 0 12px rgba(79, 195, 247, 0.8);
}

.camera-marker.offline {
    background: var(--text-dim);
    box-shadow: 0 0 4px rgba(136, 136, 170, 0.3);
}

/* Panel */

.panel {
    position: fixed;
    top: 0;
    right: 0;
    width: 380px;
    height: 100%;
    background: var(--bg-panel);
    border-left: 1px solid var(--border);
    transform: translateX(100%);
    transition: transform 0.3s ease;
    z-index: 1000;
    overflow-y: auto;
    overflow-x: hidden;
}

.panel.open {
    transform: translateX(0);
}

.panel-close {
    position: sticky;
    top: 0;
    float: right;
    background: none;
    border: none;
    color: var(--text-dim);
    font-size: 28px;
    cursor: pointer;
    padding: 12px 16px;
    z-index: 1001;
    transition: color 0.15s;
}

.panel-close:hover {
    color: var(--text);
}

#panel-content {
    padding: 16px;
    padding-top: 8px;
}

#panel-header {
    margin-bottom: 16px;
    padding-right: 32px;
}

#panel-title {
    font-size: 18px;
    font-weight: 600;
    color: var(--text);
    margin-bottom: 4px;
}

#panel-subtitle {
    font-size: 13px;
    color: var(--text-dim);
}

.panel-section {
    background: var(--bg-section);
    border-radius: 8px;
    padding: 12px;
    margin-bottom: 12px;
}

.panel-section:empty {
    display: none;
}

.panel-section h3 {
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--text-dim);
    margin-bottom: 8px;
}

.weather-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
}

.weather-item {
    display: flex;
    flex-direction: column;
}

.weather-item .value {
    font-size: 20px;
    font-weight: 600;
    color: var(--text);
}

.weather-item .label {
    font-size: 11px;
    color: var(--text-dim);
}

.sun-times {
    display: flex;
    justify-content: space-between;
}

.sun-item {
    text-align: center;
}

.sun-item .value {
    font-size: 16px;
    font-weight: 600;
}

.sun-item .label {
    font-size: 11px;
    color: var(--text-dim);
}

.sun-item.golden .value {
    color: #ffb74d;
}

/* Camera image */

#camera-container {
    position: relative;
    width: 100%;
    min-height: 60px;
}

#camera-container img {
    width: 100%;
    border-radius: 6px;
    display: block;
}

#camera-container .loading {
    color: var(--text-dim);
    font-size: 13px;
    text-align: center;
    padding: 20px;
}

#camera-container .error {
    color: var(--error);
    font-size: 13px;
    text-align: center;
    padding: 20px;
}

.camera-refresh {
    position: absolute;
    top: 8px;
    right: 8px;
    background: rgba(0, 0, 0, 0.6);
    border: none;
    color: #fff;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    cursor: pointer;
    font-size: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.15s;
}

.camera-refresh:hover {
    background: rgba(0, 0, 0, 0.8);
}

/* Layers toggle */

.layers-toggle {
    position: fixed;
    top: 16px;
    left: 16px;
    z-index: 1000;
}

#layers-btn {
    background: var(--bg-panel);
    border: 1px solid var(--border);
    color: var(--text);
    width: 40px;
    height: 40px;
    border-radius: 8px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.15s;
}

#layers-btn:hover {
    background: var(--bg-section);
}

.layers-menu {
    position: absolute;
    top: 48px;
    left: 0;
    background: var(--bg-panel);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 8px 12px;
    min-width: 160px;
}

.layers-menu.hidden {
    display: none;
}

.layers-group {
    padding: 4px 0;
    border-bottom: 1px solid var(--border);
}

.layers-group:last-child {
    border-bottom: none;
}

.layers-menu label {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 5px 0;
    font-size: 13px;
    cursor: pointer;
    color: var(--text);
}

.layers-menu input[type="checkbox"] {
    accent-color: var(--accent);
}

.iss-marker {
    background: none !important;
    border: none !important;
}

.iss-icon {
    font-size: 24px;
    filter: drop-shadow(0 0 6px rgba(79, 195, 247, 0.8));
    animation: iss-pulse 2s ease-in-out infinite;
}

@keyframes iss-pulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.15); }
}

.radio-station:hover {
    background: var(--bg) !important;
    border-radius: 4px;
}

/* Leaflet overrides */

.leaflet-control-zoom {
    border: 1px solid var(--border) !important;
}

.leaflet-control-zoom a {
    background: var(--bg-panel) !important;
    color: var(--text) !important;
    border-color: var(--border) !important;
}

.leaflet-control-zoom a:hover {
    background: var(--bg-section) !important;
}

.leaflet-control-attribution {
    background: rgba(15, 15, 26, 0.7) !important;
    color: var(--text-dim) !important;
    font-size: 10px !important;
}

.leaflet-control-attribution a {
    color: var(--accent-dim) !important;
}

#camera-container iframe {
    width: 100%;
    border-radius: 6px;
    background: #000;
}

.camera-tooltip {
    background: var(--bg-panel) !important;
    color: var(--text) !important;
    border: 1px solid var(--border) !important;
    border-radius: 4px !important;
    padding: 4px 8px !important;
    font-size: 12px !important;
    box-shadow: 0 2px 8px rgba(0,0,0,0.3) !important;
}

.camera-tooltip::before {
    border-top-color: var(--border) !important;
}

/* UFO marker */

.ufo-marker {
    background: none !important;
    border: none !important;
}

/* Roadtrip panel */

.roadtrip-panel {
    position: fixed;
    bottom: 16px;
    left: 16px;
    z-index: 999;
    background: var(--bg-panel);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 12px;
    width: 260px;
}

.roadtrip-panel.hidden {
    display: none;
}

.rt-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
}

.rt-controls {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.rt-point {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 4px 8px;
    background: var(--bg-section);
    border-radius: 4px;
}

.rt-point:hover {
    background: var(--bg);
}

/* Mobile */

@media (max-width: 600px) {
    .panel {
        width: 100%;
        height: 55%;
        top: auto;
        bottom: 0;
        right: 0;
        border-left: none;
        border-top: 1px solid var(--border);
        border-radius: 16px 16px 0 0;
        transform: translateY(100%);
    }

    .panel.open {
        transform: translateY(0);
    }

    #panel-content {
        padding: 12px;
        padding-top: 4px;
    }

    .panel-close {
        padding: 8px 16px;
    }

    .layers-toggle {
        top: 10px;
        left: 10px;
    }

    .roadtrip-panel {
        bottom: 10px;
        left: 10px;
        width: calc(100% - 20px);
    }
}
