/* --------------------------------------------------- */
/*                  Global Styles                    */
/* --------------------------------------------------- */
* {
    box-sizing: border-box;
}

body,
html {
    margin: 0;
    padding: 0;
    width: 100%;
    height: 100%;
    font-family: 'Poppins', sans-serif;
    color: #333;
    overflow-x: hidden;
}

header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px 40px;
    background: rgba(255, 255, 255, 0.1);
    -webkit-backdrop-filter: blur(10px);
    backdrop-filter: blur(10px);
    border-bottom: 1px solid rgba(255, 255, 255, 0.2);
    z-index: 1000;
}

.country-selector {
    display: flex;
    gap: 10px;
}

.country-btn {
    background: rgba(255, 255, 255, 0.2);
    border: 1px solid rgba(255, 255, 255, 0.3);
    color: white;
    padding: 10px 20px;
    border-radius: 20px;
    cursor: pointer;
    font-size: 1em;
    font-weight: 500;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 8px;
}

.country-btn:hover,
.country-btn.active {
    background: white;
    color: #2c6e49;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
}

.flag-icon {
    font-size: 1.4em;
}

.header-partners .partner-list {
    display: flex;
    gap: 20px;
}

.header-partners .partner-list a {
    color: white;
    text-decoration: none;
    font-size: 0.9em;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 6px;
    opacity: 0.8;
    transition: opacity 0.3s ease;
}

.header-partners .partner-list a:hover {
    opacity: 1;
}

/* --------------------------------------------------- */
/*                  Main Layout                        */
/* --------------------------------------------------- */
.main-container {
    padding: 30px 40px;
    /* This is now just a simple container, not a flexbox */
}

.main-content-wrapper {
    display: flex;
    gap: 30px;
    align-items: flex-start;
}

aside.ad-sidebar {
    position: sticky;
    top: 40px;
    flex-shrink: 0;
}

main.content-area {
    flex-grow: 1;
}

.title-section {
    text-align: center;
    margin-bottom: 30px;
    color: white;
}

.title-section h1 {
    font-size: 3em;
    font-weight: 700;
    margin: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 15px;
}

.globe-emoji {
    font-size: 1em;
}

.title-section p {
    font-size: 1.2em;
    opacity: 0.8;
    margin-top: 5px;
}

.controls {
    display: flex;
    justify-content: center;
    gap: 15px;
    margin-bottom: 30px;
}

.controls button {
    background: #FFC107;
    color: #333;
    border: none;
    padding: 12px 25px;
    border-radius: 25px;
    font-size: 0.9em;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(255, 193, 7, 0.3);
    display: flex;
    align-items: center;
    gap: 8px;
}

.controls button:hover {
    background: #ffca2c;
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(255, 193, 7, 0.4);
}

/* --------------------------------------------------- */
/*                Map & Content Wrapper                */
/* --------------------------------------------------- */
.map-wrapper {
    display: flex;
    gap: 30px;
    align-items: flex-start;
    transition: all 0.5s ease-in-out;
    flex-grow: 1;
    /* Allow map-wrapper to fill the space */
}

#map-container {
    flex-grow: 1;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 20px;
    padding: 15px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
    height: 70vh;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.5s ease-in-out;
}

#map {
    width: 100%;
    height: 100%;
}

#info-panel {
    background: #2c6e49;
    color: white;
    padding: 30px;
    border-radius: 20px;
    box-shadow: none;
    border: none;
    width: 380px;
    flex-shrink: 0;
    height: 70vh;
    overflow-y: auto;
    transition: all 0.3s ease;
}

.quiz-container {
    background: white;
    padding: 30px;
    border-radius: 20px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
    flex-grow: 1;
    /* Allows the container to take up the full width */
    display: flex;
    flex-direction: column;
}

/* --------------------------------------------------- */
/*                Left Sidebar (Ads)                   */
/* --------------------------------------------------- */
.ad-sidebar {
    width: 300px;
    flex-shrink: 0;
}

.ad-sidebar-content {
    background: white;
    border-radius: 20px;
    padding: 25px;
    box-shadow: 0 15px 45px rgba(0, 0, 0, 0.15);
    border: 1px solid #eee;
}

.ad-sidebar-content h4 {
    margin: 0 auto 20px auto;
    color: #2c6e49;
    font-size: 1.3em;
    font-weight: 700;
    text-align: center;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.funder-logos {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-bottom: 25px;
}

.funder-logo {
    background: linear-gradient(135deg, #ff7e5f 0%, #feb47b 100%);
    color: white;
    padding: 14px;
    border-radius: 14px;
    font-size: 1em;
    font-weight: 600;
    text-align: center;
    transition: all 0.3s ease;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.funder-logo:hover {
    transform: scale(1.05) translateY(-2px);
    box-shadow: 0 10px 20px rgba(254, 180, 123, 0.4);
}

.ad-cta {
    text-align: center;
    padding: 20px;
    background-color: rgba(230, 245, 235, 0.7);
    border-radius: 15px;
    border: 1px solid rgba(44, 110, 73, 0.1);
}

.ad-cta p {
    margin: 0 0 15px 0;
    font-size: 1em;
    line-height: 1.4;
    color: #2c6e49;
    font-weight: 500;
}

.btn-small {
    background: #2c6e49;
    color: white;
    border: none;
    padding: 12px 25px;
    border-radius: 12px;
    font-size: 0.9em;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
}

.btn-small:hover {
    background: #1e4d35;
    transform: translateY(-2px);
    box-shadow: 0 4px 10px rgba(30, 77, 53, 0.2);
}

/* --------------------------------------------------- */
/*             Right Panels (Info & Quiz)              */
/* --------------------------------------------------- */

/* Common Panel Styles */
#info-panel,
.quiz-container {
    /* This shared style block will be removed by the edit */
}

/* Custom Scrollbar for better aesthetics */
.info-panel::-webkit-scrollbar,
.quiz-container::-webkit-scrollbar {
    width: 8px;
}

.info-panel::-webkit-scrollbar-track,
.quiz-container::-webkit-scrollbar-track {
    background: rgba(0, 0, 0, 0.05);
    border-radius: 10px;
}

.info-panel::-webkit-scrollbar-thumb,
.quiz-container::-webkit-scrollbar-thumb {
    background-color: rgba(0, 0, 0, 0.2);
    border-radius: 10px;
    border: 2px solid transparent;
    background-clip: content-box;
}

.info-panel::-webkit-scrollbar-thumb:hover,
.quiz-container::-webkit-scrollbar-thumb:hover {
    background-color: rgba(0, 0, 0, 0.3);
}

/* Info Panel Specifics */
.info-panel-header {
    margin-bottom: 20px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.2);
    padding-bottom: 15px;
}

#info-title {
    font-size: 2.2em;
    font-weight: 700;
    margin: 0;
    color: white;
}

#info-helper-text {
    font-size: 1.1em;
    color: rgba(255, 255, 255, 0.85);
    line-height: 1.6;
    text-align: center;
    padding: 20px 0;
}

.info-details-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.info-details-list li {
    padding: 14px 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.15);
    font-size: 1em;
    line-height: 1.5;
    color: rgba(255, 255, 255, 0.9);
}

.info-details-list li:last-child {
    border-bottom: none;
}

.info-details-list strong {
    color: #a7d7c5;
    font-weight: 600;
    margin-right: 10px;
    display: block;
    margin-bottom: 5px;
    font-size: 0.9em;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* Quiz Container Specifics */
#question {
    font-size: 2em;
    font-weight: 800;
    margin: 0 0 35px 0;
    text-align: center;
    line-height: 1.4;
    color: #3d5a80;
}

.quiz-options {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    margin-bottom: 25px;
}

.quiz-options button {
    background: linear-gradient(180deg, #ffffff, #f9f9f9);
    border: none;
    border-bottom: 5px solid #dcdcdc;
    border-radius: 20px;
    padding: 20px;
    font-size: 1.2em;
    font-weight: 700;
    color: #555;
    text-align: center;
    cursor: pointer;
    transition: all 0.1s ease-in-out;
    font-family: 'Nunito', sans-serif;
}

.quiz-options button:hover:not(:disabled) {
    background: #fff;
    transform: translateY(-3px);
    border-bottom-width: 8px;
}

.quiz-options button:active:not(:disabled),
.quiz-options button.active-press {
    transform: translateY(3px);
    border-bottom-width: 2px;
}

.quiz-options button:disabled {
    cursor: not-allowed;
    opacity: 0.8;
}

.quiz-options button.correct {
    background: linear-gradient(180deg, #d4edda, #c3e6cb);
    border-color: #155724;
    color: #155724;
    animation: pulse 0.5s;
}

.quiz-options button.incorrect {
    background: linear-gradient(180deg, #f8d7da, #f5c6cb);
    border-color: #721c24;
    color: #721c24;
    animation: shake 0.5s;
}

#feedback {
    text-align: center;
    min-height: 30px;
    font-weight: 800;
    font-size: 1.8em;
    margin-bottom: 20px;
}

.quiz-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-top: 15px;
    border-top: 1px solid #e0e0e0;
}

#score {
    font-size: 1.2em;
    font-weight: 800;
    color: #3d5a80;
}

.progress-bar-container {
    flex-grow: 1;
    height: 18px;
    background-color: #e9ecef;
    border-radius: 18px;
    margin: 0 20px;
    box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.1);
}

.progress-bar {
    height: 100%;
    width: 0%;
    /* JS will update this */
    background: linear-gradient(90deg, #ffd028, #ffae00);
    border-radius: 18px;
    transition: width 0.4s ease-out;
}

#quiz-next-btn {
    background: #FFC107;
    color: #333;
    border: none;
    padding: 12px 28px;
    border-radius: 30px;
    font-size: 1.1em;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.1);
    font-family: 'Nunito', sans-serif;
}

#quiz-next-btn:hover {
    background: #ffca2c;
    transform: scale(1.05);
}

/* --------------------------------------------------- */
/*                 SVG Map Path Styles                 */
/* --------------------------------------------------- */
.province {
    stroke: #fff;
    stroke-width: 0.5px;
    stroke-linejoin: round;
    transition: all 0.2s ease-in-out;
    pointer-events: none;
    text-shadow: 1px 1px 0 #fff, -1px -1px 0 #fff, 1px -1px 0 #fff, -1px 1px 0 #fff;
}

.province.selected {
    stroke: #000;
    stroke-width: 2px;
}

.province-label {
    font-size: 10px;
    font-weight: 600;
    fill: #333;
    pointer-events: auto;
    text-shadow: 0 0 1px white, 0 0 3px white;
    cursor: pointer;
}

/* Adjust footer */
footer.partners-section {
    padding: 25px 40px;
    background: #2a2a2a;
    text-align: center;
    color: white;
    margin-top: 40px;
    /* This will no longer be fixed */
}

/* Couleurs de feedback pour le quiz */
.region.correct {
    fill: #22c55e !important;
}

.region.wrong {
    fill: #ef4444 !important;
}

.hidden {
    display: none;
}

/* Responsive design */
@media (max-width: 768px) {
    .main-container {
        flex-direction: column;
        gap: 20px;
    }

    .controls {
        flex-direction: column;
        align-items: center;
    }

    .controls button {
        width: 200px;
    }

    .quiz-stats {
        flex-direction: column;
        gap: 10px;
    }
}

/* Couleurs spécifiques pour chaque région */
#centre {
    fill: #FF6B6B;
}

#centre-nord {
    fill: #4ECDC4;
}

#centre-sud {
    fill: #45B7D1;
}

#centre-est {
    fill: #96CEB4;
}

#centre-ouest {
    fill: #FFEAA7;
}

#hauts-bassins {
    fill: #DDA0DD;
}

#nord {
    fill: #98D8C8;
}

#sahel {
    fill: #F7DC6F;
}

#est {
    fill: #BB8FCE;
}

#sud-ouest {
    fill: #85C1E9;
}

#cascades {
    fill: #F8C471;
}

#plateau-central {
    fill: #82E0AA;
}

#boucle-mouhoun {
    fill: #F1948A;
}

/* Keyframes for animations */
@keyframes shake {

    0%,
    100% {
        transform: translateX(0);
    }

    10%,
    30%,
    50%,
    70%,
    90% {
        transform: translateX(-5px);
    }

    20%,
    40%,
    60%,
    80% {
        transform: translateX(5px);
    }
}

@keyframes pulse {
    0% {
        transform: scale(1);
    }

    50% {
        transform: scale(1.05);
    }

    100% {
        transform: scale(1);
    }
}

.info-panel-content,
.quiz-options {
    flex-grow: 1;
}

/* --------------------------------------------------- */
/*                      Custom Modal                   */
/* --------------------------------------------------- */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.6);
    -webkit-backdrop-filter: blur(5px);
    backdrop-filter: blur(5px);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 2000;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0s 0.3s linear;
}

.modal-overlay.visible {
    opacity: 1;
    visibility: visible;
    transition-delay: 0s;
}

.modal-content {
    background: white;
    padding: 30px 40px;
    border-radius: 15px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
    width: 90%;
    max-width: 500px;
    text-align: center;
    position: relative;
    transform: scale(0.9);
    transition: transform 0.3s ease;
}

.modal-overlay.visible .modal-content {
    transform: scale(1);
}

.modal-close-btn {
    position: absolute;
    top: 10px;
    right: 15px;
    background: transparent;
    border: none;
    font-size: 2.5em;
    line-height: 1;
    color: #aaa;
    cursor: pointer;
    transition: color 0.2s ease;
}

.modal-close-btn:hover {
    color: #333;
}

#modal-title {
    font-size: 1.8em;
    font-weight: 700;
    color: #2c6e49;
    margin: 0 0 15px 0;
}

#modal-message {
    font-size: 1.1em;
    line-height: 1.6;
    color: #555;
    margin: 0;
}

/* --------------------------------------------------- */
/*                 Quiz End State Styles               */
/* --------------------------------------------------- */
.quiz-container.quiz-ended .quiz-options {
    display: block;
    /* Override the grid display */
    text-align: center;
    margin: 40px 0;
}

.quiz-container.quiz-ended .final-score-text {
    font-size: 1.6em;
    color: #333;
    font-weight: 500;
    margin-bottom: 25px;
}

.quiz-container.quiz-ended .final-score-text strong {
    font-weight: 800;
}

.quiz-container.quiz-ended #feedback {
    font-size: 1.8em;
    font-weight: 700;
}