/**
 * QuizEngine Styles - Hexworth Prime
 * Gamified quiz interface with house theme support
 */

/* ============================================
   BASE CONTAINER
   ============================================ */

.quiz-engine {
    font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
    max-width: 800px;
    margin: 0 auto;
    padding: 20px;
    color: #e0e0e0;
    background: linear-gradient(135deg, #1a1a2e 0%, #16213e 100%);
    border-radius: 16px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.4);
}

/* ============================================
   HEADER
   ============================================ */

.quiz-header {
    text-align: center;
    margin-bottom: 30px;
}

.quiz-title {
    font-size: 1.8rem;
    font-weight: 600;
    margin: 0 0 15px 0;
    background: linear-gradient(90deg, #00d4ff, #7c3aed);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.quiz-meta {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 20px;
    margin-bottom: 15px;
    font-size: 0.9rem;
    color: #888;
}

.quiz-timer {
    font-family: 'Courier New', monospace;
    font-size: 1.1rem;
    font-weight: bold;
    color: #00d4ff;
    padding: 5px 12px;
    background: rgba(0, 212, 255, 0.1);
    border-radius: 20px;
    border: 1px solid rgba(0, 212, 255, 0.3);
}

.quiz-timer.warning {
    color: #ffc107;
    background: rgba(255, 193, 7, 0.1);
    border-color: rgba(255, 193, 7, 0.3);
}

.quiz-timer.critical {
    color: #ff4757;
    background: rgba(255, 71, 87, 0.1);
    border-color: rgba(255, 71, 87, 0.3);
    animation: pulse-warning 0.5s ease-in-out infinite;
}

@keyframes pulse-warning {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.6; }
}

/* Progress Bar */
.quiz-progress-bar {
    height: 6px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 3px;
    overflow: hidden;
}

.quiz-progress-fill {
    height: 100%;
    background: linear-gradient(90deg, #00d4ff, #7c3aed);
    border-radius: 3px;
    transition: width 0.3s ease;
}

/* ============================================
   QUESTION AREA
   ============================================ */

.quiz-body {
    background: rgba(255, 255, 255, 0.03);
    border-radius: 12px;
    padding: 30px;
    margin-bottom: 20px;
}

.quiz-question {
    margin-bottom: 25px;
}

.question-text {
    font-size: 1.2rem;
    line-height: 1.6;
    margin: 0 0 15px 0;
    color: #fff;
}

.question-code {
    background: #0d1117;
    border: 1px solid #30363d;
    border-radius: 8px;
    padding: 15px;
    overflow-x: auto;
    font-family: 'Fira Code', 'Courier New', monospace;
    font-size: 0.9rem;
    color: #e6edf3;
    margin: 15px 0;
}

.question-image {
    max-width: 100%;
    border-radius: 8px;
    margin: 15px 0;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

/* ============================================
   OPTIONS
   ============================================ */

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

.quiz-option {
    display: flex;
    align-items: center;
    gap: 15px;
    padding: 16px 20px;
    background: rgba(255, 255, 255, 0.05);
    border: 2px solid rgba(255, 255, 255, 0.1);
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.2s ease;
    text-align: left;
    font-size: 1rem;
    color: #e0e0e0;
}

.quiz-option:hover:not(:disabled) {
    background: rgba(0, 212, 255, 0.1);
    border-color: rgba(0, 212, 255, 0.4);
    transform: translateX(5px);
}

.quiz-option:active:not(:disabled) {
    transform: translateX(5px) scale(0.98);
}

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

.quiz-option.correct {
    background: rgba(46, 213, 115, 0.2) !important;
    border-color: #2ed573 !important;
}

.quiz-option.incorrect {
    background: rgba(255, 71, 87, 0.2) !important;
    border-color: #ff4757 !important;
}

.option-letter {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 50%;
    font-weight: 600;
    font-size: 0.9rem;
    flex-shrink: 0;
}

.quiz-option:hover:not(:disabled) .option-letter {
    background: rgba(0, 212, 255, 0.3);
}

.option-text {
    flex: 1;
}

/* ============================================
   FEEDBACK
   ============================================ */

.quiz-feedback {
    display: flex;
    align-items: flex-start;
    gap: 15px;
    margin-top: 25px;
    padding: 20px;
    border-radius: 10px;
    animation: slideIn 0.3s ease;
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.quiz-feedback.correct {
    background: rgba(46, 213, 115, 0.15);
    border: 1px solid rgba(46, 213, 115, 0.3);
}

.quiz-feedback.incorrect {
    background: rgba(255, 71, 87, 0.15);
    border: 1px solid rgba(255, 71, 87, 0.3);
}

.feedback-icon {
    font-size: 2rem;
    line-height: 1;
}

.quiz-feedback.correct .feedback-icon { color: #2ed573; }
.quiz-feedback.incorrect .feedback-icon { color: #ff4757; }

.feedback-text {
    flex: 1;
}

.feedback-text strong {
    display: block;
    font-size: 1.1rem;
    margin-bottom: 5px;
}

.feedback-text p {
    margin: 0;
    font-size: 0.95rem;
    color: #bbb;
    line-height: 1.5;
}

.quiz-next-btn {
    padding: 12px 24px;
    background: linear-gradient(90deg, #00d4ff, #7c3aed);
    border: none;
    border-radius: 8px;
    color: #fff;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    white-space: nowrap;
}

.quiz-next-btn:hover {
    transform: scale(1.05);
    box-shadow: 0 5px 20px rgba(0, 212, 255, 0.3);
}

/* ============================================
   FOOTER
   ============================================ */

.quiz-footer {
    text-align: center;
    padding-top: 10px;
    color: #666;
    font-size: 0.9rem;
}

/* ============================================
   RESULTS SCREEN
   ============================================ */

.quiz-results {
    text-align: center;
    padding: 40px 20px;
}

.results-header {
    margin-bottom: 30px;
}

.results-emoji {
    font-size: 4rem;
    display: block;
    margin-bottom: 15px;
}

.results-title {
    font-size: 2rem;
    margin: 0;
}

.quiz-results.passed .results-title {
    color: #2ed573;
}

.quiz-results.failed .results-title {
    color: #ffc107;
}

/* Score Circle */
.results-score {
    margin: 30px 0;
}

.score-circle {
    display: inline-flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    width: 160px;
    height: 160px;
    border-radius: 50%;
    border: 6px solid;
    background: rgba(0, 0, 0, 0.3);
}

.score-circle.passed {
    border-color: #2ed573;
    box-shadow: 0 0 30px rgba(46, 213, 115, 0.3);
}

.score-circle.failed {
    border-color: #ffc107;
    box-shadow: 0 0 30px rgba(255, 193, 7, 0.3);
}

.score-percentage {
    font-size: 2.5rem;
    font-weight: 700;
}

.score-fraction {
    font-size: 1rem;
    color: #888;
}

.results-message {
    font-size: 1.1rem;
    color: #bbb;
    max-width: 400px;
    margin: 0 auto 30px;
    line-height: 1.5;
}

.results-timeout {
    color: #ff4757;
    font-weight: 500;
    margin-bottom: 20px;
}

/* Stats */
.results-stats {
    display: flex;
    justify-content: center;
    gap: 40px;
    margin-bottom: 30px;
}

.stat {
    text-align: center;
}

.stat-value {
    display: block;
    font-size: 1.5rem;
    font-weight: 600;
    color: #00d4ff;
}

.stat-label {
    font-size: 0.85rem;
    color: #666;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

/* Achievement */
.results-achievement {
    background: linear-gradient(90deg, rgba(255, 193, 7, 0.2), rgba(255, 152, 0, 0.2));
    border: 1px solid rgba(255, 193, 7, 0.4);
    border-radius: 10px;
    padding: 15px 25px;
    margin-bottom: 30px;
    display: inline-block;
    animation: glow 2s ease-in-out infinite;
}

@keyframes glow {
    0%, 100% { box-shadow: 0 0 10px rgba(255, 193, 7, 0.3); }
    50% { box-shadow: 0 0 25px rgba(255, 193, 7, 0.5); }
}

/* Action Buttons */
.results-actions {
    display: flex;
    justify-content: center;
    gap: 15px;
    flex-wrap: wrap;
}

.quiz-btn {
    padding: 14px 28px;
    border: none;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
}

.quiz-retry-btn {
    background: linear-gradient(90deg, #00d4ff, #7c3aed);
    color: #fff;
}

.quiz-retry-btn:hover {
    transform: scale(1.05);
    box-shadow: 0 5px 20px rgba(0, 212, 255, 0.3);
}

.quiz-review-btn {
    background: rgba(255, 255, 255, 0.1);
    color: #e0e0e0;
    border: 1px solid rgba(255, 255, 255, 0.2);
}

.quiz-review-btn:hover {
    background: rgba(255, 255, 255, 0.15);
}

/* ============================================
   REVIEW SCREEN
   ============================================ */

.quiz-review {
    padding: 20px;
}

.review-header-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 25px;
    flex-wrap: wrap;
    gap: 15px;
}

.review-header-bar h2 {
    margin: 0;
    font-size: 1.5rem;
}

.review-list {
    display: flex;
    flex-direction: column;
    gap: 20px;
    margin-bottom: 25px;
}

.review-item {
    background: rgba(255, 255, 255, 0.03);
    border-radius: 10px;
    padding: 20px;
    border-left: 4px solid;
}

.review-item.correct { border-left-color: #2ed573; }
.review-item.incorrect { border-left-color: #ff4757; }
.review-item.unanswered { border-left-color: #666; }

.review-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
}

.review-num {
    font-weight: 600;
    color: #888;
}

.review-status {
    font-size: 1.2rem;
}

.review-item.correct .review-status { color: #2ed573; }
.review-item.incorrect .review-status { color: #ff4757; }

.review-question {
    font-size: 1.05rem;
    margin: 0 0 15px;
    color: #fff;
}

.review-options {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.review-option {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 15px;
    background: rgba(255, 255, 255, 0.03);
    border-radius: 6px;
    font-size: 0.95rem;
}

.review-option.correct-answer {
    background: rgba(46, 213, 115, 0.15);
    color: #2ed573;
}

.review-option.wrong-selected {
    background: rgba(255, 71, 87, 0.15);
    color: #ff4757;
}

.review-explanation {
    margin: 15px 0 0;
    padding: 12px 15px;
    background: rgba(0, 212, 255, 0.1);
    border-radius: 6px;
    font-size: 0.9rem;
    color: #00d4ff;
    line-height: 1.5;
}

.review-footer {
    display: flex;
    justify-content: center;
    gap: 15px;
    flex-wrap: wrap;
}

/* ============================================
   HOUSE THEMES
   ============================================ */

/* Shield House - Purple/Security */
.quiz-engine.theme-shield {
    background: linear-gradient(135deg, #1a1a2e 0%, #2d1b4e 100%);
}
.quiz-engine.theme-shield .quiz-title,
.quiz-engine.theme-shield .stat-value {
    background: linear-gradient(90deg, #a855f7, #7c3aed);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

/* Web House - Cyan/Network */
.quiz-engine.theme-web {
    background: linear-gradient(135deg, #0f172a 0%, #164e63 100%);
}
.quiz-engine.theme-web .quiz-title,
.quiz-engine.theme-web .stat-value {
    background: linear-gradient(90deg, #22d3ee, #0ea5e9);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

/* Script House - Green/Terminal */
.quiz-engine.theme-script {
    background: linear-gradient(135deg, #0a1a0a 0%, #14532d 100%);
}
.quiz-engine.theme-script .quiz-title,
.quiz-engine.theme-script .stat-value {
    background: linear-gradient(90deg, #4ade80, #22c55e);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

/* Forge House - Orange/Hardware */
.quiz-engine.theme-forge {
    background: linear-gradient(135deg, #1c1917 0%, #44403c 100%);
}
.quiz-engine.theme-forge .quiz-title,
.quiz-engine.theme-forge .stat-value {
    background: linear-gradient(90deg, #fb923c, #f97316);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

/* Cloud House - Blue/Sky */
.quiz-engine.theme-cloud {
    background: linear-gradient(135deg, #0c1929 0%, #1e3a5f 100%);
}
.quiz-engine.theme-cloud .quiz-title,
.quiz-engine.theme-cloud .stat-value {
    background: linear-gradient(90deg, #60a5fa, #3b82f6);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

/* Key House - Gold/Crypto */
.quiz-engine.theme-key {
    background: linear-gradient(135deg, #1a1500 0%, #3d2e00 100%);
}
.quiz-engine.theme-key .quiz-title,
.quiz-engine.theme-key .stat-value {
    background: linear-gradient(90deg, #fbbf24, #f59e0b);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

/* Eye House - Red/Monitoring */
.quiz-engine.theme-eye {
    background: linear-gradient(135deg, #1a0a0a 0%, #450a0a 100%);
}
.quiz-engine.theme-eye .quiz-title,
.quiz-engine.theme-eye .stat-value {
    background: linear-gradient(90deg, #f87171, #ef4444);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

/* Code House - Teal/DevOps */
.quiz-engine.theme-code {
    background: linear-gradient(135deg, #042f2e 0%, #134e4a 100%);
}
.quiz-engine.theme-code .quiz-title,
.quiz-engine.theme-code .stat-value {
    background: linear-gradient(90deg, #2dd4bf, #14b8a6);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

/* Dark Arts Theme */
.quiz-engine.theme-dark-arts {
    background: linear-gradient(135deg, #0a0508 0%, #1a0a15 100%);
}
.quiz-engine.theme-dark-arts .quiz-title {
    background: linear-gradient(90deg, #9333ea, #7e22ce);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

/* ============================================
   RESPONSIVE
   ============================================ */

@media (max-width: 600px) {
    .quiz-engine {
        padding: 15px;
        border-radius: 12px;
    }

    .quiz-title {
        font-size: 1.4rem;
    }

    .quiz-body {
        padding: 20px 15px;
    }

    .question-text {
        font-size: 1.1rem;
    }

    .quiz-option {
        padding: 14px 16px;
    }

    .results-stats {
        gap: 25px;
    }

    .results-actions {
        flex-direction: column;
    }

    .quiz-btn {
        width: 100%;
    }

    .score-circle {
        width: 130px;
        height: 130px;
    }

    .score-percentage {
        font-size: 2rem;
    }
}

/* Accessibility: disable animations for users who prefer reduced motion */
@media (prefers-reduced-motion: reduce) {
    .quiz-timer.critical,
    .quiz-progress-fill,
    .quiz-option,
    .quiz-feedback,
    .quiz-next-btn,
    .quiz-btn,
    .results-achievement {
        animation: none !important;
        transition: none !important;
    }
}
