/* Quiz Container (chung) */
.quiz-container {
    width: 100%;
    margin: 30px auto;
    padding: 20px;
    text-align: left; /* Căn lề trái cho toàn bộ container */
    background: #FEEFD8; /* Thay đổi background màu #FEEFD8 */
    border: 4px solid #41c5c8;
    border-radius: 12px;
    box-shadow: 0 6px 12px rgba(0, 0, 0, 0.1);
    position: relative;
    z-index: 12 !important;
    display: none; /* Ẩn ban đầu */
}

/* Section 1: Header */
.quiz-header {
    margin-bottom: 20px;
    display: flex;
    justify-content: space-between; /* Tách lề trái và phải */
    align-items: center;
    width: 100%; /* Đảm bảo toàn bộ chiều rộng */
}

.quiz-header-left {
    display: flex;
    flex-direction: column;
    align-items: flex-start; /* Căn lề trái */
    width: 80%; /* Đặt 80% chiều rộng */
}

.quiz-header-left p {
    font-size: clamp(1.8rem, 3vw, 2.2rem);
    color: #666; /* Màu chữ #666 */
    margin: 0 0 10px 0;
    text-align: left; /* Căn lề trái */
}

.quiz-header-right {
    display: flex;
    align-items: center;
    width: 20%; /* Đặt 20% chiều rộng */
    justify-content: flex-end; /* Căn phải */
}

.power-button {
    background: none;
    border: none;
    cursor: pointer;
    padding: 8px; /* Tăng padding để lớn hơn */
    margin-left: auto; /* Đẩy nút về lề phải */
}

.power-button i {
    font-size: 30px; /* Tăng kích thước icon lên 30px */
    color: #f44336;
}

.quiz-progress {
    width: 100%; /* Đảm bảo chiếm 80% của quiz-header-left */
    height: 14px;
    background-color: #e0e0e0;
    border-radius: 7px;
    overflow: hidden;
    text-align: left; /* Căn lề trái */
    margin-left: 0; /* Đảm bảo căn lề trái */
}

.quiz-progress .progress-bar {
    height: 100%;
    background-color: #41c5c8;
    width: 0;
    transition: width 0.3s ease-in-out;
}

/* Section 2: Nội dung câu hỏi */
.quiz-content {
    margin-bottom: 20px;
    text-align: left; /* Căn lề trái */
    display: block; /* Thay grid bằng block cho Single Choice */
}

.quiz-content.true-false {
    display: grid; /* Chỉ dùng grid cho True/False */
    grid-template-columns: 1fr auto 1fr; /* Phân chia 1 phần cho term, 1 phần cho SVG, 1 phần cho definition */
    align-items: center;
    gap: 10px; /* Khoảng cách giữa các phần */
    position: relative;
}

.question-info {
    font-size: clamp(1.2rem, 2vw, 1.5rem);
    color: #666; /* Màu chữ #666 */
    margin-bottom: 10px;
    text-align: left; /* Căn lề trái */
    width: 100%; /* Đảm bảo chiếm toàn bộ */
}

.quiz-question,
.term-container,
.definition-container {
    font-size: clamp(1.5rem, 3vw, 2rem);
    margin-bottom: 0; /* Loại bỏ margin để khớp với quiz-options */
    min-height: 200px; /* Chiều cao tối thiểu */
    width: 100%; /* Đổi từ 90% thành 100% */
    padding: 0; /* Loại bỏ padding để khớp chiều rộng với quiz-options */
    background: #fff; /* Background màu #fff */
    display: flex;
    align-items: center; /* Căn giữa nội dung */
    justify-content: center; /* Căn giữa nội dung */
    text-align: center; /* Căn giữa text */
    border: 3px solid #F6DEB9; /* Viền màu #F6DEB9, dày 3px */
}

.svg-connector {
    width: 50px;
    height: 50px;
    position: absolute;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
    z-index: 20; /* Đè lên term-container và definition-container */
}

/* Section 3: Đáp án */
.quiz-options,
.true-false-options {
    display: flex;
    flex-direction: column;
    align-items: flex-start; /* Căn lề trái */
    gap: 10px;
    margin-bottom: 20px;
    width: 100%; /* Đổi từ 90% thành 100% giống quiz-question */
    padding: 0; /* Loại bỏ padding để khớp chiều rộng */
}

.true-false-options {
    flex-direction: row; /* Sắp xếp nút Đúng/Sai ngang */
}

.true-false-option {
    padding: 10px 20px;
    font-size: 1rem;
    width: 50%; /* Thay 100px bằng 50% */
    background: #f0f0f0;
    border: 2px solid #41c5c8;
    border-radius: 5px;
    cursor: pointer;
    transition: all 0.3s ease;
    color: #666; /* Màu chữ #666 */
    text-align: center;
}

.true-false-option:hover {
    background: #e0e0e0;
}

.true-false-option.selected {
    background: #e0f7fa; /* Hiệu ứng giống bookmark-button */
    border-color: #39c6c6;
}

.true-false-option.correct {
    border: 2px solid #FFFFFF; /* Viền #FFFFFF cho toàn bộ option khi đúng */
}

.true-false-option.correct p {
    color: #39C6C6; /* Màu chữ khi đúng */
    background: #E6FCF4; /* Màu nền khi đúng */
}

.true-false-option.incorrect {
    border: none; /* Không viền khi sai */
}

.true-false-option.incorrect p {
    color: #FD908C; /* Màu chữ khi sai */
    background: #FEF6E0; /* Màu nền khi sai */
}

/* Kết hợp selected và correct */
.true-false-option.selected.correct {
    border: 2px solid #FFFFFF; /* Viền #FFFFFF khi được chọn đúng */
}

.true-false-option.selected.correct p {
    color: #39C6C6; /* Màu chữ khi chọn đúng */
    background: #E6FCF4; /* Màu nền khi chọn đúng */
}

.quiz-submit,
.true-false-submit {
    padding: 10px 30px;
    font-size: 1rem;
    background-color: #41c5c8;
    color: #666; /* Màu chữ #666 */
    border: none;
    border-radius: 5px;
    cursor: pointer;
    margin-top: 10px;
    float: right; /* Căn lề phải */
    display: none; /* Ẩn ban đầu */
}

.quiz-submit:hover,
.true-false-submit:hover {
    background-color: #369ea1;
}

/* Quiz Result */
.quiz-result {
    margin-top: 20px;
    font-size: clamp(1.2rem, 2.5vw, 1.5rem);
    color: #666; /* Màu chữ #666 */
    text-align: left; /* Căn lề trái */
}

.quiz-result.correct {
    color: #2ecc71;
}

.quiz-result.incorrect {
    color: #e74c3c;
}

/* Popup thông báo đúng */
.quiz-continue.correct-container {
    padding: 10px 30px;
    font-size: 1rem;
    background-color: #e6fcf4; /* Màu nền popup đúng */
    color: #666; /* Màu chữ #666 */
    border: none;
    border-radius: 5px;
    cursor: pointer;
    margin-top: 20px;
    float: right; /* Căn lề phải */
}

.quiz-continue.correct-container:hover {
    background-color: #369ea1;
}

.correct-message {
    text-align: left; /* Căn lề trái */
}

.correct-message .title {
    color: #53D0D0;
    font-size: clamp(1.5em, 3vw, 1.5em); /* Responsive */
    font-weight: 700;
    margin: 0 0 10px;
}

.correct-message .subtitle {
    font-size: clamp(16px, 2.5vw, 16px); /* Responsive */
    font-weight: 700;
    margin: 0 0 10px;
}

/* Popup thông báo sai */
.quiz-continue.incorrect-container {
    padding: 10px 30px;
    font-size: 1rem;
    background-color: #fef6e0; /* Màu nền popup sai */
    color: #666; /* Màu chữ #666 */
    border: none;
    border-radius: 5px;
    cursor: pointer;
    margin-top: 20px;
    float: right; /* Căn lề phải */
}

.quiz-continue.incorrect-container:hover {
    background-color: #369ea1;
}

.incorrect-message {
    text-align: left; /* Căn lề trái */
}

.incorrect-message .title {
    color: #FD5673;
    font-size: clamp(1.5em, 3vw, 1.5em); /* Responsive */
    font-weight: 700;
    margin: 0 0 10px;
}

.incorrect-message .label {
    font-size: clamp(16px, 2.5vw, 16px); /* Responsive */
    font-weight: 400;
    margin: 0 0 5px;
}

.incorrect-message .definition {
    font-size: clamp(16px, 2.5vw, 16px); /* Responsive */
    font-weight: 700;
    margin: 0 0 10px;
}

/* Quiz Popup (before starting) */
.quiz-start-popup {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: #fff;
    padding: 30px;
    border-radius: 12px;
    border: 4px solid #41c5c8;
    box-shadow: 0 6px 12px rgba(0, 0, 0, 0.2);
    z-index: 1001;
    text-align: center;
    max-width: 400px;
    width: 90%;
    display: none; /* Ẩn ban đầu */
}

.quiz-start-popup h3 {
    margin: 0 0 15px;
    font-size: clamp(20px, 3vw, 24px);
    color: #666; /* Màu chữ #666 */
}

.quiz-start-popup input {
    padding: 10px;
    font-size: 16px;
    width: 60%;
    margin-bottom: 20px;
    border: 2px solid #41c5c8;
    border-radius: 5px;
    color: #666; /* Màu chữ #666 */
}

.quiz-start-popup button {
    padding: 10px 20px;
    margin: 0 10px;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    font-size: 16px;
    background-color: #41c5c8;
    color: #666; /* Màu chữ #666 */
}

.quiz-start-popup button:hover {
    background-color: #369ea1;
}

/* Responsive */
@media (max-width: 768px) {
    .quiz-header p {
        font-size: clamp(1.5rem, 2.5vw, 1.8rem);
    }

    .quiz-content .question-info {
        font-size: clamp(1rem, 1.8vw, 1.2rem);
    }

    .quiz-question,
    .term-container,
    .definition-container {
        font-size: clamp(1.2rem, 2.5vw, 1.5rem);
        min-height: 180px;
    }

    .quiz-option,
    .true-false-option {
        font-size: 0.9rem;
        width: 90%;
    }

    .quiz-submit,
    .true-false-submit,
    .quiz-continue {
        font-size: 0.9rem;
        padding: 8px 20px;
    }

    .correct-message .title,
    .incorrect-message .title {
        font-size: clamp(1.2em, 2.5vw, 1.2em);
    }

    .correct-message .subtitle,
    .incorrect-message .label,
    .incorrect-message .definition {
        font-size: clamp(14px, 2vw, 14px);
    }

    .power-button i {
        font-size: 25px; /* Giảm kích thước trên tablet */
    }
}

@media (max-width: 480px) {
    .quiz-header p {
        font-size: clamp(1.2rem, 2vw, 1.5rem);
    }

    .quiz-content .question-info {
        font-size: clamp(0.9rem, 1.5vw, 1rem);
    }

    .quiz-question,
    .term-container,
    .definition-container {
        font-size: clamp(1rem, 2vw, 1.2rem);
        min-height: 150px;
    }

    .quiz-option,
    .true-false-option {
        font-size: 0.8rem;
        width: 95%;
    }

    .quiz-submit,
    .true-false-submit,
    .quiz-continue {
        font-size: 0.8rem;
        padding: 6px 15px;
    }

    .correct-message .title,
    .incorrect-message .title {
        font-size: clamp(1em, 2vw, 1em);
    }

    .correct-message .subtitle,
    .incorrect-message .label,
    .incorrect-message .definition {
        font-size: clamp(12px, 1.8vw, 12px);
    }

    .quiz-submit,
    .true-false-submit,
    .quiz-continue {
        float: none; /* Loại bỏ căn lề phải trên mobile */
        margin: 10px 0;
        width: 100%;
    }

    .power-button i {
        font-size: 20px; /* Giảm kích thước trên mobile */
    }
}
