/* Quiz Button Container */
.quiz-button-container {
    margin: 40px 0;
    text-align: center;
}

.quiz-start-btn {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    padding: 16px 32px;
    font-size: 18px;
    font-weight: 600;
    color: #fff;
    background: linear-gradient(135deg, #3b82f6 0%, #2563eb 100%);
    border: none;
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.3);
}

.quiz-start-btn:hover {
    background: linear-gradient(135deg, #2563eb 0%, #1d4ed8 100%);
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(59, 130, 246, 0.4);
}

.quiz-start-btn svg {
    flex-shrink: 0;
}

/* Quiz Modal */
.quiz-modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 999999;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.quiz-modal-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.75);
    backdrop-filter: blur(4px);
}

.quiz-modal-container {
    position: relative;
    width: 100%;
    max-width: 750px;
    max-height: 85vh;
    background: #ffffff;
    border-radius: 16px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

body.quiz-modal-open {
    overflow: hidden;
}

/* Quiz Modal Header */
.quiz-modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 18px 30px;
    border-bottom: 2px solid #e5e7eb;
    background: #f9fafb;
}

.quiz-modal-title {
    font-size: 20px;
    font-weight: 700;
    color: #111827;
    margin: 0;
}

.quiz-modal-close {
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: transparent;
    border: none;
    font-size: 32px;
    color: #6b7280;
    cursor: pointer;
    border-radius: 8px;
    transition: all 0.2s ease;
}

.quiz-modal-close:hover {
    background: #e5e7eb;
    color: #111827;
}

/* Quiz Modal Body */
.quiz-modal-body {
    flex: 1;
    overflow-y: auto;
    padding: 20px 30px;
}

/* Progress Bar */
.quiz-progress-bar {
    height: 4px;
    background: #e5e7eb;
    border-radius: 2px;
    margin-bottom: 20px;
    overflow: hidden;
}

.quiz-progress-fill {
    height: 100%;
    background: linear-gradient(90deg, #3b82f6 0%, #2563eb 100%);
    border-radius: 2px;
    transition: width 0.3s ease;
}

/* Single Question */
.quiz-single-question {
    animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Question Header */
.question-header {
    display: flex;
    justify-content: flex-end;
    align-items: center;
    margin-bottom: 12px;
}

.question-difficulty {
    display: inline-block;
    padding: 4px 12px;
    border-radius: 16px;
    font-size: 12px;
    font-weight: 600;
    text-transform: capitalize;
}

.difficulty-easy {
    background: #d1fae5;
    color: #065f46;
}

.difficulty-medium {
    background: #fed7aa;
    color: #92400e;
}

.difficulty-hard {
    background: #fecaca;
    color: #991b1b;
}

/* Question Text */
.question-text {
    font-size: 18px;
    font-weight: 600;
    color: #111827;
    margin: 0 0 20px 0;
    line-height: 1.5;
}

/* Options */
.question-options {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.quiz-option {
    position: relative;
    display: flex;
    align-items: center;
    padding: 12px 16px;
    background: #f9fafb;
    border: 2px solid #e5e7eb;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.quiz-option:hover {
    border-color: #3b82f6;
    background: #eff6ff;
}

.quiz-option input[type="radio"] {
    margin: 0;
    width: 18px;
    height: 18px;
    cursor: pointer;
    accent-color: #3b82f6;
    flex-shrink: 0;
}

.quiz-option input[type="radio"]:disabled {
    cursor: not-allowed;
}

.option-label {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 30px;
    height: 30px;
    margin: 0 12px;
    background: #e5e7eb;
    border-radius: 50%;
    font-weight: 700;
    color: #374151;
    font-size: 14px;
    flex-shrink: 0;
}

.quiz-option:hover .option-label {
    background: #3b82f6;
    color: #fff;
}

.option-text {
    flex: 1;
    font-size: 15px;
    color: #374151;
    line-height: 1.4;
}

.option-icon {
    margin-left: 10px;
    flex-shrink: 0;
    width: 20px;
    height: 20px;
}

/* Selected option */
.quiz-option:has(input:checked) {
    border-color: #3b82f6;
    background: #eff6ff;
}

.quiz-option:has(input:checked) .option-label {
    background: #3b82f6;
    color: #fff;
}

/* Correct/Incorrect states */
.quiz-option.correct-option {
    border-color: #10b981;
    background: #ecfdf5;
}

.quiz-option.correct-option .option-label {
    background: #10b981;
    color: #fff;
}

.quiz-option.correct-option .option-icon {
    color: #10b981;
}

.quiz-option.wrong-option {
    border-color: #ef4444;
    background: #fef2f2;
}

.quiz-option.wrong-option .option-label {
    background: #ef4444;
    color: #fff;
}

.quiz-option.wrong-option .option-icon {
    color: #ef4444;
}

/* Explanation */
.question-explanation-box {
    margin-top: 16px;
    padding: 14px 18px;
    background: #f0f9ff;
    border-left: 3px solid #3b82f6;
    border-radius: 6px;
}

.question-explanation-box h4 {
    font-size: 14px;
    font-weight: 700;
    color: #111827;
    margin: 0 0 6px 0;
}

.question-explanation-box p {
    font-size: 14px;
    color: #374151;
    line-height: 1.5;
    margin: 0;
}

/* Quiz Modal Footer */
.quiz-modal-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 30px;
    border-top: 2px solid #e5e7eb;
    background: #f9fafb;
}

.quiz-nav-btn,
.quiz-submit-modal-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 10px 20px;
    font-size: 15px;
    font-weight: 600;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.quiz-nav-btn {
    background: #f3f4f6;
    color: #374151;
}

.quiz-nav-btn:hover:not(:disabled) {
    background: #e5e7eb;
}

.quiz-nav-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.quiz-submit-modal-btn {
    background: linear-gradient(135deg, #3b82f6 0%, #2563eb 100%);
    color: #fff;
    box-shadow: 0 2px 8px rgba(59, 130, 246, 0.3);
}

.quiz-submit-modal-btn:hover {
    background: linear-gradient(135deg, #2563eb 0%, #1d4ed8 100%);
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.4);
}

.quiz-question-indicator {
    font-size: 15px;
    font-weight: 600;
    color: #6b7280;
}

.quiz-current-question {
    color: #111827;
    font-size: 16px;
}

/* Quiz Results Container */
.quiz-results-container {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 40px;
    animation: fadeIn 0.3s ease;
}

.quiz-results-content {
    text-align: center;
    max-width: 500px;
}

.quiz-results-container.performance-excellent {
    background: linear-gradient(135deg, #ecfdf5 0%, #d1fae5 100%);
}

.quiz-results-container.performance-good {
    background: linear-gradient(135deg, #f0fdf4 0%, #dcfce7 100%);
}

.quiz-results-container.performance-fair {
    background: linear-gradient(135deg, #fef3c7 0%, #fde68a 100%);
}

.quiz-results-container.performance-poor {
    background: linear-gradient(135deg, #fee2e2 0%, #fecaca 100%);
}

/* Score Circle */
.results-score-circle {
    position: relative;
    width: 150px;
    height: 150px;
    margin: 0 auto 30px;
}

.score-svg {
    width: 100%;
    height: 100%;
    transform: rotate(-90deg);
}

.score-bg {
    fill: none;
    stroke: rgba(0, 0, 0, 0.1);
    stroke-width: 10;
}

.score-progress {
    fill: none;
    stroke: #3b82f6;
    stroke-width: 10;
    stroke-linecap: round;
    stroke-dasharray: 314.159;
    stroke-dashoffset: 314.159;
    transition: stroke-dashoffset 1s ease;
}

.performance-excellent .score-progress {
    stroke: #10b981;
}

.performance-good .score-progress {
    stroke: #22c55e;
}

.performance-fair .score-progress {
    stroke: #f59e0b;
}

.performance-poor .score-progress {
    stroke: #ef4444;
}

.score-text {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    text-align: center;
}

.score-percentage {
    display: block;
    font-size: 42px;
    font-weight: 700;
    color: #111827;
    line-height: 1;
}

/* Results Info */
.results-title {
    font-size: 28px;
    font-weight: 700;
    color: #111827;
    margin: 0 0 15px 0;
}

.results-summary {
    font-size: 17px;
    color: #374151;
    margin: 0 0 30px 0;
    line-height: 1.6;
}

/* Results Actions */
.results-actions {
    display: flex;
    flex-direction: column;
    gap: 12px;
    align-items: center;
}

.quiz-retry-btn,
.quiz-review-btn,
.quiz-close-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 14px 28px;
    font-size: 16px;
    font-weight: 600;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
    min-width: 200px;
}

.quiz-retry-btn {
    background: linear-gradient(135deg, #3b82f6 0%, #2563eb 100%);
    color: #fff;
    box-shadow: 0 2px 8px rgba(59, 130, 246, 0.3);
}

.quiz-retry-btn:hover {
    background: linear-gradient(135deg, #2563eb 0%, #1d4ed8 100%);
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.4);
}

.quiz-review-btn {
    background: #f3f4f6;
    color: #374151;
}

.quiz-review-btn:hover {
    background: #e5e7eb;
}

.quiz-close-btn {
    background: transparent;
    color: #6b7280;
    border: 2px solid #e5e7eb;
}

.quiz-close-btn:hover {
    background: #f9fafb;
    border-color: #d1d5db;
}

/* Quiz Warning Modal */
.quiz-warning-modal {
    z-index: 1000000 !important;
}

.quiz-warning-modal .quiz-modal-overlay {
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(8px);
}

.quiz-warning-container {
    position: relative;
    width: 100%;
    max-width: 480px;
    background: #ffffff;
    border-radius: 20px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    padding: 40px;
    text-align: center;
    animation: warningSlideIn 0.3s ease;
}

@keyframes warningSlideIn {
    from {
        opacity: 0;
        transform: translateY(-20px) scale(0.95);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.quiz-warning-icon {
    width: 80px;
    height: 80px;
    margin: 0 auto 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #fef3c7 0%, #fde68a 100%);
    border-radius: 50%;
    animation: warningPulse 2s ease-in-out infinite;
}

@keyframes warningPulse {
    0%, 100% {
        transform: scale(1);
        box-shadow: 0 0 0 0 rgba(245, 158, 11, 0.4);
    }
    50% {
        transform: scale(1.05);
        box-shadow: 0 0 0 10px rgba(245, 158, 11, 0);
    }
}

.quiz-warning-icon svg {
    color: #f59e0b;
    stroke-width: 2.5;
}

.quiz-warning-title {
    font-size: 24px;
    font-weight: 700;
    color: #111827;
    margin: 0 0 12px 0;
}

.quiz-warning-message {
    font-size: 16px;
    color: #6b7280;
    line-height: 1.6;
    margin: 0 0 24px 0;
}

.quiz-warning-stats {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    padding: 16px 24px;
    background: #f9fafb;
    border-radius: 12px;
    margin-bottom: 28px;
}

.quiz-warning-stat {
    font-size: 14px;
    color: #6b7280;
}

.quiz-warning-stat strong {
    display: block;
    font-size: 22px;
    font-weight: 700;
    color: #111827;
    margin-bottom: 2px;
}

.quiz-warning-divider {
    font-size: 18px;
    color: #d1d5db;
}

.quiz-warning-actions {
    display: flex;
    justify-content: center;
}

.quiz-warning-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 14px 36px;
    font-size: 16px;
    font-weight: 600;
    color: #fff;
    background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%);
    border: none;
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 12px rgba(245, 158, 11, 0.3);
}

.quiz-warning-btn:hover {
    background: linear-gradient(135deg, #d97706 0%, #b45309 100%);
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(245, 158, 11, 0.4);
}

.quiz-warning-btn:active {
    transform: translateY(0);
}

/* Responsive Design */
@media (max-width: 768px) {
    .quiz-modal {
        padding: 10px;
    }
    
    .quiz-modal-container {
        max-height: 95vh;
        border-radius: 12px;
    }
    
    .quiz-modal-header {
        padding: 20px;
    }
    
    .quiz-modal-title {
        font-size: 20px;
    }
    
    .quiz-modal-body {
        padding: 20px;
    }
    
    .question-text {
        font-size: 18px;
        margin-bottom: 20px;
    }
    
    .quiz-option {
        padding: 14px 16px;
    }
    
    .option-label {
        width: 32px;
        height: 32px;
        margin: 0 10px;
        font-size: 14px;
    }
    
    .option-text {
        font-size: 15px;
    }
    
    .quiz-modal-footer {
        padding: 16px 20px;
        flex-wrap: wrap;
        gap: 10px;
    }
    
    .quiz-nav-btn,
    .quiz-submit-modal-btn {
        padding: 10px 20px;
        font-size: 14px;
    }
    
    .quiz-question-indicator {
        font-size: 14px;
        order: -1;
        width: 100%;
        text-align: center;
        margin-bottom: 10px;
    }
    
    .results-score-circle {
        width: 120px;
        height: 120px;
        margin-bottom: 20px;
    }
    
    .score-percentage {
        font-size: 36px;
    }
    
    .results-title {
        font-size: 24px;
    }
    
    .results-summary {
        font-size: 15px;
    }
    
    .quiz-retry-btn,
    .quiz-review-btn,
    .quiz-close-btn {
        min-width: 100%;
        padding: 12px 24px;
    }
    
    .quiz-warning-container {
        max-width: 90%;
        padding: 32px 24px;
    }
    
    .quiz-warning-icon {
        width: 70px;
        height: 70px;
        margin-bottom: 20px;
    }
    
    .quiz-warning-icon svg {
        width: 42px;
        height: 42px;
    }
    
    .quiz-warning-title {
        font-size: 20px;
    }
    
    .quiz-warning-message {
        font-size: 15px;
    }
    
    .quiz-warning-stats {
        flex-direction: column;
        gap: 8px;
        padding: 16px;
    }
    
    .quiz-warning-divider {
        display: none;
    }
    
    .quiz-warning-btn {
        width: 100%;
        padding: 12px 24px;
    }
}

/* Dark Theme Support */
body.dark-mode .quiz-modal-container,
body[data-theme="dark"] .quiz-modal-container,
@media (prefers-color-scheme: dark) {
    body:not([data-theme="light"]) .quiz-modal-container {
        background: #1f2937;
    }
    
    body:not([data-theme="light"]) .quiz-modal-header {
        background: #111827;
        border-bottom-color: #374151;
    }
    
    body:not([data-theme="light"]) .quiz-modal-title {
        color: #f9fafb;
    }
    
    body:not([data-theme="light"]) .quiz-modal-close {
        color: #9ca3af;
    }
    
    body:not([data-theme="light"]) .quiz-modal-close:hover {
        background: #374151;
        color: #f9fafb;
    }
    
    body:not([data-theme="light"]) .quiz-progress-bar {
        background: #374151;
    }
    
    body:not([data-theme="light"]) .question-text {
        color: #f9fafb;
    }
    
    body:not([data-theme="light"]) .quiz-option {
        background: #111827;
        border-color: #374151;
    }
    
    body:not([data-theme="light"]) .quiz-option:hover {
        background: #1e3a5f;
        border-color: #3b82f6;
    }
    
    body:not([data-theme="light"]) .option-label {
        background: #374151;
        color: #f9fafb;
    }
    
    body:not([data-theme="light"]) .option-text {
        color: #e5e7eb;
    }
    
    body:not([data-theme="light"]) .quiz-option:has(input:checked) {
        background: #1e3a5f;
        border-color: #3b82f6;
    }
    
    body:not([data-theme="light"]) .question-explanation-box {
        background: #1e3a5f;
        border-left-color: #3b82f6;
    }
    
    body:not([data-theme="light"]) .question-explanation-box h4 {
        color: #f9fafb;
    }
    
    body:not([data-theme="light"]) .question-explanation-box p {
        color: #d1d5db;
    }
    
    body:not([data-theme="light"]) .quiz-modal-footer {
        background: #111827;
        border-top-color: #374151;
    }
    
    body:not([data-theme="light"]) .quiz-nav-btn {
        background: #374151;
        color: #f9fafb;
    }
    
    body:not([data-theme="light"]) .quiz-nav-btn:hover:not(:disabled) {
        background: #4b5563;
    }
    
    body:not([data-theme="light"]) .quiz-question-indicator {
        color: #9ca3af;
    }
    
    body:not([data-theme="light"]) .quiz-current-question {
        color: #f9fafb;
    }
    
    body:not([data-theme="light"]) .results-title {
        color: #111827;
    }
    
    body:not([data-theme="light"]) .results-summary {
        color: #374151;
    }
    
    body:not([data-theme="light"]) .score-percentage {
        color: #111827;
    }
    
    body:not([data-theme="light"]) .score-bg {
        stroke: rgba(0, 0, 0, 0.2);
    }
}

/* Explicit dark mode classes */
body.dark-mode .quiz-modal-container,
body[data-theme="dark"] .quiz-modal-container {
    background: #1f2937;
}

body.dark-mode .quiz-modal-header,
body[data-theme="dark"] .quiz-modal-header {
    background: #111827;
    border-bottom-color: #374151;
}

body.dark-mode .quiz-modal-title,
body[data-theme="dark"] .quiz-modal-title {
    color: #f9fafb;
}

body.dark-mode .quiz-modal-close,
body[data-theme="dark"] .quiz-modal-close {
    color: #9ca3af;
}

body.dark-mode .quiz-modal-close:hover,
body[data-theme="dark"] .quiz-modal-close:hover {
    background: #374151;
    color: #f9fafb;
}

body.dark-mode .quiz-progress-bar,
body[data-theme="dark"] .quiz-progress-bar {
    background: #374151;
}

body.dark-mode .question-text,
body[data-theme="dark"] .question-text {
    color: #f9fafb;
}

body.dark-mode .quiz-option,
body[data-theme="dark"] .quiz-option {
    background: #111827;
    border-color: #374151;
}

body.dark-mode .quiz-option:hover,
body[data-theme="dark"] .quiz-option:hover {
    background: #1e3a5f;
    border-color: #3b82f6;
}

body.dark-mode .option-label,
body[data-theme="dark"] .option-label {
    background: #374151;
    color: #f9fafb;
}

body.dark-mode .option-text,
body[data-theme="dark"] .option-text {
    color: #e5e7eb;
}

body.dark-mode .quiz-option:has(input:checked),
body[data-theme="dark"] .quiz-option:has(input:checked) {
    background: #1e3a5f;
    border-color: #3b82f6;
}

body.dark-mode .question-explanation-box,
body[data-theme="dark"] .question-explanation-box {
    background: #1e3a5f;
    border-left-color: #3b82f6;
}

body.dark-mode .question-explanation-box h4,
body[data-theme="dark"] .question-explanation-box h4 {
    color: #f9fafb;
}

body.dark-mode .question-explanation-box p,
body[data-theme="dark"] .question-explanation-box p {
    color: #d1d5db;
}

body.dark-mode .quiz-modal-footer,
body[data-theme="dark"] .quiz-modal-footer {
    background: #111827;
    border-top-color: #374151;
}

body.dark-mode .quiz-nav-btn,
body[data-theme="dark"] .quiz-nav-btn {
    background: #374151;
    color: #f9fafb;
}

body.dark-mode .quiz-nav-btn:hover:not(:disabled),
body[data-theme="dark"] .quiz-nav-btn:hover:not(:disabled) {
    background: #4b5563;
}

body.dark-mode .quiz-question-indicator,
body[data-theme="dark"] .quiz-question-indicator {
    color: #9ca3af;
}

body.dark-mode .quiz-current-question,
body[data-theme="dark"] .quiz-current-question {
    color: #f9fafb;
}

body.dark-mode .results-title,
body[data-theme="dark"] .results-title {
    color: #111827;
}

body.dark-mode .results-summary,
body[data-theme="dark"] .results-summary {
    color: #374151;
}

body.dark-mode .score-percentage,
body[data-theme="dark"] .score-percentage {
    color: #111827;
}

body.dark-mode .score-bg,
body[data-theme="dark"] .score-bg {
    stroke: rgba(0, 0, 0, 0.2);
}

body.dark-mode .quiz-warning-container,
body[data-theme="dark"] .quiz-warning-container {
    background: #1f2937;
}

body.dark-mode .quiz-warning-title,
body[data-theme="dark"] .quiz-warning-title {
    color: #f9fafb;
}

body.dark-mode .quiz-warning-message,
body[data-theme="dark"] .quiz-warning-message {
    color: #d1d5db;
}

body.dark-mode .quiz-warning-stats,
body[data-theme="dark"] .quiz-warning-stats {
    background: #111827;
}

body.dark-mode .quiz-warning-stat,
body[data-theme="dark"] .quiz-warning-stat {
    color: #9ca3af;
}

body.dark-mode .quiz-warning-stat strong,
body[data-theme="dark"] .quiz-warning-stat strong {
    color: #f9fafb;
}
