@charset "utf-8";

/* =========================================
   1. BASE & FOND CORPORATE (PC & MOBILE)
   ========================================= */
body {
    /* Dégradé du Bleu (#2c5aa8) vers le Violet (#701c96) */
    background: linear-gradient(135deg, #2c5aa8 0%, #701c96 100%);
    background-attachment: fixed;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    color: #444;
    margin: 0;
    padding: 20px 0;
    min-height: 100vh;
}

/* =========================================
   2. CONTENEUR PRINCIPAL
   ========================================= */
.container {
    width: 92%;
    max-width: 1100px;
    background-color: #ffffff;
    margin: 0 auto;
    border-radius: 8px;
    box-shadow: 0 5px 25px rgba(0, 0, 0, 0.15);
    overflow: hidden;
}

/* =========================================
   3. EN-TÊTE (HEADER - Zone Blanche)
   ========================================= */
header {
    background-color: #fff;
    border-bottom: 1px solid #f0f0f0;
    position: relative;
    z-index: 500; /* S'assure que le header est au-dessus du reste */
}

.primary_header {
    display: flex; /* Active le mode flexible */
    justify-content: space-between; /* ESSENTIEL : Pousse le Logo à GAUCHE et le Menu à DROITE */
    align-items: center; /* Centre verticalement */
    padding: 10px 20px;
    height: 70px; /* Hauteur fixe pour éviter les décalages */
}

/* Groupe Logo + Titre (Gauche) */
.header-brand {
    display: flex;
    align-items: center;
    gap: 15px;
}

.header-logo {
    height: 50px;
    width: auto;
}

.title {
    background: linear-gradient(135deg, #2c5aa8 0%, #701c96 100%);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
    font-size: 1.4em;
    font-weight: 800;
    margin: 0;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    white-space: nowrap; /* Empêche le titre de passer à la ligne */
}

/* --- LE MENU DÉROULANT (Droite) --- */
.user-menu {
    position: relative;
    display: flex;
    align-items: center;
    height: 100%; /* Prend toute la hauteur du header pour faciliter le survol */
    padding-left: 15px; /* Zone de sécurité à gauche */
}

/* Le bouton visible */
.dropbtn {
    background-color: #eaf2f8; 
    color: #2c5aa8;
    padding: 8px 15px;
    font-size: 0.9em;
    border: 1px solid #dbeafe;
    cursor: pointer;
    border-radius: 20px;
    font-weight: bold;
    display: flex;
    align-items: center;
    gap: 8px;
    transition: all 0.2s ease;
}

.dropbtn:hover {
    background-color: #2c5aa8; 
    color: white;
}

/* Le contenu CACHÉ du menu */
.dropdown-content {
    display: none;
    position: absolute;
    top: 100%; /* S'aligne parfaitement au bas de la barre blanche */
    right: 0;
    background-color: #ffffff;
    min-width: 180px;
    box-shadow: 0px 10px 25px rgba(0,0,0,0.15);
    border-radius: 0 0 8px 8px; /* Arrondi seulement en bas */
    border: 1px solid #eee;
    border-top: none; /* On colle visuellement au header */
    z-index: 1000;
    overflow: hidden;
    
    /* ASTUCE : On enlève la marge qui causait le bug */
    margin-top: 0; 
}

/* Liens dans le menu */
.dropdown-content a {
    color: #444;
    padding: 15px 20px; /* Plus grand pour être plus facile à cliquer */
    text-decoration: none;
    display: block;
    text-align: left;
    font-size: 0.95em;
    border-bottom: 1px solid #f9f9f9;
}

.dropdown-content a:hover {
    background-color: #f8f9fa;
    color: #701c96;
}

/* Affichage au survol */
.user-menu:hover .dropdown-content {
    display: block;
}

/* Liens dans le menu déroulant */
.dropdown-content a {
    color: #444;
    padding: 12px 20px;
    text-decoration: none;
    display: block;
    text-align: left;
    font-size: 0.9em;
    transition: background 0.2s;
    border-bottom: 1px solid #f9f9f9;
}

.dropdown-content a:hover {
    background-color: #f8f9fa;
    color: #701c96;
}

/* --- MAGIE : AFFICHER AU SURVOL --- */
.user-menu:hover .dropdown-content {
    display: block; /* Devient visible quand on passe la souris sur .user-menu */
}


/* =========================================
   4. MENU DE NAVIGATION (Barre Grise)
   ========================================= */
.secondary_header {
    background-color: #f8f9fa;
    border-bottom: 1px solid #e0e0e0;
}

.secondary_header ul {
    margin: 0;
    padding: 0;
    list-style: none;
    display: flex;
    justify-content: center; /* Navigation centrée */
    align-items: center;
    flex-wrap: wrap;
}

.secondary_header li { display: inline-block; }

.secondary_header a {
    display: block;
    padding: 12px 20px;
    text-decoration: none;
    color: #666;
    font-weight: 600;
    font-size: 0.9em;
    transition: all 0.3s ease;
    white-space: nowrap;
    border-bottom: 3px solid transparent; /* Prépare la ligne du bas */
}

.secondary_header a:hover {
    color: #701c96;
    background-color: #fff;
}

.secondary_header a.active-link {
    color: #701c96;
    background-color: #ffffff;
    border-bottom: 3px solid #701c96;
}

/* --- MOBILE --- */
@media (max-width: 768px) {
    .primary_header {
        flex-direction: column;
        height: auto;
        padding: 15px;
        gap: 15px;
    }
    
    .title { font-size: 1.1em; text-align: center; white-space: normal;}
    
    .user-menu {
        width: 100%;
        justify-content: center;
    }
    
    .dropdown-content {
        position: relative; /* Sur mobile, on affiche en dessous sans flotter */
        width: 100%;
        text-align: center;
        box-shadow: none;
        border: 1px solid #ddd;
    }
    .dropdown-content a { text-align: center; }
}
/* =========================================
   5. CALENDRIER (AGENDA)
   ========================================= */
.calendar-grid {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    grid-auto-rows: 110px;
    border: 1px solid #ddd;
    background: #fff;
    min-width: 100%;
}

.day-header { 
    background: #2C3E50; 
    color: white; 
    padding: 10px 0; 
    text-align: center; 
    font-size: 0.9em; 
}

.day-cell { 
    border: 1px solid #eee; 
    padding: 5px; 
    position: relative; 
    font-size: 0.9em; 
    height: 110px; min-height: 110px; max-height: 110px; /* Fixe */
    overflow-y: auto; overflow-x: hidden; 
    box-sizing: border-box; 
}
.day-cell::-webkit-scrollbar { width: 4px; }
.day-cell::-webkit-scrollbar-thumb { background: #ccc; border-radius: 2px; }

.day-number { font-weight: bold; margin-bottom: 5px; display: block; color: #7f8c8d;}
.empty-cell { background: #f9f9f9; }
.today { background-color: #eaf2f8; border: 2px solid #3498db; }

/* Pastilles événements Calendrier */
.cal-event {
    background: #d35400; color: white; 
    padding: 2px 5px; border-radius: 3px; 
    font-size: 0.75em; margin-bottom: 2px; 
    display: block; text-decoration: none; 
    cursor: pointer; white-space: nowrap; 
    overflow: hidden; text-overflow: ellipsis; 
}
.cal-event:hover { background: #e67e22; }

/* Badges de couleurs (Agenda) */
.badge { padding: 3px 8px; border-radius: 4px; color: white; font-size: 0.75em; font-weight: bold; }
.badge-course { background-color: #e74c3c; } /* Rouge */
.badge-entrainement { background-color: #27ae60; } /* Vert */
.badge-autre { background-color: #f39c12; } /* Orange */
.badge-apero { background-color: #8e44ad; } /* Violet */

.cal-nav { 
    display: flex; justify-content: space-between; align-items: center; 
    margin-bottom: 0; background: #2C3E50; color: white; 
    padding: 10px; border-radius: 5px 5px 0 0; 
}
.cal-btn { color: white; text-decoration: none; font-weight: bold; font-size: 1.2em; padding: 0 15px; }
.cal-title { margin: 0; font-size: 1.2em; text-transform: capitalize; }

/* =========================================
   6. STRUCTURE GENERALE
   ========================================= */
section { 
    padding: 30px; 
    display: flex; 
    flex-wrap: wrap; 
    gap: 30px; 
}

h2, h3, h4 { color: #2c5aa8; margin-top: 0; }
p { line-height: 1.6; margin-bottom: 15px; font-size: 0.95em; }
.row { padding: 15px; text-align: center; border-top: 1px solid #f0f0f0; }
.noDisplay { display: none; }

/* Cartes "À venir" (Agenda) */
.upcoming-card {
    background: #fff;
    border-left: 4px solid #2c5aa8; 
    padding: 15px;
    margin-bottom: 15px;
    border-radius: 4px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.05);
}
.agenda-container { display: flex; gap: 30px; width: 100%; }
.agenda-thumb { width: 60px; height: 60px; object-fit: cover; border-radius: 4px; margin-right: 10px; border: 1px solid #ddd; }

/* Boutons Admin (Crayon / Poubelle) */
.btn-icon { background:none; border:none; cursor:pointer; font-size:1.1em; padding:0 2px; }
.admin-controls { position: absolute; top: 10px; right: 10px; display: flex; gap: 5px; z-index: 10; }
.btn-edit { background: #f39c12; color: white; border: none; padding: 5px 8px; border-radius: 3px; cursor: pointer; font-size: 0.8em; }
.btn-delete { background: #e74c3c; color: white; border: none; padding: 5px 8px; border-radius: 3px; cursor: pointer; font-size: 0.8em; }

/* =========================================
   7. STYLE SPECIFIQUE SORTIES (SOUVENIRS)
   ========================================= */
.souvenir-card {
    display: flex; flex-direction: column; 
    background: #fff; border-radius: 8px; 
    box-shadow: 0 2px 5px rgba(0,0,0,0.1); margin-bottom: 20px; overflow: hidden;
    transition: transform 0.2s; position: relative;
}
.souvenir-card:hover { transform: translateY(-3px); }

.card-img-top { width: 100%; height: 180px; object-fit: cover; }
.card-body { padding: 15px; }
.card-date { color: #7f8c8d; font-size: 0.85em; font-weight: bold; margin-bottom: 5px; display: block;}
.card-title { font-size: 1.2em; color: #2c5aa8; margin: 0 0 8px 0; }
.card-resume { color: #555; line-height: 1.4; margin-bottom: 10px; font-size: 0.95em; }

/* Pagination */
.pagination { text-align: center; margin-top: 20px; }
.page-btn {
    display: inline-block; padding: 6px 12px; margin: 0 3px;
    background: #ecf0f1; color: #333; text-decoration: none; border-radius: 4px; font-size: 0.9em;
}
.page-btn.active { background: #2c5aa8; color: white; }

/* Galerie Grid */
.galerie-grid {
    display: grid; grid-template-columns: repeat(auto-fill, minmax(100px, 1fr)); gap: 5px; margin-top: 15px;
}
.galerie-img {
    width: 100%; height: 80px; object-fit: cover; border-radius: 4px; cursor: pointer; transition: opacity 0.2s;
}
.galerie-img:hover { opacity: 0.8; }


/* =========================================
   8. MODALS (POP-UPS)
   ========================================= */
.modal-overlay { display: none; position: fixed; top: 0; left: 0; width: 100%; height: 100%; background: rgba(0,0,0,0.8); z-index: 1000; justify-content: center; align-items: center; }
.modal-box { background: white; padding: 25px; border-radius: 8px; width: 90%; max-width: 500px; position: relative; box-shadow: 0 4px 15px rgba(0,0,0,0.5); max-height: 90vh; overflow-y: auto; }
.close-btn { position: absolute; top: 10px; right: 15px; font-size: 28px; cursor: pointer; color: #aaa; }
.btn-action { background: #701c96; color: white; padding: 12px; border: none; border-radius: 4px; cursor: pointer; width: 100%; font-weight: bold;}


/* =========================================
   9. OPTIMISATION MOBILE (RESPONSIVE)
   ========================================= */
@media (max-width: 768px) {
    /* Base */
    body { padding: 0; }
    .container { width: 100%; margin: 0; border-radius: 0; box-shadow: none; }

    /* Header & Menu */
    .primary_header { flex-direction: column; text-align: center; padding: 15px; }
    .header-logo { margin-bottom: 10px; height: 60px; }
    .title { font-size: 1.2em; }

    .secondary_header ul { flex-direction: column; width: 100%; }
    .secondary_header li { width: 100%; text-align: center; border-bottom: 1px solid #eee; }
    .secondary_header a { padding: 15px; font-size: 1em; }
    .btn-login, .btn-logout { margin: 10px auto; display: inline-block; width: auto; }

    /* Sections */
    section { padding: 15px; flex-direction: column; gap: 20px; }
    
    /* Calendrier Scrollable */
    article { width: 100%; overflow-x: auto; }
    .calendar-grid { min-width: 600px; }
    .modal-box { width: 95%; padding: 15px; }

    /* --- SPECIALE AGENDA MOBILE --- */
    .agenda-container { flex-direction: column !important; }
    .agenda-container aside { order: -1; width: 100%; margin-bottom: 30px; } /* Colonne droite passe en haut */
    .agenda-container article { order: 2; }

    .upcoming-card {
        display: flex !important; flex-direction: row !important; align-items: center; justify-content: space-between;
    }
    .upcoming-card img.agenda-thumb {
        display: block !important; width: 80px !important; height: 80px !important;
        flex-shrink: 0; object-fit: cover; margin-right: 10px;
    }

    /* --- SPECIALE SORTIES MOBILE --- */
    .souvenir-card { flex-direction: column; height: auto; }
    .card-img-top { height: 200px; width: 100%; }
}

@media (min-width: 768px) {
    /* Sorties PC : Image à gauche */
    .souvenir-card { flex-direction: row; height: 180px; }
    .card-img-top { width: 280px; height: 100%; }
    .card-body { flex: 1; overflow: hidden; }
}