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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    padding: 20px;
}

.container {
    max-width: 1400px;
    margin: 0 auto;
    background: white;
    border-radius: 20px;
    box-shadow: 0 20px 60px rgba(0,0,0,0.3);
    overflow: hidden;
}

header {
    background: linear-gradient(135deg, #1e3c72 0%, #2a5298 100%);
    color: white;
    padding: 40px;
    text-align: center;
}

header h1 {
    font-size: 2.5em;
    margin-bottom: 10px;
    font-weight: 700;
}

.subtitle {
    font-size: 1.1em;
    opacity: 0.9;
}

.controls {
    padding: 30px 40px;
    background: #f8f9fa;
    border-bottom: 2px solid #e9ecef;
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.filter-section {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 20px;
}

.filter-group {
    display: flex;
    align-items: center;
    gap: 12px;
}

.filter-label {
    font-weight: 600;
    color: #495057;
    font-size: 0.95em;
}

.neighborhood-select {
    padding: 10px 20px;
    font-size: 1em;
    border: 2px solid #667eea;
    border-radius: 8px;
    background: white;
    color: #1e3c72;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s;
    min-width: 250px;
}

.neighborhood-select:hover {
    border-color: #764ba2;
    box-shadow: 0 2px 8px rgba(102, 126, 234, 0.3);
}

.neighborhood-select:focus {
    outline: none;
    border-color: #764ba2;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.2);
}

.toggle-group {
    display: flex;
    gap: 25px;
    flex-wrap: wrap;
}

.toggle-label {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    font-weight: 500;
    color: #495057;
    transition: color 0.3s;
}

.toggle-label:hover {
    color: #1e3c72;
}

.toggle-label input[type="checkbox"] {
    width: 20px;
    height: 20px;
    cursor: pointer;
}

.info-panel {
    display: flex;
    gap: 15px;
    flex-wrap: wrap;
    justify-content: center;
}

.stat-box {
    background: white;
    padding: 12px 20px;
    border-radius: 10px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    display: flex;
    flex-direction: column;
    gap: 5px;
    min-width: 140px;
}

.stat-label {
    font-size: 0.85em;
    color: #6c757d;
    font-weight: 500;
}

.stat-value {
    font-size: 1.2em;
    font-weight: 700;
    color: #1e3c72;
}

.map-container {
    position: relative;
    display: flex;
    height: 600px;
    width: 100%;
}

.property-list {
    width: 0;
    min-width: 0;
    background: white;
    overflow: hidden;
    transition: all 0.3s ease;
    border-right: 2px solid #e9ecef;
    display: flex;
    flex-direction: column;
    box-shadow: 2px 0 10px rgba(0,0,0,0.1);
    z-index: 1000;
}

.property-list.active {
    width: 380px;
    min-width: 380px;
}

.property-list-header {
    padding: 20px;
    background: linear-gradient(135deg, #1e3c72 0%, #2a5298 100%);
    color: white;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.property-list-header h3 {
    margin: 0;
    font-size: 1.3em;
    font-weight: 600;
}

.close-list-btn {
    background: rgba(255,255,255,0.2);
    border: none;
    color: white;
    width: 30px;
    height: 30px;
    border-radius: 50%;
    cursor: pointer;
    font-size: 1.2em;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.3s;
}

.close-list-btn:hover {
    background: rgba(255,255,255,0.3);
}

.property-list-content {
    flex: 1;
    overflow-y: auto;
    padding: 15px;
}

.property-card {
    background: white;
    border: 2px solid #e9ecef;
    border-radius: 12px;
    padding: 15px;
    margin-bottom: 15px;
    cursor: pointer;
    transition: all 0.3s;
}

.property-card:hover {
    border-color: #667eea;
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.2);
    transform: translateX(5px);
}

.property-card.selected {
    border-color: #667eea;
    background: linear-gradient(135deg, #f8f9ff 0%, #f0f2ff 100%);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.3);
}

.property-card-title {
    font-weight: 700;
    color: #1e3c72;
    margin-bottom: 8px;
    font-size: 1.05em;
    display: flex;
    align-items: center;
    gap: 8px;
}

.property-card-locality {
    color: #6c757d;
    font-size: 0.85em;
    margin-bottom: 10px;
    display: flex;
    align-items: center;
    gap: 5px;
}

.property-card-stats {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    margin-top: 10px;
}

.property-card-stat {
    display: flex;
    flex-direction: column;
    gap: 3px;
}

.property-card-stat-label {
    font-size: 0.75em;
    color: #6c757d;
    font-weight: 500;
}

.property-card-stat-value {
    font-size: 1em;
    font-weight: 700;
    color: #1e3c72;
}

.property-card-stat-value.pollution-high {
    color: #dc3545;
}

.property-card-stat-value.pollution-moderate {
    color: #fd7e14;
}

.property-card-stat-value.pollution-low {
    color: #28a745;
}

.property-card-badge {
    display: inline-block;
    padding: 4px 10px;
    border-radius: 12px;
    font-size: 0.75em;
    font-weight: 600;
    margin-top: 8px;
}

.badge-premium {
    background: #e3f2fd;
    color: #1976d2;
}

.badge-affordable {
    background: #e8f5e9;
    color: #388e3c;
}

.badge-ultra {
    background: #f3e5f5;
    color: #7b1fa2;
}

#map {
    flex: 1;
    height: 600px;
    position: relative;
}

.insights {
    padding: 50px 40px;
    background: #fff;
}

.insights h2 {
    font-size: 2em;
    margin-bottom: 30px;
    color: #2a5298;
    text-align: center;
}

.insight-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 25px;
}

.insight-card {
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
    padding: 25px;
    border-radius: 15px;
    border-left: 5px solid #667eea;
    transition: transform 0.3s, box-shadow 0.3s;
}

.insight-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 25px rgba(0,0,0,0.15);
}

.insight-card h3 {
    color: #1e3c72;
    margin-bottom: 12px;
    font-size: 1.2em;
}

.insight-card p {
    color: #495057;
    line-height: 1.6;
}

.insight-card strong {
    color: #dc3545;
    font-weight: 700;
}

.data-sources {
    padding: 50px 40px;
    background: #f8f9fa;
}

.data-sources h3 {
    font-size: 1.8em;
    margin-bottom: 25px;
    color: #2a5298;
    text-align: center;
}

.api-list {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(400px, 1fr));
    gap: 30px;
}

.api-card {
    background: white;
    padding: 30px;
    border-radius: 12px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
}

.api-card h4 {
    color: #1e3c72;
    margin-bottom: 15px;
    font-size: 1.3em;
    border-bottom: 2px solid #667eea;
    padding-bottom: 10px;
}

.api-card ul {
    list-style: none;
}

.api-card li {
    margin-bottom: 12px;
    padding-left: 20px;
    position: relative;
    line-height: 1.6;
    color: #495057;
}

.api-card li::before {
    content: "→";
    position: absolute;
    left: 0;
    color: #667eea;
    font-weight: bold;
}

.api-card code {
    background: #f1f3f5;
    padding: 3px 8px;
    border-radius: 4px;
    font-size: 0.9em;
    color: #e83e8c;
}

.api-card a {
    color: #667eea;
    text-decoration: none;
}

.api-card a:hover {
    text-decoration: underline;
}

footer {
    background: #343a40;
    color: white;
    padding: 30px 40px;
    text-align: center;
}

footer p {
    margin-bottom: 8px;
    opacity: 0.9;
}

footer em {
    color: #ffc107;
}

/* Leaflet Popup Customization */
.leaflet-popup-content-wrapper {
    border-radius: 12px;
    box-shadow: 0 8px 24px rgba(0,0,0,0.2);
}

.property-popup {
    min-width: 250px;
}

.popup-title {
    font-size: 1.2em;
    font-weight: 700;
    color: #1e3c72;
    margin-bottom: 12px;
    border-bottom: 2px solid #667eea;
    padding-bottom: 8px;
}

.popup-detail {
    margin: 8px 0;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.popup-label {
    font-weight: 600;
    color: #6c757d;
}

.popup-value {
    font-weight: 700;
    color: #1e3c72;
}

.aqi-severe {
    color: #dc3545 !important;
    font-weight: 800;
}

.aqi-poor {
    color: #fd7e14 !important;
}

.aqi-moderate {
    color: #ffc107 !important;
}

.pollution-badge {
    display: inline-block;
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 0.85em;
    font-weight: 700;
    margin-top: 8px;
}

.badge-severe {
    background: #dc3545;
    color: white;
}

.badge-poor {
    background: #fd7e14;
    color: white;
}

.badge-moderate {
    background: #ffc107;
    color: #333;
}

/* Scrollbar styling for property list */
.property-list-content::-webkit-scrollbar {
    width: 8px;
}

.property-list-content::-webkit-scrollbar-track {
    background: #f1f3f5;
}

.property-list-content::-webkit-scrollbar-thumb {
    background: #667eea;
    border-radius: 4px;
}

.property-list-content::-webkit-scrollbar-thumb:hover {
    background: #764ba2;
}

@media (max-width: 768px) {
    header h1 {
        font-size: 1.8em;
    }
    
    .controls {
        flex-direction: column;
    }
    
    .map-container {
        flex-direction: column;
        height: auto;
    }
    
    .property-list {
        width: 100% !important;
        min-width: 100% !important;
        max-height: 300px;
        border-right: none;
        border-bottom: 2px solid #e9ecef;
    }
    
    .property-list.active {
        width: 100% !important;
    }
    
    #map {
        height: 400px;
    }
    
    .api-list {
        grid-template-columns: 1fr;
    }
}

