/* GSOD Viewer Styles - Dark Theme */

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, sans-serif;
    background-color: #1a1a2e;
    color: #eaeaea;
    height: 100vh;
    overflow: hidden;
}

#app {
    display: flex;
    flex-direction: column;
    height: 100vh;
}

/* Header */
#header {
    background: linear-gradient(135deg, #16213e 0%, #1a1a2e 100%);
    padding: 12px 20px;
    border-bottom: 1px solid #0f3460;
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 15px;
}

#header h1 {
    font-size: 1.3rem;
    color: #00bcd4;
    font-weight: 600;
    text-shadow: 0 0 10px rgba(0, 188, 212, 0.3);
    margin: 0;
}

.header-title {
    display: flex;
    align-items: center;
    gap: 12px;
}

.legal-btn {
    padding: 4px 12px;
    font-size: 12px;
    background-color: #7f8c8d;
    border: none;
    border-radius: 4px;
    color: white;
    cursor: pointer;
    transition: background-color 0.3s;
}

.legal-btn:hover {
    background-color: #95a5a6;
}

#controls {
    display: flex;
    align-items: center;
    gap: 15px;
    flex-wrap: wrap;
}

.control-group {
    display: flex;
    align-items: center;
    gap: 8px;
}

.control-group label {
    font-size: 0.9rem;
    color: #a0a0a0;
}

/* Inputs */
input[type="date"],
input[type="text"],
select {
    background: #16213e;
    border: 1px solid #0f3460;
    color: #eaeaea;
    padding: 8px 12px;
    border-radius: 6px;
    font-size: 0.9rem;
    cursor: pointer;
    transition: all 0.2s ease;
}

input[type="date"]:hover,
input[type="text"]:hover,
select:hover {
    border-color: #00bcd4;
}

input[type="date"]:focus,
input[type="text"]:focus,
select:focus {
    outline: none;
    border-color: #00bcd4;
    box-shadow: 0 0 8px rgba(0, 188, 212, 0.3);
}

input[type="text"] {
    width: 140px;
}

/* Buttons */
.primary-btn {
    background: linear-gradient(135deg, #0f3460 0%, #16213e 100%);
    border: 1px solid #00bcd4;
    color: #00bcd4;
    padding: 8px 20px;
    border-radius: 6px;
    font-size: 0.9rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
}

.primary-btn:hover {
    background: #00bcd4;
    color: #1a1a2e;
    box-shadow: 0 0 15px rgba(0, 188, 212, 0.4);
}

.secondary-btn {
    background: #16213e;
    border: 1px solid #0f3460;
    color: #a0a0a0;
    padding: 8px 12px;
    border-radius: 6px;
    font-size: 0.85rem;
    cursor: pointer;
    transition: all 0.2s;
}

.secondary-btn:hover {
    border-color: #00bcd4;
    color: #00bcd4;
}

.secondary-btn.active {
    background: #e67e22;
    border-color: #e67e22;
    color: #fff;
}

.primary-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.primary-btn:disabled:hover {
    background: linear-gradient(135deg, #0f3460 0%, #16213e 100%);
    color: #00bcd4;
    box-shadow: none;
}

/* Drawing mode cursor */
#map.drawing-mode {
    cursor: crosshair !important;
}

#map.drawing-mode * {
    cursor: crosshair !important;
}

/* Dropdown */
.dropdown-container {
    position: relative;
    display: inline-block;
}

.dropdown-btn {
    padding: 8px 14px;
    background: #16213e;
    border: 1px solid #00d4ff;
    color: #00d4ff;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.85rem;
    font-weight: 500;
    transition: all 0.2s;
}

.dropdown-btn:hover {
    background: #1f2b4a;
}

.dropdown-content {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    min-width: 160px;
    background: #16213e;
    border: 1px solid #00d4ff;
    border-radius: 6px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4);
    z-index: 1000;
    margin-top: 4px;
    padding: 8px;
}

.dropdown-content.show {
    display: block;
}

.dropdown-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px;
    color: #ccc;
    font-size: 0.85rem;
    cursor: pointer;
    transition: background 0.15s;
    border-radius: 4px;
}

.dropdown-item:hover {
    background: #0f3460;
    color: #fff;
}

.dropdown-item input[type="radio"],
.dropdown-item input[type="checkbox"] {
    accent-color: #00d4ff;
    cursor: pointer;
}

.dropdown-section {
    padding: 8px;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.dropdown-section label {
    font-size: 0.75rem;
    color: #888;
}

.dropdown-section select {
    padding: 6px;
    font-size: 0.85rem;
}

/* Status */
#statusMessage {
    font-size: 0.85rem;
    color: #7bed9f;
    margin-left: 10px;
}

/* Main Content */
#main-content {
    flex: 1;
    display: flex;
    overflow: hidden;
}

/* Map */
#map-container {
    flex: 1;
    position: relative;
}

#map {
    width: 100%;
    height: 100%;
    background: #0d1117;
}

/* Sidebar */
#sidebar {
    width: 320px;
    background: #16213e;
    border-left: 1px solid #0f3460;
    padding: 15px;
    display: flex;
    flex-direction: column;
    gap: 15px;
    overflow-y: auto;
}

/* Legend */
#legend {
    padding: 15px;
    background: rgba(15, 52, 96, 0.5);
    border-radius: 6px;
}

.legend-title {
    font-weight: 600;
    color: #00bcd4;
    margin-bottom: 12px;
    font-size: 0.95rem;
    text-align: center;
}

.legend-scale {
    display: flex;
    gap: 8px;
    align-items: stretch;
}

.legend-bar {
    display: flex;
    flex-direction: column-reverse;
    width: 24px;
    min-height: 200px;
    border-radius: 4px;
    overflow: hidden;
}

.legend-bar .bin {
    flex: 1;
    width: 100%;
}

.legend-labels {
    display: flex;
    flex-direction: column-reverse;
    justify-content: space-between;
    font-size: 0.7rem;
    color: #a0a0a0;
}

/* Detail Panel */
#detailPanel {
    padding: 15px;
    background: rgba(15, 52, 96, 0.5);
    border-radius: 6px;
}

#detailPanel.hidden {
    display: none;
}

.panel-header {
    margin-bottom: 8px;
}

.panel-header h3 {
    font-size: 1rem;
    color: #00bcd4;
    margin-bottom: 4px;
}

.station-id {
    font-size: 0.75rem;
    color: #888;
    font-family: monospace;
}

.station-location {
    font-size: 0.75rem;
    color: #a0a0a0;
    margin-bottom: 12px;
}

/* Weather Grid */
.weather-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
}

.weather-item {
    background: rgba(0, 0, 0, 0.2);
    padding: 8px;
    border-radius: 4px;
}

.weather-item.full-width {
    grid-column: span 2;
}

.weather-label {
    display: block;
    font-size: 0.7rem;
    color: #888;
    margin-bottom: 2px;
}

.weather-value {
    display: block;
    font-size: 1rem;
    font-weight: 600;
    color: #eaeaea;
}

.weather-value.temp {
    color: #ff6b6b;
}

.weather-sub {
    display: block;
    font-size: 0.7rem;
    color: #666;
}

/* View Full History Button */
.view-history-btn {
    width: 100%;
    margin-top: 15px;
    padding: 12px 20px;
    background: linear-gradient(135deg, #0f3460 0%, #16213e 100%);
    border: 1px solid #00bcd4;
    color: #00bcd4;
    border-radius: 6px;
    font-size: 0.9rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
}

.view-history-btn:hover {
    background: #00bcd4;
    color: #1a1a2e;
    box-shadow: 0 0 15px rgba(0, 188, 212, 0.4);
}

/* Charts */
#chartContainer {
    margin-top: 15px;
}

#chartContainer canvas {
    width: 100%;
    margin-bottom: 10px;
    border-radius: 4px;
}

/* Info Section */
#info-section {
    padding: 15px;
    background: rgba(15, 52, 96, 0.5);
    border-radius: 6px;
}

#info-section h3 {
    font-size: 0.9rem;
    color: #00bcd4;
    margin-bottom: 10px;
}

#data-info {
    font-size: 0.85rem;
    color: #a0a0a0;
}

#data-info a {
    color: #00bcd4;
    text-decoration: none;
}

#data-info a:hover {
    text-decoration: underline;
}

#data-info p {
    margin-bottom: 6px;
}

.data-lag-note {
    color: #f39c12 !important;
    font-style: italic;
    margin-top: 8px !important;
}

/* Loading Overlay */
#loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(26, 26, 46, 0.9);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 9999;
}

#loading-overlay.hidden {
    display: none;
}

.spinner {
    width: 50px;
    height: 50px;
    border: 3px solid #0f3460;
    border-top-color: #00bcd4;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

#loading-overlay p {
    margin-top: 15px;
    color: #00bcd4;
    font-size: 1rem;
}

/* Marker Cluster Styles */
.marker-cluster {
    background: transparent;
}

.cluster-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    color: white;
    font-weight: bold;
    font-size: 12px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.4);
}

.cluster-icon.cluster-small {
    background: rgba(0, 188, 212, 0.8);
    width: 30px;
    height: 30px;
}

.cluster-icon.cluster-medium {
    background: rgba(0, 150, 180, 0.8);
    width: 40px;
    height: 40px;
    font-size: 14px;
}

.cluster-icon.cluster-large {
    background: rgba(0, 100, 150, 0.8);
    width: 50px;
    height: 50px;
    font-size: 16px;
}

/* Station Popup */
.station-popup {
    font-size: 12px;
    line-height: 1.4;
}

.station-popup strong {
    color: #333;
}

.station-popup hr {
    border: none;
    border-top: 1px solid #ddd;
}

/* Leaflet Customizations */
.leaflet-container {
    background: #0d1117;
}

.leaflet-control-zoom {
    border: none !important;
}

.leaflet-control-zoom a {
    background: #16213e !important;
    color: #00bcd4 !important;
    border: 1px solid #0f3460 !important;
}

.leaflet-control-zoom a:hover {
    background: #0f3460 !important;
}

.leaflet-control-attribution {
    background: rgba(22, 33, 62, 0.8) !important;
    color: #666 !important;
}

.leaflet-control-attribution a {
    color: #00bcd4 !important;
}

/* Legal Modal */
.legal-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.8);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 10000;
    overflow-y: auto;
    padding: 20px;
}

.legal-modal.hidden {
    display: none !important;
}

.legal-modal-content {
    background-color: #2c3e50;
    border-radius: 8px;
    width: 100%;
    max-width: 700px;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.5);
}

.legal-modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 25px;
    border-bottom: 2px solid #34495e;
}

.legal-modal-header h2 {
    color: #3498db;
    font-size: 22px;
    margin: 0;
}

.legal-close-btn {
    background: none;
    border: none;
    color: #ecf0f1;
    font-size: 28px;
    cursor: pointer;
    padding: 0;
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: color 0.3s;
}

.legal-close-btn:hover {
    color: #e74c3c;
}

.legal-modal-body {
    padding: 25px;
    overflow-y: auto;
    color: #ecf0f1;
}

.legal-section {
    margin-bottom: 25px;
}

.legal-section h3 {
    color: #3498db;
    font-size: 16px;
    margin-bottom: 10px;
    border-bottom: 1px solid #34495e;
    padding-bottom: 6px;
}

.legal-section p {
    margin-bottom: 8px;
    line-height: 1.5;
}

.legal-section ul {
    margin-left: 20px;
    margin-bottom: 8px;
}

.legal-section li {
    margin-bottom: 6px;
    line-height: 1.5;
}

.legal-section a {
    color: #3498db;
    text-decoration: none;
}

.legal-section a:hover {
    text-decoration: underline;
}

.warning-box {
    background-color: #e67e22;
    border-left: 4px solid #d35400;
    padding: 12px;
    margin: 12px 0;
    border-radius: 4px;
}

.warning-box p {
    margin: 0;
    color: #ffffff;
}

.legal-footer {
    margin-top: 15px;
    padding-top: 15px;
    border-top: 2px solid #34495e;
    text-align: center;
    color: #95a5a6;
    font-size: 13px;
}

/* Scrollbar */
#sidebar::-webkit-scrollbar {
    width: 6px;
}

#sidebar::-webkit-scrollbar-track {
    background: #0f3460;
}

#sidebar::-webkit-scrollbar-thumb {
    background: #00bcd4;
    border-radius: 3px;
}

/* Responsive */
@media (max-width: 768px) {
    #header {
        flex-direction: column;
        align-items: flex-start;
    }

    #controls {
        width: 100%;
    }

    #sidebar {
        display: none;
    }

    input[type="text"] {
        width: 100px;
    }
}
