/* ==========================================================================
   ChemLabX 3.0 — Stylesheet
   المعمل الافتراضي المتطور
   ========================================================================== */

/* ========== QUIZ MODAL ========== */
/* ========== QUIZ MODAL ========== */
.quiz-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.9);
    backdrop-filter: blur(20px) saturate(180%);
    z-index: 3000;
    display: none;
    align-items: center;
    justify-content: center;
    animation: quiz-bg-in 0.4s ease;
}
.quiz-overlay.active { display: flex; }
@keyframes quiz-bg-in {
    from { opacity: 0; }
    to { opacity: 1; }
}

.quiz-container {
    background: var(--bg-secondary);
    border-radius: 24px;
    border: 1px solid var(--glass-border);
    width: 95%;
    max-width: 600px;
    max-height: 90vh;
    overflow: hidden;
    box-shadow: 0 50px 120px rgba(0,0,0,0.9), 0 0 80px rgba(var(--accent-purple-rgb),0.15);
    animation: quiz-in 0.6s cubic-bezier(0.34, 1.56, 0.64, 1);
    position: relative;
}
@keyframes quiz-in {
    from { transform: scale(0.8) translateY(40px); opacity: 0; }
    to { transform: scale(1) translateY(0); opacity: 1; }
}

.quiz-header {
    background: linear-gradient(135deg, rgba(var(--accent-purple-rgb),0.2), rgba(var(--accent-pink-rgb),0.15));
    padding: 28px 32px;
    border-bottom: 1px solid var(--glass-border);
    position: relative;
    overflow: hidden;
}
.quiz-header::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 100%;
    background: url("data:image/svg+xml,%3Csvg width='60' height='60' viewBox='0 0 60 60' xmlns='http://www.w3.org/2000/svg'%3E%3Cg fill='none' fill-rule='evenodd'%3E%3Cg fill='%23a87bff' fill-opacity='0.05'%3E%3Cpath d='M36 34v-4h-2v4h-4v2h4v4h2v-4h4v-2h-4zm0-30V0h-2v4h-4v2h4v4h2V6h4V4h-4zM6 34v-4H4v4H0v2h4v4h2v-4h4v-2H6zM6 4V0H4v4H0v2h4v4h2V6h4V4H6z'/%3E%3C/g%3E%3C/g%3E%3C/svg%3E");
    pointer-events: none;
}
.quiz-header h1,
.quiz-header h2 {
    font-size: 22px;
    font-weight: 800;
    margin: 0 0 16px 0;
    display: flex;
    align-items: center;
    gap: 12px;
    position: relative;
}
.quiz-close {
    position: absolute;
    top: 0;
    left: 0;
    background: var(--bg-card);
    border: 1px solid var(--glass-border);
    color: var(--text-primary);
    width: 36px;
    height: 36px;
    border-radius: 10px;
    cursor: pointer;
    font-size: 18px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition);
}
.quiz-close:hover {
    background: var(--accent-red);
    border-color: var(--accent-red);
    transform: scale(1.1);
}

.quiz-progress {
    display: flex;
    gap: 6px;
    position: relative;
}
.quiz-progress-dot {
    flex: 1;
    height: 6px;
    border-radius: 3px;
    background: var(--border-glass);
    transition: var(--transition);
    overflow: hidden;
}
.quiz-progress-dot::after {
    content: '';
    display: block;
    width: 0;
    height: 100%;
    background: var(--accent-green);
    border-radius: 3px;
    transition: width 0.5s ease;
}
.quiz-progress-dot.done::after { width: 100%; }
.quiz-progress-dot.current::after { 
    width: 50%; 
    background: linear-gradient(90deg, var(--accent-green), var(--accent-blue));
    animation: progress-pulse 1.5s infinite;
}
.quiz-progress-dot.wrong::after { width: 100%; background: var(--accent-red); }
@keyframes progress-pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.6; }
}

.quiz-stats {
    display: flex;
    justify-content: space-between;
    margin-top: 14px;
    position: relative;
}
.quiz-stat {
    text-align: center;
}
.quiz-stat-value {
    font-size: 20px;
    font-weight: 800;
    font-family: var(--font-mono);
    color: var(--accent-green);
}
.quiz-stat-label {
    font-size: 10px;
    color: var(--text-secondary);
    margin-top: 2px;
}

.quiz-body {
    padding: 32px;
    min-height: 300px;
}

.quiz-question-number {
    font-size: 12px;
    font-weight: 700;
    color: var(--accent-purple);
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-bottom: 12px;
}

.quiz-question {
    font-size: 18px;
    font-weight: 700;
    line-height: 1.6;
    margin-bottom: 28px;
    color: var(--text-primary);
}

.quiz-options {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.quiz-option {
    background: var(--bg-card);
    border: 2px solid var(--glass-border);
    border-radius: 14px;
    padding: 16px 20px;
    cursor: pointer;
    transition: var(--transition);
    display: flex;
    align-items: center;
    gap: 14px;
    width: 100%;
    color: var(--text-primary);
    font-family: var(--font-arabic);
    font-size: 15px;
    font-weight: 600;
    text-align: start;
    position: relative;
    overflow: hidden;
}
.quiz-option::before {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(135deg, rgba(var(--accent-purple-rgb),0.1), rgba(var(--accent-blue-rgb),0.1));
    opacity: 0;
    transition: opacity 0.3s;
}
.quiz-option:hover::before { opacity: 1; }
.quiz-option:hover {
    border-color: var(--accent-purple);
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(var(--accent-purple-rgb),0.2);
}
.quiz-option-letter {
    width: 32px;
    height: 32px;
    border-radius: 10px;
    background: rgba(var(--accent-purple-rgb),0.15);
    color: var(--accent-purple);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 800;
    font-size: 14px;
    flex-shrink: 0;
    position: relative;
    z-index: 1;
    transition: var(--transition);
}
.quiz-option:hover .quiz-option-letter {
    background: var(--accent-purple);
    color: var(--on-bright);
}
.quiz-option-text {
    flex: 1;
    position: relative;
    z-index: 1;
}

.quiz-option.correct {
    border-color: var(--accent-green) !important;
    background: rgba(var(--accent-green-rgb),0.1);
    animation: option-correct 0.5s ease;
}
.quiz-option.correct .quiz-option-letter {
    background: var(--accent-green);
    color: var(--on-bright);
}
.quiz-option.wrong {
    border-color: var(--accent-red) !important;
    background: rgba(var(--accent-red-rgb),0.1);
    animation: option-wrong 0.5s ease;
}
.quiz-option.wrong .quiz-option-letter {
    background: var(--accent-red);
    color: var(--on-bright);
}
.quiz-option.disabled {
    pointer-events: none;
    opacity: 1;
}
.quiz-option[aria-disabled="true"] {
    pointer-events: none;
}
.quiz-option:disabled { cursor: default; }
@keyframes option-correct {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.02); }
}
@keyframes option-wrong {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-5px); }
    75% { transform: translateX(5px); }
}

.quiz-footer {
    padding: 20px 32px;
    border-top: 1px solid var(--glass-border);
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: var(--bg-subtle);
}

.quiz-timer {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
    font-weight: 600;
    color: var(--text-secondary);
}
.quiz-timer-icon {
    font-size: 18px;
    animation: timer-tick 1s infinite;
}
@keyframes timer-tick {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.1); }
}

.quiz-next-btn {
    background: linear-gradient(135deg, var(--accent-purple), var(--accent-pink));
    border: none;
    color: var(--on-bright);
    padding: 12px 28px;
    border-radius: 12px;
    font-weight: 700;
    font-size: 14px;
    cursor: pointer;
    transition: var(--transition);
    font-family: var(--font-arabic);
    box-shadow: 0 4px 20px rgba(var(--accent-purple-rgb),0.3);
    min-width: 140px;
}
.quiz-next-btn:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 8px 30px rgba(var(--accent-purple-rgb),0.5);
}
.quiz-next-btn:disabled {
    opacity: 1;
    background: var(--bg-card);
    color: var(--text-secondary);
    box-shadow: none;
    cursor: not-allowed;
    transform: none;
}
.quiz-next-btn:not(:disabled) {
    animation: countdownPulse 1s ease-in-out infinite;
}
@keyframes countdownPulse {
    0%, 100% { box-shadow: 0 4px 20px rgba(var(--accent-purple-rgb),0.3); }
    50% { box-shadow: 0 4px 30px rgba(var(--accent-red-rgb),0.5); }
}

/* Quiz Result */
.quiz-result {
    text-align: center;
    padding: 40px 32px;
}
.quiz-result-icon {
    font-size: 80px;
    margin-bottom: 20px;
    animation: result-bounce 1s cubic-bezier(0.34, 1.56, 0.64, 1);
}
@keyframes result-bounce {
    0% { transform: scale(0) rotate(-180deg); }
    60% { transform: scale(1.2) rotate(10deg); }
    100% { transform: scale(1) rotate(0deg); }
}
.quiz-result-title {
    font-size: 28px;
    font-weight: 900;
    margin-bottom: 10px;
    background: linear-gradient(135deg, var(--accent-green), var(--accent-blue));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}
.quiz-result-score {
    font-size: 48px;
    font-weight: 900;
    font-family: var(--font-mono);
    color: var(--accent-purple);
    text-shadow: 0 0 30px rgba(var(--accent-purple-rgb),0.4);
    margin: 20px 0;
}
.quiz-result-details {
    font-size: 14px;
    color: var(--text-secondary);
    margin-bottom: 30px;
    line-height: 1.8;
}
.quiz-result-xp {
    display: inline-block;
    background: linear-gradient(135deg, rgba(var(--accent-purple-rgb),0.2), rgba(var(--accent-pink-rgb),0.2));
    border: 1px solid rgba(var(--accent-purple-rgb),0.3);
    border-radius: 30px;
    padding: 12px 32px;
    font-size: 18px;
    font-weight: 800;
    color: var(--accent-purple);
    margin-bottom: 30px;
}
.quiz-result-buttons {
    display: flex;
    gap: 12px;
    justify-content: center;
}
.quiz-result-btn {
    padding: 14px 32px;
    border-radius: 14px;
    font-weight: 700;
    font-size: 15px;
    cursor: pointer;
    transition: var(--transition);
    font-family: var(--font-arabic);
    border: none;
}
.quiz-result-btn.primary {
    background: linear-gradient(135deg, var(--accent-green), var(--accent-teal));
    color: var(--on-primary);
    box-shadow: 0 4px 20px rgba(var(--accent-green-rgb),0.3);
}
.quiz-result-btn.primary:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 30px rgba(var(--accent-green-rgb),0.5);
}
.quiz-result-btn.secondary {
    background: var(--bg-card);
    border: 1px solid var(--glass-border);
    color: var(--text-primary);
}
.quiz-result-btn.secondary:hover {
    background: var(--bg-hover);
    transform: translateY(-2px);
}

/* ======================================================================
   ChemLabX 4.0 — STANDALONE QUIZ PAGE
   ====================================================================== */
.quiz-page {
    display: flex;
    align-items: flex-start;
    justify-content: center;
    padding: 40px 16px 60px;
    min-height: calc(100vh - 80px);
}
.quiz-page .quiz-container {
    width: 100%;
    max-width: 640px;
    box-shadow: 0 24px 70px rgba(0, 0, 0, 0.45);
}
.quiz-idle {
    text-align: center;
    padding: 30px 20px 10px;
}
.quiz-idle-icon {
    font-size: 54px;
    margin-bottom: 10px;
    animation: quiz-idle-float 3s ease-in-out infinite;
}
@keyframes quiz-idle-float {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-10px); }
}
.quiz-idle h3 {
    font-size: 20px;
    margin-bottom: 8px;
    color: var(--text-primary);
}
.quiz-idle p {
    font-size: 14px;
    color: var(--text-secondary);
    line-height: 1.8;
    max-width: 420px;
    margin: 0 auto 20px;
}
.quiz-start-btn {
    background: linear-gradient(135deg, var(--accent-green), var(--accent-blue));
    color: var(--on-primary);
    border: none;
    border-radius: 12px;
    padding: 13px 34px;
    font-size: 15px;
    font-weight: 700;
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s;
    box-shadow: 0 8px 24px rgba(var(--accent-green-rgb), 0.35);
}
.quiz-start-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 12px 30px rgba(var(--accent-green-rgb), 0.45);
}
.quiz-best {
    margin-top: 14px;
    font-size: 13px;
    color: var(--accent-purple);
    font-weight: 600;
}
.quiz-cat {
    font-size: 11px;
    background: rgba(var(--accent-purple-rgb), 0.15);
    color: var(--accent-purple);
    padding: 2px 10px;
    border-radius: 20px;
    margin-inline-start: 6px;
}
.quiz-header h1,
.quiz-header h2 {
    font-size: 20px;
}
