/* --- 1. VARIABLES & RESET --- */
@import url('https://fonts.googleapis.com/css2?family=Cairo:wght@400;600;700;800&display=swap');

:root {
    --bg-color: #FFFFFF;
    --text-color: #3F4739;
    --text-color-light: rgba(63, 71, 57, 0.03);
    --accent-color: #F2A904;
    --accent-light: rgba(242, 169, 4, 0.15);

    /* --- TYPOGRAPHY SYSTEM (MOBILE-FIRST & FLUID) --- */
    --font-size-title-main: clamp(1.8rem, 4vw, 2.6rem);
    --font-size-title-section: clamp(1.4rem, 3vw, 2.0rem);
    --font-size-title-card: clamp(1.05rem, 2vw, 1.25rem);
    --font-size-text-body: clamp(0.85rem, 1.2vw, 0.95rem);
    --font-size-text-lead: clamp(0.95rem, 1.5vw, 1.1rem);
    --font-size-text-small: clamp(0.75rem, 1vw, 0.85rem);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body, html {
    font-family: 'Cairo', sans-serif;
    background-color: var(--bg-color);
    color: var(--text-color);
    font-size: 16px; 
    line-height: 1.6;
    scroll-behavior: smooth;
    overflow-x: hidden;
}

/* --- 2. LAYOUT & GRID --- */
.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px; /* Réduit au lieu de 40px 20px */
}

.text-center { text-align: center; }
.bg-light { background-color: var(--text-color-light); }

.grid-programme {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
    gap: clamp(15px, 2vw, 30px);
    margin-top: 20px;
}

/* --- 3. TYPOGRAPHIE GENERALE --- */
h1, h2, h3, h4 {
    font-weight: 800;
    line-height: 1.3;
    color: var(--text-color);
}

h2.section-title {
    font-size: var(--font-size-title-section);
    text-align: center;
    position: relative;
    padding-bottom: 10px;
    margin-bottom: 40px;
}

h2.section-title::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 80px;
    height: 5px;
    background-color: var(--accent-color);
    border-radius: 5px;
}

/* --- 4. NAVIGATION --- */
.navbar {
    background-color: var(--bg-color);
    box-shadow: 0 5px 15px rgba(63, 71, 57, 0.05);
    padding: 15px 30px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: sticky;
    top: 0;
    z-index: 1000;
}

.navbar-brand {
    display: flex;
    align-items: center;
    gap: 10px;
    text-decoration: none;
    color: var(--text-color);
    font-weight: 400;
    font-size: 1.2rem;
}

.navbar-brand img {
    width: 45px;
    height: 45px;
    border-radius: 50%;
    object-fit: cover;
    box-shadow: 0 4px 10px rgba(0,0,0,0.1);
}

.nav-links {
    display: flex;
    gap: 15px;
    align-items: center;
}

/* --- 5. BUTTONS --- */
.btn {
    padding: 10px 24px;
    border-radius: 12px;
    text-decoration: none;
    font-weight: 700;
    font-size: clamp(0.9rem, 2vw, 1rem);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    border: 2px solid transparent;
    transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    cursor: pointer;
    font-family: inherit;
}

.btn:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 20px rgba(63, 71, 57, 0.15);
}

.btn-primary {
    background-color: var(--accent-color);
    color: var(--text-color);
    box-shadow: 0 5px 15px rgba(242, 169, 4, 0.3);
}

.btn-primary:hover {
    background-color: var(--text-color);
    color: #fff;
}

.btn-accent {
    background-color: var(--accent-color);
    color: var(--text-color);
    box-shadow: 0 5px 15px rgba(242, 169, 4, 0.3);
}

.btn-accent:hover {
    background-color: var(--text-color);
    color: #fff;
}

.btn-outline {
    background-color: transparent;
    color: var(--text-color);
    border: 2px solid rgba(63, 71, 57, 0.15);
}

.btn-outline:hover {
    border-color: var(--text-color);
}

/* --- 6. HERO SECTION --- */
.hero {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 40px;
    padding: 10px 20px; /* Padding intérieur encore plus réduit */
    background-color: var(--text-color-light);
    border-radius: 30px; 
    margin: 10px 0 10px 0; /* Marge du bas très réduite pour coller au titre suivant */
}

/* .hero rules removed, handled by inline styles and .section-alt */

.hero-text { flex: 1; text-align: center; }
.hero-text h1 { font-size: var(--font-size-title-main); margin-bottom: 20px;}
.hero-text h1 span { color: var(--accent-color); position: relative; }
.hero-text p { font-size: var(--font-size-text-lead); margin-top: 15px; opacity: 0.85; font-weight: 600; margin-bottom: 30px; max-width: 800px; margin-inline: auto;}

.hero-image { flex: 1; text-align: center; }
.hero-image img { 
    max-width: 80%; 
    border-radius: 50%; 
    box-shadow: 0 25px 50px rgba(63, 71, 57, 0.15); 
    border: 8px solid var(--bg-color);
}

@media (max-width: 768px) {
    .hero { flex-direction: column; text-align: center; }
    .section-alt { padding: 40px 0; }
    .nav-links { flex-wrap: nowrap; justify-content: flex-end; gap: 8px;}
    .nav-links .btn { padding: 8px 12px; }
    .navbar { padding: 15px 10px; }
    .nav-text { display: none; }
}

/* --- 7. CARDS (LESSONS & TEASERS) --- */
.module-card {
    background: var(--bg-color);
    padding: clamp(20px, 3vh, 30px) clamp(15px, 2vw, 25px);
    border-radius: 20px;
    box-shadow: 0 10px 30px rgba(63, 71, 57, 0.06);
    border-top: 4px solid var(--accent-color);
    transition: all 0.4s ease-out;
    display: flex;
    flex-direction: column;
}

.module-card:hover { 
    transform: translateY(-8px); 
    box-shadow: 0 20px 40px rgba(63, 71, 57, 0.12); 
}

.module-card video {
    width: 100%;
    border-radius: 12px;
    margin-bottom: 20px;
    background-color: #000;
    max-height: 250px;
    object-fit: contain;
}

.module-card h3 { 
    font-size: var(--font-size-title-card); 
    margin-bottom: 12px; 
}

.module-card p { 
    font-size: var(--font-size-text-body); 
    opacity: 0.8; 
    line-height: 1.6; 
    flex-grow: 1;
}

.badge {
    background-color: var(--accent-light);
    color: var(--accent-color);
    padding: 6px 14px;
    border-radius: 30px;
    font-size: var(--font-size-text-small);
    font-weight: 800;
    display: inline-block;
    margin-bottom: 15px;
}

/* --- ALTERNATING SECTIONS --- */
.section-alt {
    background-color: var(--text-color-light);
    /* border-radius retiré pour un affichage carré de bout en bout */
    padding: 20px 0; /* Padding drastiquement réduit pour correspondre aux autres sections */
}

@media (max-width: 768px) {
    .section-alt {
        padding: 10px 0; /* Encore plus réduit sur mobile */
    }
}

/* --- 8. MODALS --- */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(63, 71, 57, 0.5);
    backdrop-filter: blur(5px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
}

.modal-overlay.active {
    opacity: 1;
    visibility: visible;
}

.modal-box {
    background-color: var(--bg-color);
    width: 90%;
    max-width: 500px;
    border-radius: 24px;
    box-shadow: 0 25px 50px rgba(0, 0, 0, 0.2);
    transform: translateY(30px);
    transition: transform 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    overflow: hidden;
}

.modal-overlay.active .modal-box {
    transform: translateY(0);
}

.modal-header {
    background-color: var(--text-color-light);
    padding: 20px 30px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid rgba(63, 71, 57, 0.05);
}

.modal-header h3 {
    margin: 0;
    font-size: var(--font-size-title-card);
}

.modal-close {
    background: transparent;
    border: none;
    font-size: 1.5rem;
    color: var(--text-color);
    cursor: pointer;
    transition: color 0.3s ease;
}
.modal-close:hover { color: var(--accent-color); }

.modal-body {
    padding: 30px;
}

/* --- 9. FORMULAIRES --- */
.form-group {
    margin-bottom: 20px;
}

.form-label {
    display: block;
    font-weight: 700;
    margin-bottom: 8px;
    font-size: var(--font-size-text-body);
}

.form-control {
    width: 100%;
    padding: 14px 18px;
    border-radius: 12px;
    border: 2px solid rgba(63, 71, 57, 0.15);
    font-size: var(--font-size-text-body);
    font-family: inherit;
    transition: all 0.3s ease;
    background-color: rgba(63, 71, 57, 0.01);
    color: var(--text-color);
    font-weight: 600;
}

.form-control:focus {
    border-color: var(--accent-color);
    background-color: var(--bg-color);
    outline: none;
    box-shadow: 0 0 0 4px var(--accent-light);
}

.error-message {
    background-color: rgba(231, 76, 60, 0.1);
    color: #e74c3c;
    padding: 12px 18px;
    border-radius: 12px;
    margin-bottom: 20px;
    font-weight: 700;
    font-size: var(--font-size-text-body);
    text-align: center;
}

.success-message {
    background-color: rgba(46, 204, 113, 0.1);
    color: #27ae60;
    padding: 12px 18px;
    border-radius: 12px;
    margin-bottom: 20px;
    font-weight: 700;
    font-size: var(--font-size-text-body);
    text-align: center;
}

/* --- 10. TERMS & CONDITIONS --- */
.terms-box {
    max-width: 850px;
    margin: 40px auto; 
    background-color: var(--bg-color);
    padding: clamp(30px, 4vh, 50px) clamp(20px, 3vw, 40px);
    border-radius: 24px;
    box-shadow: 0 20px 50px rgba(63, 71, 57, 0.05);
    border-top: 6px solid var(--accent-color);
    border-left: 1px solid rgba(63, 71, 57, 0.05);
    border-right: 1px solid rgba(63, 71, 57, 0.05);
    border-bottom: 1px solid rgba(63, 71, 57, 0.05);
}

.terms-box h2 {
    text-align: left;
    margin-top: 30px;
    font-size: var(--font-size-title-card);
}
.terms-box h2::after { display: none; }
.terms-box p {
    font-size: var(--font-size-text-lead);
    opacity: 0.85;
    margin-bottom: 15px;
}

/* --- 11. UTILS --- */
.hidden { display: none !important; }
/* --- 12. NEW UI CONTROLS (ICONS & AVATAR) --- */
.btn-icon {
    width: 45px;
    height: 45px;
    border-radius: 50%;
    padding: 0;
    display: inline-flex;
    justify-content: center;
    align-items: center;
    font-size: 1.2rem;
}

.user-controls {
    display: flex;
    align-items: center;
    gap: 20px;
}

.user-profile {
    display: flex;
    align-items: center;
    gap: 10px;
}

.avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background-color: var(--accent-color);
    color: var(--text-color);
    font-weight: 800;
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 1.2rem;
}

.user-role {
    font-weight: 700;
    font-size: 0.9rem;
    color: #3F4739;
}

.btn-icon-simple {
    background: transparent;
    border: none;
    font-size: 1.4rem;
    color: #4a5d4e;
    cursor: pointer;
    transition: color 0.3s ease;
    padding: 5px;
}

.btn-icon-simple:hover {
    color: var(--text-color);
}

.logout-icon {
    color: #e74c3c;
}

.logout-icon:hover {
    color: #c0392b;
}

/* Toggle Switch UI */
.theme-switch {
    position: relative;
    display: inline-block;
    width: 50px;
    height: 26px;
}

.theme-switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: #d1d9e6;
    transition: .4s;
}

.slider:before {
    position: absolute;
    content: """";
    height: 20px;
    width: 20px;
    left: 3px;
    bottom: 3px;
    background-color: white;
    transition: .4s;
}

input:checked + .slider {
    background-color: var(--accent-color);
}

input:checked + .slider:before {
    transform: translateX(24px);
}

.slider.round {
    border-radius: 34px;
}

.slider.round:before {
    border-radius: 50%;
}

/* --- 10. FEEDBACK INFINITE CAROUSEL --- */
.carousel {
    display: flex;
    gap: 1rem;
    box-sizing: border-box;
    width: 100%;
    max-width: 1000px;
    margin: 0 auto;
    padding: 1rem;
    overflow-x: hidden;
    mask-image: linear-gradient(
        90deg,
        #0000 0% 1%,
        #0004 1% 2%,
        #000b 2% 4%,
        #000 4% 96%,
        #000b 96% 98%,
        #0004 98% 99%,
        #0000 99% 100%
    );
}

.carousel-track { 
    display: flex;
    gap: 1rem;
    animation: scroll 150s linear infinite; 
}

.carousel-track.paused {
    animation-play-state: paused;
}

.cards {
    display: flex;
    flex-flow: column nowrap;
    width: clamp(200px, 25vw, 300px); 
    background-color: #FFFFFF;
    border: 1px solid #FFFFFF;
    border-radius: 10px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.07);
    transition: all 0.3s ease;
    overflow: hidden;
    font-size: 1.2rem;
    text-align: center;
    -webkit-user-select: none;
    user-select: none;
}

.cards:hover {
    transform: scale(1.05);
    box-shadow: 0 15px 30px rgba(63, 71, 57, 0.2);
    z-index: 10;
    cursor: pointer;
}

.icon {
    display: block;
    width: 100%; 
    height: auto; 
    pointer-events: none;
}

@keyframes scroll {
    from { transform: translateX(0); }
    to   { transform: translateX(-50%); }
}

/* --- 11. LEVEL CARDS --- */
.levels-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 30px;
    padding: 20px;
}

.level-card {
    background: var(--bg-color);
    padding: 25px 20px; /* Réduit pour éviter trop d'espace vide */
    border-radius: 10px; /* Moins arrondi pour que la ligne soit plus droite */
    box-shadow: 0 10px 30px rgba(63, 71, 57, 0.05);
    border: none;
    border-top: 5px solid var(--accent-color); /* Ligne droite de bout en bout en haut */
    transition: all 0.3s ease;
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.level-card:hover {
    transform: translateY(-10px);
    box-shadow: 0 20px 40px rgba(63, 71, 57, 0.1);
}

.level-icon {
    width: 70px; /* Légèrement réduit (au lieu de 80px) */
    height: 70px;
    background-color: var(--text-color-light);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2.2rem;
    color: var(--accent-color);
    margin-bottom: 15px; /* Rapproché du titre */
    transition: all 0.3s ease;
}

.level-card:hover .level-icon {
    background-color: var(--accent-color);
    color: var(--bg-color);
    transform: scale(1.1);
}

.level-card h3 {
    font-size: 1.5rem;
    color: var(--text-color);
    margin-bottom: 15px;
}

.level-card p {
    color: var(--text-color-muted);
    line-height: 1.6;
    margin-bottom: 0;
}

/* --- 12. TP FOCUS --- */
.tp-focus {
    max-width: 800px;
    margin: 0 auto;
    border-radius: 20px;
    overflow: hidden;
    box-shadow: 0 20px 50px rgba(63, 71, 57, 0.15);
    border: 4px solid var(--accent-color);
    background-color: #000;
}

.ratio-16x9 {
    position: relative;
    width: 100%;
    padding-top: 56.25%; /* 16:9 Aspect Ratio */
}

.ratio-16x9 iframe,
.ratio-16x9 video {
    position: absolute;
    top: 0;
    left: 0;
    bottom: 0;
    right: 0;
    width: 100%;
    height: 100%;
}

@media (max-width: 768px) {
    /* Disposition horizontale pour les cartes de niveaux sur mobile (identique à la vitrine) */
    .level-card {
        display: grid;
        grid-template-columns: auto 1fr;
        align-items: center;
        text-align: left;
        padding: 10px; /* Padding intérieur plus petit (excellent comme image 1) */
        gap: 5px 12px;
    }
    .level-icon {
        grid-column: 1;
        grid-row: 1 / 3;
        width: 50px; /* Réduit comme image 1 */
        height: 50px;
        font-size: 1.4rem;
        margin-bottom: 0;
        border-radius: 10px;
    }
    .level-card > *:not(.level-icon) {
        grid-column: 2;
    }
    .level-card h3 {
        margin-bottom: 2px;
        align-self: end;
        font-size: 1.1rem;
    }
    .level-card p {
        align-self: start;
        font-size: 0.85rem;
    }
    
    .levels-grid {
        padding: 10px 0;
        grid-template-columns: 1fr;
    }
    
    .grid-programme {
        grid-template-columns: 1fr;
        gap: 20px;
    }
}
