:root {
    --primary-color: #0d47a1; /* Dark Blue */
    --secondary-color: #ff8f00; /* Orange */
}

body {
    background-color: #f0f2f5;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    margin: 0;
    padding: 0;
    overflow: hidden;
}

.header {
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--secondary-color) 100%);
    color: white;
    padding: 0.8rem 1.5rem;
    box-shadow: 0 2px 10px rgba(0,0,0,0.15);
    position: relative;
    z-index: 1000;
}

.header h1 {
    font-size: 1.5rem;
    margin: 0;
    font-weight: 600;
}

.main-container {
    display: flex;
    height: calc(100vh - 70px);
    position: relative;
}

#map {
    flex: 1;
    height: 100%;
}

.side-panel {
    width: 450px;
    background: white;
    overflow-y: auto;
    box-shadow: -2px 0 10px rgba(0,0,0,0.1);
    position: relative;
    z-index: 999;
    transition: margin-right 0.3s;
}

.side-panel.collapsed {
    margin-right: -450px;
}

.panel-toggle {
    position: absolute;
    left: -40px;
    top: 50%;
    transform: translateY(-50%);
    background: var(--secondary-color);
    color: #fff;
    border: none;
    border-radius: 8px 0 0 8px;
    padding: 15px 10px;
    cursor: pointer;
    box-shadow: -2px 0 10px rgba(0,0,0,0.1);
    z-index: 1000;
}

.stats-header {
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--secondary-color) 100%);
    color: white;
    padding: 1rem 1.5rem;
    position: sticky;
    top: 0;
    z-index: 100;
}

.stats-content {
    padding: 1.5rem;
}

.stat-card {
    background: #f8f9fa;
    border-radius: 8px;
    padding: 1rem;
    margin-bottom: 1rem;
    border-left: 4px solid var(--secondary-color);
}

.stat-label {
    font-size: 0.85rem;
    color: #6c757d;
    margin-bottom: 0.25rem;
}

.stat-value {
    font-size: 1.5rem;
    font-weight: 600;
    color: #212529;
}

.chart-container {
    background: white;
    border-radius: 8px;
    padding: 1rem;
    margin-bottom: 1.5rem;
    box-shadow: 0 2px 8px rgba(0,0,0,0.05);
}

.chart-title {
    font-size: 1rem;
    font-weight: 600;
    margin-bottom: 1rem;
    color: #212529;
}

.resolution-selector {
    margin-bottom: 1.5rem;
}

.resolution-info {
    background: #e7f3ff;
    border-left: 4px solid var(--secondary-color);
    padding: 0.75rem;
    border-radius: 4px;
    margin-bottom: 1rem;
    font-size: 0.9rem;
}

.legend {
    position: absolute;
    bottom: 30px;
    right: 10px;
    background: white;
    padding: 12px 15px;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.2);
    z-index: 1200; /* above side panel */
    font-size: 0.85rem;
    min-width: 320px;
}
.legend-gradient {
    margin-top: 6px;
}
.legend-gradient .gradient-bar {
    width: 300px;
    height: 12px;
    border-radius: 4px;
    background: linear-gradient(90deg, 
        #0d47a1 0%,    /* Dark Blue */
        #1976d2 20%,   /* Medium Blue */
        #00bcd4 35%,   /* Cyan */
        #4caf50 50%,   /* Green */
        #ffeb3b 65%,   /* Yellow */
        #ff9800 80%,   /* Orange */
        #d32f2f 100%   /* Intense Red */
    );
    border: 1px solid #ddd;
}
.legend-gradient .gradient-labels {
    display: flex;
    justify-content: space-between;
    font-size: 0.75rem;
    color: #555;
    margin-top: 6px;
}

.legend-ticks {
    display: flex;
    justify-content: space-between;
    font-size: 0.7rem;
    color: #333;
    margin-top: 6px;
    font-weight: 500;
}

.legend-ticks span {
    cursor: default;
    min-width: 20px;
    text-align: center;
}

.legend-subtitle {
    font-size: 0.7rem;
    color: #777;
    margin-top: 4px;
    text-align: center;
    font-style: italic;
}

.legend-colors-info {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 6px;
    margin-top: 10px;
    padding-top: 8px;
    border-top: 1px solid #eee;
}

.color-stop {
    display: flex;
    align-items: center;
    font-size: 0.7rem;
    color: #555;
    gap: 4px;
}

.color-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    display: inline-block;
    border: 1px solid rgba(0,0,0,0.2);
    flex-shrink: 0;
}

.legend-title {
    font-weight: 600;
    margin-bottom: 8px;
    font-size: 0.9rem;
}

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

.legend-color {
    width: 30px;
    height: 15px;
    margin-right: 8px;
    border-radius: 2px;
}

.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(255,255,255,0.9);
    display: none;
    justify-content: center;
    align-items: center;
    z-index: 9999;
}

.loading-overlay.active {
    display: flex;
}

.spinner {
    border: 4px solid #f3f3f3;
    border-top: 4px solid var(--primary-color);
    border-radius: 50%;
    width: 50px;
    height: 50px;
    animation: spin 1s linear infinite;
}

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

.zoom-indicator {
    position: absolute;
    top: 90px;
    left: 10px;
    background: white;
    padding: 8px 12px;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.2);
    z-index: 900;
    font-size: 0.85rem;
}

.h3-hexagon {
    stroke: white;
    stroke-width: 1;
    opacity: 0.8;
    transition: opacity 0.2s;
}

.h3-hexagon:hover {
    opacity: 1;
    stroke-width: 2;
}

canvas {
    max-height: 250px;
}

.btn-sm {
    font-size: 0.85rem;
}


