/* 
 * Premium DMV AI Quiz Frontend CSS 
 * Inspired by modern driving test UIs
 */

:root {
    --dmv-primary: #1d4ed8;
    --dmv-primary-hover: #1e40af;
    --dmv-correct: #10b981;
    --dmv-correct-bg: #d1fae5;
    --dmv-incorrect: #ef4444;
    --dmv-incorrect-bg: #fee2e2;
    --dmv-bg: #f9fafb;
    --dmv-card-bg: #ffffff;
    --dmv-border: #e5e7eb;
    --dmv-text-main: #111827;
    --dmv-text-muted: #6b7280;
    --dmv-radius: 12px;
    --dmv-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    --dmv-font: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

.dmv-premium-quiz-wrapper {
    font-family: var(--dmv-font);
    background-color: var(--dmv-bg);
    color: var(--dmv-text-main);
    padding: 20px;
    border-radius: var(--dmv-radius);
    max-width: 1200px;
    margin: 0 auto;
}

.dmv-quiz-loading {
    text-align: center;
    padding: 40px;
}

.dmv-spinner {
    border: 4px solid var(--dmv-border);
    border-top: 4px solid var(--dmv-primary);
    border-radius: 50%;
    width: 40px;
    height: 40px;
    animation: spin 1s linear infinite;
    margin: 0 auto 16px;
}
@keyframes spin { 0% { transform: rotate(0deg); } 100% { transform: rotate(360deg); } }

.dmv-quiz-layout {
    display: flex;
    gap: 30px;
    align-items: flex-start;
}

/* ─── Main Left Column ─── */
.dmv-quiz-main {
    flex: 1;
    background: var(--dmv-card-bg);
    border-radius: var(--dmv-radius);
    padding: 24px;
    box-shadow: var(--dmv-shadow);
}

.dmv-quiz-header-top {
    display: flex;
    align-items: center;
    gap: 16px;
    margin-bottom: 24px;
}

.dmv-back-link {
    text-decoration: none;
    color: var(--dmv-text-muted);
    font-weight: 500;
    font-size: 14px;
}
.dmv-back-link:hover { color: var(--dmv-text-main); }

.dmv-progress-text {
    font-weight: 600;
    font-size: 14px;
}

.dmv-progress-bar-container {
    flex: 1;
    height: 8px;
    background: var(--dmv-border);
    border-radius: 4px;
    overflow: hidden;
}

.dmv-progress-fill {
    height: 100%;
    background: var(--dmv-primary);
    width: 0%;
    transition: width 0.3s ease;
}

.dmv-icon-btn {
    background: #f3f4f6;
    border: none;
    border-radius: 6px;
    width: 32px;
    height: 32px;
    cursor: pointer;
    color: var(--dmv-text-muted);
    font-size: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}
.dmv-icon-btn:hover { background: #e5e7eb; color: var(--dmv-text-main); }
.dmv-icon-btn.active { color: var(--dmv-primary); background: #eff6ff; }

.dmv-settings-dropdown {
    position: relative;
}

.dmv-settings-menu {
    position: absolute;
    top: 40px;
    right: 0;
    background: var(--dmv-card-bg);
    border: 1px solid var(--dmv-border);
    border-radius: 8px;
    box-shadow: var(--dmv-shadow);
    padding: 16px;
    width: 250px;
    z-index: 100;
}
.dmv-settings-menu label {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
    font-size: 14px;
    cursor: pointer;
}
.dmv-settings-menu label:last-child { margin-bottom: 0; }

/* Question Image */
.dmv-question-image-wrap {
    margin-bottom: 24px;
    border-radius: 8px;
    overflow: hidden;
    position: relative;
}
.dmv-question-image {
    width: 100%;
    max-height: 400px;
    object-fit: cover;
    display: block;
}

/* Question Header Area */
.dmv-topic-label {
    color: var(--dmv-primary);
    font-weight: 600;
    font-size: 13px;
    margin-bottom: 8px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.dmv-question-title-wrap {
    display: flex;
    gap: 12px;
    align-items: flex-start;
    margin-bottom: 24px;
}

.dmv-voice-btn {
    background: var(--dmv-primary);
    color: white;
    border: none;
    border-radius: 50%;
    width: 36px;
    height: 36px;
    flex-shrink: 0;
    cursor: pointer;
    font-size: 18px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.1s;
}
.dmv-voice-btn:active { transform: scale(0.9); }
.dmv-voice-btn:hover { background: var(--dmv-primary-hover); }

.dmv-question-text {
    font-size: 24px;
    font-weight: 700;
    line-height: 1.3;
    margin: 0;
}

/* Options */
.dmv-options-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.dmv-option {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px;
    border: 1px solid var(--dmv-border);
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s;
    background: #fff;
    font-size: 16px;
}
.dmv-option:hover { background: #f9fafb; border-color: #d1d5db; }

.dmv-opt-left {
    display: flex;
    align-items: center;
    gap: 12px;
}
.dmv-opt-circle {
    width: 20px;
    height: 20px;
    border: 2px solid #d1d5db;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
}
.dmv-popularity {
    font-size: 13px;
    font-weight: 600;
    color: var(--dmv-text-muted);
}

/* Answered States */
.dmv-option.correct {
    background: var(--dmv-correct-bg);
    border-color: var(--dmv-correct);
    pointer-events: none;
}
.dmv-option.correct .dmv-opt-circle {
    background: var(--dmv-correct);
    border-color: var(--dmv-correct);
    color: white;
}
.dmv-option.correct .dmv-opt-circle::after { content: '✓'; }

.dmv-option.incorrect {
    background: var(--dmv-incorrect-bg);
    border-color: var(--dmv-incorrect);
    pointer-events: none;
}
.dmv-option.incorrect .dmv-opt-circle {
    background: var(--dmv-incorrect);
    border-color: var(--dmv-incorrect);
    color: white;
}
.dmv-option.incorrect .dmv-opt-circle::after { content: '✕'; }
.dmv-option.incorrect .dmv-opt-text { text-decoration: line-through; color: var(--dmv-text-muted); }

.dmv-quiz-state-answered .dmv-option { pointer-events: none; }

/* Explanation */
.dmv-explanation-box {
    margin-top: 16px;
    background: #f3f4f6;
    border-radius: 8px;
    padding: 16px;
    display: flex;
    gap: 12px;
    animation: fadeIn 0.3s ease;
}
@keyframes fadeIn { from { opacity: 0; transform: translateY(-5px); } to { opacity: 1; transform: translateY(0); } }

.dmv-explanation-text {
    font-size: 15px;
    line-height: 1.5;
    color: var(--dmv-text-main);
}

/* Footer Navigation */
.dmv-quiz-footer {
    margin-top: 32px;
    display: flex;
    justify-content: flex-end;
}
.dmv-btn-next {
    background: var(--dmv-card-bg);
    color: var(--dmv-primary);
    border: 2px solid var(--dmv-primary);
    padding: 12px 24px;
    border-radius: 8px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}
.dmv-btn-next:hover {
    background: var(--dmv-primary);
    color: white;
}
.dmv-btn-next.finish {
    background: var(--dmv-primary);
    color: white;
}

/* ─── Right Sidebar Column ─── */
.dmv-quiz-sidebar {
    width: 320px;
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.dmv-card {
    background: var(--dmv-card-bg);
    border-radius: var(--dmv-radius);
    padding: 24px;
    box-shadow: var(--dmv-shadow);
}

.dmv-card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
}
.dmv-card-header h3 { margin: 0; font-size: 18px; font-weight: 700; }

.dmv-restart-btn {
    background: transparent;
    border: 1px solid var(--dmv-border);
    padding: 6px 12px;
    border-radius: 16px;
    font-size: 13px;
    cursor: pointer;
    color: var(--dmv-text-muted);
}
.dmv-restart-btn:hover { background: #f3f4f6; color: var(--dmv-text-main); }

.dmv-score-summary {
    display: flex;
    gap: 16px;
    font-size: 13px;
    color: var(--dmv-text-muted);
    margin-bottom: 24px;
}
.dmv-dot-red { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: var(--dmv-incorrect); }
.dmv-dot-green { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: var(--dmv-correct); }

.dmv-question-matrix {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 10px;
}
.dmv-matrix-dot {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    font-weight: 600;
    background: #f3f4f6;
    color: var(--dmv-text-main);
    cursor: pointer;
    transition: all 0.2s;
}
.dmv-matrix-dot.active { background: #fee2e2; } /* Current question outline */
.dmv-matrix-dot.correct { background: var(--dmv-correct-bg); color: var(--dmv-correct); }
.dmv-matrix-dot.incorrect { background: var(--dmv-incorrect-bg); color: var(--dmv-incorrect); }

.dmv-hint-card p {
    font-size: 14px;
    color: var(--dmv-text-muted);
    line-height: 1.5;
    margin: 0 0 16px 0;
}
.dmv-hint-btn {
    width: 100%;
    background: #eff6ff;
    color: var(--dmv-primary);
    border: none;
    padding: 10px;
    border-radius: 8px;
    font-weight: 600;
    cursor: pointer;
    margin-bottom: 16px;
}

.dmv-chat-input-wrapper {
    position: relative;
}
.dmv-chat-input-wrapper input {
    width: 100%;
    padding: 12px 40px 12px 16px;
    border: 1px solid var(--dmv-border);
    border-radius: 20px;
    background: #f9fafb;
    box-sizing: border-box;
}
.dmv-send-btn {
    position: absolute;
    right: 6px;
    top: 50%;
    transform: translateY(-50%);
    background: var(--dmv-primary);
    color: white;
    border: none;
    border-radius: 50%;
    width: 28px;
    height: 28px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Results Screen */
.dmv-quiz-results {
    background: var(--dmv-card-bg);
    border-radius: var(--dmv-radius);
    padding: 40px;
    text-align: center;
    box-shadow: var(--dmv-shadow);
}
.dmv-res-score {
    font-size: 48px;
    font-weight: 800;
    margin-bottom: 8px;
}
.dmv-res-pass { color: var(--dmv-correct); }
.dmv-res-fail { color: var(--dmv-incorrect); }

/* Responsive */
@media (max-width: 900px) {
    .dmv-quiz-layout { flex-direction: column; }
    .dmv-quiz-sidebar { width: 100%; }
}
