/* Base Styles */
:root {
    --brand-green: #2e7d32; /* Main Forest Green */
    --brand-green-light: #4caf50; /* Bright green for 3D edges */
    --brand-dark: #102a12; /* Very dark green for contrast */
    --brand-accent: #c8e6c9; /* Soft pastel green to replace the ugly blue */
    --brand-accent-3d: #81c784; /* Shadow for the accent */
    --bg-color: #f5f5f5;
    --text-color: #333333;
    --white: #ffffff;
    --border-color: #e0e0e0;
}

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

@font-face {
    font-family: 'OpenDyslexic';
    src: url('https://cdn.jsdelivr.net/gh/antijingoist/opendyslexic@master/compiled/OpenDyslexic-Regular.woff') format('woff');
    font-weight: normal;
    font-style: normal;
}

body {
    font-family: Arial, "Helvetica Neue", Helvetica, sans-serif;
    background-color: var(--white);
    color: var(--text-color);
    line-height: 1.5;
}

.dyslexic-mode, .dyslexic-mode * {
    font-family: 'OpenDyslexic', 'Comic Sans MS', sans-serif !important;
}
body.dyslexic-mode {
    font-size: 12px; /* OpenDyslexic is naturally large, so we reduce the base size */
}

a {
    text-decoration: none;
    color: var(--brand-green);
}

a:hover {
    text-decoration: underline;
}

ul {
    list-style: none;
}

/* Header & Navigation */
header {
    width: 100%;
}

.top-header {
    background-color: var(--brand-green);
    color: var(--white);
    height: 85px; /* Plus aéré en haut, comme British Council */
    display: flex;
    align-items: center;
}

.header-container {
    width: 100%;
    max-width: 1100px;
    margin: 0 auto;
    padding: 0 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: relative;
    height: 100%; /* Permet aux actions de s'ancrer en haut */
}

/* Logo styling */
.logo a {
    display: flex;
    align-items: center;
    color: var(--white);
    font-size: 22px; /* Logo légèrement plus grand */
    text-decoration: none;
}

.logo-text {
    font-weight: 400;
}

.logo-text strong {
    font-weight: 700;
}

.top-actions {
    position: absolute;
    top: 0;
    right: 20px; /* S'aligne sur le padding du container */
    display: flex;
    align-items: center;
    background-color: var(--white);
    height: 32px; /* Hauteur ajustée pour un look plus fin */
}

.search-btn, .auth-btn {
    background-color: var(--white);
    color: var(--brand-green);
    border: none;
    padding: 0 15px;
    height: 100%;
    display: flex;
    align-items: center;
    cursor: pointer;
    font-size: 13px;
    font-weight: bold;
    border-left: 1px solid #ccc;
}
.search-btn:first-child {
    border-left: none;
}
.auth-btn:hover {
    background-color: #f9f9f9;
}

.display-settings-wrapper {
    position: relative;
    height: 100%;
    display: flex;
    align-items: center;
}

/* Modal Paramètres */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 9999;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s, visibility 0.3s;
}

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

.modal-content {
    background: var(--white);
    width: 90%;
    max-width: 600px;
    padding: 30px;
    border-radius: 4px;
    position: relative;
    box-shadow: 0 10px 30px rgba(0,0,0,0.2);
}

.modal-close {
    position: absolute;
    top: 20px;
    right: 20px;
    background: none;
    border: none;
    color: var(--brand-dark);
    font-weight: bold;
    cursor: pointer;
    font-size: 14px;
}
.modal-close:hover {
    text-decoration: underline;
}

.modal-title {
    font-size: 24px;
    color: var(--text-color);
    margin-bottom: 10px;
    padding-top: 10px;
}

.modal-subtitle {
    color: #666;
    margin-bottom: 25px;
    font-size: 15px;
}

.settings-options {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.setting-card {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border: 1px solid #ddd;
    padding: 15px 20px;
    cursor: pointer;
    transition: border-color 0.2s;
}

.setting-card:hover {
    background-color: #f9f9f9;
}

.setting-card.active {
    border-color: var(--brand-green);
    border-width: 2px;
    padding: 14px 19px; /* Compensate for border width */
}

.setting-card-left {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 16px;
    color: var(--text-color);
}

.setting-card-left input[type="radio"] {
    accent-color: var(--brand-green);
    width: 18px;
    height: 18px;
}

.setting-card-right {
    font-size: 32px;
    font-weight: bold;
    border-left: 1px solid #ddd;
    padding-left: 20px;
    width: 80px;
    text-align: center;
}

.dyslexic-preview {
    font-family: 'OpenDyslexic', 'Comic Sans MS', sans-serif !important;
}

/* Mobile Menu Button */
.mobile-menu-btn {
    display: none; /* Hidden on desktop */
    background: var(--brand-dark);
    color: var(--white);
    border: none;
    padding: 0 15px;
    height: 100%;
    align-items: center;
    cursor: pointer;
    margin-left: 1px;
}
.mobile-menu-btn:hover {
    background-color: var(--brand-green);
}

/* Nav menu wrapper */
.nav-wrapper {
    background-color: var(--brand-green); /* Le fond vert remplit tout l'espace à droite */
    border-bottom: none;
    position: relative;
    z-index: 10;
}

.nav-container {
    justify-content: flex-start;
}

.nav-menu {
    display: flex;
    position: relative;
    background-color: transparent;
}

.nav-menu > li {
    position: relative;
    background-color: var(--white);
    border-right: 1px solid var(--brand-green);
    border-bottom: 1px solid var(--brand-green);
}
.nav-menu > li:first-child {
    border-left: 1px solid var(--brand-green);
}

.nav-menu > li > a {
    color: var(--brand-green);
    padding: 10px 15px; /* Moins de marge en haut/bas, bien aéré sur les côtés */
    display: block;
    font-size: 14px;
    transition: background-color 0.2s, color 0.2s;
}

/* Hover state on the main tab */
.nav-menu > li:hover > a,
.nav-menu > li > a:hover {
    background-color: var(--brand-dark);
    color: var(--white);
    text-decoration: none;
}

.nav-menu > li.active > a {
    background-color: var(--brand-dark);
    color: var(--white);
    border-bottom-color: var(--brand-dark);
}

/* Dropdown Menu */
.dropdown {
    display: block;
    visibility: hidden;
    opacity: 0;
    transform: translateY(15px);
    transition: all 0.2s ease-in-out;
    position: absolute;
    top: 100%;
    left: -1px;
    background-color: var(--white);
    min-width: 200px;
    z-index: 1000;
    box-shadow: 0 4px 15px rgba(0,0,0,0.15);
    padding: 10px 0;
}

.nav-menu > li:hover .dropdown {
    visibility: visible;
    opacity: 1;
    transform: translateY(0);
}

.dropdown li a {
    padding: 10px 20px;
    display: block;
    color: var(--brand-dark);
    font-size: 14px;
    transition: color 0.15s;
}

.dropdown li a:hover {
    background-color: #f5f5f5;
    color: var(--brand-dark);
    text-decoration: none;
}

/* Main Content Blocks */
.block-green {
    background-color: var(--brand-green);
    padding: 40px 0 60px;
}
.block-green.hero-block {
    padding-top: 0; /* Remove top padding for hero block */
}

.block-cyan {
    background-color: var(--brand-accent);
    padding: 60px 0;
}

.block-bg {
    background-color: var(--bg-color);
    padding: 60px 0;
}

.block-white {
    background-color: var(--white);
    padding: 60px 0;
}

.container-inner {
    max-width: 1100px;
    margin: 0 auto;
    padding: 0 20px;
}

/* Hero Section */
.hero-wrapper {
    position: relative;
    width: 100%;
    /* Max width is removed so it aligns perfectly with container boundaries */
    background-image: url('https://images.unsplash.com/photo-1542601906990-b4d3fb778b09?ixlib=rb-4.0.3&auto=format&fit=crop&w=1200&q=80');
    background-size: cover;
    background-position: center;
    height: 400px;
    display: flex;
    align-items: center;
}

.box-3d {
    position: relative;
    background-color: var(--brand-dark);
    color: var(--white);
    padding: 40px;
    width: 450px;
    margin-left: 15px; /* Adjust left margin to let shadow stick out */
    box-shadow: -15px 15px 0 var(--brand-green-light);
    border-top-right-radius: 60px; /* Exact rounded corner from image */
}

.box-3d h1 {
    font-size: 32px;
    margin-bottom: 15px;
    line-height: 1.2;
}

.box-3d p {
    font-size: 15px;
    margin-bottom: 25px;
}

.btn-pill {
    display: inline-block;
    background-color: var(--brand-green);
    color: var(--white);
    padding: 10px 25px;
    border-radius: 25px;
    font-weight: bold;
    font-size: 14px;
    transition: background-color 0.2s;
}
.btn-pill:hover {
    background-color: var(--brand-dark);
    color: var(--white);
    text-decoration: none;
}

/* Welcome Section */
.welcome-section {
    text-align: left;
    margin: 0 auto 50px;
    max-width: 800px;
    background: var(--white);
    padding: 40px;
    border-radius: 8px; 
}

.welcome-title {
    font-size: 26px;
    color: var(--brand-dark);
    margin-bottom: 20px;
    display: inline-block;
    position: relative;
}
.welcome-title::before {
    content: '';
    position: absolute;
    top: -15px;
    left: 0;
    width: 40px;
    height: 3px;
    background-color: var(--brand-dark);
}

.welcome-text {
    color: var(--text-color);
    font-size: 15px;
    line-height: 1.6;
}

/* Cards Grid */
.cards-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 30px;
}

.cat-card {
    background-color: var(--white);
    border-radius: 0 40px 0 40px; /* Style typique British Council (coins asymétriques) */
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.cat-card img {
    width: 100%;
    height: 180px;
    object-fit: cover;
}

.cat-card-body {
    padding: 25px;
    flex-grow: 1;
    display: flex;
    flex-direction: column;
}

.cat-card h3 {
    color: var(--brand-dark);
    font-size: 22px;
    margin-bottom: 10px;
}

.cat-card p {
    color: #555;
    font-size: 14px;
    margin-bottom: 20px;
    flex-grow: 1;
}

.cat-card .btn-pill {
    align-self: center;
}

/* Secondary Banners */
.banner-3d {
    position: relative;
    background-color: var(--brand-dark);
    color: var(--white);
    padding: 40px;
    width: 400px;
    box-shadow: -15px 15px 0 var(--brand-green);
    z-index: 2;
}

.banner-wrapper {
    display: flex;
    align-items: center;
    position: relative;
}

.banner-img {
    position: absolute;
    right: 0;
    top: -30px;
    width: 600px;
    height: 250px;
    object-fit: cover;
    z-index: 1;
}

/* Recommended Content */
.rec-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 30px;
    margin-top: 30px;
}
.rec-card img {
    width: 100%;
    height: 250px;
    object-fit: cover;
}
.rec-card h3 {
    color: var(--brand-green);
    margin: 15px 0 10px;
    font-size: 20px;
}
.rec-card p {
    color: #555;
    font-size: 14px;
}

/* Footer */
footer {
    background-color: var(--brand-green);
    color: var(--white);
    padding: 60px 0 20px;
}

.footer-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 30px;
}

.footer-col h4 {
    font-size: 14px;
    margin-bottom: 20px;
    color: #fff;
    text-transform: uppercase;
}

.footer-col ul li {
    margin-bottom: 8px;
}

.footer-col a {
    color: #fff;
    font-size: 12px;
}
.footer-col a:hover {
    text-decoration: underline;
}

/* Mobile responsive */
@media (max-width: 900px) {
    .cards-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 768px) {
    .hero-wrapper {
        height: auto;
        flex-direction: column;
        background: none;
    }
    
    .hero-block .container-inner {
        padding: 0;
    }
    
    .hero-wrapper::before {
        content: '';
        display: block;
        width: 100%;
        height: 250px;
        background-image: url('https://images.unsplash.com/photo-1542601906990-b4d3fb778b09?ixlib=rb-4.0.3&auto=format&fit=crop&w=1200&q=80');
        background-size: cover;
        background-position: center;
    }
    
    .box-3d {
        width: 100%;
        margin-left: 0;
        box-shadow: none;
        border-radius: 0;
        padding: 40px 20px;
    }

    .banner-wrapper {
        flex-direction: column;
    }
    .banner-img {
        position: static;
        width: 100%;
        margin-top: 20px;
    }
    .banner-3d {
        width: 100%;
        margin-left: 0;
        box-shadow: none;
    }

    /* Header layout mobile */
    .top-header {
        height: auto;
        padding: 15px 0;
    }
    .header-container {
        flex-direction: column;
        align-items: flex-start;
        padding: 0 20px;
    }
    
    .logo {
        margin-bottom: 20px;
    }
    
    .top-actions {
        position: static;
        width: 100%;
        background-color: transparent;
        justify-content: flex-end; /* Push menu to right */
        height: auto;
    }
    
    .search-btn, .auth-btn {
        display: none; /* Cache les autres actions sur mobile pour coller au BC */
    }

    .mobile-menu-btn {
        display: flex;
        width: 100%;
        justify-content: space-between;
        align-items: center;
        background: transparent;
        color: var(--white);
        margin: 0;
        padding: 10px 0;
        border-top: 1px solid rgba(255,255,255,0.2); /* BC a une petite ligne séparatrice */
        margin-top: 15px;
    }
    
    /* Pour ajouter le texte "Menu" à côté du hamburger comme sur BC */
    .mobile-menu-btn::before {
        content: 'Menu';
        font-size: 14px;
        font-weight: normal;
    }
    
    /* Hide the nav wrapper by default on mobile, make it static so it pushes content down */
    .nav-wrapper {
        display: none;
        position: static;
        width: 100%;
        background-color: var(--brand-green);
    }
    
    .nav-wrapper.active {
        display: block;
    }
    
    .nav-container {
        padding: 0;
    }

    .nav-menu {
        flex-direction: column;
        width: 100%;
    }

    .nav-menu > li {
        border-right: none;
        border-bottom: 1px solid rgba(255,255,255,0.2);
        background-color: transparent;
    }
    .nav-menu > li:first-child {
        border-left: none;
    }

    .nav-menu > li > a {
        color: var(--white);
        padding: 15px 20px;
        font-size: 16px;
    }

    /* Arrow indicator for dropdowns */
    .nav-menu > li:has(.dropdown) > a::after {
        content: '▼';
        float: right;
        font-size: 12px;
        margin-top: 2px;
    }
    .nav-menu > li.active:has(.dropdown) > a::after {
        content: '▲';
    }

    /* Hover state on the main tab mobile */
    .nav-menu > li:hover > a,
    .nav-menu > li.active > a {
        background-color: var(--brand-dark);
        border-bottom-color: transparent;
    }

    .dropdown {
        position: static;
        display: none;
        box-shadow: none;
        background-color: var(--white);
        transform: none;
        padding: 0;
    }
    
    .nav-menu > li:hover .dropdown {
        /* Disable desktop hover behavior on mobile */
        display: none; 
    }
    
    /* Only show dropdown when the li has 'active' class (clicked) */
    .nav-menu > li.active .dropdown {
        display: block;
    }
    
    .dropdown li a {
        padding: 12px 20px 12px 40px;
        border-bottom: 1px solid #eee;
    }
}

@media (max-width: 600px) {
    .cards-grid, .rec-grid, .footer-grid {
        grid-template-columns: 1fr;
    }
}
