/* ============================================================
   ACADEMY QUIZ PLAYER — Styles
   Modal QCM AI-generated pour Giri Academy
   ============================================================ */

/* Keyframes */
@keyframes aqp-overlay-in {
    from { opacity: 0; }
    to   { opacity: 1; }
}
@keyframes aqp-modal-in {
    from { transform: translateY(24px) scale(0.97); opacity: 0; }
    to   { transform: translateY(0) scale(1); opacity: 1; }
}
@keyframes aqp-spin {
    to { transform: rotate(360deg); }
}
@keyframes aqp-fall {
    0%   { transform: translateY(-10px) rotate(0deg); opacity: 1; }
    100% { transform: translateY(110vh) rotate(720deg); opacity: 0; }
}
@keyframes aqp-progress {
    from { width: 0; }
}
@keyframes aqp-score-fill {
    from { width: 0; }
}

/* Overlay */
.aqp-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.7);
    backdrop-filter: blur(6px);
    z-index: 9100;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 16px;
    animation: aqp-overlay-in 0.2s ease;
}

/* Modal */
.aqp-modal {
    background: var(--bg-card, #1e1e2e);
    border: 1px solid var(--border, rgba(255,255,255,0.1));
    border-radius: 20px;
    width: 100%;
    max-width: 600px;
    max-height: 90vh;
    overflow: hidden;
    box-shadow: 0 32px 80px rgba(0,0,0,0.5);
    animation: aqp-modal-in 0.3s cubic-bezier(0.34,1.56,0.64,1);
}

.aqp-modal-inner {
    display: flex;
    flex-direction: column;
    max-height: 90vh;
    overflow: hidden;
}

/* Header */
.aqp-header {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 20px 24px 16px;
    border-bottom: 1px solid var(--border, rgba(255,255,255,0.08));
    flex-shrink: 0;
}

.aqp-header-icon {
    font-size: 28px;
    line-height: 1;
    flex-shrink: 0;
}

.aqp-title {
    font-size: 16px;
    font-weight: 700;
    color: var(--text-primary, #f0f0f0);
    margin: 0;
}

.aqp-subtitle {
    font-size: 12px;
    color: var(--text-muted, #888);
    margin: 2px 0 0;
}

.aqp-close {
    margin-left: auto;
    background: transparent;
    border: none;
    color: var(--text-muted, #888);
    cursor: pointer;
    font-size: 16px;
    padding: 4px 8px;
    border-radius: 6px;
    transition: transform 0.15s ease-out, background 0.15s ease-out, border-color 0.15s ease-out, color 0.15s ease-out, opacity 0.15s ease-out;
    flex-shrink: 0;
}
.aqp-close:hover { background: rgba(255,255,255,0.08); color: var(--text-primary, #f0f0f0); }

/* Loading */
.aqp-loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 16px;
    padding: 60px 24px;
}

.aqp-spinner {
    width: 40px;
    height: 40px;
    border: 3px solid rgba(255,255,255,0.1);
    border-top-color: var(--accent, #6366f1);
    border-radius: 50%;
    animation: aqp-spin 0.8s linear infinite;
}

.aqp-loading-text {
    font-size: 15px;
    font-weight: 600;
    color: var(--text-primary, #f0f0f0);
    margin: 0;
}

.aqp-loading-sub {
    font-size: 13px;
    color: var(--text-muted, #888);
    margin: 0;
    text-align: center;
}

/* Intro body */
.aqp-intro-body {
    padding: 24px;
    display: flex;
    flex-direction: column;
    gap: 20px;
    overflow-y: auto;
}

.aqp-best-score {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 16px;
    border-radius: 12px;
    font-size: 13px;
    font-weight: 500;
}

.aqp-best--pass {
    background: rgba(16, 185, 129, 0.12);
    border: 1px solid rgba(16, 185, 129, 0.25);
    color: #10b981;
}

.aqp-best--fail {
    background: rgba(245, 158, 11, 0.1);
    border: 1px solid rgba(245, 158, 11, 0.2);
    color: var(--text-primary, #f0f0f0);
}

.aqp-best-icon { font-size: 16px; }
.aqp-badge-pass {
    margin-left: auto;
    background: #10b981;
    color: white;
    font-size: 11px;
    padding: 2px 8px;
    border-radius: 20px;
    font-weight: 600;
}

.aqp-intro-info {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.aqp-info-item {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 13px;
    color: var(--text-secondary, #ccc);
}

.aqp-info-icon { font-size: 16px; }

.aqp-intro-actions {
    display: flex;
    gap: 10px;
    align-items: center;
}

.aqp-btn-start {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px 24px;
    background: var(--accent, #6366f1);
    color: white;
    border: none;
    border-radius: 12px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: transform 0.2s ease-out, background 0.2s ease-out, border-color 0.2s ease-out, color 0.2s ease-out, opacity 0.2s ease-out;
    flex: 1;
    justify-content: center;
}
.aqp-btn-start:hover { background: var(--accent-hover, #4f46e5); transform: translateY(-1px); }

.aqp-btn-regen {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 12px 16px;
    background: transparent;
    color: var(--text-muted, #888);
    border: 1px solid var(--border, rgba(255,255,255,0.1));
    border-radius: 12px;
    font-size: 13px;
    cursor: pointer;
    transition: transform 0.2s ease-out, background 0.2s ease-out, border-color 0.2s ease-out, color 0.2s ease-out, opacity 0.2s ease-out;
    white-space: nowrap;
}
.aqp-btn-regen:hover { border-color: var(--accent, #6366f1); color: var(--accent, #6366f1); }
.aqp-btn-regen:disabled { opacity: 0.5; cursor: not-allowed; }

/* Question view */
.aqp-question-view {
    display: flex;
    flex-direction: column;
    height: 100%;
}

/* Progress bar */
.aqp-progress-wrap {
    flex: 1;
    height: 4px;
    background: rgba(255,255,255,0.08);
    border-radius: 2px;
    overflow: hidden;
}

.aqp-progress-bar {
    height: 100%;
    background: var(--accent, #6366f1);
    border-radius: 2px;
    transition: width 0.3s ease;
    animation: aqp-progress 0.3s ease;
}

.aqp-header-meta {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-shrink: 0;
}

.aqp-q-counter {
    font-size: 12px;
    color: var(--text-muted, #888);
    white-space: nowrap;
}

.aqp-question-body {
    padding: 28px 24px 16px;
    flex: 1;
    overflow-y: auto;
}

.aqp-question-text {
    font-size: 17px;
    font-weight: 600;
    color: var(--text-primary, #f0f0f0);
    line-height: 1.5;
    margin-bottom: 24px;
}

.aqp-options {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.aqp-option {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 16px;
    background: rgba(255,255,255,0.04);
    border: 1.5px solid rgba(255,255,255,0.08);
    border-radius: 12px;
    text-align: left;
    cursor: pointer;
    transition: transform 0.15s ease-out, background 0.15s ease-out, border-color 0.15s ease-out, color 0.15s ease-out, opacity 0.15s ease-out;
    color: var(--text-secondary, #ccc);
    font-size: 14px;
}
.aqp-option:hover {
    background: rgba(99,102,241,0.08);
    border-color: var(--accent, #6366f1);
    color: var(--text-primary, #f0f0f0);
}
.aqp-option--selected {
    background: rgba(99,102,241,0.15);
    border-color: var(--accent, #6366f1);
    color: var(--text-primary, #f0f0f0);
}

.aqp-opt-letter {
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(255,255,255,0.06);
    border-radius: 50%;
    font-size: 12px;
    font-weight: 700;
    flex-shrink: 0;
    transition: transform 0.15s ease-out, background 0.15s ease-out, border-color 0.15s ease-out, color 0.15s ease-out, opacity 0.15s ease-out;
}
.aqp-option--selected .aqp-opt-letter {
    background: var(--accent, #6366f1);
    color: white;
}

.aqp-opt-text { flex: 1; line-height: 1.4; }

/* Footer nav */
.aqp-question-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 24px 20px;
    border-top: 1px solid rgba(255,255,255,0.06);
    flex-shrink: 0;
}

.aqp-btn-nav {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 10px 20px;
    border-radius: 10px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: transform 0.2s ease-out, background 0.2s ease-out, border-color 0.2s ease-out, color 0.2s ease-out, opacity 0.2s ease-out;
    border: 1.5px solid;
}

.aqp-btn-prev {
    background: transparent;
    border-color: rgba(255,255,255,0.12);
    color: var(--text-muted, #888);
}
.aqp-btn-prev:hover { border-color: rgba(255,255,255,0.25); color: var(--text-primary, #f0f0f0); }

.aqp-btn-next {
    background: var(--accent, #6366f1);
    border-color: var(--accent, #6366f1);
    color: white;
}
.aqp-btn-next:hover:not(:disabled) { background: var(--accent-hover, #4f46e5); transform: translateY(-1px); }
.aqp-btn--disabled, .aqp-btn-next:disabled {
    opacity: 0.35;
    cursor: not-allowed;
    pointer-events: none;
}

/* Results */
.aqp-results-body {
    padding: 24px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.aqp-score-ring {
    display: flex;
    justify-content: center;
}

.aqp-score-circle {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    width: 120px;
    height: 120px;
    border-radius: 50%;
    border: 6px solid;
    gap: 4px;
}

.aqp-score--pass .aqp-score-circle { border-color: #10b981; }
.aqp-score--fail .aqp-score-circle { border-color: #f59e0b; }

.aqp-score-pct {
    font-size: 28px;
    font-weight: 800;
    line-height: 1;
}
.aqp-score--pass .aqp-score-pct { color: #10b981; }
.aqp-score--fail .aqp-score-pct { color: #f59e0b; }

.aqp-score-label {
    font-size: 11px;
    color: var(--text-muted, #888);
    text-align: center;
}

/* Score bar */
.aqp-score-bar-wrap { display: flex; flex-direction: column; gap: 6px; }

.aqp-score-bar {
    position: relative;
    height: 8px;
    background: rgba(255,255,255,0.06);
    border-radius: 4px;
    overflow: visible;
}

.aqp-score-fill {
    height: 100%;
    border-radius: 4px;
    animation: aqp-score-fill 0.8s ease;
    transition: width 0.8s ease;
}
.aqp-fill--pass { background: #10b981; }
.aqp-fill--fail { background: #f59e0b; }

.aqp-score-threshold {
    position: absolute;
    top: -4px;
    width: 2px;
    height: 16px;
    background: rgba(255,255,255,0.4);
    border-radius: 1px;
    transform: translateX(-50%);
}

.aqp-score-labels {
    display: flex;
    justify-content: space-between;
    font-size: 11px;
    color: var(--text-muted, #888);
}
.aqp-threshold-label { color: rgba(255,255,255,0.4); }

/* Answers review */
.aqp-answers-review {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.aqp-review-item {
    padding: 12px 14px;
    border-radius: 10px;
    border: 1px solid;
}

.aqp-review--correct {
    background: rgba(16, 185, 129, 0.06);
    border-color: rgba(16, 185, 129, 0.2);
}
.aqp-review--wrong {
    background: rgba(239, 68, 68, 0.06);
    border-color: rgba(239, 68, 68, 0.2);
}

.aqp-review-q {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    font-size: 13px;
    font-weight: 500;
    color: var(--text-primary, #f0f0f0);
}
.aqp-review-icon { flex-shrink: 0; }
.aqp-review-qtext { line-height: 1.4; }

.aqp-review-answer {
    margin-top: 8px;
    padding-left: 24px;
    display: flex;
    flex-direction: column;
    gap: 4px;
    font-size: 12px;
}

.aqp-review-your, .aqp-review-correct { color: var(--text-muted, #aaa); }
.aqp-ans--wrong { color: #ef4444; }
.aqp-ans--right { color: #10b981; }
.aqp-review-expl { color: var(--text-muted, #888); font-style: italic; margin-top: 2px; }

/* Results actions */
.aqp-results-actions {
    display: flex;
    gap: 10px;
    padding-top: 4px;
}

.aqp-btn-retry {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 10px 20px;
    background: transparent;
    border: 1.5px solid rgba(255,255,255,0.12);
    border-radius: 10px;
    color: var(--text-muted, #888);
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: transform 0.2s ease-out, background 0.2s ease-out, border-color 0.2s ease-out, color 0.2s ease-out, opacity 0.2s ease-out;
}
.aqp-btn-retry:hover { border-color: var(--accent, #6366f1); color: var(--accent, #6366f1); }

.aqp-btn-close-final {
    flex: 1;
    padding: 10px 20px;
    background: var(--accent, #6366f1);
    border: none;
    border-radius: 10px;
    color: white;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: transform 0.2s ease-out, background 0.2s ease-out, border-color 0.2s ease-out, color 0.2s ease-out, opacity 0.2s ease-out;
}
.aqp-btn-close-final:hover { background: var(--accent-hover, #4f46e5); }

/* Hover action button for quiz on formation card */
.fcha-btn[title="Quiz IA"] {
    color: var(--text-muted, #aaa);
}
.fcha-btn[title="Quiz IA"]:hover {
    color: #f59e0b;
    background: rgba(245, 158, 11, 0.12);
}
