/* ==========================================================================
   CLI.M.A. v2 — Stylesheet
   Association CLI.M.A. 57-67-68
   ========================================================================== */

/* --------------------------------------------------------------------------
   1. Custom Properties (palette v1 préservée)
   -------------------------------------------------------------------------- */
:root {
    --color-forest: #025021;
    --color-forest-light: #03692e;
    --color-forest-dark: #011a0b;
    --color-content-bg: #e8f5e2;
    --color-teal: #1D4665;
    --color-gold: #FED500;
    --color-lime: #AAFF00;
    --color-sky: #A4D1F4;
    --color-sky-light: #D2EAF8;
    --color-case: #DAFCCE;
    --color-case-border: #b8e6a8;
    --color-white: #FFFFFF;
    --color-muted: #6a9a7a;
    --color-text: #1a3a2a;
    --color-text-light: #4a7a5a;
    --color-danger: #c0392b;

    --font-main: "Verdana", "Segoe UI", sans-serif;
    --max-width: 1200px;
    --header-height: 80px;
    --nav-height: 48px;
    --radius: 6px;
    --shadow: 0 2px 8px rgba(0, 0, 0, 0.12);
    --shadow-lg: 0 4px 16px rgba(0, 0, 0, 0.18);
}

/* --------------------------------------------------------------------------
   2. Reset & Base
   -------------------------------------------------------------------------- */
*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    font-size: 15px;
    scroll-behavior: smooth;
}

body {
    font-family: var(--font-main);
    color: var(--color-text);
    background-color: var(--color-forest);
    line-height: 1.6;
    min-height: 100vh;
}

a {
    color: var(--color-teal);
    text-decoration: none;
    transition: color 0.2s;
}

a:hover {
    color: var(--color-forest);
    text-decoration: underline;
}

img {
    max-width: 100%;
    height: auto;
    display: block;
}

h1, h2, h3, h4 {
    line-height: 1.3;
    color: var(--color-forest);
}

/* --------------------------------------------------------------------------
   3. Layout
   -------------------------------------------------------------------------- */
.site-wrapper {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

.container {
    width: 100%;
    max-width: var(--max-width);
    margin: 0 auto;
    padding: 0 16px;
}

.content {
    flex: 1;
    background-color: var(--color-content-bg);
    padding: 24px 0;
}

/* --------------------------------------------------------------------------
   4. Header
   -------------------------------------------------------------------------- */
.site-header {
    background: linear-gradient(135deg, var(--color-forest-dark), var(--color-forest));
    color: var(--color-white);
    padding: 16px 0;
    box-shadow: var(--shadow);
}

.header-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
}

.header-brand {
    display: flex;
    align-items: center;
    gap: 16px;
    text-decoration: none;
    color: var(--color-white);
}

.header-brand:hover {
    color: var(--color-gold);
    text-decoration: none;
}

/* Logo rond du header (visuel « mystère » ou définitif selon l'utilisateur).
   Sorti du flux pour ne pas agrandir le bandeau : il déborde sur la bande de
   navigation, dont le contenu est décalé à droite pour éviter la superposition. */
.with-logo .header-brand {
    position: relative;
    padding-left: 120px; /* logo 100px à left 0 + écart 20px */
}

.with-logo .header-logo {
    position: absolute;
    left: 0; /* petit écran : pas de débordement en gouttière */
    top: 0;
    width: 100px;
    height: 100px;
    z-index: 1001; /* au-dessus de la nav sticky (z-index 1000) pour déborder dessus */
}

/* Menu poussé à droite sous le débordement du logo. En mobile (<600px), le header —
   plus haut, titre et tagline passant sur plusieurs lignes — contient tout le logo :
   aucun débordement sur la bande de menu, le hamburger reste donc calé à gauche. */
@media (min-width: 600px) {
    .site-header {
        padding: 36px 0 16px; /* place au débordement haut du logo */
    }

    .header-auth {
        flex-shrink: 0; /* à l'aise en largeur : l'encart ne se comprime plus */
    }

    .with-logo .header-brand {
        padding-left: 146px; /* logo 150px décalé de -20px + écart 16px */
    }

    .with-logo .header-logo {
        left: -20px; /* déborde sur la gouttière gauche */
        top: -30px; /* compense le padding vertical du header : affleure le haut du bandeau */
        width: 150px;
        height: auto;
    }

    /* gouttière 16px - 20px + logo 150px + écart 16px */
    .with-logo .nav-inner {
        padding-left: 162px;
    }
}

.header-text h1 {
    font-size: 1.3rem;
    color: var(--color-white);
    font-weight: 700;
    letter-spacing: 0.5px;
}

.header-text .tagline {
    font-size: 0.75rem;
    color: var(--color-lime);
    margin-top: 2px;
    font-weight: 400;
}

.header-auth {
    font-size: 0.8rem;
    text-align: right;
    /* Mobile : peut se comprimer, la ligne « Créer un compte · Mot de passe oublié ? »
       se replie alors entre les deux liens (chaque lien est insécable). */
    min-width: 0;
}

.header-auth a {
    color: var(--color-gold);
}

.header-auth a:hover {
    color: var(--color-lime);
}

.header-auth .welcome {
    color: var(--color-white);
    margin-bottom: 4px;
}

/* Login form compact : champs empilés en mobile, en ligne en desktop */
.login-form {
    display: flex;
    flex-direction: column;
    gap: 6px;
    align-items: flex-end;
}

.login-form input[type="text"],
.login-form input[type="password"] {
    padding: 4px 8px;
    font-size: 0.8rem;
    border: 1px solid rgba(255, 255, 255, 0.3);
    border-radius: 3px;
    background: rgba(255, 255, 255, 0.1);
    color: var(--color-white);
    width: 110px;
    font-family: var(--font-main);
}

.login-form input::placeholder {
    color: rgba(255, 255, 255, 0.5);
}

.login-form button {
    padding: 4px 12px;
    font-size: 0.8rem;
    border: 1px solid var(--color-gold);
    border-radius: 3px;
    background: transparent;
    color: var(--color-gold);
    cursor: pointer;
    font-family: var(--font-main);
    transition: background 0.2s, color 0.2s;
}

.login-form button:hover {
    background: var(--color-gold);
    color: var(--color-forest-dark);
}

.signup-link {
    font-size: 0.75rem;
    margin-top: 4px;
}

/* Bouton de déconnexion (formulaire POST stylé comme un lien) */
.logout-link {
    background: none;
    border: none;
    padding: 0;
    font-family: var(--font-main);
    font-size: 0.8rem;
    color: var(--color-gold);
    cursor: pointer;
}

.logout-link:hover {
    color: var(--color-lime);
    text-decoration: underline;
}

.signup-link a {
    color: var(--color-lime);
    white-space: nowrap; /* césure possible uniquement entre les deux liens */
}

/* --------------------------------------------------------------------------
   5. Navigation
   -------------------------------------------------------------------------- */
.site-nav {
    background: var(--color-forest);
    border-bottom: 2px solid var(--color-lime);
    position: sticky;
    top: 0;
    z-index: 1000;
}

.nav-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.nav-links {
    display: none;
    list-style: none;
    flex-wrap: wrap;
}

.nav-links a {
    display: block;
    padding: 12px 16px;
    color: var(--color-gold);
    font-size: 0.82rem;
    font-weight: 500;
    transition: background 0.2s, color 0.2s;
    white-space: nowrap;
}

.nav-links a:hover,
.nav-links a.active {
    background: var(--color-forest-light);
    color: var(--color-white);
    text-decoration: none;
}

/* Hamburger */
.hamburger {
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 5px;
    padding: 12px 16px;
    margin-left: -16px; /* compense son padding : icône alignée sur la gouttière */
    background: none;
    border: none;
    cursor: pointer;
}

.hamburger span {
    display: block;
    width: 24px;
    height: 2px;
    background: var(--color-gold);
    transition: transform 0.3s, opacity 0.3s;
}

/* Hamburger animation quand ouvert */
.nav-open .hamburger span:nth-child(1) {
    transform: translateY(7px) rotate(45deg);
}

.nav-open .hamburger span:nth-child(2) {
    opacity: 0;
}

.nav-open .hamburger span:nth-child(3) {
    transform: translateY(-7px) rotate(-45deg);
}

/* Mobile : nav visible quand ouvert */
.nav-open .nav-links {
    display: flex;
    flex-direction: column;
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: var(--color-forest);
    border-bottom: 2px solid var(--color-lime);
    box-shadow: var(--shadow-lg);
    z-index: 999;
}

/* Dropdowns */
.nav-dropdown {
    position: relative;
}

.nav-dropdown-toggle {
    display: block;
    width: 100%;
    padding: 12px 16px;
    color: var(--color-gold);
    font-size: 0.82rem;
    font-weight: 500;
    font-family: var(--font-main);
    background: none;
    border: none;
    cursor: pointer;
    text-align: left;
    white-space: nowrap;
    transition: background 0.2s, color 0.2s;
}

.nav-dropdown-toggle::after {
    content: ' \25BE';
    font-size: 0.7em;
    opacity: 0.7;
}

.nav-dropdown-toggle:hover {
    background: var(--color-forest-light);
    color: var(--color-white);
}

.nav-dropdown-menu {
    display: none;
    list-style: none;
    background: var(--color-forest);
}

.nav-dropdown.open .nav-dropdown-menu {
    display: block;
}

/* Mobile : sous-menu indenté */
.nav-dropdown-menu a {
    padding-left: 32px;
}

/* Menu Administration : fond clair / texte foncé pour le distinguer du menu public */
.nav-admin .nav-dropdown-toggle {
    background: var(--color-case);
    color: var(--color-forest);
    font-weight: 700;
}

.nav-admin .nav-dropdown-toggle:hover,
.nav-admin.open .nav-dropdown-toggle {
    background: var(--color-white);
    color: var(--color-forest);
}

.nav-admin .nav-dropdown-menu {
    background: var(--color-case);
}

.nav-admin .nav-dropdown-menu a {
    color: var(--color-forest);
}

.nav-admin .nav-dropdown-menu a:hover {
    background: var(--color-white);
    color: var(--color-forest);
}

/* --------------------------------------------------------------------------
   6. Sections de contenu
   -------------------------------------------------------------------------- */
.section {
    margin-bottom: 32px;
}

.section-title {
    font-size: 1.2rem;
    color: var(--color-forest);
    padding-bottom: 8px;
    margin-bottom: 16px;
    border-bottom: 2px solid var(--color-lime);
    display: flex;
    align-items: center;
    gap: 8px;
}

.section-title .icon {
    font-size: 1.1rem;
}

/* --- Cartes actualités --- */
.news-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.news-card {
    background: var(--color-case);
    border: 1px solid var(--color-case-border);
    border-radius: var(--radius);
    padding: 16px;
    transition: box-shadow 0.2s;
}

.news-card:hover {
    box-shadow: var(--shadow);
}

.news-card .news-date {
    font-size: 0.8rem;
    color: var(--color-muted);
    margin-bottom: 4px;
}

.news-card .news-title {
    font-weight: 700;
    color: var(--color-teal);
    margin-bottom: 6px;
}

.news-card .news-body {
    font-size: 0.9rem;
    color: var(--color-text-light);
    line-height: 1.5;
}

/* --- Grille photos --- */
.photo-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 12px;
}

.photo-card {
    background: var(--color-white);
    border-radius: var(--radius);
    overflow: hidden;
    box-shadow: var(--shadow);
    transition: transform 0.2s, box-shadow 0.2s;
}

.photo-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
}

.photo-card img {
    width: 100%;
    height: 180px;
    object-fit: cover;
}

.photo-card .photo-info {
    padding: 10px 12px;
}

.photo-card .photo-title {
    font-weight: 600;
    font-size: 0.9rem;
    color: var(--color-teal);
    margin-bottom: 4px;
}

.photo-card .photo-meta {
    font-size: 0.75rem;
    color: var(--color-muted);
}

/* --- Tableau relevés --- */
.releves-wrapper {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

.releves-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.85rem;
}

.releves-table th {
    background: var(--color-forest);
    color: var(--color-white);
    padding: 8px 10px;
    text-align: center;
    font-weight: 600;
    font-size: 0.8rem;
    white-space: nowrap;
}

.releves-table th:first-child {
    text-align: left;
}

.releves-table td {
    padding: 6px 10px;
    text-align: center;
    border-bottom: 1px solid var(--color-case-border);
    white-space: nowrap;
}

.releves-table td:first-child {
    text-align: left;
    font-weight: 500;
}

.releves-table td a {
    color: var(--color-forest);
    font-weight: 500;
}

.releves-table td a:hover {
    color: var(--color-teal);
}

.releves-table .temp-cell {
    font-weight: 700;
    border-radius: 3px;
}

.releves-table .weather-icons img {
    width: 18px;
    height: 18px;
    display: inline-block;
    vertical-align: middle;
    margin: 0 1px;
}

.releves-link {
    margin-top: 10px;
    font-size: 0.85rem;
}

/* --- Tendance du jour --- */
.trend-box {
    background: var(--color-case);
    border: 1px solid var(--color-case-border);
    border-radius: var(--radius);
    padding: 16px;
    margin-top: 16px;
}

.trend-box .trend-title {
    font-weight: 700;
    color: var(--color-forest);
    margin-bottom: 8px;
    font-size: 0.95rem;
}

.trend-box .trend-text {
    font-size: 0.85rem;
    color: var(--color-text-light);
    line-height: 1.5;
}

.trend-box .trend-more {
    display: inline-block;
    margin-top: 8px;
    font-size: 0.85rem;
    color: var(--color-teal);
    font-weight: 500;
}

/* --- Éphémérides --- */
.events-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.event-item {
    background: var(--color-case);
    border: 1px solid var(--color-case-border);
    border-radius: var(--radius);
    padding: 10px 14px;
    font-size: 0.9rem;
}

.event-item a {
    color: var(--color-teal);
}

/* --- Message vide --- */
.empty-message {
    color: var(--color-muted);
    font-style: italic;
    font-size: 0.9rem;
    padding: 12px 0;
}

/* --------------------------------------------------------------------------
   7. Footer
   -------------------------------------------------------------------------- */
.site-footer {
    background: var(--color-forest-dark);
    color: rgba(255, 255, 255, 0.7);
    padding: 24px 0;
    font-size: 0.8rem;
    text-align: center;
}

.footer-inner {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
}

.site-footer a {
    color: var(--color-gold);
}

.site-footer a:hover {
    color: var(--color-lime);
}

.footer-name {
    font-weight: 700;
    color: var(--color-white);
    font-size: 0.9rem;
}

.footer-tagline {
    color: var(--color-gold);
}

/* --------------------------------------------------------------------------
   8. Utilitaires
   -------------------------------------------------------------------------- */
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    border: 0;
}

.text-center {
    text-align: center;
}

/* --------------------------------------------------------------------------
   9. Deux colonnes (relevés + photos côte à côte en desktop)
   -------------------------------------------------------------------------- */
.home-grid {
    display: flex;
    flex-direction: column;
    gap: 32px;
}

/* --------------------------------------------------------------------------
   10. Media Queries
   -------------------------------------------------------------------------- */

/* Tablet */
@media (min-width: 600px) {
    .photo-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

/* Desktop */
@media (min-width: 900px) {
    html {
        font-size: 16px;
    }

    .container {
        padding: 0 24px;
    }

    .content {
        padding: 32px 0;
    }

    /* Header */
    .with-logo .header-brand {
        padding-left: 166px; /* logo 170px décalé de -20px + écart 16px */
    }

    .with-logo .header-logo {
        width: 170px;
    }

    /* Gouttière desktop 24px - 20px + logo 170px + écart 16px */
    .with-logo .nav-inner {
        padding-left: 190px;
    }

    .header-text h1 {
        font-size: 1.5rem;
    }

    .header-text .tagline {
        font-size: 0.85rem;
    }

    .login-form {
        flex-direction: row;
        align-items: center;
        flex-wrap: wrap;
        justify-content: flex-end;
    }

    /* Nav : horizontal */
    .hamburger {
        display: none;
    }

    .nav-links {
        display: flex;
        flex-direction: row;
    }

    .nav-links a {
        padding: 14px 10px;
        font-size: 0.8rem;
    }

    /* Nav dropdowns : position absolue en desktop */
    .nav-dropdown-toggle {
        padding: 14px 10px;
        font-size: 0.8rem;
    }

    .nav-dropdown-menu {
        position: absolute;
        top: 100%;
        left: 0;
        min-width: 180px;
        border-radius: 0 0 var(--radius) var(--radius);
        box-shadow: var(--shadow-lg);
        border-top: 2px solid var(--color-lime);
        z-index: 1001;
    }

    .nav-dropdown-menu a {
        padding-left: 16px;
    }

    /* Home grid : 2 colonnes */
    .home-grid {
        flex-direction: row;
    }

    .home-col-left {
        flex: 1;
        min-width: 0;
    }

    .home-col-right {
        flex: 1;
        min-width: 0;
    }

    /* Photos : 3 colonnes */
    .photo-grid {
        grid-template-columns: repeat(3, 1fr);
    }
}

@media (min-width: 1100px) {
    .nav-links a,
    .nav-dropdown-toggle {
        padding: 14px 16px;
        font-size: 0.82rem;
    }
}

/* --------------------------------------------------------------------------
   11. Composants ajoutés pour la version .NET (formulaires, alertes, cartes…)
   -------------------------------------------------------------------------- */

/* --- Titres de page --- */
.page-title {
    font-size: 1.4rem;
    color: var(--color-forest);
    margin-bottom: 16px;
    padding-bottom: 8px;
    border-bottom: 2px solid var(--color-lime);
}

/* Titre avec lien en vis-à-vis (passerelles Relevés ↔ Temps réel) : le souligné
   passe sur la rangée pour couvrir toute la largeur, lien aligné à droite. */
.page-title-row {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 12px;
    flex-wrap: wrap;
    margin-bottom: 16px;
    border-bottom: 2px solid var(--color-lime);
}

.page-title-row .page-title {
    margin-bottom: 0;
    padding-bottom: 8px;
    border-bottom: none;
}

.page-title-link {
    white-space: nowrap;
}

/* --- Formulaires --- */
.form-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 12px;
    max-width: 560px;
}

@media (min-width: 600px) {
    .form-grid.two-cols {
        grid-template-columns: 1fr 1fr;
        max-width: 760px;
    }
}

.form-field {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.form-field label {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--color-forest);
}

.form-field input[type="text"],
.form-field input[type="password"],
.form-field input[type="email"],
.form-field input[type="number"],
.form-field input[type="date"],
.form-field input[type="time"],
.form-field input[type="datetime-local"],
.form-field input[type="file"],
.form-field select,
.form-field textarea {
    padding: 8px 10px;
    font-size: 0.9rem;
    font-family: var(--font-main);
    border: 1px solid var(--color-case-border);
    border-radius: var(--radius);
    background: var(--color-white);
    color: var(--color-text);
}

.form-field input:focus,
.form-field select:focus,
.form-field textarea:focus {
    outline: 2px solid var(--color-forest-light);
    outline-offset: 0;
}

.form-field .field-hint {
    font-size: 0.75rem;
    color: var(--color-muted);
}

.form-field .field-error,
.field-validation-error {
    font-size: 0.78rem;
    color: var(--color-danger);
}

.validation-summary-errors {
    background: #fdecea;
    border: 1px solid #f5c6c1;
    border-radius: var(--radius);
    color: var(--color-danger);
    font-size: 0.85rem;
    padding: 10px 14px;
    margin-bottom: 16px;
}

.validation-summary-errors ul {
    margin-left: 18px;
}

.form-actions {
    margin-top: 8px;
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

/* --- Boutons --- */
.btn {
    display: inline-block;
    padding: 8px 18px;
    font-size: 0.88rem;
    font-family: var(--font-main);
    font-weight: 600;
    border-radius: var(--radius);
    border: 1px solid var(--color-forest);
    background: var(--color-forest);
    color: var(--color-white);
    cursor: pointer;
    text-decoration: none;
    transition: background 0.2s, color 0.2s;
}

.btn:hover {
    background: var(--color-forest-light);
    color: var(--color-white);
    text-decoration: none;
}

.btn.btn-secondary {
    background: transparent;
    color: var(--color-forest);
}

.btn.btn-secondary:hover {
    background: var(--color-case);
}

.btn.btn-danger {
    background: var(--color-danger);
    border-color: var(--color-danger);
}

.btn.btn-sm {
    padding: 4px 10px;
    font-size: 0.78rem;
}

/* --- Alertes --- */
.alert {
    padding: 12px 16px;
    border-radius: var(--radius);
    margin-bottom: 16px;
    font-size: 0.9rem;
    border: 1px solid transparent;
}

.alert-info {
    background: var(--color-sky-light);
    border-color: var(--color-sky);
    color: #14425f;
}

.alert-success {
    background: var(--color-case);
    border-color: var(--color-case-border);
    color: var(--color-forest);
}

.alert-error {
    background: #fdecea;
    border-color: #f5c6c1;
    color: var(--color-danger);
}

/* --- Encadrés génériques --- */
.panel {
    background: var(--color-case);
    border: 1px solid var(--color-case-border);
    border-radius: var(--radius);
    padding: 16px;
    margin-bottom: 16px;
}

.panel-white {
    background: var(--color-white);
}

/* --- Barre de filtres (relevés, photos, archives…) --- */
.filter-bar {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    align-items: center;
    background: var(--color-case);
    border: 1px solid var(--color-case-border);
    border-radius: var(--radius);
    padding: 10px 12px;
    margin-bottom: 16px;
    font-size: 0.85rem;
}

.filter-bar select,
.filter-bar input {
    padding: 5px 8px;
    font-size: 0.85rem;
    font-family: var(--font-main);
    border: 1px solid var(--color-case-border);
    border-radius: 3px;
}

.filter-bar option.has-data {
    background-color: var(--color-lime);
}

/* --- Carte Leaflet --- */
.map-container {
    width: 100%;
    height: 480px;
    border-radius: var(--radius);
    border: 1px solid var(--color-case-border);
    z-index: 0;
}

.map-container.map-tall {
    height: 620px;
}

/* Étiquettes de valeurs colorées sur les cartes (climato / temps réel) */
.map-value-label {
    display: inline-block;
    padding: 2px 6px;
    border-radius: 3px;
    font-size: 0.8rem;
    font-weight: 700;
    box-shadow: var(--shadow);
    white-space: nowrap;
}

/* Étiquette d'observation sur la carte */
.map-obs-label {
    background: var(--color-white);
    border-radius: 4px;
    box-shadow: var(--shadow);
    font-size: 0.72rem;
    overflow: hidden;
    text-align: center;
    min-width: 58px;
}

.map-obs-label .obs-place {
    background: var(--color-teal);
    color: var(--color-white);
    padding: 1px 4px;
    font-weight: 600;
    white-space: nowrap;
}

.map-obs-label .obs-body {
    padding: 2px 4px;
}

.map-obs-label .obs-emoji {
    font-size: 1.15rem;
    line-height: 1.2;
}

/* --- Cellules colorées (tableaux relevés/temps réel) --- */
.temp-cell {
    font-weight: 700;
    border-radius: 3px;
}

/* --- Pictos phénomènes (emoji) --- */
.weather-emoji {
    font-size: 1rem;
    margin: 0 1px;
    cursor: default;
}

/* --- Flèche de direction du vent --- */
.wind-arrow {
    display: inline-block;
    font-weight: 700;
}

/* --- Statistiques mensuelles (module relevés) --- */
.stats-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 16px;
}

@media (min-width: 900px) {
    .stats-grid {
        grid-template-columns: 1fr 1fr;
    }
}

.stats-block {
    background: var(--color-case);
    border: 1px solid var(--color-case-border);
    border-radius: var(--radius);
    padding: 14px 16px;
}

.stats-block h3 {
    font-size: 0.95rem;
    color: var(--color-forest);
    margin-bottom: 10px;
    border-bottom: 1px solid var(--color-case-border);
    padding-bottom: 6px;
}

.stats-block table {
    width: 100%;
    font-size: 0.85rem;
    border-collapse: collapse;
}

.stats-block td {
    padding: 3px 4px;
    vertical-align: top;
}

.stats-block td.stat-value {
    text-align: right;
    font-weight: 700;
    white-space: nowrap;
}

.stats-block td.stat-date {
    text-align: right;
    color: var(--color-muted);
    font-size: 0.78rem;
    white-space: nowrap;
}

/* --- Pagination --- */
.pagination {
    display: flex;
    gap: 6px;
    margin: 16px 0;
    flex-wrap: wrap;
}

.pagination a,
.pagination span {
    padding: 5px 11px;
    border: 1px solid var(--color-case-border);
    border-radius: 3px;
    font-size: 0.85rem;
    background: var(--color-white);
}

.pagination .current {
    background: var(--color-forest);
    color: var(--color-white);
    border-color: var(--color-forest);
}

/* --- Graphiques --- */
.chart-container {
    position: relative;
    width: 100%;
    height: 320px;
    background: var(--color-white);
    border: 1px solid var(--color-case-border);
    border-radius: var(--radius);
    padding: 8px;
    margin-bottom: 16px;
}

/* --- Tableau générique --- */
.data-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.85rem;
    background: var(--color-white);
}

.data-table th {
    background: var(--color-forest);
    color: var(--color-white);
    padding: 8px 10px;
    text-align: center;
    font-weight: 600;
    font-size: 0.8rem;
    white-space: nowrap;
}

.data-table td {
    padding: 6px 10px;
    text-align: center;
    border-bottom: 1px solid var(--color-case-border);
}

.data-table tbody tr:hover {
    background: var(--color-sky-light);
}

.data-table tr.row-strong td {
    font-weight: 700;
}

/* --- Utilitaires --- */
.text-muted {
    color: var(--color-muted);
}

.text-danger {
    color: var(--color-danger);
}

.text-small {
    font-size: 0.8rem;
}

.mt-2 { margin-top: 8px; }
.mt-4 { margin-top: 16px; }
.mb-2 { margin-bottom: 8px; }
.mb-4 { margin-bottom: 16px; }

/* Paragraphe d'introduction sous le titre d'une page */
.page-intro {
    font-size: 0.9rem;
    margin-bottom: 16px;
}

/* --------------------------------------------------------------------------
   12. Accueil — tableau de bord (layout C)
   -------------------------------------------------------------------------- */

/* --- Bandeau des températures actuelles (défilant, accessible) --- */
.temp-marquee {
    position: relative;
    overflow: hidden;
    background: var(--color-forest);
    border-bottom: 2px solid var(--color-lime);
    border-radius: var(--radius);
    margin-bottom: 20px;
}

.temp-marquee__track {
    display: flex;
    width: max-content;
    animation: temp-scroll 45s linear infinite;
}

/* Pause au survol et au focus clavier */
.temp-marquee:hover .temp-marquee__track,
.temp-marquee:focus-within .temp-marquee__track {
    animation-play-state: paused;
}

.temp-marquee__list {
    display: flex;
    align-items: center;
    list-style: none;
    margin: 0;
    padding: 0;
}

.temp-marquee__item {
    padding: 8px 16px;
    white-space: nowrap;
    font-size: 0.85rem;
    color: var(--color-gold);
}

.temp-marquee__item a {
    color: var(--color-gold);
}

.temp-marquee__item a:hover {
    color: var(--color-lime);
    text-decoration: none;
}

/* Anniversaires en tête de bandeau */
.temp-marquee__item--birthday {
    color: #fff;
}

.temp-marquee .temp-chip {
    display: inline-block;
    padding: 1px 6px;
    border-radius: 3px;
    font-weight: 700;
    margin-left: 6px;
}

@keyframes temp-scroll {
    from { transform: translateX(0); }
    to { transform: translateX(-50%); }
}

/* Accessibilité : mouvement réduit → bandeau statique défilable au clavier */
@media (prefers-reduced-motion: reduce) {
    .temp-marquee {
        overflow-x: auto;
    }

    .temp-marquee__track {
        animation: none;
    }

    .temp-marquee__list[aria-hidden="true"] {
        display: none;
    }
}

/* --- Grille tableau de bord : grande tuile relevés + colonne latérale --- */
.dashboard-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 16px;
    margin-bottom: 24px;
}

@media (min-width: 900px) {
    .dashboard-grid {
        grid-template-columns: 2fr 1fr;
        align-items: start;
    }
}

.tile {
    background: var(--color-white);
    border: 1px solid var(--color-case-border);
    border-radius: var(--radius);
    padding: 16px;
    box-shadow: var(--shadow);
}

.tile-col {
    display: flex;
    flex-direction: column;
    gap: 16px;
    min-width: 0;
}

.tile .section-title {
    font-size: 1.05rem;
    margin-bottom: 12px;
}

/* --- Vignettes de vigilance météo (cartes Météo-France) --- */
.vigilance-maps {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
    justify-content: center;
}

.vigilance-map {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    text-decoration: none;
}

.vigilance-map img {
    width: 150px;
    height: auto;
    border: 1px solid var(--color-case-border);
    border-radius: var(--radius);
}

.vigilance-map:hover img {
    border-color: var(--color-forest-light);
}

.vigilance-label {
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--color-forest);
}

/* --- Diaporama photos --- */
.slideshow {
    position: relative;
}

.slide {
    display: none;
}

.slide.active {
    display: block;
}

.slide__grid {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: 12px;
}

@media (min-width: 600px) {
    .slide__grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (min-width: 900px) {
    .slide__grid {
        grid-template-columns: repeat(4, minmax(0, 1fr));
    }
}

/* Carte photo : bloc plein (évite tout repli en flux inline si la grille ne charge pas),
   en colonne et à hauteur fixe — l'image absorbe l'espace restant sous le libellé. */
.slide .photo-card {
    display: flex;
    flex-direction: column;
    position: relative;
    height: 280px;
}

.slide .photo-card img {
    flex: 1;
    min-height: 0;
    height: auto;
}

.photo-tag {
    position: absolute;
    top: 8px;
    right: 8px;
    background: var(--color-teal);
    color: var(--color-white);
    font-size: 0.68rem;
    font-weight: 600;
    padding: 2px 8px;
    border-radius: 3px;
    box-shadow: var(--shadow);
}

.slideshow__controls {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 14px;
    margin-top: 14px;
}

.slideshow__btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border: none;
    border-radius: var(--radius);
    background: var(--color-forest);
    color: var(--color-white);
    font-size: 1.1rem;
    cursor: pointer;
    transition: background 0.2s;
}

.slideshow__btn:hover {
    background: var(--color-forest-light);
}

.slideshow__dots {
    display: flex;
    gap: 8px;
}

.slideshow__dot {
    width: 11px;
    height: 11px;
    padding: 0;
    border: none;
    border-radius: 50%;
    background: var(--color-case-border);
    cursor: pointer;
    transition: background 0.2s;
}

.slideshow__dot[aria-current="true"] {
    background: var(--color-forest);
}

.slideshow__dot:hover {
    background: var(--color-muted);
}

/* --------------------------------------------------------------------------
   13. Popin d'affichage d'une photographie (lightbox)
   -------------------------------------------------------------------------- */
body.no-scroll {
    overflow: hidden;
}

.lightbox {
    position: fixed;
    inset: 0;
    z-index: 2000;
    background: rgba(0, 0, 0, 0.82);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.lightbox__inner {
    position: relative;
    background: var(--color-white);
    border-radius: var(--radius);
    max-width: 95vw;
    max-height: 95vh;
    overflow-y: auto;
    box-shadow: var(--shadow-lg);
}

.lightbox__img {
    display: block;
    width: auto;
    height: auto;
    max-width: 95vw;
    max-height: 72vh;
    object-fit: contain;
    background: #000;
    margin: 0 auto;
    border-radius: var(--radius) var(--radius) 0 0;
}

/* Sans bandeau de métadonnées en dessous, l'image porte l'arrondi complet. */
.lightbox__img:last-child {
    border-radius: var(--radius);
}

.lightbox__close {
    position: absolute;
    top: 10px;
    right: 10px;
    width: 38px;
    height: 38px;
    border: none;
    border-radius: 50%;
    background: rgba(0, 0, 0, 0.6);
    color: #fff;
    font-size: 1.6rem;
    line-height: 1;
    cursor: pointer;
    z-index: 1;
    transition: background 0.2s;
}

.lightbox__close:hover {
    background: rgba(0, 0, 0, 0.9);
}

.lightbox__meta {
    padding: 14px 20px 18px;
}

.lightbox__title {
    font-size: 1.15rem;
    color: var(--color-forest);
    margin-bottom: 4px;
}

.lightbox__sub {
    font-size: 0.85rem;
    color: var(--color-muted);
}

.lightbox__comment {
    margin-top: 10px;
    font-size: 0.92rem;
    color: var(--color-text-light);
    line-height: 1.5;
    white-space: pre-wrap;
}

.lightbox__author {
    margin-top: 10px;
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--color-teal);
}

/* --------------------------------------------------------------------------
   14. Newsletters & dossiers (liste, lecture, chapitres/paragraphes)
   -------------------------------------------------------------------------- */

/* --- Liste des newsletters : cartes --- */
.newsletter-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 16px;
}

/* 2 colonnes à partir du breakpoint desktop existant */
@media (min-width: 900px) {
    .newsletter-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

.newsletter-card {
    display: flex;
    flex-direction: column;
    background: var(--color-white);
    border: 1px solid var(--color-case-border);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    overflow: hidden;
    transition: transform 0.2s, box-shadow 0.2s;
}

.newsletter-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
}

.newsletter-card__head {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    gap: 10px;
    background: var(--color-forest);
    color: var(--color-white);
    padding: 8px 14px;
}

.newsletter-card__num {
    font-weight: 700;
    font-size: 0.95rem;
}

.newsletter-card__date {
    font-size: 0.78rem;
    color: var(--color-lime);
    white-space: nowrap;
}

.newsletter-card__body {
    display: flex;
    flex-direction: column;
    flex: 1;
    padding: 12px 14px;
    font-size: 0.9rem;
}

.newsletter-card__label {
    font-size: 0.72rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--color-muted);
}

.newsletter-card__sommaire {
    list-style: none;
    margin: 6px 0 14px;
}

.newsletter-card__sommaire li {
    padding: 5px 0;
    border-bottom: 1px dashed var(--color-case-border);
}

.newsletter-card__sommaire li:last-child {
    border-bottom: none;
}

.newsletter-card__auteur {
    color: var(--color-muted);
    font-size: 0.8rem;
}

.newsletter-card__desc {
    margin-bottom: 14px;
    text-align: justify;
}

/* Bouton calé en bas : rangées de cartes de même hauteur, boutons alignés */
.newsletter-card__foot {
    margin-top: auto;
}

/* --- Lecture d'une newsletter ou d'un dossier --- */
.newsletter-date {
    text-align: right;
    font-style: italic;
    color: var(--color-muted);
}

.newsletter-banner,
.dossier-banner {
    text-align: center;
    font-size: 1.15rem;
    font-weight: 700;
    background: var(--color-forest);
    color: var(--color-white);
    padding: 10px 14px;
    border-radius: var(--radius);
    margin-bottom: 12px;
}

.newsletter-subtitle {
    text-align: center;
    font-size: 0.9rem;
    color: var(--color-text-light);
    margin-bottom: 24px;
}

/* --- Chapitres & paragraphes --- */
.chapter-heading {
    background: var(--color-forest);
    color: var(--color-white);
    font-weight: 700;
    padding: 8px 14px;
    border-radius: var(--radius);
    margin: 28px 0 14px;
}

/* flow-root : chaque paragraphe contient sa propre photo flottante, qui ne
   déborde donc jamais sur le paragraphe ou le chapitre suivant. */
.chapter-paragraph {
    display: flow-root;
    margin-bottom: 18px;
}

.chapter-paragraph .paragraph-text {
    text-align: justify;
}

.chapter-paragraph .paragraph-text img {
    max-width: 100%;
    height: auto;
}

.chapter-paragraph .paragraph-photo {
    margin: 0 0 15px;
}

.chapter-paragraph .paragraph-photo a {
    display: block;
    cursor: zoom-in;
}

/* La vignette affiche l'image pleine taille bornée par CSS, jamais agrandie :
   certaines images d'archive ne font qu'une centaine de pixels de large. */
.chapter-paragraph .paragraph-photo img {
    display: block;
    max-width: 100%;
    height: auto;
    border-radius: 4px;
    box-shadow: var(--shadow);
}

/* Habillage du texte autour de la photo seulement quand la colonne est assez
   large ; en mobile la photo reste en tête, pleine largeur. Bornée à 480px
   (et jamais plus de la moitié de la colonne, pour garder du texte en regard). */
@media (min-width: 600px) {
    .chapter-paragraph .paragraph-photo {
        max-width: min(480px, 50%);
    }

    .chapter-paragraph .paragraph-photo--left {
        float: left;
        margin: 0 15px 15px 0;
    }

    .chapter-paragraph .paragraph-photo--right {
        float: right;
        margin: 0 0 15px 15px;
    }
}

.chapter-author {
    font-style: italic;
    color: var(--color-muted);
    margin: 4px 0 20px;
}

/* --------------------------------------------------------------------------
   15. Back-office
   -------------------------------------------------------------------------- */

.admin-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
    gap: 12px;
    margin-bottom: 24px;
}

.admin-tile {
    display: block;
    color: inherit;
    text-decoration: none;
}

.admin-tile:hover {
    border-color: var(--color-lime);
    text-decoration: none;
}

.admin-tile .admin-tile-title {
    font-weight: 700;
    color: var(--color-forest);
    margin-bottom: 4px;
}

.admin-badge {
    display: inline-block;
    min-width: 20px;
    padding: 1px 7px;
    border-radius: 10px;
    background: #c62828;
    color: #fff;
    font-size: 0.8rem;
    font-weight: 700;
    text-align: center;
}

.admin-thumb {
    width: 60px;
    height: auto;
    border-radius: 3px;
    vertical-align: middle;
}

.admin-photo-card {
    display: flex;
    gap: 16px;
    flex-wrap: wrap;
    align-items: flex-start;
}

.admin-photo-card img {
    max-width: 300px;
    height: auto;
    border-radius: var(--radius);
}

.vote-table th,
.vote-table td {
    text-align: center;
    padding: 4px 8px;
}

.inline-form {
    display: inline;
}

/* Sites partenaires : cartes, 2 colonnes en desktop */
.partner-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 16px;
}

@media (min-width: 900px) {
    .partner-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

/* Toute la carte est un lien */
.partner-card {
    display: block;
    color: inherit;
    text-decoration: none;
}

.partner-card:hover {
    border-color: var(--color-lime);
    color: inherit;
    text-decoration: none;
}

.partner-card .partner-title {
    display: block;
    font-weight: 700;
    font-size: 1.05rem;
    color: var(--color-forest);
    margin-bottom: 4px;
}

.partner-card .text-muted {
    display: block;
}

.partner-card .partner-desc {
    display: block;
    margin-top: 8px;
}

/* Tableau des membres : tient dans la largeur du conteneur (~1118 px). Colonnes étroites
   en largeur fixe adaptée à leur contenu (dates, statut, actions) ; Identité et E-mail,
   sans largeur, se partagent l'espace restant (table-layout fixed). */
.admin-membres-table {
    width: 100%;
    min-width: 760px; /* en dessous, défilement horizontal via le conteneur */
    table-layout: fixed;
}

.admin-membres-table td {
    overflow-wrap: break-word; /* e-mails longs et pseudos sans espace */
}

/* En-têtes sur 2 lignes possibles (« Dernière connexion ») : sans quoi le nowrap
   hérité de .data-table th déborde sur la colonne voisine en table-layout fixed. */
.admin-membres-table th {
    white-space: normal;
    vertical-align: middle;
}

/* Liens de tri : lisibles sur le fond vert des en-têtes */
.admin-membres-table th a {
    color: var(--color-gold);
    text-decoration: none;
}

.admin-membres-table th a:hover {
    color: var(--color-lime);
}

.admin-membres-table .col-commune { width: 140px; }
.admin-membres-table .col-date { width: 92px; }
.admin-membres-table .col-statut { width: 96px; }
.admin-membres-table .col-actions { width: 118px; }
