/* Quiz Taking Page Styles */

/* Quiz Info Section */
.quiz-info-container {
    margin-bottom: var(--space-6);
    animation: fadeIn 0.3s ease;
}

.quiz-info-card {
    background-color: var(--bg-white);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-md);
    overflow: hidden;
}

.quiz-info-header {
    padding: var(--space-6);
    border-bottom: 1px solid var(--border-light);
}

.quiz-info-header h1 {
    margin-bottom: var(--space-2);
}

.quiz-info-content {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-6);
    padding: var(--space-6);
}

.quiz-image-container {
    flex: 1;
    min-width: 300px;
    max-width: 400px;
}

.quiz-image-container img {
    width: 100%;
    height: 240px;
    object-fit: cover;
    border-radius: var(--radius);
}

.quiz-details {
    flex: 2;
    min-width: 300px;
}

.quiz-details p {
    margin-bottom: var(--space-4);
    line-height: 1.6;
    color: var(--text-medium);
}

.quiz-stats {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-6);
    margin-bottom: var(--space-4);
    padding: var(--space-4) 0;
    border-top: 1px solid var(--border-light);
    border-bottom: 1px solid var(--border-light);
}

.stat-item {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    color: var(--text-medium);
}

.stat-item i {
    color: var(--primary-color);
}

.quiz-author {
    font-size: var(--text-sm);
    color: var(--text-medium);
}

.quiz-rules {
    background-color: var(--bg-light);
    padding: var(--space-6);
    border-top: 1px solid var(--border-light);
}

.quiz-rules h3 {
    margin-bottom: var(--space-3);
    color: var(--text-dark);
}

.quiz-rules ul {
    padding-left: var(--space-6);
}

.quiz-rules li {
    margin-bottom: var(--space-2);
    color: var(--text-medium);
}

.quiz-actions {
    display: flex;
    gap: var(--space-4);
    padding: var(--space-6);
    border-top: 1px solid var(--border-light);
    justify-content: flex-end;
}

/* Quiz Content Section */
.quiz-content-container {
    animation: fadeIn 0.3s ease;
    width: 100%;
    max-width: none; /* Removed max-width for full screen feel */
}

.quiz-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: var(--space-6);
    padding: var(--space-4);
    background-color: var(--bg-white);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
}

.quiz-progress {
    display: flex;
    align-items: center;
    gap: var(--space-6);
}

.timer {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    color: var(--text-dark);
    font-weight: 500;
    padding: var(--space-2) var(--space-4);
    background-color: var(--bg-light);
    border-radius: var(--radius);
}

.timer.warning {
    background-color: var(--warning-light);
    color: var(--warning-dark);
}

.timer.danger {
    background-color: var(--error-light);
    color: var(--error);
}

.progress-indicator {
    font-weight: 500;
    color: var(--text-dark);
}

.question-container {
    background-color: var(--bg-white);
    border-radius: var(--radius-lg);
    padding: var(--space-6);
    box-shadow: var(--shadow-md);
    margin-bottom: var(--space-6);
}

.question-text {
    margin-bottom: var(--space-6);
}

.question-text h3 {
    font-size: var(--text-xl);
    line-height: 1.4;
}

.options-list {
    display: flex;
    flex-direction: column;
    gap: var(--space-3);
    margin-bottom: var(--space-6);
}

.option-item {
    position: relative;
    padding: var(--space-4);
    background-color: var(--bg-light);
    border: 2px solid var(--border-light);
    border-radius: var(--radius);
    cursor: pointer;
    transition: all 0.2s ease;
}

.option-item:hover {
    background-color: var(--primary-light);
    border-color: var(--primary-light);
}

.option-item.selected {
    background-color: var(--primary-light);
    border-color: var(--primary-color);
    box-shadow: 0 0 0 2px rgba(16, 185, 129, 0.2);
}

.take-quiz-container .option-item input[type="radio"], .quiz-card .take-quiz-container .option-item input[type="radio"], .quiz-card .option-item input[type="radio"] {
    position: absolute;
    opacity: 0;
    width: 0;
    height: 0;
}

.option-item label {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    cursor: pointer;
}

.option-indicator {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    border: 2px solid var(--border-medium);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.option-item.selected .option-indicator {
    border-color: var(--primary-color);
    background-color: var(--primary-color);
    color: white;
}

.option-text {
    flex: 1;
}

.navigation-buttons {
    display: flex;
    justify-content: flex-end;
    gap: var(--space-4);
}

/* Results Section */
.quiz-results-container {
    animation: fadeIn 0.3s ease;
}

.results-card {
    background-color: var(--bg-white);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-md);
    overflow: hidden;
}

.results-header {
    background-color: var(--primary-color);
    color: white;
    padding: var(--space-6);
    text-align: center;
}

.results-icon {
    font-size: 48px;
    margin-bottom: var(--space-3);
}

.score-display {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: center;
    gap: var(--space-6);
    padding: var(--space-6);
    border-bottom: 1px solid var(--border-light);
}

.score-circle {
    width: 140px;
    height: 140px;
    border-radius: 50%;
    border: 10px solid var(--primary-color);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 36px;
    font-weight: 700;
    color: var(--primary-color);
}

.score-details {
    flex: 1;
    min-width: 200px;
}

.score-details p {
    font-size: var(--text-lg);
    margin-bottom: var(--space-2);
}

.time-taken {
    padding: var(--space-4) var(--space-6);
    background-color: var(--bg-light);
    color: var(--text-medium);
    text-align: center;
    font-size: var(--text-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-2);
}

.results-breakdown {
    padding: var(--space-6);
}

.results-breakdown h3 {
    margin-bottom: var(--space-4);
    text-align: center;
}

.breakdown-stats {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: var(--space-4);
}

.breakdown-item {
    width: 100px;
    padding: var(--space-3);
    background-color: var(--bg-light);
    border-radius: var(--radius);
    text-align: center;
}

.breakdown-item .label {
    display: block;
    font-size: var(--text-sm);
    color: var(--text-medium);
    margin-bottom: var(--space-1);
}

.breakdown-item .value {
    font-size: var(--text-xl);
    font-weight: 600;
}

.value.correct {
    color: var(--success);
}

.value.incorrect {
    color: var(--error);
}

.results-actions {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: var(--space-4);
    padding: var(--space-6);
    border-top: 1px solid var(--border-light);
}

.share-btn {
    background-color: #3b5998; /* Facebook blue */
    color: white;
}

.share-btn:hover {
    background-color: #2d4373;
}

/* Login Required and Not Found States */
.login-required, .not-found {
    text-align: center;
    padding: var(--space-8);
    background-color: var(--bg-white);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-md);
}

.login-required i, .not-found i {
    font-size: 64px;
    color: var(--text-light);
    margin-bottom: var(--space-4);
}

.login-required h2, .not-found h2 {
    margin-bottom: var(--space-3);
}

.login-required p, .not-found p {
    margin-bottom: var(--space-6);
    color: var(--text-medium);
    max-width: 500px;
    margin-left: auto;
    margin-right: auto;
}

.login-buttons {
    display: flex;
    justify-content: center;
    gap: var(--space-4);
}

/* Modal Styles */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    z-index: 1000;
    align-items: center;
    justify-content: center;
}

.modal.show {
    display: flex;
}

.modal-content {
    background-color: var(--bg-white);
    border-radius: var(--radius-lg);
    width: 90%;
    max-width: 500px;
    box-shadow: var(--shadow-lg);
    animation: modalOpen 0.3s ease;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: var(--space-4) var(--space-6);
    border-bottom: 1px solid var(--border-light);
}

.modal-body {
    padding: var(--space-6);
}

.modal-footer {
    padding: var(--space-4) var(--space-6);
    border-top: 1px solid var(--border-light);
    display: flex;
    justify-content: flex-end;
    gap: var(--space-3);
}

.close-modal {
    background: none;
    border: none;
    font-size: 24px;
    cursor: pointer;
    color: var(--text-medium);
}

@keyframes modalOpen {
    from {
        opacity: 0;
        transform: translateY(-20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

/* Responsive adjustments */
@media (max-width: 768px) {
    .quiz-info-content {
        flex-direction: column;
    }
    
    .quiz-image-container {
        max-width: none;
    }
    
    .quiz-header {
        flex-direction: column;
        gap: var(--space-3);
        text-align: center;
    }
    
    .quiz-actions, .results-actions {
        flex-direction: column;
    }
    
    .navigation-buttons {
        flex-direction: column;
    }
    
    .score-display {
        flex-direction: column;
        text-align: center;
    }
}

/* --- Styles for Login Required & Quiz Not Found States --- */

/* Base Card Styling for Both States */
.login-required,
.not-found {
    /* Center the card on the page */
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    
    /* Card appearance */
    max-width: 450px; 
    margin: var(--space-10) auto; /* Generous top/bottom margin, and 'auto' for horizontal centering */
    padding: var(--space-8);
    background-color: var(--bg-white);
    border: 1px solid var(--border-medium);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-xl); /* Make it stand out */
    animation: fadeIn 0.5s ease-out; /* Subtle animation for when it appears */
}

/* Common Icon and Text Styling */
.login-required i,
.not-found i {
    font-size: 3rem; /* Large icon size */
    margin-bottom: var(--space-4);
}

.login-required h2,
.not-found h2 {
    margin-bottom: var(--space-3);
    font-size: 1.8rem;
}

.login-required p,
.not-found p {
    margin-bottom: var(--space-6);
    color: var(--text-medium);
}

/* Specific Styles for Login Required (Informational/Primary) */
.login-required i {
    color: var(--primary-color); /* Use primary color for the lock icon */
}

.login-required .login-buttons {
    /* Layout for the Log In and Register buttons */
    display: flex;
    gap: var(--space-4); /* Space between buttons */
}

/* Specific Styles for Quiz Not Found (Error/Warning) */
.not-found i {
    color: var(--error); /* Use error color for the question mark icon */
}

.not-found h2 {
    color: var(--error); /* Highlight the heading as an error state */
}

/* Container for each option row */
.answer-option {
    display: flex;
    align-items: center;
    gap: 15px;
    margin-bottom: 15px;
    background: #1e293b; /* Matches your dark theme */
    padding: 12px 18px;
    border-radius: 10px;
    border: 1px solid #334155;
    transition: all 0.2s ease;
}

.answer-option:hover {
    border-color: #3b82f6;
    background: #243146;
}

/* The Radio Button (Custom Look) */
.answer-option input[type="radio"] {
    width: 20px;
    height: 20px;
    cursor: pointer;
    accent-color: #3b82f6; /* Modern Blue */
}

/* The Text Input Area */
.option-input {
    flex: 1;
    background: transparent !important;
    border: none !important;
    color: #f8fafc !important;
    font-size: 16px !important;
    font-family: 'Inter', sans-serif;
    padding: 8px 0;
    outline: none;
}

.option-input::placeholder {
    color: #64748b;
}

/* The Delete (X) Button */
.remove-option {
    background: transparent;
    border: none;
    color: #64748b;
    font-size: 20px;
    cursor: pointer;
    transition: color 0.2s;
    padding: 5px;
}

.remove-option:hover {
    color: #ef4444; /* Red on hover */
}

/* Add Option Button Styling */
#add-option {
    width: 100%;
    padding: 12px;
    background: transparent;
    border: 2px dashed #334155;
    color: #94a3b8;
    border-radius: 10px;
    font-weight: 600;
    margin-top: 10px;
    cursor: pointer;
    transition: all 0.2s;
}

#add-option:hover {
    border-color: #3b82f6;
    color: #3b82f6;
    background: rgba(59, 130, 246, 0.05);
}


/* REPLACE the old .score-circle block with this NEW one */
.score-circle {
    width: 150px;
    height: 150px;
    border-radius: 50%;
    /* This creates the progress chart */
    background: conic-gradient(#22c55e var(--progress, 0%), #e2e8f0 0deg) !important;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    border: none !important; /* Forces the old border to disappear */
    margin: 0 auto 20px;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
}

/* This creates the white inner circle */
.score-circle::before {
    content: "";
    position: absolute;
    inset: 12px;
    background: #ffffff;
    border-radius: 50%;
    z-index: 1;
}

/* This ensures the text is visible */
.score-circle span,
#score-percentage {
    position: relative;
    z-index: 2;
    font-size: 36px;
    font-weight: 700;
    color: #22c55e;
}

@media (max-width: 992px) {
    .container {
        padding-top: 1px;
        flex-direction: column;
        min-height: auto;
        overflow: visible;
    }
}

/* --- KAHOOT STYLE ANIMATIONS --- */

/* Smooth Circle Transition */
.score-circle {
    transition: background 1.5s cubic-bezier(0.2, 0.8, 0.2, 1);
}

/* Points Pop Effect */
.points-pop-anim {
    animation: popIn 0.6s cubic-bezier(0.175, 0.885, 0.32, 1.275) forwards;
    color: #10B981; /* Primary Green */
    font-weight: 800;
    font-size: 1.5rem;
    display: inline-block;
}

@keyframes popIn {
    0% { opacity: 0; transform: scale(0.5) translateY(20px); }
    100% { opacity: 1; transform: scale(1) translateY(0); }
}

/* Confetti Particles (Generated by JS) */
.confetti {
    position: absolute;
    width: 10px;
    height: 10px;
    background-color: #f00;
    animation: confetti-fall 3s linear forwards;
    z-index: 9999;
}

@keyframes confetti-fall {
    0% { transform: translateY(-10vh) rotate(0deg); opacity: 1; }
    100% { transform: translateY(100vh) rotate(720deg); opacity: 0; }
}
/* ============================================================== */
/* Quiz Option Selection & Dark Mode Highlights */
/* ============================================================== */
.options-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin: 20px 0;
}

.option-item {
    display: flex !important;
    align-items: center !important;
    gap: 14px !important;
    padding: 14px 18px !important;
    border-radius: 12px !important;
    border: 2px solid var(--border-color, #e2e8f0) !important;
    background: var(--card-bg, #ffffff) !important;
    color: var(--color-text-primary, #0f172a) !important;
    cursor: pointer !important;
    transition: all 0.2s ease !important;
    user-select: none !important;
}

[data-theme="dark"] .option-item,
body.dark-theme .option-item {
    background: #1e293b !important;
    border-color: #334155 !important;
    color: #f8fafc !important;
}

.option-item:hover {
    border-color: #10b981 !important;
    background: rgba(16, 185, 129, 0.08) !important;
}

[data-theme="dark"] .option-item:hover,
body.dark-theme .option-item:hover {
    border-color: #10b981 !important;
    background: rgba(16, 185, 129, 0.15) !important;
}

/* Selected Answer Highlight: Bright Emerald Green border and glowing background */
.option-item.selected {
    border-color: #10b981 !important;
    background: rgba(16, 185, 129, 0.16) !important;
    box-shadow: 0 0 0 2px rgba(16, 185, 129, 0.35) !important;
}

[data-theme="dark"] .option-item.selected,
body.dark-theme .option-item.selected,
.dark .option-item.selected {
    border-color: #10b981 !important;
    background: rgba(16, 185, 129, 0.28) !important;
    box-shadow: 0 0 0 2px rgba(16, 185, 129, 0.6) !important;
}

.option-item.selected .option-prefix {
    background: #10b981 !important;
    color: #ffffff !important;
    border-color: #10b981 !important;
}

/* Correct Answer (Green) */
.option-item.correct {
    border-color: #10b981 !important;
    background: rgba(16, 185, 129, 0.22) !important;
    box-shadow: 0 0 0 2px rgba(16, 185, 129, 0.4) !important;
}

.option-item.correct .option-prefix {
    background: #10b981 !important;
    color: #ffffff !important;
}

/* Incorrect Answer (Red) */
.option-item.incorrect {
    border-color: #ef4444 !important;
    background: rgba(239, 68, 68, 0.18) !important;
    box-shadow: 0 0 0 2px rgba(239, 68, 68, 0.35) !important;
}

.option-item.incorrect .option-prefix {
    background: #ef4444 !important;
    color: #ffffff !important;
}

.option-prefix {
    width: 28px !important;
    height: 28px !important;
    border-radius: 50% !important;
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    font-size: 0.88rem !important;
    font-weight: 700 !important;
    border: 1.5px solid var(--border-color, #cbd5e1) !important;
    color: var(--color-text-secondary, #64748b) !important;
    flex-shrink: 0 !important;
}

[data-theme="dark"] .option-prefix,
body.dark-theme .option-prefix {
    border-color: #475569 !important;
    color: #94a3b8 !important;
}

.option-text {
    flex: 1 !important;
    font-size: 0.95rem !important;
    font-weight: 500 !important;
}

.option-icon {
    font-size: 1.25rem !important;
    margin-left: 8px !important;
}
.option-item.correct .option-icon { color: #10b981 !important; }
.option-item.incorrect .option-icon { color: #ef4444 !important; }
