/* ==========================
   PAGE ANNEXE MATHS (CPGE) - Effets néon
   CODE CORRIGÉ POUR MOBILE
========================== */

/* ==========================
   VARIABLES CSS
========================== */
:root {
    --primary: #00ffff;       /* Couleur principale cyan */
    --secondary: #ff00ff;     /* Couleur secondaire magenta */
    --accent: #ffff00;        /* Couleur accent jaune */
    --bg-dark: #0a0a0a;       /* Fond sombre principal */
    --bg-card: #1a1a1a;       /* Fond des cartes */
    --text-primary: #ffffff;  /* Couleur texte principale */
    --text-secondary: #b0b0b0; /* Couleur texte secondaire/gris clair */
}

/* ==========================
   RESET CSS
========================== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

/* ==========================
   STRUCTURE DE BASE
========================== */
html, body {
    height: 100%;
}

body {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    font-family: 'Exo 2', sans-serif;
    background-color: var(--bg-dark);
    color: var(--text-primary);
    line-height: 1.6;
    overflow-x: hidden; /* Crucial pour éviter le scroll horizontal */
    position: relative;
    width: 100%; /* S'assure que le body ne dépasse pas */
}

/* ==========================
   GRILLE NÉON SUBTILE DERRIÈRE
========================== */
body::before {
    content: '';
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: repeating-linear-gradient(
        0deg,
        transparent,
        transparent 2px,
        rgba(0, 255, 255, 0.03) 2px,
        rgba(0, 255, 255, 0.03) 4px
    );
    pointer-events: none;
    z-index: 1;
}

/* ==========================
   HEADER
========================== */
.page-title {
    text-align: center;
    font-family: 'Orbitron', sans-serif;
    font-size: 3rem;
    color: var(--primary);
    margin: 30px 0;
    text-transform: uppercase;
    letter-spacing: 4px;
    text-shadow: 0 0 10px rgba(0,255,255,0.5),
                 0 0 20px rgba(0,255,255,0.3),
                 0 0 30px rgba(0,255,255,0.2);
    animation: glowTitle 2s ease-in-out infinite alternate;
    padding: 0 10px; /* Sécurité pour ne pas coller aux bords sur mobile */
}

header nav {
    padding: 15px 50px;
    background: rgba(10,10,10,0.95);
    border-bottom: 1px solid rgba(0,255,255,0.2);
    /* Ajout pour centrer proprement */
    display: flex;
    justify-content: center;
}

header nav a {
    color: var(--text-primary);
    text-decoration: none;
    font-weight: bold;
    transition: all 0.3s ease;
    position: relative;
}

header nav a::after {
    content: '';
    position: absolute;
    bottom: -3px;
    left: 0;
    width: 0;
    height: 2px;
    background: linear-gradient(90deg, var(--primary), var(--secondary));
    transition: width 0.3s ease;
}

header nav a:hover::after {
    width: 100%;
}

header nav a:hover {
    color: var(--primary);
}

/* ==========================
   CONTENU PRINCIPAL
========================== */
main {
    flex: 1;
    padding: 100px 20px 50px;
    max-width: 1200px;
    margin: 0 auto;
    position: relative;
    z-index: 2;
    width: 100%; /* S'assure que le main reste dans les clous */
}

main h2 {
    text-align: center;
    margin-bottom: 40px;
    font-size: 2.3rem;
    font-family: 'Orbitron', sans-serif;
    color: var(--primary);
    text-transform: uppercase;
    letter-spacing: 3px;
    text-shadow: 0 0 10px rgba(0,255,255,0.5),
                 0 0 20px rgba(0,255,255,0.3),
                 0 0 30px rgba(0,255,255,0.2);
    animation: glowTitle 2s ease-in-out infinite alternate;
}

@keyframes glowTitle {
    0% { opacity: 0.8; text-shadow: 0 0 10px rgba(0,255,255,0.5); }
    100% { opacity: 1; text-shadow: 0 0 20px rgba(0,255,255,0.8), 0 0 40px rgba(0,255,255,0.6); }
}

/* ==========================
   SECTION CPGE
========================== */
.cpge-section {
    display: flex;
    flex-direction: row;
    align-items: flex-start;
    justify-content: center;
    gap: 60px;
    padding: 40px 20px;
    max-width: 1100px;
    margin: auto;
}

.cpge-images {
    flex: 1;
    display: flex;
    flex-wrap: wrap;
    gap: 25px;
    justify-content: center;
}

.cpge-images img {
    width: 120px;
    max-width: 100%; /* SÉCURITÉ MOBILE */
    height: auto;
    background: var(--bg-card);
    padding: 12px;
    border-radius: 12px;
    box-shadow: 0 0 10px rgba(0,255,255,0.2);
    transition: transform 0.3s, box-shadow 0.3s;
    cursor: pointer;
}

.cpge-images img:hover {
    transform: scale(1.15);
    box-shadow: 0 0 25px var(--primary), 0 0 40px var(--secondary);
}

.cpge-subtitle {
    text-align: center;
    font-size: 1.3rem;
    color: var(--secondary);
    font-family: 'Orbitron', sans-serif;
    margin-bottom: 30px;
    text-shadow: 0 0 5px rgba(255,0,255,0.5),
                 0 0 10px rgba(255,0,255,0.3);
}

.cpge-text {
    flex: 1;
    max-width: 550px;
    font-size: 1.1rem;
    line-height: 1.8;
    color: var(--text-secondary);
}

/* ==========================
   SECTION UNIVERSITAIRES
========================== */
.uni-section {
    display: flex;
    flex-direction: row;
    align-items: center;
    justify-content: center;
    gap: 60px;
    padding: 40px 20px;
    max-width: 1100px;
    margin: auto;
}

.uni-text {
    flex: 1;
    max-width: 550px;
    font-size: 1.1rem;
    line-height: 1.8;
    color: var(--text-secondary);
}

.uni-images {
    flex: 1;
    display: flex;
    flex-wrap: wrap;
    gap: 25px;
    justify-content: center;
}

.uni-images img {
    width: 360px; /* Largeur pour Desktop */
    max-width: 100%; /* ⚠️ CRUCIAL : Empêche l'image de dépasser son conteneur */
    height: 165px;
    background: var(--bg-card);
    padding: 12px;
    border-radius: 12px;
    box-shadow: 0 0 10px rgba(0,255,255,0.2);
    transition: transform 0.3s, box-shadow 0.3s;
    cursor: pointer;
    object-fit: cover;
}

.uni-images img:hover {
    transform: scale(1.15);
    box-shadow: 0 0 25px var(--primary), 0 0 40px var(--secondary);
}

/* ==========================
   TARIFS
========================== */
#tarifs {
    margin-top: 4rem;
    text-align: center;
}

.tarifs {
    color: var(--text-secondary, #ccc);
    font-size: 1.1rem;
    margin-bottom: 2rem;
    padding: 0 10px;
}

.tarifs-table {
    margin: 0 auto;
    max-width: 600px;
    width: 100%; /* S'assure que le tableau ne déborde pas */
    background: var(--bg-glass, rgba(255,255,255,0.05));
    border-radius: 20px;
    padding: 1.5rem;
    box-shadow: 0 0 20px rgba(0, 255, 255, 0.15);
    overflow-x: auto; /* Permet de scroller DANS le tableau si nécessaire */
}

.table-tarifs {
    width: 100%;
    border-collapse: collapse;
    color: var(--text-primary, #fff);
    font-size: 16px;
}

.table-tarifs th {
    color: var(--primary, cyan);
    font-family: 'Audiowide', sans-serif;
    text-transform: uppercase;
    letter-spacing: 1px;
    padding: 12px;
    border-bottom: 2px solid rgba(0, 255, 255, 0.2);
}

.table-tarifs td {
    padding: 15px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.table-tarifs tr:hover {
    background: rgba(0, 255, 255, 0.08);
    transition: background 0.3s ease;
}

/* ==========================
   BOUTON CONTACT
========================== */
.btn-container {
    display: flex;
    justify-content: center;
    margin-top: 10px;
}

.btn-primary {
    background-color: var(--primary);
    color: #000;
    border: none;
    padding: 12px 25px;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s ease;
    text-decoration: none;
    font-weight: bold;
    display: inline-block;
    margin-top: 20px;
}

.btn-primary:hover {
    background-color: var(--secondary);
    transform: scale(1.05);
    box-shadow: 0 0 15px var(--primary), 0 0 25px var(--secondary);
}

/* ==========================
   FOOTER
========================== */
footer {
    background: rgba(10, 10, 10, 0.95);
    border-top: 1px solid rgba(0, 255, 255, 0.2);
    padding: 50px 50px 30px;
    margin-top: 100px;
    position: relative;
    z-index: 2;
}

.footer-content {
    max-width: 1200px;
    margin: 0 auto;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 40px;
    margin-bottom: 30px;
}

.footer-section h3 {
    font-family: 'Audiowide', sans-serif;
    color: var(--primary);
    margin-bottom: 20px;
    font-size: 1.1rem;
    font-weight: 400;
    text-transform: uppercase;
    letter-spacing: 2px;
}

.footer-section:last-child {
    text-align: right;
}

.footer-section ul {
    list-style: none;
    padding: 0;
}

.footer-section ul li {
    margin-bottom: 10px;
}

.footer-section a {
    color: var(--text-secondary);
    text-decoration: none;
    transition: all 0.3s ease;
}

.footer-section a:hover {
    color: var(--primary);
    transform: translateX(5px);
    display: inline-block;
}

.social-links {
    display: flex;
    justify-content: flex-end;
    gap: 20px;
    margin-top: 20px;
}

.social-links a {
    display: inline-block;
    transition: all 0.3s ease;
}

.social-links a img {
    width: 40px;
    height: 40px;
    display: block;
    transition: all 0.3s ease;
}

.social-links a:hover img {
    transform: translateY(-5px);
    filter: drop-shadow(0 0 5px #00ffff) drop-shadow(0 0 10px #00ffff);
}

.footer-bottom {
    font-family: 'Exo 2', sans-serif;
    text-align: center;
    padding-top: 30px;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    color: var(--text-secondary);
    font-size: 0.9rem;
    letter-spacing: 1px;
}

.footer-bottom a {
    color: white;
}

/* ==========================
   ANIMATIONS
========================== */
@keyframes fadeInUp {
    from { opacity: 0; transform: translateY(30px); }
    to { opacity: 1; transform: translateY(0); }
}

.fade-in {
    opacity: 0;
    transform: translateY(30px);
    transition: all 0.6s ease;
}

.fade-in.visible {
    opacity: 1;
    transform: translateY(0);
}

/* =========================================
   RESPONSIVE DESIGN (MOBILES & TABLETTES)
   Tout est regroupé ici pour plus de clarté
========================================= */

@media (max-width: 900px) {
    /* 1. Ajustement Header */
    .page-title {
        font-size: 2rem; /* Titre plus petit */
        margin-top: 20px;
    }
    header nav {
        padding: 15px 20px; /* Moins de padding sur les côtés */
    }

    /* 2. Section CPGE : Colonne */
    .cpge-section {
        flex-direction: column; 
        text-align: center;
        gap: 40px;
    }
    .cpge-text {
        max-width: 100%;
        padding: 0 10px;
    }
    .cpge-images img {
        /* On réduit un peu la taille des logos sur mobile */
        width: 100px; 
    }

    /* 3. Section Universitaire : Colonne + Correction Images */
    .uni-section {
        flex-direction: column;
        text-align: center;
    }
    .uni-text {
        max-width: 100%;
    }
    .uni-images {
        flex-direction: column; /* Images l'une sous l'autre sur mobile */
        gap: 20px;
        width: 100%;
    }
    /* CORRECTION CRITIQUE DES IMAGES UNIV */
    .uni-images img {
        width: 100%; /* Prend toute la largeur disponible */
        max-width: 400px; /* Mais pas plus large que ça pour les tablettes */
        height: auto; /* Hauteur auto pour ne pas déformer */
    }

    /* 4. Tableaux */
    .table-tarifs th,
    .table-tarifs td {
        font-size: 14px;
        padding: 10px;
    }

    /* 5. Footer : Centrage */
    .footer-section:last-child {
        text-align: center; /* Plus aligné à droite sur mobile */
    }
    .social-links {
        justify-content: center; /* Centrer les icônes */
    }
    footer {
        padding: 40px 20px 20px; /* Réduire padding footer */
    }
}