:root {
    --color-principal: rgb(21, 65, 74);
    --color-texto: #ffffff;
    --color-texto-secundario: #e0e0e0;
    --fuente-principal: 'Segoe UI', Arial, sans-serif;
    --espaciado-seccion: 40px;
    --main-color: #9F3222;      /* RGB(159, 50, 34) */
    --light-bg: #FFF2F2;        /* RGB(255, 242, 242) */
    --accent-color: #d45845;
    --text-color: #333;
    --border-radius: 8px;
    --transition-time: 0.4s;
}

body {
    margin: 0;
    font-family: var(--fuente-principal);
    line-height: 1.6;
    color: #333;
    background-color: #ffffff;
    text-align: justify;
}

/* Secció amb fons blau fix */
.seccion-azul {
    background-color: var(--color-principal);
    background-attachment: fixed;
    color: var(--color-texto);
    padding: var(--espaciado-seccion) 20px;
}

.titulo {
    text-align: left;
    margin-bottom: 20px;
    font-size: 2.2em;
    font-weight: 700;
}

/* Contenidor de dues columnes */
.contenedor {
    display: flex;
    gap: 30px;
    align-items: center;
    flex-wrap: wrap;
    max-width: 1200px;
    margin: auto;
}

.columna {
    flex: 1;
    min-width: 280px;
}

/* Columna de la imatge més petita */
.columna.imagen {
    flex: 0.4; /* 40% del ample */
    max-width: 400px; /* límit màxim */
}

.columna p {
    color: var(--color-texto-secundario);
    font-size: 1rem;
}

img {
    max-width: 100%;
    height: auto;
    border-radius: 10px;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.25);
    display: block;
}

/* Estils per a la secció d'estadístiques i gràfics */
.content-container {
    max-width: 1400px;
    width: 90%;
    margin: 40px auto 0;
}

.stats-row {
    display: flex;
    flex-wrap: wrap;
    gap: 20px;
    margin-top: 20px;
    justify-content: center;
}

.stat-card {
    flex: 1;
    min-width: 200px;
    background-color: white;
    border-radius: var(--border-radius);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    padding: 25px;
    text-align: center;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.stat-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 6px 15px rgba(159, 50, 34, 0.15);
}

.stat-card i {
    font-size: 2.5rem;
    color: var(--main-color);
    margin-bottom: 15px;
}

.stat-card h3 {
    margin: 0 0 10px 0;
    color: var(--main-color);
    font-size: 1.2rem;
}

.stat-value {
    font-size: 2.5rem;
    font-weight: 700;
    color: var(--accent-color);
    margin: 5px 0;
}

.stat-label {
    font-size: 0.9rem;
    color: #666;
    margin-top: 5px;
}

.toggle-box {
    width: 100%;
    margin-bottom: 25px;
    border-radius: var(--border-radius);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.08);
    background: white;
    transition: box-shadow 0.3s ease;
    animation: fadeIn 0.5s ease forwards;
    opacity: 0;
}

.toggle-box:hover {
    box-shadow: 0 6px 20px rgba(159, 50, 34, 0.15);
}

.toggle-title {
    background: var(--light-bg);
    padding: 18px;
    cursor: pointer;
    font-weight: 600;
    color: var(--main-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
    user-select: none;
    transition: background-color var(--transition-time) ease;
}

.toggle-title:hover {
    background-color: #FFE5E5;
}

.toggle-content {
    display: none;
    padding: 20px;
}

.toggle-icon {
    display: flex;
    justify-content: center;
    align-items: center;
    width: 16px;
    height: 16px;
    background-color: var(--main-color);
    color: white;
    border-radius: 50%;
    transition: all 0.3s ease;
    font-size: 10px;
}

.toggle-box.open .toggle-icon {
    background-color: #d45d4a;
    transform: rotate(180deg);
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

label {
    display: block;
    margin-bottom: 10px;
    font-weight: 600;
    color: var(--main-color);
}

#promotorSelect {
    max-width: 280px;
    padding: 8px 12px;
    font-size: 0.9em;
}

#yearSelect {
    max-width: 180px;
    padding: 8px 12px;
    font-size: 0.9em;
}

#eventTypeYearSelect {
    max-width: 180px;
    padding: 8px 12px;
    font-size: 0.9em;
}

select {
    margin-bottom: 20px;
    padding: 10px 15px;
    font-size: 1em;
    border-radius: 5px;
    border: 1px solid #ddd;
    width: 100%;
    max-width: 300px;
    background: white;
    color: var(--text-color);
    transition: border-color 0.2s ease;
}

select:focus {
    border-color: var(--main-color);
    outline: none;
    box-shadow: 0 0 0 2px rgba(159, 50, 34, 0.2);
}

footer {
    margin-top: 40px;
    font-size: 0.9em;
    color: #777;
    text-align: center;
    padding: 20px 0;
    width: 100%;
    border-top: 1px solid #eee;
}

#map {
    height: 60vh;
    min-height: 300px;
    border: 1px solid #ddd;
    border-radius: var(--border-radius);
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.05);
}

.leaflet-popup-content-wrapper, .leaflet-popup-content {
    font-family: 'Segoe UI', Tahoma, sans-serif;
    border-radius: 8px;
}

.popup-grid {
    display: grid;
    grid-template-columns: 24px 1fr;
    gap: 8px;
    align-items: center;
}

.popup-icon { color: var(--main-color); }
.popup-text { display: flex; flex-direction: column; }
.popup-label { font-weight: 600; color: var(--main-color); }
.popup-value { word-break: break-word; }

.popup-title {
    font-weight: 700;
    font-size: 16px;
    color: var(--main-color);
    margin-bottom: 8px;
    grid-column: 1 / -1;
    border-bottom: 1px solid #eee;
    padding-bottom: 6px;
}

/* Responsivitat */
@media (max-width: 768px) {
    .contenedor {
        flex-direction: column;
    }

    .titulo {
        text-align: center;
        font-size: 1.8em;
    }

    .columna.imagen {
        flex: 1;
        max-width: 100%;
    }
    
    .stat-card {
        min-width: 180px;
        padding: 20px;
    }
    
    .stat-value {
        font-size: 2.2rem;
    }
}

@media (max-width: 480px) {
    :root {
        --espaciado-seccion: 20px;
    }

    .titulo {
        font-size: 1.6em;
    }
    
    .stat-card {
        min-width: 200px;
        padding: 15px;
    }
    
    .stat-value {
        font-size: 2rem;
    }
    
    .stat-card h3 {
        font-size: 1.1rem;
    }
    
    .toggle-title {
        font-size: 1rem;
    }
    
    .toggle-icon {
        width: 20px;
        height: 20px;
        font-size: 10px;
    }
    
    #map {
        height: 45vh;
    }
    
    select {
        font-size: 0.9rem;
        padding: 8px 12px;
    }

    #yearSelect {
        max-width: 280px;
        padding: 7px 10px;
        font-size: 0.85rem;
    }

    #yearSelect {
        max-width: 150px;
        padding: 7px 10px;
        font-size: 0.85rem;
    }

    #eventTypeYearSelect{
        max-width: 150px;
        padding: 7px 10px;
        font-size: 0.85rem;
    }
}

@media (max-width: 400px) {
    .stat-card {
        padding: 12px;
    }
    
    .stat-card i {
        font-size: 2rem;
    }
    
    .stat-value {
        font-size: 1.7rem;
    }
    
    #map {
        height: 40vh;
    }

    #promotorSelect {
        max-width: 280px;
        padding: 6px 8px;
        font-size: 0.8rem;
    }

    #yearSelect {
        max-width: 130px;
        padding: 6px 8px;
        font-size: 0.8rem;
    }

    #eventTypeYearSelect {
        max-width: 130px;
        padding: 6px 8px;
        font-size: 0.8rem;
    }

}