/* ==========================================
   1. VARIABLES GLOBALES (Couleurs et tailles)
   ========================================== */
:root {
    --nature-vert: #4a7c44;
    --nature-clair: #f0f4f0;
    --nature-beige: #faf9f6;
    --nature-texte: #2d3436;
    --nature-fond: #f8faf8;
    --arrondi: 25px;
    --largeur-site: 1200px; /* Largeur validée pour tout le site */
}

/* ==========================================
   2. RESET ET FOND DE PAGE
   ========================================== */
body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    color: var(--nature-texte);
    margin: 0;
    padding: 20px;
    display: flex;
    flex-direction: column;
    align-items: center;
    min-height: 100vh;
    
    /* Le fond est géré dynamiquement par PHP, mais on garde les réglages fixes ici */
    background-attachment: fixed;
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    background-color: var(--nature-fond); /* Couleur de secours au chargement */
}

.site-container {
    width: 100%;
    max-width: var(--largeur-site);
}

.banner-img {
    width: 100%;
    height: auto;
    border-radius: var(--arrondi);
    display: block;
    box-shadow: 0 4px 15px rgba(0,0,0,0.1);
    border: 1px solid var(--nature-vert); /* Ajout du contour vert */
}

.main-wrapper {
    margin-top: 25px;
    background: rgba(255, 255, 255, 0.80); /* Opacité baissée ici à 85% */
    border-radius: var(--arrondi);
    padding: 40px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.08);
    border: 1px solid var(--nature-vert);
}

h2 { text-align: center; color: var(--nature-vert); margin-top: 0; margin-bottom: 20px; }
h3 { color: var(--nature-vert); margin-top: 0; }

/* ==========================================
   3. NAVIGATION (MENU)
   ========================================== */
nav {
    margin: 20px auto;
    padding: 10px 40px;
    background: rgba(255, 255, 255, 0.80); /* Opacité baissée ici à 85% */
    border-radius: 50px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.05);
    width: fit-content;
    backdrop-filter: blur(5px); /* Ce filtre floute légèrement ce qu'il y a derrière, c'est très esthétique avec la transparence */
    border: 1px solid var(--nature-vert);
}
/* ==========================================
   4. BOUTONS ET ALERTES
   ========================================== */
.btn-valider, .btn-admin-news, .btn-send {
    background: var(--nature-vert);
    color: white;
    border: none;
    padding: 10px 25px;
    border-radius: 20px;
    font-weight: bold;
    cursor: pointer;
    transition: 0.3s;
}

.btn-valider:hover, .btn-admin-news:hover, .btn-send:hover {
    background: #3b6336;
}

.btn-annuler {
    background: #999;
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 20px;
    font-weight: bold;
    cursor: pointer;
}

.alert, .msg {
    padding: 15px;
    border-radius: 15px;
    margin-bottom: 20px;
    text-align: center;
    font-weight: bold;
}
.alert-success, .succes { background: #e1ede0; color: var(--nature-vert); border: 1px solid #c8e6c9; }
.alert-error, .erreur { background: #fee; color: #c33; border: 1px solid #fcc; }

/* ==========================================
   5. PAGE ACCUEIL (Onglets, Actualités, Blog)
   ========================================== */
.tabs-header { display: flex; justify-content: space-between; align-items: center; border-bottom: 2px solid var(--nature-clair); padding-bottom: 10px; margin-bottom: 20px; }
.tabs { display: flex; gap: 10px; }
.tab-btn { padding: 10px 25px; cursor: pointer; border: none; background: none; font-weight: bold; color: #999; border-radius: var(--arrondi); font-family: inherit; font-size: 1em; }
.tab-btn.active { background: var(--nature-vert); color: white; }
.user-badge { background: #e1ede0; padding: 8px 20px; border-radius: 30px; color: var(--nature-vert); font-weight: 600; }
.tab-content { display: none; }
.tab-content.active { display: block; }
.content-scroll { max-height: 800px; overflow-y: auto; padding-right: 15px; }

/* Actualités & Blog items */
.news-item, .blog-bubble { background: var(--nature-beige); padding: 20px; border-radius: 20px; margin-bottom: 20px; border-left: 5px solid var(--nature-vert); position: relative; }
.blog-bubble { border-left-color: #8dae8a; }
.news-header, .blog-meta { display: flex; justify-content: space-between; align-items: flex-start; margin-bottom: 10px; }
.news-date, .blog-meta span { font-size: 0.85em; color: #777; }

/* Galerie images */
.news-gallery { display: flex; gap: 10px; margin-top: 15px; flex-wrap: wrap; }
.news-thumb { width: 120px; height: 120px; object-fit: cover; border-radius: 15px; cursor: pointer; border: 2px solid white; box-shadow: 0 2px 5px rgba(0,0,0,0.1); }

/* Formulaire Blog */
.blog-form { background: var(--nature-clair); padding: 20px; border-radius: 20px; margin-bottom: 30px; }
.blog-form textarea { width: 100%; border: 2px solid #fff; border-radius: 15px; padding: 15px; box-sizing: border-box; resize: none; margin-bottom: 10px; font-family: inherit; }

/* Commentaires */
.comments-section { margin-top: 15px; padding-left: 20px; border-left: 2px solid #ddd; }
.comment-item { font-size: 0.9em; background: white; padding: 10px; border-radius: 15px; margin-top: 8px; border: 1px solid #eee; }
.comment-form { margin-top: 15px; display: flex; gap: 10px; }
.comment-form input { flex: 1; border: 1px solid #ddd; border-radius: 15px; padding: 8px 15px; font-family: inherit; }
.btn-com { background: #8dae8a; color: white; border: none; padding: 5px 15px; border-radius: 15px; cursor: pointer; }

/* Actions (Modifier / Supprimer) */
.action-group { display: flex; gap: 8px; }
.btn-action { border: none; padding: 5px 12px; border-radius: 10px; cursor: pointer; font-size: 0.8em; font-weight: bold; font-family: inherit; }
.btn-edit { background: #e1ede0; color: var(--nature-vert); }
.btn-delete { background: #fee; color: #c33; }

/* ==========================================
   6. FENÊTRES FLOTTANTES (MODALS) ET LIGHTBOX
   ========================================== */
.modal { display: none; position: fixed; z-index: 3000; left: 0; top: 0; width: 100%; height: 100%; background: rgba(0,0,0,0.6); backdrop-filter: blur(3px); align-items: center; justify-content: center; }
.modal-content { background: white; padding: 30px; border-radius: var(--arrondi); width: 95%; max-width: 500px; box-shadow: 0 20px 50px rgba(0,0,0,0.2); max-height: 90vh; overflow-y: auto; }
.modal-content input, .modal-content textarea { width: 100%; padding: 12px; margin: 10px 0; border: 2px solid var(--nature-clair); border-radius: 15px; box-sizing: border-box; font-family: inherit; }

.lightbox-modal { display: none; position: fixed; z-index: 4000; left: 0; top: 0; width: 100%; height: 100%; background: rgba(0,0,0,0.85); align-items: center; justify-content: center; }
.lightbox-img { max-width: 90%; max-height: 90%; border-radius: 15px; }
.lightbox-close { position: absolute; top: 20px; right: 30px; color: white; font-size: 40px; cursor: pointer; }

/* ==========================================
   7. PAGE DÉCHETS (Grilles et cartes)
   ========================================== */
.dechets-grid { display: grid; grid-template-columns: repeat(6, 1fr); gap: 20px; }
.card-poubelle { padding: 25px; border-radius: 20px; text-align: center; border: 2px solid transparent; position: relative; display: flex; flex-direction: column; justify-content: space-between; }
.card-large { grid-column: span 3; } 
.card-small { grid-column: span 2; } 
.dates-list { display: flex; flex-direction: column; gap: 8px; margin: 15px 0; }
.date-row { background: white; padding: 10px; border-radius: 12px; font-weight: bold; font-size: 1em; box-shadow: 0 2px 4px rgba(0,0,0,0.03); border-left: 5px solid transparent; }
.btn-edit-corner { position: absolute; top: 10px; right: 10px; background: white; border: 1px solid #ddd; padding: 5px 10px; border-radius: 12px; cursor: pointer; font-size: 0.75em; }

/* Thèmes Poubelles */
.card-1 { background: #f1f8f1; border-color: #4a7c44; } .card-1 .date-row { border-left-color: #4a7c44; color: #4a7c44; }
.card-2 { background: #fffde7; border-color: #fbc02d; } .card-2 .date-row { border-left-color: #fbc02d; color: #f57f17; }
.card-3 { background: #fdfbf7; border-color: #8d6e63; } .card-3 .date-row { border-left-color: #8d6e63; color: #5d4037; }
.card-4 { background: #f1fcf1; border-color: #8bc34a; }
.card-5 { background: #f3f7fd; border-color: #2196f3; }

/* ==========================================
   8. PAGE INFOS PRATIQUES
   ========================================== */
.infos-grid { display: flex; gap: 30px; flex-wrap: wrap; }
.info-card { flex: 1; min-width: 300px; background: #fdfbf7; padding: 30px; border-radius: 20px; border: 2px solid #eee; position: relative; }
.contact-item { margin-bottom: 20px; }
.contact-item strong { display: block; color: #777; font-size: 0.9em; text-transform: uppercase; }
.contact-item p { margin: 5px 0; font-size: 1.1em; font-weight: 500; }
.horaires-table { width: 100%; border-collapse: collapse; margin-top: 10px; }
.horaires-table td { padding: 12px 0; border-bottom: 1px solid #eee; }
.horaires-table td:first-child { font-weight: bold; color: #555; }
.horaires-table td:last-child { text-align: right; color: var(--nature-vert); font-weight: bold; }

/* ==========================================
   9. RESPONSIVE (Tablettes et Mobiles)
   ========================================== */
@media (max-width: 900px) {
    .card-large, .card-small { grid-column: span 6; }
    .infos-grid { flex-direction: column; }
}

@media (max-width: 768px) {
    .form-row { flex-direction: column; }
}

/* =========================================================
   EFFET DE DÉFILEMENT POUR LES ONGLETS (MOBILE UNIQUEMENT)
   ========================================================= */

.onglets-wrapper {
    width: 100%;
    overflow: hidden; /* Empêche le débordement global */
}

.onglets-liste {
    display: flex;
    gap: 15px;
    margin: 0;
    padding: 0;
}

@media (max-width: 768px) {
    .onglets-wrapper {
        /* Effet de fondu noir vers transparent sur les bords gauche et droit */
        -webkit-mask-image: linear-gradient(to right, transparent 0%, black 10%, black 90%, transparent 100%);
        mask-image: linear-gradient(to right, transparent 0%, black 10%, black 90%, transparent 100%);
        padding: 5px 0;
    }

    .onglets-liste {
        overflow-x: auto; /* Active le scroll horizontal */
        flex-wrap: nowrap; /* Interdit de passer à la ligne */
        scroll-behavior: smooth;
        -webkit-overflow-scrolling: touch; /* Glissement fluide sur smartphone */
        padding: 0 15%; /* Marge interne pour que les onglets puissent atteindre les zones transparentes */
        
        /* Masquer la barre de défilement (Scrollbar) pour l'esthétique */
        scrollbar-width: none; /* Firefox */
        -ms-overflow-style: none; /* IE/Edge */
    }
    
    .onglets-liste::-webkit-scrollbar {
        display: none; /* Chrome/Safari */
    }

    .onglets-liste li, .onglets-liste a, .onglets-liste button {
        flex: 0 0 auto; /* Force les boutons à garder leur taille normale sans s'écraser */
        white-space: nowrap; /* Interdit au texte de se couper en deux */
    }
}

/* Centrage global pour la page Infos Pratiques */
.main-wrapper {
    text-align: center; /* Centre les titres et textes simples */
}

/* Centre les encarts de coordonnées (les petits cadres blancs) */
.main-wrapper .info-card, 
.main-wrapper .contact-box,
.main-wrapper > div { 
    margin-left: auto;
    margin-right: auto;
    text-align: center;
}

/* Si tu as des listes (horaires, etc), on les aligne proprement au centre */
.main-wrapper ul {
    display: inline-block;
    text-align: left; /* Le bloc est centré, mais le texte reste aligné à gauche pour la lecture */
    padding: 0;
}

/* Correction spécifique pour les titres de sections */
.main-wrapper h2, .main-wrapper h3 {
    width: 100%;
    text-align: center;
    margin-bottom: 20px;
}

/* On cible l'encart principal de la page infos */
.main-content, .info-wrapper {
    display: flex;
    flex-direction: column;
    align-items: center; /* Centre horizontalement */
    text-align: center;   /* Centre le texte */
    width: 100%;
}

/* On s'assure que les paragraphes et titres à l'intérieur ne flottent pas à gauche */
.main-content p, .main-content h1, .main-content h2, .main-content div {
    margin-left: auto;
    margin-right: auto;
}

/* Si tu as des icônes ou images, elles seront aussi centrées */
.main-content img {
    display: block;
    margin: 0 auto;
}

/* =========================================================
   CENTRAGE DES ENCARTS (PAGE INFOS PRATIQUES) SUR MOBILE
   ========================================================= */
@media (max-width: 768px) {
    /* On s'assure que le conteneur principal bloque les débordements */
    .main-wrapper {
        display: flex !important;
        flex-direction: column !important;
        align-items: center !important; 
        box-sizing: border-box !important;
        width: 100% !important;
        overflow-x: hidden !important;
    }

    /* On annule les marges gauches parasites qui poussent les boîtes hors du cadre */
    .main-wrapper > div, 
    .info-card, 
    .contact-box {
        margin-left: 0 !important; 
        margin-right: 0 !important;
        width: 100% !important; 
        max-width: 100% !important;
        box-sizing: border-box !important; 
        align-self: center !important;
    }
}
/* ==========================================
   ACTUALITÉS PANNEAUPOCKET (carrousel)
   ========================================== */
.pp-carrousel { outline: none; }
.pp-carrousel:focus-visible { box-shadow: 0 0 0 3px rgba(74,124,68,0.35); border-radius: 20px; }

.pp-fenetre { overflow: hidden; transition: height 0.35s ease; border-radius: 20px; }
.pp-piste { display: flex; align-items: flex-start; transition: transform 0.45s ease; will-change: transform; }
.pp-diapo { flex: 0 0 100%; min-width: 0; box-sizing: border-box; margin: 0; text-align: left; }

.pp-titre { text-align: left; margin: 0; color: var(--nature-vert); font-size: 1.35em; line-height: 1.3; }
.pp-date { white-space: nowrap; margin-left: 15px; background: #e1ede0; color: var(--nature-vert); padding: 4px 12px; border-radius: 20px; font-weight: 600; }

.pp-corps { display: block; }
.pp-corps.pp-avec-image { display: grid; grid-template-columns: minmax(0, 2fr) minmax(0, 3fr); gap: 25px; align-items: start; }
.pp-image-principale { width: 100%; max-height: 380px; object-fit: contain; background: white; border-radius: 15px; cursor: zoom-in; box-shadow: 0 2px 8px rgba(0,0,0,0.08); display: block; }
.pp-medias .news-gallery { margin-top: 10px; }
.pp-medias .news-thumb { width: 70px; height: 70px; }

.pp-texte { line-height: 1.65; color: var(--nature-texte); overflow-wrap: anywhere; }
.pp-texte p { margin: 0 0 12px 0; }
.pp-texte a { color: var(--nature-vert); font-weight: bold; }
.pp-texte.pp-coupe { max-height: 320px; overflow: hidden; position: relative; }
.pp-texte.pp-coupe::after { content: ""; position: absolute; left: 0; right: 0; bottom: 0; height: 70px; background: linear-gradient(rgba(250,249,246,0), var(--nature-beige)); }
.pp-texte.pp-coupe.pp-ouvert { max-height: none; }
.pp-texte.pp-coupe.pp-ouvert::after { display: none; }
.pp-texte:not(.pp-coupe) { max-height: 320px; overflow: hidden; } /* mesure initiale */
.pp-lire-suite { margin-top: 8px; background: none; border: none; color: var(--nature-vert); font-weight: bold; cursor: pointer; padding: 5px 0; font-size: 0.95em; }
.pp-piece-jointe { display: inline-block; margin-top: 12px; margin-right: 10px; background: white; border: 1px solid #e1ede0; padding: 8px 14px; border-radius: 12px; color: var(--nature-vert); font-weight: bold; text-decoration: none; }

.pp-navigation { display: flex; align-items: center; justify-content: center; gap: 20px; margin-top: 18px; }
.pp-fleche { width: 46px; height: 46px; border-radius: 50%; border: 2px solid var(--nature-vert); background: white; color: var(--nature-vert); font-size: 1.1em; font-weight: bold; cursor: pointer; display: flex; align-items: center; justify-content: center; transition: 0.2s; flex-shrink: 0; }
.pp-fleche:hover:not(:disabled) { background: var(--nature-vert); color: white; transform: scale(1.05); }
.pp-fleche:disabled { opacity: 0.3; cursor: default; }
.pp-reperes { display: flex; flex-direction: column; align-items: center; gap: 8px; min-width: 120px; }
.pp-points { display: flex; gap: 8px; flex-wrap: wrap; justify-content: center; }
.pp-point { width: 11px; height: 11px; border-radius: 50%; border: none; background: #cfdccd; cursor: pointer; padding: 0; transition: 0.2s; }
.pp-point.actif { background: var(--nature-vert); transform: scale(1.3); }
.pp-compteur { font-size: 0.9em; color: #777; font-weight: 600; }
.pp-source { text-align: center; font-size: 0.8em; color: #999; margin-top: 15px; }
.pp-source a { color: #999; }

@media (max-width: 768px) {
    .pp-corps.pp-avec-image { grid-template-columns: 1fr; gap: 15px; }
    .pp-image-principale { max-height: 260px; }
    .news-header { flex-wrap: wrap; gap: 8px; }
    .pp-date { margin-left: 0; }
    .pp-navigation { gap: 12px; }
}
@media (prefers-reduced-motion: reduce) {
    .pp-piste, .pp-fenetre { transition: none; }
}
.pp-meta { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; justify-content: flex-end; margin-left: 15px; }
.pp-meta .pp-date { margin-left: 0; }
.pp-categorie { background: var(--nature-vert); color: white; padding: 4px 12px; border-radius: 20px; font-size: 0.8em; font-weight: 600; letter-spacing: 0.5px; white-space: nowrap; }
@media (max-width: 768px) { .pp-meta { margin-left: 0; justify-content: flex-start; } }
.pp-diapo .news-header .pp-titre { text-align: left; flex: 1; }
