/* ==========================================
   STYLES POUR VISUALISATIONS INTERACTIVES
   Chart.js + Sliders + Mini-jeu
   ========================================== */

/* Canvas Charts */
#pmChart {
    max-height: 400px !important;
    margin: 2rem 0;
}

/* Interactive Controls */
.interactive-controls {
    background: linear-gradient(135deg, #f8f9fa, #ffffff);
    border: 1px solid #e1e8ed;
    border-radius: 12px;
    padding: 1.5rem;
    margin-top: 2rem;
}

.control-label {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
    font-family: 'Inter', sans-serif;
    font-size: 1rem;
    color: #2d3748;
}

.control-label strong {
    color: var(--premium-blue, #0066cc);
    font-size: 1.3rem;
    font-weight: 700;
}

/* Sliders */
.year-slider,
.pm-slider {
    width: 100%;
    height: 8px;
    border-radius: 5px;
    background: linear-gradient(to right, #e1e8ed 0%, var(--premium-blue, #0066cc) 100%);
    outline: none;
    -webkit-appearance: none;
    appearance: none;
}

.year-slider::-webkit-slider-thumb,
.pm-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: var(--premium-blue, #0066cc);
    cursor: pointer;
    box-shadow: 0 2px 6px rgba(0, 102, 204, 0.3);
    transition: all 0.2s ease;
}

.year-slider::-webkit-slider-thumb:hover,
.pm-slider::-webkit-slider-thumb:hover {
    transform: scale(1.2);
    box-shadow: 0 4px 12px rgba(0, 102, 204, 0.4);
}

.year-slider::-moz-range-thumb,
.pm-slider::-moz-range-thumb {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: var(--premium-blue, #0066cc);
    cursor: pointer;
    border: none;
    box-shadow: 0 2px 6px rgba(0, 102, 204, 0.3);
}

/* France Info Display */
.france-info {
    background: linear-gradient(135deg, rgba(0, 102, 204, 0.08), rgba(0, 102, 204, 0.03));
    border-left: 4px solid var(--premium-blue, #0066cc);
    padding: 1rem 1.5rem;
    margin-top: 1.5rem;
    border-radius: 8px;
    font-size: 1.05rem;
    line-height: 1.7;
    color: #2d3748;
}

/* Simulator Controls (Health Impact) */
.simulator-controls {
    background: linear-gradient(135deg, #f8f9fa, #ffffff);
    border: 1px solid #e1e8ed;
    border-radius: 12px;
    padding: 1.5rem;
    margin: 2rem 0;
}

.pm-value-display {
    color: var(--premium-red, #dc3545);
    font-size: 1.5rem;
    font-weight: 700;
}

.health-impact-result {
    background: linear-gradient(135deg, rgba(220, 53, 69, 0.08), rgba(220, 53, 69, 0.03));
    border: 1px solid rgba(220, 53, 69, 0.2);
    border-radius: 10px;
    padding: 1.5rem;
    margin-top: 2rem;
}

.health-impact-result p {
    font-size: 1.05rem;
    line-height: 1.8;
    color: #2d3748;
    margin: 0;
}

.lives-saved {
    color: var(--premium-green, #198754);
    font-weight: 700;
    font-size: 1.1rem;
}

/* Mini-Jeu */
.game-container {
    background: linear-gradient(135deg, #eef6fc, #ffffff) !important;
}

.game-question-box {
    background: white;
    border: 2px solid var(--premium-blue, #0066cc);
    border-radius: 12px;
    padding: 2rem;
    margin: 2rem 0;
    min-height: 100px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.game-question {
    font-size: 1.15rem;
    line-height: 1.7;
    color: #2d3748;
    text-align: center;
    margin: 0;
}

.game-question .pm-value {
    color: var(--premium-red, #dc3545);
    font-weight: 700;
    font-size: 1.3rem;
}

.game-buttons {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
    margin: 1.5rem 0;
}

.game-btn {
    padding: 1rem 1.5rem;
    font-size: 1rem;
    font-weight: 600;
    font-family: 'Inter', sans-serif;
    border: 2px solid;
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.game-btn-safe {
    background: white;
    border-color: var(--premium-green, #198754);
    color: var(--premium-green, #198754);
}

.game-btn-safe:hover {
    background: var(--premium-green, #198754);
    color: white;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(25, 135, 84, 0.25);
}

.game-btn-unsafe {
    background: white;
    border-color: var(--premium-red, #dc3545);
    color: var(--premium-red, #dc3545);
}

.game-btn-unsafe:hover {
    background: var(--premium-red, #dc3545);
    color: white;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(220, 53, 69, 0.25);
}

.game-feedback-box {
    min-height: 100px;
    margin-top: 1.5rem;
}

.game-feedback {
    padding: 1rem 1.5rem;
    border-radius: 10px;
    font-size: 1.05rem;
    line-height: 1.6;
    margin-bottom: 1rem;
}

.game-feedback.correct {
    background: linear-gradient(135deg, rgba(25, 135, 84, 0.15), rgba(25, 135, 84, 0.05));
    border-left: 4px solid var(--premium-green, #198754);
    color: #0f5132;
}

.game-feedback.incorrect {
    background: linear-gradient(135deg, rgba(220, 53, 69, 0.15), rgba(220, 53, 69, 0.05));
    border-left: 4px solid var(--premium-red, #dc3545);
    color: #721c24;
}

.game-score {
    background: linear-gradient(135deg, #f8f9fa, #ffffff);
    border: 1px solid #e1e8ed;
    border-radius: 8px;
    padding: 1rem;
    text-align: center;
    font-size: 1rem;
    line-height: 1.7;
    color: #2d3748;
}

/* Responsive */

/* Tablettes */
@media (max-width: 1024px) {

    .interactive-controls,
    .simulator-controls {
        padding: 1.25rem;
    }

    .control-label {
        font-size: 0.95rem;
    }

    .control-label strong {
        font-size: 1.2rem;
    }

    #pmChart,
    #comparativeChart {
        max-height: 380px !important;
    }

    .population-grid {
        gap: 5px;
        padding: 0.85rem;
    }

    .pop-icon {
        font-size: 1.15rem;
    }
}

/* Smartphones */
@media (max-width: 768px) {
    body {
        font-size: 15px;
    }

    /* Contrôles interactifs */
    .interactive-controls,
    .simulator-controls {
        padding: 1rem;
        margin-top: 1.5rem;
    }

    .control-label {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.5rem;
        font-size: 0.9rem;
    }

    .control-label strong {
        font-size: 1.1rem;
    }

    /* Sliders */
    .year-slider,
    .pm-slider {
        height: 6px;
    }

    .year-slider::-webkit-slider-thumb,
    .pm-slider::-webkit-slider-thumb {
        width: 20px;
        height: 20px;
    }

    .year-slider::-moz-range-thumb,
    .pm-slider::-moz-range-thumb {
        width: 20px;
        height: 20px;
    }

    /* Graphiques */
    #pmChart,
    #comparativeChart {
        max-height: 300px !important;
    }

    /* Info France */
    .france-info {
        padding: 0.85rem 1.25rem;
        font-size: 0.95rem;
        margin-top: 1.25rem;
    }

    /* Résultats impact santé */
    .health-impact-result {
        padding: 1.25rem;
        margin-top: 1.5rem;
    }

    .health-impact-result p {
        font-size: 0.95rem;
        line-height: 1.7;
    }

    .pm-value-display {
        font-size: 1.3rem;
    }

    .lives-saved {
        font-size: 1rem;
    }

    /* Grille de population */
    .population-grid {
        gap: 4px;
        padding: 0.75rem;
        margin-bottom: 1.25rem;
    }

    .pop-icon {
        font-size: 1rem;
    }

    /* Mini-jeu */
    .game-question-box {
        padding: 1.5rem;
        margin: 1.5rem 0;
    }

    .game-question {
        font-size: 1rem;
        line-height: 1.6;
    }

    .game-question .pm-value {
        font-size: 1.15rem;
    }

    .game-buttons {
        grid-template-columns: 1fr;
        gap: 0.85rem;
        margin: 1.25rem 0;
    }

    .game-btn {
        padding: 0.85rem 1.25rem;
        font-size: 0.95rem;
    }

    .game-feedback-box {
        min-height: 80px;
        margin-top: 1.25rem;
    }

    .game-feedback {
        padding: 0.85rem 1.25rem;
        font-size: 0.95rem;
    }

    .game-score {
        padding: 0.85rem;
        font-size: 0.95rem;
    }

    /* Sélecteur de pays */
    .country-selector-panel {
        padding: 1rem;
        max-height: 400px !important;
    }

    .country-checkbox {
        padding: 0.45rem 0.65rem;
        gap: 0.65rem;
    }

    .country-checkbox input[type="checkbox"] {
        width: 16px;
        height: 16px;
    }

    .country-checkbox span {
        font-size: 0.9rem;
    }

    /* Modal du sélecteur */
    #countrySelectorModal>div {
        max-width: 90% !important;
        margin: 30px auto !important;
        padding: 1.5rem !important;
    }

    #countrySelectorModal h4 {
        font-size: 1.1rem !important;
        margin-bottom: 1.25rem !important;
    }
}

/* Très petits écrans */
@media (max-width: 480px) {
    body {
        font-size: 14px;
    }

    /* Contrôles */
    .interactive-controls,
    .simulator-controls {
        padding: 0.85rem;
        margin-top: 1.25rem;
        border-radius: 8px;
    }

    .control-label {
        font-size: 0.85rem;
        gap: 0.4rem;
    }

    .control-label strong {
        font-size: 1rem;
    }

    /* Sliders */
    .year-slider,
    .pm-slider {
        height: 5px;
    }

    .year-slider::-webkit-slider-thumb,
    .pm-slider::-webkit-slider-thumb {
        width: 18px;
        height: 18px;
    }

    .year-slider::-moz-range-thumb,
    .pm-slider::-moz-range-thumb {
        width: 18px;
        height: 18px;
    }

    /* Graphiques */
    #pmChart,
    #comparativeChart {
        max-height: 250px !important;
    }

    /* Info France */
    .france-info {
        padding: 0.75rem 1rem;
        font-size: 0.9rem;
        margin-top: 1rem;
        line-height: 1.6;
    }

    /* Résultats impact santé */
    .health-impact-result {
        padding: 1rem;
        margin-top: 1.25rem;
        border-radius: 8px;
    }

    .health-impact-result p {
        font-size: 0.9rem;
        line-height: 1.6;
    }

    .pm-value-display {
        font-size: 1.2rem;
    }

    .lives-saved {
        font-size: 0.95rem;
    }

    /* Grille de population */
    .population-grid {
        gap: 3px;
        padding: 0.6rem;
        margin-bottom: 1rem;
    }

    .pop-icon {
        font-size: 0.9rem;
    }

    /* Mini-jeu */
    .game-question-box {
        padding: 1.25rem;
        margin: 1.25rem 0;
        border-radius: 10px;
    }

    .game-question {
        font-size: 0.95rem;
        line-height: 1.5;
    }

    .game-question .pm-value {
        font-size: 1.05rem;
    }

    .game-buttons {
        gap: 0.75rem;
        margin: 1rem 0;
    }

    .game-btn {
        padding: 0.75rem 1rem;
        font-size: 0.9rem;
        border-radius: 8px;
    }

    .game-feedback-box {
        min-height: 70px;
        margin-top: 1rem;
    }

    .game-feedback {
        padding: 0.75rem 1rem;
        font-size: 0.9rem;
        border-radius: 8px;
    }

    .game-score {
        padding: 0.75rem;
        font-size: 0.9rem;
        border-radius: 6px;
    }

    /* Sélecteur de pays */
    .country-selector-panel {
        padding: 0.85rem;
        max-height: 350px !important;
    }

    .country-checkbox {
        padding: 0.4rem 0.55rem;
        gap: 0.55rem;
    }

    .country-checkbox input[type="checkbox"] {
        width: 15px;
        height: 15px;
    }

    .country-checkbox span {
        font-size: 0.85rem;
    }

    /* Modal du sélecteur */
    #countrySelectorModal>div {
        max-width: 95% !important;
        margin: 20px auto !important;
        padding: 1.25rem !important;
        border-radius: 10px !important;
    }

    #countrySelectorModal h4 {
        font-size: 1rem !important;
        margin-bottom: 1rem !important;
    }

    #openCountrySelectorBtn {
        padding: 8px 16px !important;
        font-size: 0.9rem !important;
        margin-bottom: 0.85rem !important;
    }

    #closeCountrySelectorBtn {
        font-size: 1.3rem !important;
        top: 0.75rem !important;
        right: 0.75rem !important;
    }
}

/* Landscape mobile optimization */
@media (max-width: 768px) and (orientation: landscape) {

    #pmChart,
    #comparativeChart {
        max-height: 250px !important;
    }

    .game-question-box {
        padding: 1rem 1.5rem;
    }

    .population-grid {
        padding: 0.5rem;
    }
}

/* Population Grid Visualization */
.population-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    justify-content: center;
    margin-bottom: 1.5rem;
    padding: 1rem;
    background: rgba(255, 255, 255, 0.5);
    border-radius: 8px;
}

.pop-icon {
    font-size: 1.25rem;
    transition: all 0.3s ease;
    line-height: 1;
    cursor: default;
}

.pop-icon.healthy {
    color: #cbd5e0;
    /* Neutral grey */
    filter: grayscale(100%);
    opacity: 0.5;
}

.pop-icon.sick {
    color: var(--premium-red, #dc3545);
    filter: drop-shadow(0 2px 4px rgba(220, 53, 69, 0.3));
    animation: popIn 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

/* Country Selector Panel */
.country-selector-panel {
    background: var(--institutional-light-gray);
    border: 1px solid var(--institutional-border);
    padding: 1.25rem;
    border-radius: 8px;
}

.country-checkbox {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.5rem 0.75rem;
    cursor: pointer;
    border-radius: 6px;
    transition: background 0.2s ease;
    user-select: none;
}

.country-checkbox:hover {
    background: rgba(0, 85, 164, 0.05);
}

.country-checkbox input[type="checkbox"] {
    width: 18px;
    height: 18px;
    cursor: pointer;
    accent-color: var(--institutional-blue);
}

.country-checkbox span {
    font-size: 0.95rem;
    color: var(--institutional-text);
}

/* Custom scrollbar for country list */
.country-selector-panel>div::-webkit-scrollbar {
    width: 8px;
}

.country-selector-panel>div::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 4px;
}

.country-selector-panel>div::-webkit-scrollbar-thumb {
    background: var(--institutional-blue);
    border-radius: 4px;
}

.country-selector-panel>div::-webkit-scrollbar-thumb:hover {
    background: var(--institutional-blue-dark);
}

.group-option {
    background: rgba(0, 85, 164, 0.08);
    font-weight: 600;
    border-left: 3px solid var(--institutional-blue);
}

.group-option:hover {
    background: rgba(0, 85, 164, 0.15);
}


@keyframes popIn {
    from {
        transform: scale(0);
        opacity: 0;
    }

    to {
        transform: scale(1);
        opacity: 1;
    }
}