/* ===== RESET ET STYLES DE BASE ===== */
body {
    font-family: Arial, sans-serif;
    line-height: 1.6;
    margin: 0;
    padding: 0;
    color: #333;
    background-color: #f4f4f4;
}

header {
    background-color: #fff;
    padding: 15px 20px 10px;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
}

.container {
    width: 90%;
    max-width: 1200px;
    margin: 0 auto;
}

.logos-container {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
    width: 100%;
}

.header-title {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 40px;
    margin: 0 auto 10px;
}

.header-title img {
    height: 150px;
}

.header-title h1 {
    margin: 0;
    color: #000000;
    font-size: 2em;
}

/* Texte sous le titre : aligné à GAUCHE */
.container > p {
    color: #666;
    margin: 0 0 10px 0;
    text-align: left; /* ✅ Correction : aligné à gauche */
}

main {
    padding: 20px;
    max-width: 1200px;
    margin: 0 auto;
}

/* ===== FORMULAIRE ===== */
.form-section {
    background-color: #fff;
    padding: 15px;
    border-radius: 5px;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
    margin-bottom: 20px;
}

.filter-form {
    display: flex;
    flex-wrap: wrap;
    gap: 15px;
    align-items: flex-end;
}

.filter-form .form-group {
    flex: 1;
    min-width: 180px;
    margin-bottom: 0;
}

.filter-form label {
    display: block;
    margin-bottom: 5px;
    font-weight: bold;
    color: #555;
    font-size: 0.9em;
}

.filter-form select,
.filter-form input {
    padding: 8px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 14px;
    width: 100%;
}

.form-actions {
    display: flex;
    gap: 10px;
    margin-left: auto;
}

.btn {
    padding: 8px 15px;
    height: 36px;
    line-height: 1;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
    text-decoration: none;
}

.btn-primary {
    background-color: #0056b3;
    color: white;
}

.btn-primary:hover {
    background-color: #003d7a;
}

.btn-secondary {
    background-color: #f0f0f0;
    color: #333;
}

.btn-secondary:hover {
    background-color: #e0e0e0;
}

/* ===== TABLEAU ===== */
.results-section {
    background-color: #fff;
    padding: 20px;
    border-radius: 5px;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
}

.table-container {
    overflow-x: auto;
}

table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 20px;
}

th, td {
    padding: 10px 12px;
    border: 1px solid #ddd;
    font-size: 0.8em;
}

/* En-têtes du tableau */
th {
    font-size: 0.9em;
    font-weight: bold;
    text-align: center;
    border: 1px solid #ddd !important;
}

/* Colonnes 1-5 : bleu clair */
th:nth-child(1),
th:nth-child(2),
th:nth-child(3),
th:nth-child(4),
th:nth-child(5),
th:nth-child(6){
    background-color: #cccccc;
}

/* Ligne 1 : cellule "Débits (m³/s)" */
thead tr:first-of-type > th[colspan="7"] {
    background-color: #cccccc;
}

/* Ligne 2 : cellules "2003-2022" et "1971-2000" */
thead tr:nth-of-type(2) > th[colspan="4"] {
    background-color: #ffc0a2;
}
thead tr:nth-of-type(2) > th[colspan="3"] {
    background-color: #dafdd0;
}

/* Ligne 3 : sous-titres */
thead tr:nth-of-type(3) > th:nth-of-type(1),
thead tr:nth-of-type(3) > th:nth-of-type(2),
thead tr:nth-of-type(3) > th:nth-of-type(3),
thead tr:nth-of-type(3) > th:nth-of-type(4) {
    background-color: #ffc0a2;  /* Bleu clair pour les colonnes 6-10 */
}

thead tr:nth-of-type(3) > th:nth-child(n+5) {  /* Sélectionne les colonnes 11+ (11 et 12) */
    background-color: #dafdd0;  /* Vert clair pour les colonnes 11-12 */
}

/* Lignes paires du corps du tableau */
tbody tr:nth-child(even) {
    background-color: #f2f2f2;
}

.no-results {
    color: #666;
    text-align: center;
    font-style: italic;
    padding: 15px;
}

/* ===== FOOTER ===== */
footer {
    text-align: center;
    padding: 20px;
    background-color: #fff;
    margin-top: 20px;
    box-shadow: 0 -2px 5px rgba(0, 0, 0, 0.1);
}

footer a {
    color: #0056b3;
    text-decoration: none;
}

footer a:hover {
    text-decoration: underline;
}

.chart-container {
    width: 90%;
    max-width: 1000px;
    margin: 20px auto;
    height: 500px;
    background: white;
    padding: 15px;
    border-radius: 8px;
    box-shadow: 0 0 10px rgba(0, 0, 0, 0.1);
}
.info {
    text-align: center;
    color: #7f8c8d;
    margin-bottom: 20px;
}
.legend-custom {
    display: flex;
    justify-content: center;
    margin-top: 10px;
    gap: 20px;
}
.legend-item {
    display: flex;
    align-items: center;
    font-size: 14px;
}
.legend-color {
    width: 20px;
    height: 3px;
    margin-right: 8px;
    border-radius: 2px;
}

/* ===== RESPONSIVE ===== */
@media (max-width: 768px) {
    .filter-form {
        flex-direction: column;
        gap: 10px;
    }

    .filter-form .form-group {
        width: 100%;
    }

    .form-actions {
        width: 100%;
        margin-left: 0;
        justify-content: center;
    }

    table {
        font-size: 0.75em;
    }

    th, td {
        padding: 8px;
    }

    .header-title {
        flex-direction: column;
        gap: 20px;
    }
}