/* ==========================================================================
   PAGE SCORES ET PROGRESSION
   ========================================================================== */

.scores-workspace {
    min-width: 0;
    min-height: 100vh;
    overflow: auto;
    background: #f3f6f9;
}

.scores-page {
    width: 100%;
    padding: 28px;
    box-sizing: border-box;
}

.scores-page-header {
    display: flex;
    justify-content: space-between;
    gap: 20px;
    align-items: flex-start;
    margin-bottom: 24px;
}

.scores-page-header h2 {
    margin: 0 0 7px;
    color: #172033;
    font-size: 26px;
}

.scores-page-header p {
    margin: 0;
    color: #64748b;
}

.scores-total-indicator {
    flex: 0 0 auto;
    border-radius: 999px;
    padding: 8px 14px;
    background: #e2e8f0;
    color: #334155;
    font-weight: 700;
}

/* ==========================================================================
   COLONNE GAUCHE
   ========================================================================== */

.score-sidebar-section {
    padding: 18px;
}

.score-sidebar-section h2 {
    margin: 0 0 10px;
    font-size: 18px;
}

.score-sidebar-text {
    margin: 0 0 20px;
    color: #64748b;
    line-height: 1.45;
}

.score-sidebar-actions {
    display: grid;
    gap: 10px;
}

.score-sidebar-actions button {
    width: 100%;
}

.score-danger-button {
    border: 1px solid #b91c1c;
    background: #ffffff;
    color: #b91c1c;
}

.score-danger-button:hover {
    background: #fef2f2;
}

/* ==========================================================================
   CARTES DE RÉSUMÉ
   ========================================================================== */

.scores-summary-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 16px;
    margin-bottom: 22px;
}

.scores-summary-card {
    border: 1px solid #dbe3ec;
    border-radius: 10px;
    padding: 18px;
    background: #ffffff;
}

.scores-summary-card span {
    display: block;
    margin-bottom: 8px;
    color: #64748b;
    font-size: 13px;
}

.scores-summary-card strong {
    display: block;
    color: #0f172a;
    font-size: 27px;
}

/* ==========================================================================
   FILTRES
   ========================================================================== */

.scores-filters {
    display: flex;
    flex-wrap: wrap;
    gap: 16px;
    margin-bottom: 20px;
    padding: 16px;
    border: 1px solid #dbe3ec;
    border-radius: 10px;
    background: #ffffff;
}

.scores-filter-field {
    display: grid;
    gap: 6px;
    min-width: 220px;
}

.scores-filter-field label {
    color: #334155;
    font-size: 13px;
    font-weight: 700;
}

.scores-filter-field select {
    min-height: 40px;
    border: 1px solid #cbd5e1;
    border-radius: 7px;
    padding: 8px 10px;
    background: #ffffff;
    color: #0f172a;
}

/* ==========================================================================
   MESSAGE SANS SCORE
   ========================================================================== */

.scores-empty-message {
    border: 1px dashed #94a3b8;
    border-radius: 10px;
    padding: 40px 24px;
    background: #ffffff;
    text-align: center;
}

.scores-empty-message h3 {
    margin: 0 0 8px;
    color: #334155;
}

.scores-empty-message p {
    margin: 0;
    color: #64748b;
}

/* ========================================================================== 
   TABLEAU
   ========================================================================== */

.scores-groups {
    display: grid;
    gap: 24px;
}

.scores-exercise-group {
    min-width: 0;
}

.scores-exercise-title {
    margin: 0 0 10px;
    color: #172033;
    font-size: 19px;
}

.scores-table-wrapper {
    overflow-x: auto;
    border: 1px solid #dbe3ec;
    border-radius: 10px;
    background: #ffffff;
}

.scores-table {
    width: 100%;
    border-collapse: collapse;
    min-width: 1120px;
}

.scores-table th,
.scores-table td {
    border-bottom: 1px solid #e2e8f0;
    padding: 12px 10px;
    text-align: left;
    vertical-align: middle;
    font-size: 13px;
}

.scores-table th {
    background: #f8fafc;
    color: #334155;
    font-weight: 700;
    white-space: nowrap;
}

.scores-table tbody tr:last-child td {
    border-bottom: none;
}

.scores-table tbody tr:hover {
    background: #f8fafc;
}

/* ==========================================================================
   BADGES DE POURCENTAGE
   ========================================================================== */

.score-percentage-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 62px;
    border-radius: 999px;
    padding: 6px 9px;
    font-weight: 700;
}

.score-percentage-badge.is-good {
    background: #dcfce7;
    color: #166534;
}

.score-percentage-badge.is-medium {
    background: #fef3c7;
    color: #92400e;
}

.score-percentage-badge.is-low {
    background: #fee2e2;
    color: #991b1b;
}

/* ==========================================================================
   BOUTONS DU TABLEAU
   ========================================================================== */

.score-table-button {
    min-height: 34px;
    border: 1px solid #94a3b8;
    border-radius: 6px;
    padding: 6px 10px;
    background: #ffffff;
    color: #1e293b;
    cursor: pointer;
    white-space: nowrap;
}

.score-table-button:hover:not(:disabled) {
    border-color: #2563eb;
    background: #eff6ff;
    color: #1d4ed8;
}

.score-table-button:disabled {
    opacity: 0.55;
    cursor: not-allowed;
}

.score-view-button {
    border-color: #2563eb;
    color: #1d4ed8;
}

.score-retry-button {
    border-color: #15803d;
    color: #15803d;
}

.score-retry-button:hover:not(:disabled) {
    border-color: #15803d;
    background: #f0fdf4;
    color: #166534;
}

.score-delete-button {
    border-color: #b91c1c;
    color: #b91c1c;
}

.score-delete-button:hover:not(:disabled) {
    border-color: #b91c1c;
    background: #fef2f2;
    color: #991b1b;
}

/* ==========================================================================
   CORRECTION HISTORIQUE
   ========================================================================== */

.score-history-correction {
    margin-top: 28px;
    border-top: 3px solid #2563eb;
    padding-top: 22px;
}

.score-history-correction-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 20px;
    margin-bottom: 18px;
}

.score-history-correction-header h2 {
    margin: 0 0 7px;
    color: #172033;
}

.score-history-correction-header p {
    margin: 0;
    color: #64748b;
}

#score-history-close-button {
    flex: 0 0 auto;
    border: 1px solid #64748b;
    border-radius: 7px;
    padding: 9px 13px;
    background: #ffffff;
    color: #334155;
    cursor: pointer;
}

#score-history-close-button:hover {
    background: #f1f5f9;
}

/* ==========================================================================
   CARTES LEAFLET DE L’HISTORIQUE
   ========================================================================== */

.score-history-correction .quiz-correction-card {
    background: #ffffff;
}

.score-history-correction .quiz-correction-map {
    min-height: 280px;
}

.score-history-map-button {
    cursor: pointer;
}

/* ==========================================================================
   TEXTES D’ENREGISTREMENT DU QUIZ
   ========================================================================== */

.quiz-score-saved {
    margin: 8px 0 0;
    color: #166534;
    font-size: 13px;
}

.quiz-score-save-error {
    margin: 8px 0 0;
    color: #b91c1c;
    font-size: 13px;
}

/* ==========================================================================
   TABLETTE
   ========================================================================== */

@media (max-width: 1100px) {
    .scores-summary-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

/* ==========================================================================
   MOBILE
   ========================================================================== */

@media (max-width: 760px) {
    .scores-page {
        padding: 16px;
    }

    .scores-page-header {
        display: grid;
    }

    .scores-total-indicator {
        justify-self: start;
    }

    .scores-summary-grid {
        grid-template-columns: 1fr;
    }

    .scores-filters {
        display: grid;
    }

    .scores-filter-field {
        min-width: 0;
    }

    .score-history-correction-header {
        display: grid;
    }

    #score-history-close-button {
        width: 100%;
    }

    .score-history-correction .quiz-correction-map {
        min-height: 230px;
    }
}

/* ==========================================================================
   DEUX VERSIONS DE LA CORRECTION
   ========================================================================== */

.score-correction-buttons {
    display: flex;
    gap: 6px;
    align-items: center;
}

.score-correction-buttons .score-table-button {
    min-width: 58px;
}

.score-correction-mode-banner {
    display: flex;
    flex-wrap: wrap;
    gap: 8px 16px;
    align-items: center;
    margin-bottom: 18px;
    border: 1px solid #93c5fd;
    border-radius: 8px;
    padding: 12px 14px;
    background: #eff6ff;
    color: #1e3a8a;
}

.score-correction-mode-banner span {
    color: #475569;
    font-size: 13px;
}

.score-candidate-section,
.score-forgotten-section,
.score-corrected-answer {
    display: grid;
    grid-template-columns: 190px minmax(0, 1fr);
    gap: 12px;
    align-items: start;
    margin-top: 14px;
}

.score-answer-group {
    display: grid;
    gap: 7px;
    margin-bottom: 10px;
}

.score-answer-group:last-child {
    margin-bottom: 0;
}

.score-answer-group-label {
    color: #64748b;
    font-size: 12px;
    font-weight: 700;
}

.score-answer-list {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.score-answer-item {
    display: inline-flex;
    align-items: center;
    min-height: 34px;
    border: 1px solid #94a3b8;
    border-radius: 6px;
    padding: 6px 10px;
    background: #ffffff;
    color: #0f172a;
}

.score-answer-item.is-selected-correct {
    border-color: #16a34a;
    background: #f0fdf4;
    color: #166534;
}

.score-answer-item.is-selected-wrong {
    border-color: #dc2626;
    background: #fef2f2;
    color: #991b1b;
}

.score-answer-item.is-forgotten {
    border-color: #d97706;
    background: #fffbeb;
    color: #92400e;
}

.score-answer-item.is-corrected {
    border-color: #16a34a;
    background: #f0fdf4;
    color: #166534;
}

.score-no-answer {
    color: #64748b;
    font-style: italic;
}

.score-forgotten-section {
    border-top: 1px dashed #cbd5e1;
    padding-top: 14px;
}

.score-corrected-card {
    border-left-color: #2563eb;
}

@media (max-width: 760px) {
    .score-correction-buttons {
        display: grid;
    }

    .score-candidate-section,
    .score-forgotten-section,
    .score-corrected-answer {
        grid-template-columns: 1fr;
    }
}

/* ==========================================================================
   COULEURS DES RÉPONSES
   ========================================================================== */

.score-answer-item.is-answer-correct {
    border-color: #16a34a;
    background: #f0fdf4;
    color: #166534;
}

.score-answer-item.is-answer-wrong {
    border-color: #dc2626;
    background: #fef2f2;
    color: #991b1b;
}

/* ==========================================================================
   ALIGNEMENT DES RÉPONSES ET DU BOUTON CARTE
   ========================================================================== */

.score-answer-list {
    display: grid;
    gap: 8px;
}

.score-answer-row {
    display: flex;
    align-items: center;
    gap: 10px;
}

.score-answer-item {
    display: inline-flex;
    align-items: center;
    min-height: 34px;
    border-width: 1px;
    border-style: solid;
    border-radius: 6px;
    padding: 6px 10px;
}

/* ==========================================================================
   BOUTON CARTE
   ========================================================================== */

.score-map-link {
    flex: 0 0 auto;
    margin: 0;
    border: 1px solid #2563eb;
    border-radius: 5px;
    padding: 5px 9px;
    background: #ffffff;
    color: #2563eb;
    font-size: 12px;
    font-weight: 700;
    line-height: 1.2;
    cursor: pointer;
}

.score-map-link:hover:not(:disabled) {
    background: #eff6ff;
}

.score-map-link:disabled {
    border-color: #94a3b8;
    background: #ffffff;
    color: #64748b;
    opacity: 1;
    cursor: not-allowed;
}

/* ==========================================================================
   MOBILE
   ========================================================================== */

@media (max-width: 760px) {
    .score-answer-row {
        align-items: flex-start;
        flex-wrap: wrap;
    }

    .score-map-link {
        margin-top: 2px;
    }
}

/* ==========================================================================
   COULEURS FORCÉES DES RÉPONSES DANS LA CORRECTION
   ========================================================================== */

/* Réponse fausse du candidat */
.score-history-correction
.score-answer-item.is-answer-wrong {
    border-color: #dc2626 !important;
    background-color: #fef2f2 !important;
    color: #991b1b !important;
}

/* Réponse juste du candidat */
.score-history-correction
.score-answer-item.is-answer-correct {
    border-color: #16a34a !important;
    background-color: #f0fdf4 !important;
    color: #166534 !important;
}

/* Réponse correcte affichée après une erreur */
.score-history-correction
.score-corrected-answer
.score-answer-item {
    border-color: #16a34a !important;
    background-color: #f0fdf4 !important;
    color: #166534 !important;
}

/* Le bouton Carte reste séparé du texte */
.score-history-correction .score-answer-row {
    display: flex !important;
    align-items: center !important;
    gap: 10px !important;
}

.score-history-correction .score-map-link {
    flex: 0 0 auto !important;
    margin: 0 !important;
    border: 1px solid #2563eb !important;
    border-radius: 5px !important;
    padding: 5px 9px !important;
    background: #ffffff !important;
    color: #2563eb !important;
    font-weight: 700 !important;
    cursor: pointer !important;
}

/* ==========================================================================
   FENÊTRE CARTOGRAPHIQUE DES CORRECTIONS
   ========================================================================== */

body.score-map-modal-open {
    overflow: hidden;
}

.score-map-modal[hidden] {
    display: none !important;
}

.score-map-modal {
    position: fixed;
    z-index: 10000;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
    box-sizing: border-box;
    background: rgba(15, 23, 42, 0.65);
}

.score-map-dialog {
    width: min(920px, 100%);
    overflow: hidden;
    border: 1px solid #cbd5e1;
    border-radius: 10px;
    background: #ffffff;
    box-shadow: 0 20px 50px rgba(15, 23, 42, 0.30);
}

.score-map-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 20px;
    padding: 16px 18px;
    border-bottom: 1px solid #e2e8f0;
}

.score-map-header-text {
    min-width: 0;
}

.score-map-header h2 {
    margin: 0 0 5px;
    color: #0f172a;
    font-size: 20px;
}

.score-map-header p {
    margin: 0;
    color: #64748b;
    font-size: 13px;
    overflow-wrap: anywhere;
}

.score-map-close-button {
    flex: 0 0 auto;
    border: 1px solid #64748b;
    border-radius: 6px;
    padding: 8px 12px;
    background: #ffffff;
    color: #334155;
    cursor: pointer;
}

.score-map-close-button:hover {
    background: #f1f5f9;
}

.score-map-container {
    width: 100%;
    height: 560px;
    background: #e2e8f0;
}

/* ==========================================================================
   MOBILE
   ========================================================================== */

@media (max-width: 760px) {
    .score-map-modal {
        align-items: flex-start;
        padding: 12px;
    }

    .score-map-dialog {
        width: 100%;
    }

    .score-map-header {
        display: grid;
    }

    .score-map-close-button {
        width: 100%;
    }

    .score-map-container {
        height: 70vh;
        min-height: 360px;
    }
}
