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

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

/* Sidebar */
#sidebar {
    width: 280px;
    min-width: 280px;
    background: #1a1a2e;
    color: #e0e0e0;
    padding: 20px;
    overflow-y: auto;
    z-index: 1000;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

#sidebar h1 {
    font-size: 1.4em;
    color: #fff;
    margin-bottom: 0;
}

.subtitle {
    font-size: 0.85em;
    color: #888;
    margin-bottom: 8px;
}

.filter-group {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.filter-group > label {
    font-size: 0.8em;
    font-weight: 600;
    color: #aaa;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* Predicted toggle */
.toggle-group {
    background: #16213e;
    border-radius: 6px;
    padding: 10px 12px;
    border: 1px solid #333;
}

.toggle-label {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    text-transform: none !important;
    font-size: 0.9em !important;
}

.toggle-label input[type="checkbox"] {
    accent-color: #4a9eff;
    width: 16px;
    height: 16px;
}

.toggle-text {
    color: #e0e0e0;
}

.toggle-hint {
    font-size: 0.75em;
    color: #666;
    margin-top: 4px;
    line-height: 1.3;
}

.range-inputs {
    display: flex;
    align-items: center;
    gap: 6px;
}

.range-inputs span {
    color: #666;
}

.range-inputs input {
    flex: 1;
    min-width: 0;
    padding: 6px 8px;
    border: 1px solid #333;
    border-radius: 4px;
    background: #16213e;
    color: #e0e0e0;
    font-size: 0.85em;
}

.range-inputs input:focus,
.single-input:focus {
    outline: none;
    border-color: #4a9eff;
}

.single-input {
    width: 100%;
    padding: 6px 8px;
    border: 1px solid #333;
    border-radius: 4px;
    background: #16213e;
    color: #e0e0e0;
    font-size: 0.85em;
}

.checkbox-group {
    display: flex;
    flex-wrap: wrap;
    gap: 4px 12px;
}

.checkbox-group label {
    font-size: 0.85em;
    display: flex;
    align-items: center;
    gap: 4px;
    cursor: pointer;
}

.checkbox-group input[type="checkbox"] {
    accent-color: #4a9eff;
}

button {
    padding: 8px 16px;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.9em;
    font-weight: 600;
}

#apply-filters {
    background: #4a9eff;
    color: #fff;
}

#apply-filters:hover {
    background: #3a8eef;
}

button.secondary {
    background: #333;
    color: #aaa;
}

button.secondary:hover {
    background: #444;
}

.info-text {
    font-size: 0.8em;
    color: #888;
    margin-top: 4px;
}

/* Map */
#map {
    flex: 1;
    height: 100vh;
}

/* Legend */
#legend {
    position: fixed;
    bottom: 24px;
    right: 16px;
    background: rgba(26, 26, 46, 0.92);
    color: #e0e0e0;
    padding: 10px 14px;
    border-radius: 6px;
    z-index: 1000;
    font-size: 0.8em;
    min-width: 160px;
}

.legend-title {
    font-weight: 600;
    margin-bottom: 6px;
    text-align: center;
}

.legend-bar {
    height: 12px;
    border-radius: 3px;
    background: linear-gradient(to right, #64a0dc, #e63c5a, #f0648c, #ffc800, #8c8c8c, #505050);
}

.legend-labels {
    display: flex;
    justify-content: space-between;
    margin-top: 3px;
    font-size: 0.85em;
    color: #aaa;
}

/* Popup styling */
.leaflet-popup-content-wrapper {
    border-radius: 8px;
    max-width: 320px;
}

.property-popup {
    font-size: 0.9em;
    line-height: 1.5;
}

.property-popup .popup-predicted {
    font-size: 1.3em;
    font-weight: 700;
    color: #2c3e50;
}

.property-popup .popup-predicted-ppsqm {
    font-size: 1em;
    font-weight: 600;
    color: #4a9eff;
}

.property-popup .popup-sale {
    font-size: 0.85em;
    color: #888;
    margin-top: 2px;
}

.property-popup .popup-growth {
    font-size: 0.8em;
    color: #27ae60;
    margin-bottom: 4px;
}

.property-popup .popup-address {
    margin: 4px 0;
    color: #555;
}

.property-popup .popup-links {
    margin-top: 8px;
    padding-top: 6px;
    border-top: 1px solid #eee;
    display: flex;
    gap: 10px;
}

.property-popup .popup-links a {
    font-size: 0.85em;
    color: #4a9eff;
    text-decoration: none;
}

.property-popup .popup-links a:hover {
    text-decoration: underline;
}

.property-popup table {
    width: 100%;
    margin-top: 6px;
    font-size: 0.9em;
}

.property-popup td {
    padding: 2px 0;
}

.property-popup td:first-child {
    color: #888;
    padding-right: 8px;
    white-space: nowrap;
}

/* Match % legend */
#match-legend {
    position: fixed;
    bottom: 80px;
    right: 16px;
    background: rgba(26, 26, 46, 0.92);
    color: #e0e0e0;
    padding: 10px 14px;
    border-radius: 6px;
    z-index: 1000;
    font-size: 0.8em;
    min-width: 160px;
}

.match-legend-bar {
    height: 12px;
    border-radius: 3px;
    background: linear-gradient(to right, #e74c3c, #e67e22, #f1c40f, #a8e063, #2ecc71);
}

/* Custom location pins */
.pin-entry { background: #16213e; border: 1px solid #333; border-radius: 4px; padding: 6px 8px; margin-bottom: 4px; }
.pin-entry .pin-name { width: 100%; border: none; background: transparent; color: #e0e0e0; font-size: 0.85em; margin-bottom: 4px; outline: none; }
.pin-controls { display: flex; align-items: center; gap: 4px; }
.pin-controls input { width: 60px; }
.pin-controls span { color: #666; font-size: 0.8em; }
.pin-remove { background: none; border: none; color: #e74c3c; font-size: 1.2em; cursor: pointer; padding: 0 4px; min-width: 0; }
#add-location { width: 100%; margin-top: 4px; font-size: 0.8em; }
.pin-dot { width: 24px; height: 24px; border-radius: 50%; background: #e74c3c; color: #fff; text-align: center; line-height: 24px; font-size: 12px; font-weight: bold; border: 2px solid #fff; box-shadow: 0 1px 4px rgba(0,0,0,0.5); }
.leaflet-container.placing-pin,
.leaflet-container.placing-pin .leaflet-grab,
.leaflet-container.placing-pin .leaflet-interactive { cursor: crosshair !important; }

/* Loading indicator */
#loading {
    display: none;
    position: fixed;
    top: 12px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(26, 26, 46, 0.9);
    color: #4a9eff;
    padding: 6px 16px;
    border-radius: 20px;
    z-index: 1001;
    font-size: 0.85em;
}
