/* =====================================================================
   Thème de l'application AWS Quiz
   ===================================================================== */

:root {
    --aws-orange: #ff9900;
    --aws-dark:   #232f3e;
    --aws-blue:   #146eb4;
    --bg:         #f4f6f9;
    --green:      #2e7d32;
    --red:        #c62828;
}

body {
    background-color: var(--bg);
    color: var(--aws-dark);
    font-family: "Segoe UI", Roboto, system-ui, -apple-system, sans-serif;
}

.bg-aws   { background-color: var(--aws-dark) !important; color: #fff; }
.text-aws { color: var(--aws-orange) !important; }

.btn-aws {
    --bs-btn-bg: var(--aws-orange);
    --bs-btn-hover-bg: #e68a00;
    --bs-btn-active-bg: #cc7a00;
    --bs-btn-border-color: var(--aws-orange);
    --bs-btn-hover-border-color: #e68a00;
    --bs-btn-color: #111;
    --bs-btn-hover-color: #111;
    background-color: var(--aws-orange);
    color: #111;
    font-weight: 600;
    border: none;
}
.btn-aws:hover { color: #111; }

/* Cartes */
.card {
    border: none;
    border-radius: 1rem;
    box-shadow: 0 6px 20px rgba(35, 47, 62, 0.08);
}
.card-title { font-weight: 700; }

/* Session cards (liste de choix sans code) */
.session-card {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    padding: .85rem 1rem;
    margin-bottom: .5rem;
    background: #fff;
    border: 1px solid #eef1f5;
    border-radius: .85rem;
    cursor: pointer;
    transition: box-shadow .15s, border-color .15s, transform .1s;
    text-align: left;
    font-family: inherit;
    font-size: inherit;
    color: inherit;
}
.session-card:hover {
    box-shadow: 0 4px 16px rgba(35,47,62,.08);
    border-color: var(--aws-orange);
    transform: translateY(-1px);
}
.session-card:active { transform: scale(.98); }
.session-card:last-child { margin-bottom: 0; }
.session-card-title {
    font-weight: 700;
    font-size: 1rem;
    color: var(--aws-dark);
}
.session-card-meta {
    font-size: .82rem;
    color: #888;
    margin-top: .1rem;
}
.session-card-count {
    font-size: .78rem;
    font-weight: 600;
    color: #888;
    white-space: nowrap;
    margin-left: .75rem;
}

/* Question */
.q-enonce {
    font-size: 1.25rem;
    font-weight: 600;
    line-height: 1.4;
}

.option {
    cursor: pointer;
    transition: all .15s ease;
    user-select: none;
}
.option:hover { background-color: #eef2f7; }
.option.selected {
    border-color: var(--aws-orange) !important;
    background-color: #fff4e0;
}

.option.correct   { border-color: var(--green) !important; background-color: #e6f4ea !important; }
.option.wrong     { border-color: var(--red)   !important; background-color: #fdecea !important; }
.option.correct .badge-ok { color: var(--green); }

/* Chrono */
.chrono {
    font-family: "SFMono-Regular", Menlo, monospace;
    font-size: 2.2rem;
    font-weight: 700;
}
.chrono.expired { color: var(--red); }

/* Liste des participants */
.participant-item {
    display: flex;
    align-items: center;
    gap: .5rem;
    padding: .35rem 0;
    border-bottom: 1px dashed #e0e0e0;
}
.participant-item:last-child { border-bottom: none; }

/* ===== Tableau de bord admin (sidebar) ===== */
.admin-panel {
    background: linear-gradient(180deg, #ffffff 0%, #fafbfd 100%);
    border: 1px solid #e2e8f0;
    border-radius: 1rem;
    box-shadow: 0 4px 16px rgba(35, 47, 62, 0.06), 0 0 0 1px rgba(0,0,0,.02);
    padding: 1.25rem;
    position: sticky;
    top: 1rem;
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

/* En-tête */
.admin-header {
    padding-bottom: .75rem;
    border-bottom: 1px solid #f0f0f0;
}
.admin-header .fw-bold { font-size: 1rem; color: #1a1a2e; }
.admin-session-info {
    display: flex;
    align-items: center;
    gap: .5rem;
    margin-top: .35rem;
}
.admin-progress {
    font-size: .85rem;
    font-weight: 700;
    color: #1a1a2e;
    background: #f0f4ff;
    padding: .15rem .65rem;
    border-radius: 1rem;
}

/* Phase badge */
#admin-phase-badge {
    font-size: .75rem;
    font-weight: 600;
    letter-spacing: .3px;
    padding: .25rem .75rem;
}

/* Stats */
.admin-stats {
    display: flex;
    flex-direction: column;
    gap: .5rem;
}
.admin-stat {
    display: flex;
    align-items: center;
    gap: .75rem;
    padding: .55rem .75rem;
    background: #f8f9fb;
    border: 1px solid transparent;
    border-radius: .75rem;
    transition: background .15s, border-color .15s, transform .1s;
}
.admin-stat:hover {
    background: #fff;
    border-color: #e2e8f0;
    transform: translateY(-1px);
}
.admin-stat-icon {
    width: 38px;
    height: 38px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    background: #fff;
    font-size: 1.05rem;
    flex-shrink: 0;
    box-shadow: 0 1px 3px rgba(0,0,0,.06);
}
.admin-stat-val {
    font-size: 1.3rem;
    font-weight: 800;
    line-height: 1;
    color: #1a1a2e;
}
.admin-stat-lbl {
    font-size: .78rem;
    color: #888;
    margin-left: .25rem;
}

/* Barre de progression des réponses */
.admin-bar-wrapper {
    margin-top: -.25rem;
}
#admin-response-bar {
    height: 8px;
    border-radius: 1rem;
    background: #e9ecef;
}
#admin-response-progress {
    border-radius: 1rem;
    font-size: 0;
    transition: width .4s ease;
}

/* Boutons d'action */
.admin-actions {
    display: flex;
    flex-direction: column;
    gap: .5rem;
    padding-top: .25rem;
    border-top: 1px solid #f0f0f0;
}
.admin-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: .5rem;
    border: none;
    border-radius: .75rem;
    padding: .65rem 1rem;
    font-size: .88rem;
    font-weight: 600;
    transition: all .15s ease;
    cursor: pointer;
    min-height: 44px;
}
.admin-btn:active { transform: scale(.97); }

.admin-btn-primary {
    background: #1a1a2e;
    color: #fff;
    box-shadow: 0 2px 6px rgba(26,26,46,.2);
}
.admin-btn-primary:hover { background: #2d2d4a; box-shadow: 0 4px 12px rgba(26,26,46,.3); }

.admin-btn-accent {
    background: #e8f5e9;
    color: #2e7d32;
}
.admin-btn-accent:hover { background: #c8e6c9; }

.admin-btn-danger {
    background: #fff;
    color: #c62828;
    border: 1px solid #ffcdd2;
}
.admin-btn-danger:hover { background: #ffebee; }

@media (max-width: 991.98px) {
    .admin-panel { position: static; }
}

/* Stats correction dans le panneau admin */
#admin-correction-stats .progress {
    height: 14px;
    border-radius: 1rem;
    background: #e9ecef;
    overflow: hidden;
}

#admin-correct-bar,
#admin-incorrect-bar {
    transition: width .5s ease;
}

/* Cartes correct / incorrect */
.correction-summary {
    display: flex;
    gap: .5rem;
}

.correction-stat-card {
    flex: 1;
    text-align: center;
    padding: .75rem .5rem;
    border-radius: .75rem;
    background: #fff;
    border: 2px solid;
    transition: transform .15s ease;
}
.correction-stat-card:hover { transform: translateY(-1px); }

.correction-stat-card--correct {
    border-color: #a5d6a7;
    background: #e8f5e9;
}
.correction-stat-card--incorrect {
    border-color: #ef9a9a;
    background: #ffebee;
}

.correction-stat-num {
    font-size: 1.6rem;
    font-weight: 800;
    line-height: 1.1;
    color: #1a1a2e;
}

.correction-stat-lbl {
    font-size: .72rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: .5px;
    color: #666;
}

/* Bouton toggle détail */
.admin-detail-toggle {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    padding: .55rem .85rem;
    background: #f8f9fb;
    border: 1px solid #e9ecef;
    border-radius: .75rem;
    color: #555;
    font-size: .82rem;
    font-weight: 600;
    cursor: pointer;
    transition: background .15s ease;
}
.admin-detail-toggle:hover { background: #eef1f5; }
.admin-detail-toggle:active { transform: scale(.98); }

/* Liste déroulante des noms */
.admin-detail-list {
    max-height: 0;
    overflow: hidden;
    transition: max-height .3s ease;
    background: #fafbfc;
    border-radius: .75rem;
    margin-top: .5rem;
}
.admin-detail-list.show {
    max-height: 280px;
    overflow-y: auto;
}
.admin-detail-list.show::-webkit-scrollbar {
    width: 5px;
}
.admin-detail-list.show::-webkit-scrollbar-thumb {
    background: #d0d5dd;
    border-radius: 1rem;
}

.admin-detail-item {
    display: flex;
    align-items: center;
    gap: .5rem;
    padding: .4rem .85rem;
    font-size: .82rem;
    border-bottom: 1px solid #f0f0f0;
    transition: background .1s;
}
.admin-detail-item:last-child { border-bottom: none; }
.admin-detail-item:hover { background: #f0f4f8; }

/* Stats par question (résultats finaux) */
.question-stat-row {
    display: flex;
    flex-direction: column;
    gap: .35rem;
    padding: .65rem .75rem;
    border-radius: .75rem;
    background: #fff;
    border: 1px solid #eef1f5;
    margin-bottom: .5rem;
    transition: box-shadow .15s;
}
.question-stat-row:hover { box-shadow: 0 1px 6px rgba(0,0,0,.06); }

.qstat-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    cursor: pointer;
    user-select: none;
}

.qstat-num {
    font-weight: 700;
    font-size: .82rem;
    color: #1a1a2e;
}

.qstat-chevron {
    font-size: .85rem;
    color: #999;
    transition: transform .25s ease;
    min-width: 20px;
    text-align: center;
}

.qstat-pct {
    display: flex;
    align-items: center;
    gap: .4rem;
    font-weight: 700;
    font-size: .8rem;
    padding: .15rem .55rem;
    border-radius: 1rem;
}
.qstat-pct--success { background: #e8f5e9; color: #2e7d32; }
.qstat-pct--warning { background: #fff3e0; color: #ef6c00; }
.qstat-pct--danger  { background: #ffebee; color: #c62828; }

.qstat-pct-val { font-weight: 800; }
.qstat-pct-sub { font-size: .7rem; opacity: .7; }

.qstat-bar {
    height: 6px;
    border-radius: 1rem;
    background: #eef1f5;
    overflow: hidden;
}
.qstat-bar-fill {
    height: 100%;
    border-radius: 1rem;
    transition: width .6s ease;
}
.qstat-bar-fill--success { background: #4caf50; }
.qstat-bar-fill--warning { background: #ff9800; }
.qstat-bar-fill--danger  { background: #f44336; }

/* Barre cliquable au survol */
.qstat-bar {
    cursor: pointer;
}

/* Détail question (dépliable) */
.question-detail {
    max-height: 0;
    overflow: hidden;
    opacity: 0;
    transition: max-height .35s ease, opacity .25s ease, padding .25s ease;
    background: #fafbfc;
    border-top: 0 solid #eef1f5;
    border-radius: 0 0 .75rem .75rem;
    margin-top: 0;
    padding: 0 .75rem;
}
.question-detail.open {
    max-height: 400px;
    overflow-y: auto;
    opacity: 1;
    border-top-width: 1px;
    padding: .75rem;
}

.qdetail-enonce {
    font-size: .85rem;
    font-weight: 600;
    line-height: 1.5;
    color: #1a1a2e;
    margin-bottom: .65rem;
    padding: .5rem .65rem;
    background: #fff;
    border-left: 3px solid var(--aws-orange);
    border-radius: 0 .5rem .5rem 0;
}

.qdetail-label {
    font-size: .78rem;
    font-weight: 700;
    color: #2e7d32;
    margin-bottom: .35rem;
}

.qdetail-answers {
    display: flex;
    flex-direction: column;
    gap: .25rem;
}

.qdetail-answer {
    display: inline-block;
    font-size: .82rem;
    padding: .35rem .6rem;
    background: #e8f5e9;
    color: #1b5e20;
    border-radius: .5rem;
    border: 1px solid #c8e6c9;
    line-height: 1.4;
}

/* Suppression des anciennes classes .stat (remplacées ci-dessus) */

/* Responsive — petits écrans (smartphones) */
@media (max-width: 576px) {
    .chrono { font-size: 1.5rem; }
    .q-enonce { font-size: 1rem; }
    .admin-panel { padding: 1rem; }
    .admin-stat { padding: .4rem .6rem; }
    .admin-stat-val { font-size: 1.1rem; }
    .admin-btn { font-size: .82rem; padding: .5rem .75rem; }
    .navbar-brand { font-size: 1rem; }
    #view-lobby .card-body { padding: 1rem !important; }
}

/* État désactivé (spinner) */
.btn:disabled { pointer-events: none; opacity: .7; }

.badge-level { letter-spacing: .5px; }
.badge-standard { background-color: #2e7d32; }
.badge-difficile { background-color: #ef6c00; }
.badge-extreme  { background-color: #c62828; }

/* Classement */
.result-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: .6rem .75rem;
    border-bottom: 1px solid #f0f0f0;
    transition: background .15s;
}
.result-row:last-child { border-bottom: none; }
.result-row:hover { background: #f8f9fb; }

.result-row-me {
    background: #f0f4ff !important;
    border-radius: .5rem;
    margin: .25rem 0;
}

.result-left {
    display: flex;
    align-items: center;
    gap: .75rem;
}

.result-rank {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: #e9ecef;
    font-size: .82rem;
    font-weight: 700;
    color: #555;
    flex-shrink: 0;
}

.result-name {
    font-weight: 700;
}

.result-right {
    display: flex;
    align-items: center;
}

.result-score {
    font-weight: 800;
    font-size: 1rem;
}

.score-green  { color: #2e7d32; }
.score-orange { color: #ef6c00; }
.score-red    { color: #c62828; }

/* Stats cards (results) */
.stat-card {
    text-align: center;
    background: #f8f9fb;
    border-radius: .75rem;
    padding: .75rem .5rem;
}
.stat-val-lg {
    font-size: 1.5rem;
    font-weight: 800;
    color: #1a1a2e;
}
.stat-card .stat-lbl {
    font-size: .78rem;
    color: #888;
    margin-top: .15rem;
}
