/* ===========================
   Reset et Variables
   =========================== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --primary-color: #003366;
    --secondary-color: #99cc99;
    --tertiary-color: #f0ead6;
    --danger-color: #ef4444;
    --warning-color: #f59e0b;
    --dark-color: #1f2937;
    --light-color: #f0ead6;
    --border-color: #e5e7eb;
    --shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    line-height: 1.6;
    color: var(--dark-color);
    background-color: var(--light-color);
}

.container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 20px;
}

/* ===========================
   Header
   =========================== */
.header {
    background: linear-gradient(135deg, var(--primary-color) 0%, #002244 100%);
    color: white;
    padding: 20px 0;
    box-shadow: var(--shadow-lg);
}

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

.logo {
    display: flex;
    align-items: center;
    gap: 15px;
}

.logo-img {
    height: 50px;
    width: auto;
    object-fit: contain;
}

.logo i {
    font-size: 2.5rem;
}

.logo h1 {
    font-size: 1.8rem;
    font-weight: 600;
}

.header-info {
    display: flex;
    gap: 15px;
    flex-wrap: wrap;
}

.score-badge,
.class-badge {
    padding: 10px 20px;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 50px;
    backdrop-filter: blur(10px);
    font-size: 1.1rem;
}

.score-badge strong,
.class-badge {
    font-weight: 700;
}

/* ===========================
   Stats Overview
   =========================== */
.stats-overview {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 20px;
    margin: 30px 0;
}

.stat-card {
    background: white;
    padding: 25px;
    border-radius: 12px;
    box-shadow: var(--shadow);
    display: flex;
    align-items: center;
    gap: 20px;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.stat-card:hover {
    transform: translateY(-5px);
    box-shadow: var(--shadow-lg);
}

.stat-card i {
    font-size: 2.5rem;
    color: var(--primary-color);
    opacity: 0.8;
}

.stat-content h3 {
    font-size: 0.9rem;
    color: #6b7280;
    margin-bottom: 5px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.stat-value {
    font-size: 2rem;
    font-weight: 700;
    color: var(--dark-color);
    line-height: 1;
}

.stat-label {
    font-size: 0.9rem;
    color: #9ca3af;
}

/* ===========================
   Map Section
   =========================== */
.map-section {
    background: white;
    border-radius: 12px;
    padding: 25px;
    box-shadow: var(--shadow);
    margin: 30px 0;
}

.map-controls {
    margin-bottom: 20px;
}

.map-controls h2 {
    font-size: 1.5rem;
    margin-bottom: 15px;
    color: var(--dark-color);
}

.map-controls h2 i {
    color: var(--primary-color);
    margin-right: 10px;
}

.filter-group {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.filter-btn {
    padding: 12px 20px;
    border: 2px solid var(--border-color);
    background: white;
    border-radius: 50px;
    cursor: pointer;
    font-size: 0.95rem;
    display: flex;
    align-items: center;
    gap: 8px;
    transition: all 0.3s ease;
    font-weight: 500;
}

.filter-btn i {
    font-size: 1.1rem;
}

.filter-btn .count {
    background: var(--light-color);
    padding: 2px 8px;
    border-radius: 20px;
    font-size: 0.85rem;
    font-weight: 600;
}

.filter-btn.active {
    background: var(--primary-color);
    color: white;
    border-color: var(--primary-color);
}

.filter-btn.active .count {
    background: rgba(255, 255, 255, 0.3);
    color: white;
}

.filter-btn:hover:not(.active) {
    border-color: var(--primary-color);
    color: var(--primary-color);
}

#map {
    height: 600px;
    border-radius: 8px;
    overflow: hidden;
    border: 1px solid var(--border-color);
}

.legend {
    margin-top: 20px;
    padding: 15px;
    background: var(--light-color);
    border-radius: 8px;
}

.legend h3 {
    font-size: 1rem;
    margin-bottom: 10px;
    color: var(--dark-color);
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 10px;
    margin: 8px 0;
    font-size: 0.9rem;
}

.legend-marker {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    border: 2px solid white;
    box-shadow: 0 0 5px rgba(0, 0, 0, 0.3);
}

.legend-marker.red {
    background: var(--danger-color);
}

.legend-marker.green {
    background: var(--secondary-color);
}

.legend-marker.blue {
    background: var(--primary-color);
}

/* ===========================
   Evolution Section
   =========================== */
.evolution-section {
    background: white;
    border-radius: 12px;
    padding: 25px;
    box-shadow: var(--shadow);
    margin: 30px 0;
}

.evolution-section h2 {
    font-size: 1.5rem;
    margin-bottom: 20px;
    color: var(--dark-color);
}

.evolution-section h2 i {
    color: var(--primary-color);
    margin-right: 10px;
}

.chart-container {
    position: relative;
    height: 350px;
}

/* ===========================
   Info Section
   =========================== */
.info-section {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 20px;
    margin: 30px 0;
}

.info-card {
    background: white;
    border-radius: 12px;
    padding: 25px;
    box-shadow: var(--shadow);
}

.info-card h3 {
    font-size: 1.3rem;
    margin-bottom: 15px;
    color: var(--dark-color);
}

.info-card h3 i {
    color: var(--primary-color);
    margin-right: 10px;
}

.info-card p {
    margin-bottom: 12px;
    color: #4b5563;
    line-height: 1.6;
}

.info-card ul {
    margin-left: 20px;
    color: #4b5563;
}

.info-card ul li {
    margin: 8px 0;
}

.btn-download {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    padding: 12px 24px;
    background: var(--primary-color);
    color: white;
    text-decoration: none;
    border-radius: 8px;
    margin-top: 15px;
    transition: background 0.3s ease;
    font-weight: 500;
}

.btn-download:hover {
    background: #002244;
}

/* ===========================
   Footer
   =========================== */
.footer {
    background: var(--dark-color);
    color: white;
    padding: 20px 0;
    text-align: center;
    margin-top: 50px;
}

.footer p {
    margin: 5px 0;
}

.footer p:first-child {
    font-weight: 600;
    font-size: 0.95rem;
}

.footer p:last-child {
    font-size: 0.85rem;
    opacity: 0.8;
}

.footer a {
    color: var(--secondary-color);
    text-decoration: underline;
    transition: all 0.3s ease;
}

.footer a:hover {
    color: var(--primary-color);
    background-color: var(--secondary-color);
    padding: 2px 4px;
    border-radius: 3px;
    text-decoration: none;
}

/* ===========================
   Custom Popup Styles
   =========================== */
.custom-popup {
    min-width: 250px;
}

.custom-popup .popup-title {
    font-weight: 600;
    color: var(--dark-color);
    margin-bottom: 8px;
    font-size: 1.1rem;
}

.custom-popup .popup-description {
    color: #4b5563;
    line-height: 1.5;
    margin-bottom: 10px;
}

.custom-popup .popup-type {
    display: inline-block;
    padding: 4px 12px;
    background: var(--light-color);
    border-radius: 20px;
    font-size: 0.85rem;
    color: var(--dark-color);
    font-weight: 500;
}

.popup-type.rouge {
    background: #fee2e2;
    color: #dc2626;
}

.popup-type.vert {
    background: #d1fae5;
    color: #059669;
}

.popup-type.parking {
    background: #dbeafe;
    color: #2563eb;
}

/* ===========================
   Responsive Design
   =========================== */
@media (max-width: 768px) {
    .logo-img {
        height: 40px;
    }

    .logo h1 {
        font-size: 1.3rem;
    }

    .header-content {
        flex-direction: column;
        align-items: flex-start;
    }

    .stats-overview {
        grid-template-columns: 1fr;
    }

    .stat-card {
        padding: 20px;
    }

    #map {
        height: 400px;
    }

    .filter-group {
        flex-direction: column;
    }

    .filter-btn {
        width: 100%;
        justify-content: center;
    }

    .info-section {
        grid-template-columns: 1fr;
    }
}

/* ===========================
   Loading Animation
   =========================== */
.loading {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 3px solid rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    border-top-color: white;
    animation: spin 1s ease-in-out infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* ===========================
   Marker Clusters
   =========================== */
.marker-cluster-small {
    background-color: rgba(37, 99, 235, 0.6);
}

.marker-cluster-small div {
    background-color: rgba(37, 99, 235, 0.8);
}

.marker-cluster-medium {
    background-color: rgba(16, 185, 129, 0.6);
}

.marker-cluster-medium div {
    background-color: rgba(16, 185, 129, 0.8);
}

.marker-cluster-large {
    background-color: rgba(239, 68, 68, 0.6);
}

.marker-cluster-large div {
    background-color: rgba(239, 68, 68, 0.8);
}
