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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    background-color: #f5f5f5;
    color: #333;
    line-height: 1.6;
}

#app {
    display: flex;
    flex-direction: column;
    height: 100vh;
}

/* Header */
header {
    background: linear-gradient(135deg, #1e3a8a 0%, #3b82f6 100%);
    color: white;
    padding: 1rem 2rem;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

header h1 {
    font-size: 1.8rem;
    font-weight: 600;
    margin-bottom: 0.25rem;
}

header .subtitle {
    font-size: 0.9rem;
    opacity: 0.9;
}

/* Main Container */
#main-container {
    display: flex;
    flex: 1;
    overflow: hidden;
}

/* Control Panel */
#control-panel {
    width: 300px;
    background: white;
    border-right: 1px solid #e0e0e0;
    overflow-y: auto;
    box-shadow: 2px 0 4px rgba(0,0,0,0.05);
}

.control-section {
    padding: 1.5rem;
    border-bottom: 1px solid #e0e0e0;
}

.control-section:last-child {
    border-bottom: none;
}

.control-section h3 {
    font-size: 1rem;
    font-weight: 600;
    margin-bottom: 1rem;
    color: #1e3a8a;
}

/* Form Controls */
.control-input {
    width: 100%;
    padding: 0.5rem;
    border: 1px solid #d1d5db;
    border-radius: 0.375rem;
    font-size: 0.9rem;
    background: white;
    transition: border-color 0.2s;
}

.control-input:focus {
    outline: none;
    border-color: #3b82f6;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

.control-button {
    padding: 0.5rem 1rem;
    background: #3b82f6;
    color: white;
    border: none;
    border-radius: 0.375rem;
    font-size: 0.9rem;
    cursor: pointer;
    transition: background-color 0.2s;
}

.control-button:hover:not(:disabled) {
    background: #2563eb;
}

.control-button:disabled {
    background: #9ca3af;
    cursor: not-allowed;
}

.button-group {
    display: flex;
    gap: 0.5rem;
    margin-top: 0.5rem;
}

.button-group button {
    flex: 1;
}

/* Data Info */
#data-info p {
    margin-bottom: 0.5rem;
    font-size: 0.85rem;
}

#data-info strong {
    color: #1e3a8a;
}

.info-text {
    margin-top: 0.5rem;
    padding: 0.5rem;
    background: #f0f9ff;
    border-left: 3px solid #3b82f6;
    font-size: 0.85rem;
    border-radius: 0.25rem;
}

/* Time Controls */
#time-controls {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

#time-slider {
    width: 100%;
}

#time-display {
    text-align: center;
    font-weight: 600;
    font-size: 0.95rem;
    padding: 0.5rem;
    background: #f3f4f6;
    border-radius: 0.375rem;
}

/* Checkboxes */
.checkbox-group {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.checkbox-group label {
    display: flex;
    align-items: center;
    font-size: 0.9rem;
    cursor: pointer;
}

.checkbox-group input[type="checkbox"] {
    margin-right: 0.5rem;
    cursor: pointer;
}

.contour-config {
    margin-top: 1rem;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.contour-config label {
    font-size: 0.9rem;
    font-weight: 500;
}

/* Color Scale */
#color-scale-container {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

#color-scale {
    width: 100%;
    height: 30px;
    border: 1px solid #d1d5db;
    border-radius: 0.25rem;
}

#color-scale-labels {
    display: flex;
    justify-content: space-between;
    font-size: 0.75rem;
    color: #6b7280;
}

/* Map Container */
#map-container {
    flex: 1;
    position: relative;
    background: #e5e7eb;
}

#map {
    width: 100%;
    height: 100%;
}

/* Loading Overlay */
.loading {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(255, 255, 255, 0.9);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.loading.hidden {
    display: none;
}

.spinner {
    border: 4px solid #f3f4f6;
    border-top: 4px solid #3b82f6;
    border-radius: 50%;
    width: 50px;
    height: 50px;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.loading p {
    margin-top: 1rem;
    font-size: 1rem;
    color: #6b7280;
}

/* Footer */
footer {
    background: white;
    border-top: 1px solid #e0e0e0;
    padding: 1rem 2rem;
    text-align: center;
    font-size: 0.85rem;
    color: #6b7280;
}

footer a {
    color: #3b82f6;
    text-decoration: none;
}

footer a:hover {
    text-decoration: underline;
}

/* Leaflet Custom Styles */
.leaflet-container {
    font-family: inherit;
}

.leaflet-popup-content {
    font-size: 0.9rem;
}

.leaflet-popup-content strong {
    color: #1e3a8a;
}

/* Responsive Design */
@media (max-width: 768px) {
    #main-container {
        flex-direction: column;
    }

    #control-panel {
        width: 100%;
        max-height: 50vh;
        border-right: none;
        border-bottom: 1px solid #e0e0e0;
    }

    header h1 {
        font-size: 1.4rem;
    }

    header .subtitle {
        font-size: 0.8rem;
    }
}

/* Scrollbar Styling */
#control-panel::-webkit-scrollbar {
    width: 8px;
}

#control-panel::-webkit-scrollbar-track {
    background: #f1f1f1;
}

#control-panel::-webkit-scrollbar-thumb {
    background: #888;
    border-radius: 4px;
}

#control-panel::-webkit-scrollbar-thumb:hover {
    background: #555;
}
