/* =========================================
   TABLE DES MATIÈRES
   1. Variables & Reset
   2. Header & Navigation (Desktop)
   3. Hero Section
   4. Sections & Contenu
   5. Footer
   6. Mode PWA / Application (Barre du bas)
   7. Overlay Carte Membre
   8. Responsive (Mobile Menu - Site Web)
   9. CORRECTIF MENU APP (Hamburger PWA)
   ========================================= */

/* =========================================
   1. VARIABLES & RESET
   ========================================= */
:root {
    --primary-color: #FF0000; /* Rouge */
    --accent-color: #FFD700;  /* Jaune/Or */
    --bg-dark: #1a1a1a;       /* Fond principal */
    --bg-light: #2c2c2c;      /* Fond des cartes */
    --bg-darker: #121212;     /* Fond sections alternées */
    --text-white: #f5f5f5;
    --text-grey: #cccccc;
    --nav-height: 80px;       /* Hauteur du header */
}

* { margin: 0; padding: 0; box-sizing: border-box; font-family: 'Roboto', sans-serif; }

body {
    background-color: var(--bg-dark);
    color: var(--text-white);
    line-height: 1.6;
    margin: 0 !important; /* FORCE LE COLLAGE AU BORD */
    padding: 0 !important;
    width: 100%;
    overflow-x: hidden; /* Évite le scroll horizontal accidentel */
}
html { scroll-behavior: smooth; }

/* =========================================
   2. HEADER & NAVIGATION (DESKTOP)
   ========================================= */
header, .top-menu {
    position: fixed;
    top: 0;       /* Colle tout en haut */
    left: 0;
    right: 0;     /* Force la largeur totale */
    width: 100%;
    
    /* GESTION DE L'ENCOCHE IPHONE (NOTCH) */
    padding-top: env(safe-area-inset-top); 
    height: calc(var(--nav-height) + env(safe-area-inset-top)); /* La hauteur s'adapte à l'encoche */
    
    background-color: rgba(0, 0, 0, 0.95);
    z-index: 1000;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-left: 2rem;  /* Padding latéral classique */
    padding-right: 2rem;
    box-shadow: 0 2px 10px rgba(255, 0, 0, 0.3);
    border-bottom: 2px solid var(--accent-color);
}

.logo-container { display: flex; align-items: center; gap: 15px; }
.logo-img { height: 60px; }
.header-text { display: flex; flex-direction: column; }
.site-title { font-size: 1.4rem; font-weight: bold; color: var(--accent-color); letter-spacing: 1px; }
.site-subtitle { font-size: 0.8rem; color: var(--text-white); }

/* Navigation */
.navbar { display: flex; justify-content: space-between; align-items: center; }
.nav-menu { display: flex; list-style: none; gap: 15px; align-items: center; }

/* Liens avec icônes */
.icon-link {
    display: flex !important;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    line-height: 1.2;
    padding: 5px 10px !important;
}

.menu-text {
    display: block;
    font-size: 0.75rem;
    margin-top: 4px;
    font-weight: bold;
}

.icon-link i { font-size: 1.3rem; margin-bottom: 2px; }

.nav-link {
    color: var(--text-white);
    text-decoration: none;
    font-weight: 500;
    font-size: 1.1rem;
    transition: color 0.3s;
}

.nav-link:hover { color: var(--primary-color); }

/* Hamburger (Desktop caché par défaut) */
.hamburger { display: none; cursor: pointer; background: none; border: none; }
.bar { display: block; width: 25px; height: 3px; margin: 5px auto; transition: all 0.3s ease-in-out; background-color: white; }

/* =========================================
   3. HERO SECTION
   ========================================= */
.hero {
    height: 80vh;
    background: linear-gradient(rgba(0,0,0,0.7), rgba(0,0,0,0.7)), url('img/hero.png');
    background-size: cover; background-position: center;
    display: flex; align-items: center; justify-content: center; text-align: center;
    padding-top: calc(var(--nav-height) + env(safe-area-inset-top)); /* Ajout du safe area ici aussi */
}

.hero-content h1 { font-size: 3.5rem; margin-bottom: 20px; color: var(--text-white); text-shadow: 2px 2px var(--primary-color); }
.hero-content p { font-size: 1.5rem; margin-bottom: 30px; max-width: 800px; margin-left: auto; margin-right: auto; }

.cta-button {
    background-color: var(--primary-color); color: white; padding: 15px 35px;
    text-decoration: none; border-radius: 5px; font-weight: bold; text-transform: uppercase;
    transition: 0.3s; border: 2px solid var(--primary-color); 
}
.cta-button:hover { background-color: transparent; color: var(--primary-color); }

/* =========================================
   4. SECTIONS & CONTENU
   ========================================= */
.container { max-width: 1200px; margin: 0 auto; padding: 60px 20px; }
h2 { font-size: 2.5rem; margin-bottom: 40px; color: var(--accent-color); text-transform: uppercase; border-bottom: 2px solid var(--primary-color); display: inline-block; }
h3 { color: var(--primary-color); margin-bottom: 15px; font-size: 1.5rem; }

/* Intro */
.intro-section { background-color: var(--bg-light); text-align: center; padding: 40px 20px; border-bottom: 1px solid #444; margin-top: var(--nav-height); }
.intro-text { font-size: 1.2rem; max-width: 900px; margin: 0 auto; }

/* Cartes */
.facilities-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 30px; }
.card { background-color: var(--bg-light); border-radius: 8px; overflow: hidden; box-shadow: 0 4px 10px rgba(0,0,0,0.5); border: 1px solid #444; }
.card img { width: 100%; height: 220px; object-fit: cover; }
.card-content { padding: 25px; }
.card-list { list-style-type: square; margin-left: 20px; color: var(--text-grey); }

/* Valeurs */
.values-section { background-color: var(--bg-darker); }
.values-grid { display: grid; grid-template-columns: 1.5fr 1fr; gap: 50px; align-items: start; }
.check-list li { margin-bottom: 15px; padding-left: 25px; position: relative; list-style: none; }
.check-list li::before { content: "➤"; color: var(--primary-color); position: absolute; left: 0; }
.highlight-text { font-style: italic; color: var(--accent-color); border-left: 3px solid var(--accent-color); padding-left: 15px; }
.olympics-box { background-color: var(--bg-light); padding: 30px; border-radius: 10px; border: 1px solid var(--accent-color); }
.olympic-list li { list-style: none; margin-bottom: 12px; display: flex; align-items: center; gap: 10px; }
.olympic-list i { color: var(--accent-color); }

/* Histoire */
.history-banner { text-align: center; padding: 60px 20px; background-color: var(--bg-light); }
.history-full-img { max-width: 100%; border-radius: 5px; box-shadow: 0 0 20px rgba(0,0,0,0.8); }
.caption { margin-top: 10px; font-style: italic; color: var(--text-grey); }

/* Contact */
.contact-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 40px; margin-bottom: 40px; }
.contact-info a { color: var(--accent-color); text-decoration: none; }
.schedule-list li { list-style: none; margin-bottom: 10px; border-bottom: 1px solid #444; padding-bottom: 5px; }

/* =========================================
   5. FOOTER
   ========================================= */
footer, .site-footer {
    background-color: #1a1a1a;
    color: #ffffff;
    padding: 20px 0;
    text-align: center;
    border-top: 1px solid #333;
    margin-top: 40px;
    font-size: 0.9rem;
}

footer p { margin: 0; color: #aaa; }
footer a { color: var(--accent-color); text-decoration: none; margin-left: 10px; transition: 0.3s; }
footer a:hover { text-decoration: underline; opacity: 0.8; }

/* =========================================
   6. MODE PWA / APPLICATION
   ========================================= */

/* Styles de la barre du bas (Cachée par défaut) */
.bottom-nav {
    display: none;
    position: fixed;
    bottom: 0;
    left: 0;
    width: 100%;
    
    /* HAUTEUR DYNAMIQUE : 60px + la zone de sécurité Apple */
    height: auto; 
    min-height: 10px; 
    
    background: #1a1a1a;
    border-top: 5px solid #1a1a1a;
    justify-content: space-around;
    align-items: center;
    z-index: 2000;
    
    /* GESTION SAFE AREA (iPhone X+) */
    padding-bottom: env(safe-area-inset-bottom); 
    padding-bottom: constant(safe-area-inset-bottom);
}

/* Ajustement des éléments de la barre du bas */
.bottom-nav .nav-item {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    color: #888;
    
    /* Hauteur fixe pour la zone tactile */
    height: 40px; 
}
.bottom-nav .nav-item.active { color: var(--accent-color); }
.bottom-nav .nav-item i { font-size: 1.4rem; margin-bottom: 4px; }

/* --- LOGIQUE D'AFFICHAGE --- */

/* CAS APP : On affiche la barre du bas, on cache le footer texte */
body.mode-app .bottom-nav { display: flex !important; }
body.mode-app footer, body.mode-app .site-footer { display: none !important; }

/* Ajustements Layout App */
body.mode-app { 
    /* Padding pour ne pas cacher le contenu sous les barres fixes */
    padding-bottom: calc(80px + env(safe-area-inset-bottom)); 
    padding-top: calc(80px + env(safe-area-inset-top)); 
    background-color: #121212; 
}

body.mode-app .container { width: 100%; padding-left: 15px; padding-right: 15px; }
body.mode-app .card, body.mode-app .hero-content { border-radius: 0; box-shadow: none; border: none; }

/* CAS WEB : On s'assure que la barre du bas est cachée */
body.mode-web .bottom-nav { display: none !important; }

/* =========================================
   7. OVERLAY CARTE MEMBRE
   ========================================= */
.overlay-carte {
    display: none;
    position: fixed;
    top: 0; left: 0;
    width: 100%; height: 100%;
    background: rgba(0, 0, 0, 0.85);
    backdrop-filter: blur(5px);
    z-index: 3000;
    justify-content: center;
    align-items: center;
    flex-direction: column;
}

.carte-modal-content {
    background: linear-gradient(135deg, #1a1a1a 0%, #2c2c2c 100%);
    width: 90%; max-width: 350px;
    padding: 20px;
    border-radius: 15px;
    border: 1px solid var(--accent-color);
    box-shadow: 0 0 30px rgba(255, 215, 0, 0.2);
    text-align: center;
    color: white;
    position: relative;
    animation: zoomIn 0.3s ease;
}

@keyframes zoomIn { from { transform: scale(0.8); opacity: 0; } to { transform: scale(1); opacity: 1; } }
.close-btn { margin-top: 20px; background: transparent; border: 1px solid white; color: white; padding: 8px 20px; border-radius: 20px; cursor: pointer; }

/* =========================================
   8. RESPONSIVE (MOBILE NAVIGATEUR - SITE WEB)
   ========================================= */
@media (max-width: 1000px) {
    /* Le hamburger s'affiche sur le site mobile (PAS en mode app ici, géré après) */
    body:not(.mode-app) .hamburger { display: block !important; z-index: 2000; }

    .hamburger.active .bar:nth-child(2) { opacity: 0; }
    .hamburger.active .bar:nth-child(1) { transform: translateY(8px) rotate(45deg); }
    .hamburger.active .bar:nth-child(3) { transform: translateY(-8px) rotate(-45deg); }

    .nav-menu {
        position: fixed;
        left: -100%;
        top: calc(var(--nav-height) + env(safe-area-inset-top)); /* Ajusté safe area */
        gap: 0;
        flex-direction: column;
        background-color: var(--bg-darker);
        width: 100%;
        height: calc(100vh - var(--nav-height));
        text-align: center;
        transition: 0.3s ease-in-out;
        box-shadow: 0 10px 10px rgba(0,0,0,0.5);
        border-bottom: 2px solid var(--primary-color);
        padding: 10px 0;
        display: flex;
        z-index: 1500;
    }

    .nav-item { margin: 5px 0; width: 100%; }
    .nav-link { display: block; font-size: 1.5rem; padding: 10px; }
    .nav-menu.active { left: 0 !important; }

    /* Ajustements */
    .hero h1 { font-size: 2.2rem; }
    .values-grid, .contact-grid { grid-template-columns: 1fr; }
    .logo-img { height: 50px; }
    .site-title { font-size: 1.1rem; }
}

/* =========================================
   9. CORRECTIF MENU HAMBURGER SPÉCIFIQUE MODE APP
   ========================================= */

/* 1. On FORCE l'affichage du bouton Hamburger en Mode App */
body.mode-app .hamburger {
    display: block !important;
    z-index: 2001; /* Au-dessus de tout */
}

/* 2. On configure le menu latéral pour l'App */
body.mode-app .nav-menu {
    position: fixed;
    left: -100%; /* Caché à gauche */
    top: calc(var(--nav-height) + env(safe-area-inset-top)); 
    flex-direction: column;
    background-color: #121212;
    width: 100%;
    /* Hauteur : Tout l'écran MOINS le header MOINS la barre du bas */
    height: calc(100vh - var(--nav-height) - 80px - env(safe-area-inset-top) - env(safe-area-inset-bottom)); 
    text-align: center;
    transition: 0.3s ease-in-out;
    border-top: 1px solid var(--primary-color);
    padding: 10px 0;
    display: flex;
    z-index: 1500;
}

/* Animation d'ouverture */
body.mode-app .nav-menu.active { left: 0 !important; }

/* Styles des liens */
body.mode-app .nav-item { margin: 5px 0; width: 100%; }
body.mode-app .nav-link { font-size: 1.4rem; display: block; padding: 10px; }

/* Cache le lien Profil du menu hamburger car déjà en bas */
body.mode-app .nav-menu .nav-item:has(a[href="profil.php"]) { display: none; }

/* =========================================
   10. OPTIMISATION PWA SUR DESKTOP (PC/MAC)
   Règle : Si l'écran est grand (> 1000px) ET qu'on est en mode App,
   on annule le style mobile pour retrouver le style site web.
   ========================================= */

@media (min-width: 1001px) {

    /* 1. Cacher la barre du bas sur PC */
    body.mode-app .bottom-nav {
        display: none !important;
    }

    /* 2. Réafficher le Footer classique */
    body.mode-app footer, 
    body.mode-app .site-footer {
        display: block !important;
    }

    /* 3. Cacher le Hamburger (remis par la section 9) */
    body.mode-app .hamburger {
        display: none !important;
    }

    /* 4. Rétablir le menu du haut en ligne (comme le site web) */
    body.mode-app .nav-menu {
        position: static;          /* On enlève le fixed */
        flex-direction: row;       /* On remet à l'horizontale */
        background-color: transparent;
        width: auto;
        height: auto;
        padding: 0;
        display: flex !important;
        border: none;
        box-shadow: none;
        left: auto;
        top: auto;
        gap: 15px;                 /* Espace entre les liens */
    }

    /* 5. Ajuster les liens du menu pour qu'ils soient petits (Desktop) */
    body.mode-app .nav-item {
        margin: 0;
        width: auto;
    }
    body.mode-app .nav-link {
        font-size: 1.1rem;         /* Taille normale desktop */
        padding: 0;
        display: inline-block;
    }

    /* 6. Réafficher le lien "Profil" dans le menu du haut (caché en mobile app) */
    body.mode-app .nav-menu .nav-item:has(a[href="profil.php"]) { 
        display: block !important; 
    }

    /* 7. Reset des paddings du Body (on enlève l'espace pour la barre du bas) */
    body.mode-app {
        padding-bottom: 0 !important;
        padding-top: 0 !important; /* Ou garder si nécessaire pour le header fixed */
        background-color: var(--bg-dark); /* Retour à la couleur desktop */
    }
    
    /* 8. Rétablir le style des cartes (enlevé en mode app mobile) */
    body.mode-app .container { 
        max-width: 1200px; 
        padding: 60px 20px; 
    }
    body.mode-app .card {
        border-radius: 8px;
        box-shadow: 0 4px 10px rgba(0,0,0,0.5);
        border: 1px solid #444;
    }
}