/* Enhanced Quiz Interface CSS - Improved User Experience */

/* --- Reset and Base Styles --- */
* {
    box-sizing: border-box;
}

.aqm-quiz-container-wrapper {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    line-height: 1.6;
    color: #2c3e50;
    background: #f8f9fb;
    min-height: 100vh;
    padding: 20px;
}

/* --- State Control --- */
.aqm-quiz-container-wrapper.quiz-not-started .aqm-quiz-container {
    display: none;
}

.aqm-quiz-container-wrapper:not(.quiz-not-started) .aqm-details-screen {
    display: none;
}

.aqm-question {
    display: none;
}

/* --- Enhanced Start Screen --- */
.aqm-details-screen {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border-radius: 16px;
    padding: 40px;
    text-align: center;
    max-width: 600px;
    margin: 40px auto;
    box-shadow: 0 20px 40px rgba(0,0,0,0.1);
    position: relative;
    overflow: hidden;
}

.aqm-details-screen::before {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: radial-gradient(circle, rgba(255,255,255,0.1) 1px, transparent 1px);
    background-size: 20px 20px;
    opacity: 0.3;
}

.aqm-details-screen h3 {
    margin: 0 0 20px 0;
    font-size: 2.2em;
    font-weight: 600;
    position: relative;
    z-index: 1;
}

.aqm-details-screen p {
    font-size: 1.1em;
    margin-bottom: 25px;
    opacity: 0.9;
    position: relative;
    z-index: 1;
}

.aqm-details-screen ul {
    list-style: none;
    padding: 0;
    margin: 30px 0;
    display: inline-block;
    text-align: left;
    background: rgba(255,255,255,0.1);
    padding: 20px 30px;
    border-radius: 12px;
    position: relative;
    z-index: 1;
}

.aqm-details-screen li {
    margin-bottom: 12px;
    font-size: 1.05em;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.aqm-start-btn {
    background: linear-gradient(45deg, #28a745, #20c997);
    color: white;
    border: none;
    padding: 16px 40px;
    font-size: 18px;
    font-weight: 600;
    border-radius: 50px;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 8px 25px rgba(40, 167, 69, 0.3);
    position: relative;
    z-index: 1;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.aqm-start-btn:hover {
    background: linear-gradient(45deg, #218838, #1ea885);
    transform: translateY(-2px);
    box-shadow: 0 12px 35px rgba(40, 167, 69, 0.4);
}

/* --- Enhanced Main Quiz Layout --- */
.aqm-quiz-container {
    display: grid;
    grid-template-columns: 1fr 320px;
    gap: 30px;
    max-width: 1400px;
    margin: 0 auto;
    min-height: calc(100vh - 40px);
}

.aqm-main-content {
    background: white;
    border-radius: 16px;
    box-shadow: 0 8px 32px rgba(0,0,0,0.08);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.aqm-sidebar {
    background: white;
    border-radius: 16px;
    box-shadow: 0 8px 32px rgba(0,0,0,0.08);
    padding: 25px;
    height: fit-content;
    position: sticky;
    top: 20px;
}

/* --- Enhanced Header and Timer --- */
.aqm-quiz-header {
    background: linear-gradient(135deg, #4f46e5 0%, #7c3aed 100%);
    color: white;
    padding: 25px 30px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin: 0;
}

.aqm-quiz-title {
    margin: 0;
    font-size: 1.4em;
    font-weight: 600;
}

.aqm-timer-display {
    background: rgba(255,255,255,0.2);
    backdrop-filter: blur(10px);
    padding: 10px 20px;
    border-radius: 25px;
    font-weight: 600;
    font-size: 1.1em;
    border: 1px solid rgba(255,255,255,0.3);
}

/* --- Enhanced Question Area --- */
.aqm-question-area {
    padding: 30px;
    flex-grow: 1;
    min-height: 400px;
}

.aqm-section-heading {
    background: linear-gradient(135deg, #e3f2fd 0%, #f3e5f5 100%);
    border-left: 5px solid #2196f3;
    padding: 15px 20px;
    margin: 0 0 25px 0;
    border-radius: 0 8px 8px 0;
    font-size: 1.3em;
    font-weight: 600;
    color: #1565c0;
}

.aqm-comprehension-passage {
    background: linear-gradient(135deg, #fff8e1 0%, #f3e5f5 100%);
    border-left: 5px solid #ff9800;
    padding: 20px 25px;
    margin-bottom: 25px;
    border-radius: 0 12px 12px 0;
    box-shadow: 0 4px 15px rgba(0,0,0,0.05);
}

.aqm-comprehension-passage h4 {
    color: #f57c00;
    margin: 0 0 15px 0;
    font-size: 1.2em;
}

.aqm-question-header {
    background: #f8f9fa;
    padding: 15px 20px;
    margin: 0 0 25px 0;
    border-radius: 8px;
    font-size: 1.2em;
    font-weight: 600;
    color: #495057;
    border-left: 4px solid #6c757d;
}

.aqm-question-text {
    margin-bottom: 25px;
    font-size: 1.1em;
    line-height: 1.7;
}

.aqm-question-text p {
    margin: 0;
}

/* --- Enhanced Options --- */
.aqm-options-container {
    margin-bottom: 30px;
}

.aqm-option {
    display: flex !important;
    align-items: flex-start;
    background: #fafbfc;
    border: 2px solid #e9ecef;
    padding: 18px 20px;
    margin-bottom: 12px;
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

.aqm-option::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    height: 100%;
    width: 4px;
    background: transparent;
    transition: all 0.3s ease;
}

.aqm-option:hover {
    background: #f1f5f9;
    border-color: #cbd5e1;
    transform: translateY(-1px);
    box-shadow: 0 4px 15px rgba(0,0,0,0.08);
}

.aqm-option:hover::before {
    background: #3b82f6;
}

.aqm-option input[type="radio"] {
    margin: 4px 15px 0 0;
    transform: scale(1.2);
    accent-color: #3b82f6;
}

.aqm-option input[type="radio"]:checked + span {
    font-weight: 600;
    color: #1e40af;
}

.aqm-option:has(input[type="radio"]:checked) {
    background: #eff6ff;
    border-color: #3b82f6;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

.aqm-option:has(input[type="radio"]:checked)::before {
    background: #3b82f6;
}

.aqm-option span {
    line-height: 1.5;
    font-size: 1.05em;
}

/* --- Enhanced Action Buttons --- */
.aqm-action-buttons-footer {
    display: flex;
    gap: 15px;
    padding: 25px 30px;
    border-top: 1px solid #e9ecef;
    background: #fafbfc;
    margin-top: auto;
}

.aqm-action-btn {
    padding: 12px 24px;
    border-radius: 8px;
    border: none;
    cursor: pointer;
    font-weight: 600;
    font-size: 14px;
    transition: all 0.3s ease;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.aqm-clear-response {
    background: #6c757d;
    color: white;
}

.aqm-clear-response:hover {
    background: #5a6268;
    transform: translateY(-1px);
}

.aqm-mark-review {
    background: #ffc107;
    color: #212529;
}

.aqm-mark-review:hover {
    background: #e0a800;
    transform: translateY(-1px);
}

.aqm-save-next {
    background: #007bff;
    color: white;
    margin-left: auto;
}

.aqm-save-next:hover {
    background: #0056b3;
    transform: translateY(-1px);
}

/* --- Enhanced Sidebar (Remove old progress bar styles) --- */
.aqm-sidebar h4 {
    margin: 0 0 20px 0;
    color: #2c3e50;
    font-size: 1.2em;
    font-weight: 600;
    padding-bottom: 10px;
    border-bottom: 2px solid #e9ecef;
}

.aqm-status-panel ul {
    list-style: none;
    padding: 0;
    margin: 0;
}

.aqm-status-panel li {
    display: flex;
    align-items: center;
    margin-bottom: 15px;
    padding: 10px;
    background: #f8f9fa;
    border-radius: 8px;
    font-size: 0.95em;
}

.status-indicator {
    width: 16px;
    height: 16px;
    border-radius: 50%;
    margin-right: 12px;
    flex-shrink: 0;
    border: 2px solid rgba(255,255,255,0.8);
}

.status-count {
    margin-left: auto;
    font-weight: 700;
    background: white;
    padding: 4px 8px;
    border-radius: 12px;
    min-width: 24px;
    text-align: center;
    font-size: 0.9em;
}

/* --- Enhanced Navigation Panel --- */
.aqm-navigation-panel {
    margin-top: 30px;
}

.aqm-question-grid {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 10px;
    margin-top: 15px;
}

.aqm-question-number {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 45px;
    border-radius: 8px;
    color: white;
    cursor: pointer;
    font-weight: 600;
    font-size: 14px;
    transition: all 0.3s ease;
    border: 2px solid transparent;
}

.aqm-question-number:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
}

.aqm-question-number.current {
    border: 3px solid #fff;
    box-shadow: 0 0 0 3px #007bff;
    transform: scale(1.1);
}

/* --- Enhanced Sidebar Footer --- */
.aqm-sidebar-footer {
    margin-top: 30px;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.aqm-nav-btn, .aqm-submit-btn {
    padding: 14px 20px;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    color: white;
    font-weight: 600;
    font-size: 14px;
    transition: all 0.3s ease;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.aqm-prev-btn, .aqm-next-btn {
    background: #6c757d;
    flex: 1;
}

.aqm-prev-btn:hover, .aqm-next-btn:hover {
    background: #5a6268;
    transform: translateY(-1px);
}

.aqm-submit-btn {
    background: linear-gradient(45deg, #28a745, #20c997);
    margin-top: 10px;
    padding: 16px 20px;
    font-size: 16px;
    box-shadow: 0 4px 15px rgba(40, 167, 69, 0.3);
}

.aqm-submit-btn:hover {
    background: linear-gradient(45deg, #218838, #1ea885);
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(40, 167, 69, 0.4);
}

.aqm-submit-btn:disabled {
    background: #6c757d;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

/* --- Status Colors --- */
.status-indicator.answered, .aqm-question-number.answered {
    background: #28a745;
}

.status-indicator.marked_answered, .aqm-question-number.marked_answered {
    background: #007bff;
}

.status-indicator.marked, .aqm-question-number.marked {
    background: #ffc107;
    color: #212529;
}

.status-indicator.not_answered, .aqm-question-number.not_answered {
    background: #dc3545;
}

.status-indicator.not_visited, .aqm-question-number.not_visited {
    background: #6c757d;
}

/* --- Enhanced Results Page --- */
.aqm-results-summary-enhanced {
    max-width: 900px;
    margin: 20px auto;
    background: white;
    border-radius: 20px;
    padding: 40px;
    box-shadow: 0 20px 60px rgba(0,0,0,0.1);
    text-align: center;
}

.aqm-results-summary-enhanced h3 {
    font-size: 2.5em;
    color: #2c3e50;
    margin: 0 0 15px;
    font-weight: 700;
}

.aqm-result-status {
    font-size: 1.4em;
    font-weight: 600;
    margin-bottom: 35px;
    padding: 15px 30px;
    border-radius: 50px;
    display: inline-block;
}

.aqm-result-status.passed {
    background: linear-gradient(45deg, #28a745, #20c997);
    color: white;
}

.aqm-result-status.failed {
    background: linear-gradient(45deg, #dc3545, #e74c3c);
    color: white;
}

/* Enhanced Stats Grid */
.aqm-results-grid-new {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 25px;
    margin-bottom: 35px;
}

.stat-card {
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
    border: 1px solid #dee2e6;
    border-radius: 16px;
    padding: 25px 20px;
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

.stat-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: linear-gradient(45deg, #667eea, #764ba2);
}

.stat-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 30px rgba(0,0,0,0.1);
}

.stat-value {
    font-size: 2.5em;
    font-weight: 700;
    color: #2c3e50;
    line-height: 1;
    margin-bottom: 8px;
}

.stat-value.correct { color: #28a745; }
.stat-value.wrong { color: #dc3545; }
.stat-value.unanswered { color: #ffc107; }
.stat-value.negative { color: #dc3545; }

.stat-label {
    font-size: 1em;
    color: #6c757d;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* Enhanced Category Performance */
.aqm-category-performance {
    background: #f8f9fa;
    border-radius: 16px;
    padding: 25px;
    margin-bottom: 35px;
    text-align: left;
}

.aqm-category-performance h3 {
    color: #2c3e50;
    margin-bottom: 20px;
    text-align: center;
}

.category-item {
    background: white;
    border-radius: 12px;
    padding: 20px;
    margin-bottom: 15px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.05);
}

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

.category-name {
    font-weight: 600;
    color: #2c3e50;
}

.category-score {
    font-weight: 700;
    color: #495057;
}

.category-bar-container {
    background: #e9ecef;
    height: 8px;
    border-radius: 4px;
    overflow: hidden;
}

.category-bar {
    height: 100%;
    background: linear-gradient(45deg, #28a745, #20c997);
    transition: width 1s ease;
}

/* --- Responsive Design --- */
@media (max-width: 1024px) {
    .aqm-quiz-container {
        grid-template-columns: 1fr;
        gap: 20px;
    }
    
    .aqm-sidebar {
        order: -1;
        position: static;
    }
}

@media (max-width: 768px) {
    .aqm-quiz-container-wrapper {
        padding: 10px;
    }
    
    .aqm-quiz-header {
        flex-direction: column;
        gap: 15px;
        text-align: center;
    }
    
    .aqm-question-area {
        padding: 20px;
    }
    
    .aqm-action-buttons-footer {
        flex-direction: column;
        gap: 10px;
    }
    
    .aqm-question-grid {
        grid-template-columns: repeat(4, 1fr);
    }
    
    .aqm-results-grid-new {
        grid-template-columns: repeat(2, 1fr);
        gap: 15px;
    }
}

@media (max-width: 480px) {
    .aqm-details-screen {
        padding: 25px;
        margin: 20px auto;
    }
    
    .aqm-results-summary-enhanced {
        padding: 25px;
    }
    
    .aqm-question-grid {
        grid-template-columns: repeat(3, 1fr);
    }
}

.aqm-comprehension-group {
    border: 2px solid #f0f0f0;
    border-radius: 10px;
    padding: 20px;
    margin-bottom: 30px;
    background: #fafafa;
}

.comprehension-question {
    border-top: 1px solid #e0e0e0;
    padding-top: 20px;
    margin-top: 20px;
}

.comprehension-question:first-of-type {
    border-top: none;
    padding-top: 0;
}

.aqm-fill-blank .aqm-input-text{
  width:100%;padding:12px 14px;border:1px solid #dfe3e8;border-radius:8px;font-size:15px;outline:none;
}
.aqm-fill-blank .aqm-input-text:focus{border-color:#6c63ff;box-shadow:0 0 0 3px rgba(108,99,255,.15)}

/* --- Detailed Results Section --- */
.aqm-detailed-results {
    text-align: left;
    margin-top: 30px;
}

.aqm-detailed-results h3 {
    font-size: 1.5em;
    color: #2c3e50;
    margin-bottom: 20px;
    border-bottom: 1px solid #dee2e6;
    padding-bottom: 10px;
}

.answer-item {
    border-radius: 8px;
    margin-bottom: 15px;
    overflow: hidden;
    border: 1px solid #dee2e6;
}
.answer-item.answer-correct { border-left: 5px solid #28a745; }
.answer-item.answer-wrong { border-left: 5px solid #dc3545; }

.answer-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 15px;
    background: #f8f9fa;
}

.answer-header strong { color: #2c3e50; }
.answer-status { font-weight: bold; font-size: 0.9em; }
.answer-correct .answer-status { color: #28a745; }
.answer-wrong .answer-status { color: #dc3545; }

.answer-body { padding: 15px; font-size: 0.95em; line-height: 1.6; }
.answer-body p { margin: 0 0 10px; }
.answer-body p:last-child { margin-bottom: 0; }

.answer-body .question-text { font-weight: bold; }
.answer-body .user-answer {
    background: #f1f3f5;
    padding: 8px;
    border-radius: 4px;
}
.answer-wrong .user-answer { background: #fbeaea; border: 1px solid #f5c6cb; }
.answer-correct .user-answer { background: #eaf6ec; border: 1px solid #c3e6cb; }
.answer-body .explanation {
    margin-top: 10px;
    padding-top: 10px;
    border-top: 1px dashed #dee2e6;
    font-style: italic;
    color: #495057;
}

.answer-footer {
    padding: 8px 15px;
    background: #f8f9fa;
    text-align: right;
    font-size: 0.9em;
    font-weight: bold;
}
.answer-correct .answer-footer { color: #28a745; }
.answer-wrong .answer-footer { color: #dc3545; }
