:root {
    --primary-color: #6366f1;
    --primary-hover: #4f46e5;
    --secondary-color: #6b7280;
    --secondary-hover: #4b5563;
    --background: #0f172a;
    --surface: #1e293b;
    --card: #334155;
    --text-primary: #f1f5f9;
    --text-secondary: #cbd5e1;
    --text-muted: #94a3b8;
    --success: #10b981;
    --error: #ef4444;
    --warning: #f59e0b;
    --border: #475569;
    --shadow: rgba(0, 0, 0, 0.3);
    --gradient: linear-gradient(135deg, #6366f1, #8b5cf6);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Poppins', sans-serif;
}

body {
    background: var(--background);
    color: var(--text-primary);
    line-height: 1.6;
    min-height: 100vh;
    transition: all 0.3s ease;
}

.container {
    max-width: 800px;
    margin: 0 auto;
    padding: 20px;
    animation: fadeIn 0.5s ease;
}

.page {
    display: none;
    min-height: 100vh;
    opacity: 0;
    transform: translateY(20px);
    transition: all 0.5s ease;
}

.page.active {
    display: block;
    opacity: 1;
    transform: translateY(0);
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.card {
    background: var(--card);
    border-radius: 16px;
    padding: 24px;
    margin-bottom: 20px;
    border: 1px solid var(--border);
    box-shadow: 0 8px 32px var(--shadow);
    transition: all 0.3s ease;
    backdrop-filter: blur(10px);
}

.card:hover {
    transform: translateY(-2px);
    box-shadow: 0 12px 40px var(--shadow);
}

/* === GIAO DIỆN ĐẸP PAGE 1 === */

/* Container chính */
#page1 .container {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

/* Header info section */
.info-section {
    text-align: center;
    margin-bottom: 30px;
    padding: 30px !important;
}

.main-title {
    font-size: 1.8rem;
    font-weight: 700;
    background: var(--gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin-bottom: 20px;
    line-height: 1.4;
}

.info-content {
    color: var(--text-secondary);
    line-height: 1.6;
    font-size: 1rem;
}

.info-content p {
    margin-bottom: 10px;
}

.contact-info {
    color: var(--text-primary);
    font-weight: 500;
    font-size: 0.95rem;
}

.messenger-link {
    color: var(--primary-color);
    text-decoration: none;
    margin-left: 5px;
}

.messenger-link:hover {
    text-decoration: underline;
}

/* Card spacing đẹp */
#page1 .card {
    margin-bottom: 25px;
    padding: 30px;
    border-radius: 20px;
    box-shadow: 0 8px 32px var(--shadow);
}

h1 {
    background: var(--gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    text-align: center;
    margin-bottom: 8px;
    font-size: 2.5rem;
    font-weight: 700;
}

h2 {
    color: var(--text-primary);
    margin-bottom: 20px;
    font-size: 1.4rem;
    font-weight: 600;
}

.subtitle {
    text-align: center;
    color: var(--text-secondary);
    margin-bottom: 30px;
    font-size: 1.1rem;
}

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

.input-section {
    margin-bottom: 0;
}

.input-section label {
    display: block;
    margin-bottom: 12px;
    font-weight: 500;
    color: var(--text-primary);
    font-size: 1rem;
}

input[type="text"] {
    width: 100%;
    padding: 16px 20px;
    background: var(--surface);
    border: 2px solid var(--border);
    border-radius: 12px;
    font-size: 16px;
    color: var(--text-primary);
    transition: all 0.3s ease;
}

input[type="text"]:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1);
}

input[type="text"]::placeholder {
    color: var(--text-muted);
}

.btn-primary, .btn-secondary {
    border: none;
    padding: 16px 32px;
    border-radius: 12px;
    cursor: pointer;
    font-size: 16px;
    font-weight: 600;
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

.btn-primary {
    background: var(--gradient);
    color: white;
    box-shadow: 0 4px 15px rgba(99, 102, 241, 0.3);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(99, 102, 241, 0.4);
}

.btn-secondary {
    background: var(--secondary-color);
    color: white;
}

.btn-secondary:hover {
    background: var(--secondary-hover);
    transform: translateY(-2px);
}

button:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none !important;
}

.config-section {
    margin: 0;
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.config-option {
    display: flex;
    align-items: center;
    padding: 10px 0;
}

.config-option input {
    display: none;
}

.config-option label {
    display: flex;
    align-items: center;
    cursor: pointer;
    font-weight: 500;
    color: var(--text-primary);
    transition: color 0.3s ease;
    font-size: 1rem;
}

.checkmark {
    width: 22px;
    height: 22px;
    border: 2px solid var(--border);
    border-radius: 6px;
    margin-right: 12px;
    position: relative;
    transition: all 0.3s ease;
}

.config-option input:checked + label .checkmark {
    background: var(--primary-color);
    border-color: var(--primary-color);
}

.config-option input:checked + label .checkmark::after {
    content: '✓';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    color: white;
    font-size: 12px;
    font-weight: bold;
}

.action-section {
    text-align: center;
    margin-top: 40px;
}

.action-section button {
    margin: 0 10px;
    padding: 18px 40px !important;
    font-size: 1.1rem !important;
    border-radius: 16px !important;
}

/* === DANH SÁCH MÔN HỌC ĐẸP === */
.compact-subject-list {
    max-height: 300px;
    min-height: 200px;
    overflow-y: auto;
    border: 2px solid var(--border);
    border-radius: 16px;
    background: var(--surface);
    padding: 0;
}

.compact-subject-item {
    padding: 16px 20px;
    border-bottom: 1px solid var(--border);
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 1rem;
}

.compact-subject-item:last-child {
    border-bottom: none;
}

.compact-subject-item:hover {
    background: rgba(99, 102, 241, 0.1);
    border-left: 4px solid var(--primary-color);
    transform: translateX(5px);
}

.compact-subject-item.selected {
    background: rgba(99, 102, 241, 0.2);
    border-left: 4px solid var(--primary-color);
    font-weight: 600;
}

.subject-select-area {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex: 1;
    cursor: pointer;
    padding: 4px 0;
}

.subject-info {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex: 1;
}

.subject-name {
    color: var(--text-primary);
    font-weight: 500;
    font-size: 1rem;
}

.subject-count {
    color: var(--text-secondary);
    font-size: 0.9rem;
    background: var(--card);
    padding: 6px 12px;
    border-radius: 8px;
    min-width: 70px;
    text-align: center;
}

.subject-settings-area {
    margin-left: 10px;
}

.subject-settings-btn {
    background: var(--primary-color);
    color: white;
    border: none;
    border-radius: 6px;
    padding: 6px 10px;
    cursor: pointer;
    font-size: 0.8rem;
    transition: all 0.3s ease;
}

.subject-settings-btn:hover {
    background: var(--primary-hover);
    transform: scale(1.05);
}

/* Scrollbar cho danh sách môn học */
.compact-subject-list::-webkit-scrollbar {
    width: 6px;
}

.compact-subject-list::-webkit-scrollbar-track {
    background: var(--surface);
    border-radius: 3px;
}

.compact-subject-list::-webkit-scrollbar-thumb {
    background: var(--primary-color);
    border-radius: 3px;
}

.compact-subject-list::-webkit-scrollbar-thumb:hover {
    background: var(--primary-hover);
}

/* === TRANG 2: LÀM BÀI === */
.quiz-header {
    margin-bottom: 30px;
}

.header-info {
    text-align: center;
}

.question-counter {
    font-size: 1.1rem;
    color: var(--text-secondary);
    font-weight: 500;
}

.question-section {
    text-align: center;
}

.question-content h2 {
    font-size: 1.3rem;
    line-height: 1.8;
    color: var(--text-primary);
    margin-bottom: 0;
}

/* Options với A. B. C. D. bên trái */
.options-container {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin: 20px 0;
}

.option {
    display: flex;
    align-items: flex-start;
    padding: 16px 20px;
    background: var(--surface);
    border: 2px solid var(--border);
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.3s ease;
    font-weight: 500;
    color: var(--text-primary);
    position: relative;
    overflow: hidden;
}

.option::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: var(--gradient);
    opacity: 0.1;
    transition: left 0.3s ease;
}

.option:hover {
    border-color: var(--primary-color);
    transform: translateY(-2px);
}

.option:hover::before {
    left: 0;
}

.option.selected {
    background: rgba(99, 102, 241, 0.2);
    border-color: var(--primary-color);
    color: var(--primary-color);
}

.option.selected::before {
    left: 0;
}

.option-letter {
    font-weight: 700;
    color: var(--primary-color);
    margin-right: 12px;
    min-width: 24px;
    font-size: 1rem;
}

.option-text {
    flex: 1;
    line-height: 1.5;
}

.status-container {
    margin: 20px 0;
}

.status {
    padding: 16px;
    border-radius: 12px;
    text-align: center;
    font-weight: 600;
    font-size: 16px;
    transition: all 0.3s ease;
    border: 2px solid transparent;
}

.correct {
    background: rgba(16, 185, 129, 0.2);
    color: var(--success);
    border-color: var(--success);
}

.incorrect {
    background: rgba(239, 68, 68, 0.2);
    color: var(--error);
    border-color: var(--error);
}

.navigation-section {
    padding: 20px;
}

.navigation {
    display: flex;
    justify-content: space-between;
    gap: 15px;
}

.navigation button {
    flex: 1;
}

/* === TRANG 3: KẾT QUẢ === */
.score-section {
    text-align: center;
}

.score-display {
    display: flex;
    justify-content: center;
    gap: 40px;
    flex-wrap: wrap;
}

.score-item {
    display: flex;
    flex-direction: column;
    align-items: center;
}

.score-label {
    color: var(--text-secondary);
    font-size: 1rem;
    margin-bottom: 8px;
}

.score-value {
    font-size: 2rem;
    font-weight: 700;
    background: var(--gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.result-details {
    max-height: 400px;
    overflow-y: auto;
    margin-top: 20px;
}

.result-item {
    padding: 20px;
    border-radius: 12px;
    margin-bottom: 15px;
    border-left: 4px solid;
    background: var(--surface);
    transition: all 0.3s ease;
    cursor: pointer;
}

.result-item:hover {
    transform: translateX(5px);
    box-shadow: 0 8px 25px var(--shadow);
}

.result-item.correct {
    border-left-color: var(--success);
    background: rgba(16, 185, 129, 0.1);
}

.result-item.incorrect {
    border-left-color: var(--error);
    background: rgba(239, 68, 68, 0.1);
}

.result-item p {
    margin: 8px 0;
    color: var(--text-primary);
}

.result-item strong {
    color: var(--text-primary);
}

.result-summary {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 10px;
    padding-top: 10px;
    border-top: 1px solid var(--border);
}

.result-actions {
    display: flex;
    gap: 10px;
}

.view-detail-btn {
    background: var(--primary-color);
    color: white;
    border: none;
    padding: 6px 12px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.8rem;
    transition: all 0.3s ease;
}

.view-detail-btn:hover {
    background: var(--primary-hover);
    transform: translateY(-1px);
}

/* === MODAL CHI TIẾT CÂU HỎI === */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(5px);
    animation: fadeIn 0.3s ease;
}

.modal-content {
    background: var(--card);
    margin: 5% auto;
    border-radius: 20px;
    width: 90%;
    max-width: 600px;
    box-shadow: 0 20px 60px var(--shadow);
    border: 1px solid var(--border);
    animation: slideUp 0.4s ease;
    overflow: hidden;
}

/* === Responsive modal cho phần CÀI ĐẶT MÔN HỌC === */
#subjectSettingsModal .modal-content {
    width: 90vw;          /* 90% chiều rộng màn hình */
    height: 90vh;         /* 90% chiều cao màn hình */
    max-width: none;      /* Bỏ giới hạn max-width */
    max-height: none;     /* Bỏ giới hạn max-height */
    margin: auto;         /* Canh giữa */
    display: flex;
    flex-direction: column;
}

#subjectSettingsModal .modal-body {
    flex: 1;              /* Cho phần nội dung chiếm phần còn lại */
    overflow-y: auto;     /* Cuộn khi nội dung dài */
    padding: 24px;
}


@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(50px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 24px;
    border-bottom: 1px solid var(--border);
    background: var(--surface);
}

.modal-header h3 {
    margin: 0;
    color: var(--text-primary);
    font-size: 1.4rem;
}

.close-modal {
    background: none;
    border: none;
    font-size: 2rem;
    color: var(--text-secondary);
    cursor: pointer;
    transition: color 0.3s ease;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
}

.close-modal:hover {
    color: var(--error);
    background: rgba(239, 68, 68, 0.1);
}

.modal-body {
    padding: 24px;
}

.detail-question {
    margin-bottom: 24px;
}

.detail-question h4 {
    color: var(--text-primary);
    font-size: 1.2rem;
    line-height: 1.6;
    margin: 0;
}

.detail-options {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-bottom: 24px;
}

.detail-option {
    display: flex;
    align-items: flex-start;
    padding: 16px;
    background: var(--surface);
    border: 2px solid var(--border);
    border-radius: 12px;
    transition: all 0.3s ease;
}

.detail-option.user-selected {
    border-color: var(--primary-color);
    background: rgba(99, 102, 241, 0.1);
}

.detail-option.correct-answer {
    border-color: var(--success);
    background: rgba(16, 185, 129, 0.1);
}

.detail-option.user-selected.correct-answer {
    border-color: var(--success);
    background: rgba(16, 185, 129, 0.2);
}

.detail-option .option-letter {
    width: 32px;
    height: 32px;
    border-radius: 8px;
    background: var(--primary-color);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    margin-right: 16px;
    flex-shrink: 0;
}

.detail-option.correct-answer .option-letter {
    background: var(--success);
}

.detail-option .option-text {
    color: var(--text-primary);
    font-weight: 500;
    flex: 1;
    line-height: 1.5;
}

.detail-result {
    background: var(--surface);
    border-radius: 12px;
    padding: 20px;
    border: 1px solid var(--border);
}

.result-info {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.user-choice, .correct-answer {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.user-choice span:first-child, .correct-answer span:first-child {
    color: var(--text-secondary);
    font-weight: 500;
}

.choice-value, .answer-value {
    font-weight: 700;
    padding: 6px 12px;
    border-radius: 6px;
    background: var(--primary-color);
    color: white;
}

.answer-value {
    background: var(--success);
}

/* === STYLE CHO DẠNG TRẢ LỜI NGẮN === */
.short-answer-section {
    padding: 20px 0;
}

.input-group {
    margin-bottom: 20px;
}

.input-group label {
    display: block;
    margin-bottom: 12px;
    font-weight: 500;
    color: var(--text-primary);
    font-size: 1rem;
}

#shortAnswerInput {
    width: 100%;
    padding: 16px 20px;
    background: var(--surface);
    border: 2px solid var(--border);
    border-radius: 12px;
    font-size: 16px;
    color: var(--text-primary);
    transition: all 0.3s ease;
    font-family: 'Poppins', sans-serif;
}

#shortAnswerInput:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1);
}

#shortAnswerInput::placeholder {
    color: var(--text-muted);
}

.answer-hint {
    text-align: center;
    color: var(--text-secondary);
    font-size: 0.9rem;
    margin-top: 15px;
}

/* === STYLE CHO DẠNG TRUE/FALSE SET === */
.true-false-set {
    padding: 10px 0;
}

.sub-questions {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.sub-question {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 15px;
    background: var(--surface);
    border: 2px solid var(--border);
    border-radius: 12px;
    padding: 16px;
    transition: all 0.3s ease;
    min-height: 60px;
}

.sub-question:hover {
    border-color: var(--primary-color);
}

.sub-question-content {
    flex: 1;
    min-width: 0;
    display: flex;
    align-items: center;
}

.sub-question-text {
    font-weight: 500;
    color: var(--text-primary);
    line-height: 1.5;
    word-wrap: break-word;
    white-space: normal;
    overflow: visible;
    text-overflow: unset;
    display: block;
    width: 100%;
}

.sub-question-number {
    color: var(--primary-color);
    font-weight: 700;
    margin-right: 6px;
    flex-shrink: 0;
}

.true-false-buttons {
    display: flex;
    gap: 8px;
    flex-shrink: 0;
    margin-left: 10px;
    align-items: center;
}

.tf-btn {
    width: 44px;
    height: 44px;
    border: 2px solid var(--border);
    border-radius: 50%;
    background: var(--card);
    color: var(--text-primary);
    cursor: pointer;
    font-weight: 500;
    font-size: 0.8rem;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.tf-btn:hover {
    border-color: var(--primary-color);
    transform: translateY(-1px);
}

.tf-btn.selected.correct {
    background: var(--success);
    color: white;
    border-color: var(--success);
    transform: scale(1.05);
}

.tf-btn.selected.incorrect {
    background: var(--error);
    color: white;
    border-color: var(--error);
    transform: scale(1.05);
}

.tf-btn.correct:not(.selected):hover {
    border-color: var(--success);
    background: rgba(16, 185, 129, 0.1);
}

.tf-btn.incorrect:not(.selected):hover {
    border-color: var(--error);
    background: rgba(239, 68, 68, 0.1);
}

.tf-hint {
    text-align: center;
    color: var(--warning);
    font-size: 0.9rem;
    padding: 12px;
    background: rgba(245, 158, 11, 0.1);
    border-radius: 8px;
    border: 1px solid var(--warning);
    margin-top: 15px;
}

/* === STYLE CHO MODAL CHI TIẾT CÁC DẠNG MỚI === */
.detail-short-answer, .detail-true-false {
    margin-bottom: 20px;
}

.detail-answer-input {
    background: var(--surface);
    border: 2px solid var(--border);
    border-radius: 8px;
    padding: 12px 16px;
    margin: 10px 0;
    font-weight: 500;
}

.detail-answer-input.correct {
    border-color: var(--success);
    background: rgba(16, 185, 129, 0.1);
    color: var(--success);
}

.detail-answer-input.incorrect {
    border-color: var(--error);
    background: rgba(239, 68, 68, 0.1);
    color: var(--error);
}

.detail-sub-questions {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.detail-sub-question {
    background: var(--surface);
    border: 2px solid var(--border);
    border-radius: 8px;
    padding: 16px;
}

.detail-sub-question.correct {
    border-color: var(--success);
    background: rgba(16, 185, 129, 0.1);
}

.detail-sub-question.incorrect {
    border-color: var(--error);
    background: rgba(239, 68, 68, 0.1);
}

.detail-sub-question-text {
    font-weight: 500;
    margin-bottom: 10px;
    color: var(--text-primary);
}

.detail-sub-question-answer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.9rem;
}

.sub-question-result {
    padding: 4px 8px;
    border-radius: 6px;
    font-weight: 600;
    font-size: 0.8rem;
}

.sub-question-result.correct {
    background: var(--success);
    color: white;
}

.sub-question-result.incorrect {
    background: var(--error);
    color: white;
}

/* === MODAL CÀI ĐẶT MÔN HỌC === */
#subjectSettingsModal .modal-content {
    background: var(--card);
    margin: 2% auto;
    border-radius: 20px;
    width: 95%;
    height: 96vh;
    border: 1px solid var(--border);
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

#subjectSettingsModal .modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px;
    border-bottom: 1px solid var(--border);
    background: var(--surface);
    flex-shrink: 0;
}

#subjectSettingsModal .modal-header h3 {
    margin: 0;
    color: var(--text-primary);
    font-size: 1.3rem;
    font-weight: 600;
}

.settings-controls {
    display: flex;
    gap: 10px;
    margin-bottom: 20px;
    padding-bottom: 15px;
    border-bottom: 1px solid var(--border);
    flex-shrink: 0;
}

.settings-controls button {
    padding: 12px 20px;
    font-size: 0.9rem;
    flex: 1;
    border: none;
    border-radius: 10px;
    cursor: pointer;
    font-weight: 500;
    transition: all 0.3s ease;
}

.settings-controls .btn-primary {
    background: var(--primary-color);
    color: white;
}

.settings-controls .btn-secondary {
    background: var(--secondary-color);
    color: white;
}

.settings-controls button:hover {
    opacity: 0.9;
    transform: translateY(-2px);
}

.question-type-section {
    background: var(--surface);
    border-radius: 12px;
    padding: 15px;
    border: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    height: 100%;
    min-height: 150px;
    flex: 1;
    margin-bottom: 15px;
}

.type-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
    flex-shrink: 0;
}

.type-header h4 {
    margin: 0;
    color: var(--text-primary);
    font-size: 1rem;
    font-weight: 600;
}

.btn-small {
    background: var(--secondary-color);
    color: white;
    border: none;
    padding: 6px 12px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.8rem;
    transition: all 0.3s ease;
    white-space: nowrap;
}

.btn-small:hover {
    background: var(--secondary-hover);
}

.question-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
    flex: 1;
    overflow-y: auto;
    max-height: none;
    padding: 5px;
}

.question-item {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 10px;
    background: var(--card);
    border-radius: 8px;
    border: 1px solid var(--border);
    font-size: 0.85rem;
    transition: all 0.3s ease;
    min-height: 40px;
}

.question-item:hover {
    border-color: var(--primary-color);
}

.question-item input[type="checkbox"] {
    margin-top: 2px;
    transform: scale(1);
}

.question-content {
    flex: 1;
    font-size: 0.8rem;
    line-height: 1.3;
    color: var(--text-primary);
    word-break: break-word;
    padding: 2px 0;
}

.question-item.selected {
    background: rgba(99, 102, 241, 0.1);
    border-color: var(--primary-color);
}

.settings-actions {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    margin-top: 20px;
    padding-top: 15px;
    border-top: 1px solid var(--border);
    flex-shrink: 0;
}

.settings-actions button {
    padding: 12px 24px;
    font-size: 0.9rem;
    min-height: 44px;
}

/* Scrollbar cho danh sách câu hỏi */
.question-list::-webkit-scrollbar {
    width: 4px;
}

.question-list::-webkit-scrollbar-track {
    background: var(--surface);
}

.question-list::-webkit-scrollbar-thumb {
    background: var(--primary-color);
    border-radius: 2px;
}

/* === MOBILE NAVIGATION === */
.mobile-navigation {
    display: none;
    position: sticky;
    bottom: 0;
    left: 0;
    right: 0;
    background: var(--card);
    border-top: 1px solid var(--border);
    padding: 10px 15px;
    z-index: 1000;
    box-shadow: 0 -4px 20px var(--shadow);
    width: 100%;
    margin-top: auto;
}

.mobile-nav-buttons {
    display: flex;
    justify-content: space-between;
    gap: 8px;
}

.mobile-nav-btn {
    flex: 1;
    padding: 12px 8px;
    border: none;
    border-radius: 10px;
    background: var(--surface);
    color: var(--text-primary);
    cursor: pointer;
    font-size: 0.8rem;
    font-weight: 600;
    transition: all 0.3s ease;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    min-height: 60px;
    justify-content: center;
}

.mobile-nav-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.mobile-nav-btn:not(:disabled):hover {
    background: var(--primary-color);
    transform: translateY(-2px);
}

.mobile-nav-btn.prev {
    background: var(--secondary-color);
}

.mobile-nav-btn.next {
    background: var(--primary-color);
}

.mobile-nav-btn.check {
    background: var(--success);
}

.mobile-nav-icon {
    font-size: 1.2rem;
    margin-bottom: 2px;
}

/* === STYLE CHO OPTIONS-SECTION KHI CÓ KẾT QUẢ === */
.options-section.correct {
    border: 2px solid var(--success);
    background: rgba(16, 185, 129, 0.05);
    transition: all 0.3s ease;
}

.options-section.incorrect {
    border: 2px solid var(--error);
    background: rgba(239, 68, 68, 0.05);
    transition: all 0.3s ease;
}

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

/* Ẩn navigation desktop trên mobile */
@media (max-width: 768px) {
    .desktop-navigation {
        display: none;
    }
    
    .mobile-navigation {
        display: block;
    }
    
    /* QUAN TRỌNG: Sửa container và page để sticky hoạt động */
    .container {
        padding-bottom: 0;
        display: flex;
        flex-direction: column;
        min-height: calc(100vh - 80px);
    }
    
    #page2 {
        display: flex;
        flex-direction: column;
        min-height: 100vh;
    }
    
    #page2 .container {
        flex: 1;
        display: flex;
        flex-direction: column;
    }
    
    /* Đảm bảo nội dung có thể scroll */
    .quiz-header,
    .question-section,
    .options-section,
    .status-container,
    .navigation-section {
        flex-shrink: 0;
    }
    
    .options-section {
        flex: 1;
        overflow-y: auto;
    }
    
    /* Responsive cho page 1 */
    #page1 .container {
        justify-content: flex-start;
        padding: 15px;
    }
    
    .main-title {
        font-size: 1.4rem;
    }
    
    #page1 .card {
        padding: 20px;
        margin-bottom: 20px;
    }
    
    .compact-subject-list {
        max-height: 250px;
    }
    
    .compact-subject-item {
        padding: 14px 16px;
    }
    
    .action-section button {
        padding: 16px 30px !important;
        font-size: 1rem !important;
    }
    
    /* Modal settings responsive */
    #subjectSettingsModal .modal-content {
        width: 98%;
        height: 98vh;
        margin: 1% auto;
    }
    
    #subjectSettingsModal .modal-header {
        padding: 15px;
    }
    
    #subjectSettingsModal .modal-header h3 {
        font-size: 1.1rem;
    }
    
    .settings-controls {
        gap: 8px;
        margin-bottom: 15px;
    }
    
    .settings-controls button {
        padding: 10px 15px;
        font-size: 0.8rem;
    }
    
    .question-type-section {
        padding: 12px;
        min-height: 120px;
    }
    
    .type-header h4 {
        font-size: 0.9rem;
    }
    
    .btn-small {
        padding: 5px 10px;
        font-size: 0.75rem;
    }
    
    .question-item {
        padding: 8px;
        font-size: 0.8rem;
    }
    
    .question-content {
        font-size: 0.75rem;
    }
    
    /* Đảm bảo input field có đủ không gian khi bàn phím mở */
    #shortAnswerInput {
        font-size: 16px;
    }
}

/* Responsive cho màn hình rất nhỏ */
@media (max-width: 480px) {
    .main-title {
        font-size: 1.2rem;
    }
    
    .info-content {
        font-size: 0.9rem;
    }
    
    .compact-subject-item {
        padding: 12px 14px;
        font-size: 0.9rem;
    }
    
    .subject-count {
        font-size: 0.8rem;
        min-width: 60px;
        padding: 4px 8px;
    }
    
    .mobile-nav-btn {
        min-height: 55px;
        font-size: 0.75rem;
        padding: 10px 6px;
    }
    
    .mobile-nav-icon {
        font-size: 1rem;
    }
    
    .settings-controls button {
        font-size: 0.75rem;
        padding: 8px 12px;
    }
    
    #subjectSettingsModal .modal-header h3 {
        font-size: 1rem;
    }
    
    .question-type-section {
        min-height: 100px;
    }
}

/* Đặc biệt cho landscape mode trên mobile */
@media (max-width: 768px) and (orientation: landscape) {
    .mobile-navigation {
        padding: 8px 12px;
    }
    
    .mobile-nav-btn {
        min-height: 50px;
    }
    
    .container {
        min-height: calc(100vh - 65px);
    }
}

/* Scrollbar styling */
.result-details::-webkit-scrollbar {
    width: 6px;
}

.result-details::-webkit-scrollbar-track {
    background: var(--surface);
    border-radius: 3px;
}

.result-details::-webkit-scrollbar-thumb {
    background: var(--primary-color);
    border-radius: 3px;
}

.result-details::-webkit-scrollbar-thumb:hover {
    background: var(--primary-hover);
}

/* === FIX KHOẢNG TRẮNG === */
.page:not(.active) {
    display: none !important;
    height: 0 !important;
    min-height: 0 !important;
    overflow: hidden !important;
    opacity: 0 !important;
}

body.modal-open {
    overflow: hidden;
}