body {
    margin: 0;
    padding: 0;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}

.container {
    display: flex;
    height: 100vh;
    width: 100%;
}

#map {
    flex-grow: 1;
    min-width: 0;
}

.sidebar {
    width: 400px;
    min-width: 250px;
    max-width: 800px;
    background: #f5f5f5;
    overflow-y: auto;
    padding: 20px;
    box-shadow: 2px 0 10px rgba(0,0,0,0.1);
    position: relative;
}

#info-panel {
    background: white;
    padding: 15px 20px;
    border-radius: 8px;
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
    margin-bottom: 20px;
}

#info-panel h2 {
    margin: 0 0 10px 0;
    font-size: 18px;
    color: #333;
}

#info-panel .stat {
    margin: 5px 0;
    font-size: 14px;
    color: #666;
}

#info-panel .stat strong {
    color: #333;
}

.stat-section {
    margin-top: 15px;
}

.stat-section h3 {
    margin: 0 0 10px 0;
    font-size: 15px;
    color: #333;
    font-weight: 600;
}

.stat-divider {
    height: 1px;
    background: #ddd;
    margin: 10px 0;
}

.stat-highlight {
    background: #f0f8ff;
    padding: 8px;
    margin: 5px -8px;
    border-radius: 4px;
    border-left: 3px solid #2196F3;
}

.stat-formula {
    font-size: 13px;
    color: #555;
    margin-top: 10px;
}

.formula-description {
    font-size: 13px;
    font-weight: 600;
    color: #333;
    margin: 8px 0 5px 0;
}

.layer-control {
    background: white;
    padding: 15px 20px;
    border-radius: 8px;
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
    margin-bottom: 20px;
}

.layer-control h3 {
    margin: 0 0 10px 0;
    font-size: 16px;
    color: #333;
}

.layer-item {
    margin: 8px 0;
    display: flex;
    align-items: center;
}

.layer-item input {
    margin-right: 8px;
}

.layer-item label {
    font-size: 14px;
    cursor: pointer;
    display: flex;
    align-items: center;
}

.layer-color {
    width: 20px;
    height: 20px;
    margin-right: 8px;
    border-radius: 3px;
    border: 1px solid #ccc;
}

.controls {
    background: white;
    padding: 15px 20px;
    border-radius: 8px;
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
}

.controls h3 {
    margin: 0 0 10px 0;
    font-size: 16px;
    color: #333;
}

.control-item {
    margin: 10px 0;
}

.control-item label {
    display: block;
    font-size: 14px;
    margin-bottom: 5px;
    color: #666;
}

.control-item input[type="range"] {
    width: 100%;
}

.control-item input[type="checkbox"] {
    margin-right: 8px;
    cursor: pointer;
}

.control-item input[type="checkbox"] + label {
    display: inline;
    cursor: pointer;
}

.control-item button {
    padding: 8px 16px;
    background: #4CAF50;
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
}

.control-item button:hover {
    background: #45a049;
}

.maplibregl-popup-content {
    padding: 15px;
    max-width: 300px;
}

.popup-row {
    margin: 5px 0;
    font-size: 13px;
}

.popup-row strong {
    color: #333;
}


.formula-block {
    display: flex;
    align-items: center;
    margin: 8px 0;
    flex-wrap: wrap;
    gap: 4px;
}

.formula-label {
    font-weight: 600;
    color: #2196F3;
    white-space: nowrap;
}

.formula-equals {
    font-weight: bold;
}

.formula-expression {
    font-family: 'Courier New', monospace;
    background-color: #f7f7f7;
    padding: 4px 10px;
    border-radius: 4px;
    font-size: 0.9em;
    word-break: break-word;
}

.formula-term {
    font-weight: 600;
}

.density-table-container {
    overflow-x: auto;
    margin: 8px 0;
}

.density-table {
    width: 100%;
    border-collapse: collapse;
    margin: 0;
    font-size: 0.85em;
}

.density-table th, .density-table td {
    border: 1px solid #ddd;
    padding: 6px 8px;
    text-align: left;
}

.density-table th {
    background-color: #f2f2f2;
    font-weight: 600;
    font-size: 0.9em;
}

.resize-handle {
    position: absolute;
    top: 0;
    right: -5px;
    width: 10px;
    height: 100%;
    background: transparent;
    cursor: ew-resize;
    z-index: 10000;
}

.resize-handle::before {
    content: '';
    position: absolute;
    top: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 3px;
    height: 100%;
    background: #999;
    transition: background 0.2s, width 0.2s;
}

.resize-handle:hover::before {
    background: #666;
    width: 4px;
}

.resize-handle:active::before {
    background: #2196F3;
    width: 5px;
}

/* Mobile menu toggle button */
.menu-toggle {
    display: none;
    position: fixed;
    top: 20px;
    left: 20px;
    z-index: 10001;
    background: white;
    border: none;
    border-radius: 8px;
    padding: 12px 16px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.3);
    cursor: pointer;
    font-size: 24px;
    line-height: 1;
}

.menu-toggle:hover {
    background: #f5f5f5;
}

/* Mobile responsive styles */
@media (max-width: 768px) {
    .menu-toggle {
        display: block;
    }

    .sidebar {
        position: fixed;
        left: -100%;
        top: 0;
        width: 85%;
        max-width: 350px;
        height: 100vh;
        transition: left 0.3s ease;
        z-index: 10000;
        box-shadow: 2px 0 20px rgba(0,0,0,0.3);
    }

    .sidebar.open {
        left: 0;
    }

    .resize-handle {
        display: none;
    }

    #map {
        width: 100%;
    }

    .container {
        position: relative;
    }
}

/* Toggle button for transit stops list */
.toggle-button {
    margin-left: 8px;
    padding: 4px 10px;
    background: #2196F3;
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 12px;
    transition: background 0.2s;
}

.toggle-button:hover {
    background: #1976D2;
}

/* Transit stops list */
.transit-stops-list {
    margin-top: 10px;
    padding: 10px;
    background: #f9f9f9;
    border-radius: 4px;
    border-left: 3px solid #2196F3;
    max-height: 300px;
    overflow-y: auto;
    transition: max-height 0.3s ease;
}

.transit-stops-list.hidden {
    display: none;
}

.transit-stops-list ul {
    list-style: none;
    padding: 0;
    margin: 0;
}

.transit-stops-list li {
    padding: 8px;
    margin: 4px 0;
    border-bottom: 1px solid #e0e0e0;
    font-size: 13px;
    color: #555;
    cursor: pointer;
    border-radius: 4px;
    transition: background-color 0.2s;
}

.transit-stops-list li:hover {
    background-color: #e3f2fd;
}

.transit-stops-list li:last-child {
    border-bottom: none;
}

.transit-stops-list .stop-id {
    font-weight: 600;
    color: #333;
}

.transit-stops-list .stop-agency {
    color: #666;
    font-size: 12px;
}

/* Top parcels list */
.top-parcels-list {
    margin-top: 10px;
    padding: 10px;
    background: #f9f9f9;
    border-radius: 4px;
    border-left: 3px solid #4CAF50;
    max-height: 300px;
    overflow-y: auto;
}

.top-parcels-list.hidden {
    display: none;
}

.top-parcels-list ul {
    list-style: none;
    padding: 0;
    margin: 0;
}

.top-parcels-list li {
    padding: 8px;
    margin: 4px 0;
    border-bottom: 1px solid #e0e0e0;
    font-size: 13px;
    color: #555;
    cursor: pointer;
    border-radius: 4px;
    transition: background-color 0.2s;
}

.top-parcels-list li:hover {
    background-color: #e8f5e9;
}

.top-parcels-list li:last-child {
    border-bottom: none;
}

.top-parcels-list .parcel-address {
    font-weight: 600;
    color: #333;
}

.top-parcels-list .parcel-capacity {
    color: #4CAF50;
    font-weight: 600;
}

.top-parcels-list .parcel-increase {
    color: #2196F3;
    font-size: 12px;
}

.top-parcels-list .parcel-details {
    color: #666;
    font-size: 12px;
    margin-top: 4px;
}

.top-parcels-list .parcel-legend {
    background: #f5f5f5;
    border-left: 3px solid #9e9e9e;
    cursor: default;
    font-size: 11px;
}

.top-parcels-list .parcel-legend:hover {
    background: #f5f5f5;
}

.top-parcels-list .legend-title {
    font-weight: 600;
    color: #333;
    margin-bottom: 4px;
}

.top-parcels-list .legend-item {
    color: #666;
    line-height: 1.4;
}