/* =====================================================
   QUIZ MODE CARD STYLES
   Interactive MCQ quiz with instant feedback
   ===================================================== */

.quiz-card {
    background: linear-gradient(135deg, rgba(30, 15, 50, 0.95) 0%, rgba(15, 10, 35, 0.98) 100%);
    border: 2px solid rgba(138, 43, 226, 0.3);
    border-radius: 20px;
    padding: 32px;
    margin: 20px 0;
    box-shadow: 0 12px 40px rgba(138, 43, 226, 0.2);
    animation: slideInQuiz 0.6s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

@keyframes slideInQuiz {
    from {
        opacity: 0;
        transform: translateY(30px) scale(0.95);
    }

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

/* Header Section */
.quiz-header {
    margin-bottom: 28px;
    padding-bottom: 20px;
    border-bottom: 2px solid rgba(138, 43, 226, 0.3);
}

.quiz-topic {
    display: inline-block;
    background: rgba(138, 43, 226, 0.2);
    color: #a78bfa;
    padding: 6px 14px;
    border-radius: 20px;
    font-size: 0.85rem;
    font-weight: 600;
    margin-bottom: 14px;
    letter-spacing: 0.3px;
}

.quiz-question {
    font-size: 1.3rem;
    color: #ffffff;
    font-weight: 600;
    line-height: 1.6;
    margin: 0;
    text-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}

/* Options Section */
.quiz-options {
    display: flex;
    flex-direction: column;
    gap: 14px;
    margin-bottom: 24px;
}

.quiz-option {
    background: rgba(255, 255, 255, 0.05);
    border: 2px solid rgba(255, 255, 255, 0.1);
    border-radius: 12px;
    padding: 18px 20px;
    color: #e0e0e0;
    font-size: 1.05rem;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.25, 0.46, 0.45, 0.94);
    position: relative;
    overflow: hidden;
}

.quiz-option::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.1), transparent);
    transition: left 0.5s;
}

.quiz-option:hover::before {
    left: 100%;
}

.quiz-option:hover {
    background: rgba(138, 43, 226, 0.15);
    border-color: rgba(138, 43, 226, 0.5);
    transform: translateX(8px);
    box-shadow: 0 4px 16px rgba(138, 43, 226, 0.2);
}

.quiz-option.selected {
    background: rgba(138, 43, 226, 0.25);
    border-color: #a78bfa;
    transform: scale(1.02);
}

.quiz-option.correct {
    background: linear-gradient(135deg, rgba(16, 185, 129, 0.2), rgba(5, 150, 105, 0.3));
    border-color: #10b981;
    animation: correctPulse 0.6s ease-out;
}

@keyframes correctPulse {

    0%,
    100% {
        transform: scale(1);
    }

    50% {
        transform: scale(1.05);
    }
}

.quiz-option.correct::after {
    content: '✓';
    position: absolute;
    right: 20px;
    top: 50%;
    transform: translateY(-50%);
    color: #10b981;
    font-size: 1.8rem;
    font-weight: bold;
    animation: checkmarkPop 0.4s cubic-bezier(0.68, -0.55, 0.265, 1.55);
}

@keyframes checkmarkPop {
    0% {
        transform: translateY(-50%) scale(0);
        opacity: 0;
    }

    100% {
        transform: translateY(-50%) scale(1);
        opacity: 1;
    }
}

.quiz-option.wrong {
    background: linear-gradient(135deg, rgba(239, 68, 68, 0.2), rgba(220, 38, 38, 0.3));
    border-color: #ef4444;
    animation: wrongShake 0.5s;
}

@keyframes wrongShake {

    0%,
    100% {
        transform: translateX(0);
    }

    25% {
        transform: translateX(-10px);
    }

    75% {
        transform: translateX(10px);
    }
}

.quiz-option.wrong::after {
    content: '✗';
    position: absolute;
    right: 20px;
    top: 50%;
    transform: translateY(-50%);
    color: #ef4444;
    font-size: 1.8rem;
    font-weight: bold;
    animation: crossPop 0.4s cubic-bezier(0.68, -0.55, 0.265, 1.55);
}

@keyframes crossPop {
    0% {
        transform: translateY(-50%) scale(0) rotate(-180deg);
        opacity: 0;
    }

    100% {
        transform: translateY(-50%) scale(1) rotate(0deg);
        opacity: 1;
    }
}

.quiz-option.disabled {
    cursor: not-allowed;
    opacity: 0.6;
}

.quiz-explanation {
    background: rgba(59, 130, 246, 0.1);
    border-left: 4px solid #3b82f6;
    border-radius: 8px;
    padding: 18px 20px;
    margin-top: 20px;
    animation: fadeInUp 0.5s ease-out;
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(15px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.quiz-explanation-title {
    color: #60a5fa;
    font-size: 0.9rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-bottom: 10px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.quiz-explanation-title::before {
    content: '💡';
    font-size: 1.2rem;
}

.quiz-explanation-text {
    color: #d1d5db;
    font-size: 1rem;
    line-height: 1.7;
    margin: 0;
}

.quiz-next-btn {
    background: linear-gradient(135deg, #8b5cf6 0%, #6d28d9 100%);
    color: white;
    border: none;
    border-radius: 10px;
    padding: 14px 32px;
    font-size: 1.05rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 16px rgba(139, 92, 246, 0.4);
    margin-top: 24px;
    width: 100%;
}

.quiz-next-btn:hover {
    background: linear-gradient(135deg, #7c3aed 0%, #5b21b6 100%);
    transform: translateY(-2px);
    box-shadow: 0 6px 24px rgba(139, 92, 246, 0.5);
}

/* =====================================================
   QUIZ SETUP PANEL (VERTICAL DROPDOWNS)
   ===================================================== */

.quiz-setup-panel {
    background: rgba(15, 16, 32, 0.95);
    backdrop-filter: blur(25px);
    border-right: 1px solid rgba(138, 43, 226, 0.3);
    width: 320px;
    height: 100%;
    position: absolute;
    left: 0;
    top: 0;
    z-index: 100;
    padding: 30px 20px;
    display: flex;
    flex-direction: column;
    gap: 25px;
    transition: transform 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 10px 0 30px rgba(0, 0, 0, 0.5);
}

.quiz-setup-panel.hidden {
    transform: translateX(-100%);
    pointer-events: none;
}

.setup-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.setup-group label {
    color: #a78bfa;
    font-size: 0.9rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 8px;
    letter-spacing: 0.5px;
}

.setup-group select {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 12px;
    padding: 14px;
    color: #ffffff;
    font-size: 1rem;
    font-family: 'Outfit', sans-serif;
    cursor: pointer;
    transition: all 0.3s ease;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 24 24' stroke='white'%3E%3Cpath stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M19 9l-7 7-7-7'%3E%3C/path%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 14px center;
    background-size: 16px;
}

.setup-group select:hover {
    background-color: rgba(138, 43, 226, 0.1);
    border-color: rgba(138, 43, 226, 0.5);
}

.setup-group select:focus {
    outline: none;
    border-color: #8b5cf6;
    box-shadow: 0 0 0 3px rgba(139, 92, 246, 0.2);
}

.start-quiz-btn {
    display: flex;
    /* Ensure visible */
    width: 100%;
    margin-top: auto;
    background: linear-gradient(135deg, #8b5cf6 0%, #6d28d9 100%);
    color: white;
    border: none;
    border-radius: 12px;
    padding: 16px;
    font-size: 1.1rem;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    display: none;
    /* User requested instant start upon selection */
    align-items: center;
    justify-content: center;
    gap: 10px;
    box-shadow: 0 4px 15px rgba(139, 92, 246, 0.3);
}

.start-quiz-btn:hover:not(:disabled) {
    transform: translateY(-3px);
    box-shadow: 0 8px 25px rgba(139, 92, 246, 0.5);
}

.start-quiz-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    filter: grayscale(1);
}

/* Interactive Selection Chips (STILL USED FOR MCQ) */
.quiz-chips-container {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 15px;
    padding: 5px;
}

.quiz-chip {
    background: rgba(255, 255, 255, 0.07);
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 25px;
    padding: 10px 20px;
    color: #f0f0f0;
    font-size: 0.95rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    backdrop-filter: blur(10px);
}

.quiz-chip:hover {
    background: rgba(138, 43, 226, 0.3);
    border-color: rgba(138, 43, 226, 0.6);
    transform: translateY(-2px);
}

@media (max-width: 768px) {
    .quiz-setup-panel {
        width: 100%;
        height: auto;
        left: 0;
        bottom: 0;
        top: auto;
        transform: translateY(100%);
        border-right: none;
        border-top: 1px solid rgba(138, 43, 226, 0.3);
    }

    .quiz-setup-panel.hidden {
        transform: translateY(100%) translateX(0);
    }
}

/* ─────────────────────────────────────────────────────────────────
   QUIZ MODE TOGGLE (Header)
   ───────────────────────────────────────────────────────────────── */
.quiz-toggle-container {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-right: 15px;
    padding: 4px 10px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 20px;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.toggle-label {
    font-size: 0.8rem;
    font-weight: 600;
    color: rgba(255, 255, 255, 0.7);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* The switch - the box around the slider */
.switch {
    position: relative;
    display: inline-block;
    width: 34px;
    height: 20px;
}

/* Hide default HTML checkbox */
.switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

/* The slider */
.slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(255, 255, 255, 0.2);
    transition: .4s;
}

.slider:before {
    position: absolute;
    content: "";
    height: 14px;
    width: 14px;
    left: 3px;
    bottom: 3px;
    background-color: white;
    transition: .4s;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

input:checked+.slider {
    background: linear-gradient(135deg, #8a2be2, #4b0082);
}

input:focus+.slider {
    box-shadow: 0 0 1px #8a2be2;
}

input:checked+.slider:before {
    transform: translateX(14px);
}

/* Rounded sliders */
.slider.round {
    border-radius: 20px;
}

.slider.round:before {
    border-radius: 50%;
}

/* Close Button on Quiz Panel */
.close-quiz-btn {
    position: absolute;
    top: 15px;
    right: 15px;
    background: rgba(255, 255, 255, 0.1);
    border: none;
    color: #a78bfa;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10;
}

.close-quiz-btn:hover {
    background: rgba(239, 68, 68, 0.2);
    color: #ef4444;
    transform: rotate(90deg);
}

/* Floating Stop Button */
.quiz-floating-stop-btn {
    position: fixed;
    bottom: 20px;
    right: 20px;
    background: #ef4444;
    color: white;
    border: none;
    padding: 12px 24px;
    border-radius: 30px;
    font-weight: bold;
    box-shadow: 0 4px 15px rgba(239, 68, 68, 0.4);
    cursor: pointer;
    z-index: 1000;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 8px;
    animation: slideInFab 0.5s ease-out;
}

.quiz-floating-stop-btn:hover {
    background: #dc2626;
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(239, 68, 68, 0.6);
}

@keyframes slideInFab {
    from {
        transform: translateY(100px);
        opacity: 0;
    }

    to {
        transform: translateY(0);
        opacity: 1;
    }
}