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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    display: flex;
    height: 100vh;
    overflow: hidden;
}

#sidebar {
    width: 340px;
    min-width: 340px;
    height: 100vh;
    overflow-y: auto;
    background: #f8f9fa;
    border-right: 1px solid #dee2e6;
    padding: 16px;
}

#sidebar h1 {
    font-size: 18px;
    margin-bottom: 16px;
    color: #212529;
}

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

.panel {
    background: white;
    border-radius: 8px;
    padding: 12px;
    margin-bottom: 12px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
}

.panel-header {
    font-weight: 600;
    font-size: 13px;
    color: #495057;
    margin-bottom: 10px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

label {
    display: block;
    font-size: 12px;
    color: #6c757d;
    margin: 8px 0 4px;
}

.input-row {
    display: flex;
    gap: 8px;
    max-width: 100%;
    overflow: hidden;
}

input[type="date"] {
    flex: 1;
    padding: 4px 6px;
    border: 1px solid #ced4da;
    border-radius: 4px;
    font-size: 12px;
}

input[type="range"] {
    flex: 1;
    min-width: 0;
}

#day-checkboxes {
    display: flex;
    flex-wrap: wrap;
    gap: 2px 8px;
}

#day-checkboxes label {
    display: inline-flex;
    align-items: center;
    gap: 3px;
    font-size: 12px;
    margin: 0;
    cursor: pointer;
}

#sidebar button {
    width: 100%;
    padding: 8px;
    margin-top: 8px;
    border: none;
    border-radius: 4px;
    font-size: 13px;
    cursor: pointer;
    transition: background 0.2s;
}

#btn-apply {
    background: #0d6efd;
    color: white;
}
#btn-apply:hover {
    background: #0b5ed7;
}

#btn-reset {
    background: #6c757d;
    color: white;
}
#btn-reset:hover {
    background: #5a6268;
}

#sidebar .panel button {
    background: #198754;
    color: white;
}
#sidebar .panel button:hover {
    background: #157347;
}

table {
    width: 100%;
    border-collapse: collapse;
    font-size: 12px;
}

th, td {
    padding: 6px 8px;
    text-align: left;
    border-bottom: 1px solid #eee;
}

th {
    font-weight: 600;
    color: #495057;
}

tbody tr {
    cursor: pointer;
}
tbody tr:hover {
    background: #f0f7ff;
}

#stats-content {
    font-size: 12px;
    color: #495057;
    line-height: 1.6;
}

canvas {
    max-height: 150px;
}

/* Ensure last panel has bottom spacing for scroll */
#sidebar .panel:last-child {
    margin-bottom: 24px;
}

/* Fix zoom controls above heatmap layer */
.leaflet-control-zoom {
    z-index: 1000 !important;
}
.leaflet-top.leaflet-left {
    z-index: 1000 !important;
}

/* Sidebar toggle button (mobile) */
#sidebar-toggle {
    display: none;
    position: fixed;
    top: 10px;
    left: 10px;
    z-index: 1100;
    width: 40px;
    height: 40px;
    border-radius: 4px;
    background: white;
    border: 2px solid rgba(0,0,0,0.2);
    font-size: 20px;
    line-height: 36px;
    text-align: center;
    cursor: pointer;
    box-shadow: 0 2px 6px rgba(0,0,0,0.2);
    padding: 0;
    margin: 0;
    color: #333;
}

/* Mobile responsive */
@media (max-width: 768px) {
    #sidebar {
        position: fixed;
        z-index: 1050;
        left: 0;
        top: 0;
        width: 300px;
        min-width: 300px;
        transition: transform 0.3s ease;
    }
    #sidebar.collapsed {
        transform: translateX(-100%);
    }
    #sidebar-toggle {
        display: block;
    }
    #sidebar-toggle.sidebar-open {
        left: 310px;
    }
}

/* Scrollbar */
#sidebar::-webkit-scrollbar {
    width: 6px;
}
#sidebar::-webkit-scrollbar-thumb {
    background: #ced4da;
    border-radius: 3px;
}
