/* Chỉ full màn hình ở màn load */
body[data-page='load'] #app {
    width: 100vw;
    height: auto;
    display: flex;
}
:root {
    --bg: #f0f2f5;
    --card: #fff;
    --primary: #4a90e2;
    --hover: #357abd;
    --text: #333;
    --radius: 8px;
    --shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    --gap: 12px;
}
* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}
body,
html {
    height: 100%;
    font-family: "Segoe UI", sans-serif;
    background: var(--bg);
}
.container {
    display: flex;
    height: 100%;
}
.sidebar {
    width: auto;
    background: var(--card);
    box-shadow: var(--shadow);
    overflow-y: auto;
}
.sidebar header {
    padding: var(--gap);
    text-align: center;
    border-bottom: 1px solid var(--bg);
}
#questionNav {
    padding: 20px;
    list-style: none;
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: var(--gap);
    margin: 0;
}

#questionNav li {
    width: 40px;
    height: 40px;
    /* Xóa line-height nếu có */
    /* line-height: 40px; */
    border: 2px solid var(--primary);
    border-radius: 50%;
    background: var(--card);
    color: var(--text);
    cursor: pointer;
    user-select: none;

    /* Thêm 2 dòng này để canh giữa nội dung */
    display: flex;
    align-items: center;
    justify-content: center;

    transition: background 0.2s, border-color 0.2s, color 0.2s;
}

#questionNav li:hover,
#questionNav li.active {
    background: var(--primary);
    color: #fff;
    border-color: var(--hover);
}

#questionNav li {
    padding: var(--gap);
    text-align: center;
    cursor: pointer;
}
#questionNav li.active,
#questionNav li:hover {
    background: var(--primary);
    color: #fff;
}
.content {
    flex: 1;
    padding: 12px 12px 0 12px;
    display: flex;
    flex-direction: column;
}
.content-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: var(--gap);
}
.content-header h2 {
    font-size: 1.2rem;
}
.btn-primary {
    background: var(--primary);
    color: #fff;
    border: none;
    padding: 6px 12px;
    border-radius: var(--radius);
    cursor: pointer;
}
.btn-primary.small {
    padding: 4px 8px;
    font-size: 0.9rem;
}
.btn-primary:hover {
    background: var(--hover);
}
.view-card {
    background: var(--card);
    padding: var(--gap);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    flex: 1;
    overflow-y: auto;
}
.view-card h3 {
    margin-bottom: var(--gap);
}
#viewOptions {
    list-style: none;
}
#viewOptions li {
    margin-bottom: var(--gap);
}
.correct-answer {
    margin-top: var(--gap);
    font-weight: bold;
}
/* Modal */
.modal {
    position: fixed;
    z-index: 999;
    left: 0; top: 0;
    width: 100%; height: 100%;
    background: rgba(0,0,0,0.5);
}
.hidden {
    display: none;
}
.modal-content {
    background: white;
    margin: 10% auto;
    padding: 20px;
    border-radius: 8px;
    text-align: center;
}
.modal-content form {
    display: flex;
    flex-direction: column;
    gap: var(--gap);
}
.modal-content textarea,
.modal-content input,
.modal-content select {
    padding: 8px;
    border: 1px solid #ccc;
    border-radius: var(--radius);
}
.modal-actions {
    display: flex;
    justify-content: flex-end;
    gap: var(--gap);
}
.pagination {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: var(--gap);
}
.btn-page {
    background: none;
    border: 1px solid var(--primary);
    color: var(--primary);
    padding: 4px 8px;
    border-radius: var(--radius);
    cursor: pointer;
}
.btn-page:disabled {
    opacity: 0.5;
    cursor: default;
}

/* Submit button container */
.submit-container {
    margin-top: var(--gap);
    margin-bottom: var(--gap);
    text-align: center;
}

.options-list {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.options-list li {
    display: inline-block; /* CHỈ chiếm đúng chiều ngang text */
    padding: 12px 16px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--card);
    cursor: pointer;
    transition: all 0.2s;
    font-weight: 500;
}

.options-list li:hover {
    background: #60a9ff;
}

.options-list li.selected {
    background: #4caf50; /* màu xanh lá */
    color: white;
    border-color: #4caf50;
}

.question-title {
    font-size: 20px;
    font-weight: bold;
    margin-bottom: 12px;
    color: #2c7be5; /* màu xanh hiện đại */
    margin-left: 20px;
}

#questionNav li.answered {
    background-color: #b2f2bb;
    border-color: #4caf50;
    font-weight: bold;
}

#questionNav li.correct {
    background-color: #4caf50;
    color: white;
}

#questionNav li.wrong {
    background-color: #f44336;
    color: white;
}

#questionNav li.unanswered {
    background-color: #ffeb3b;
    color: black;
}

.close-btn {
    float: right;
    font-size: 20px;
    cursor: pointer;
}

.correct-answer {
	background-color: #4caf50 !important;
	color: white;
	font-weight: bold;
}

.wrong-answer {
	background-color: #f44336 !important;
	color: white;
}

.explanation {
	margin-top: 15px;
	background: #f5f5f5;
	border-left: 4px solid #2196f3;
	padding: 10px;
	font-style: italic;
	border-radius: 4px;
}

button {
    padding: 10px 20px;
    background: #2c7be5;
    color: white;
    border: none;
    border-radius: 4px;
    font-size: 16px;
    cursor: pointer;
}

button:hover {
    background: #1a5fb4;
}

@media (max-width: 768px) {
    body[data-page='load'] #app {
        display: block;
    }

    .container {
        flex-direction: column;
        height: auto;
    }

    .sidebar {
        width: 100%;
        order: 2;
        padding: var(--gap);
    }

    .content {
        width: 100%;
        order: 1;
        padding: var(--gap);
    }

    .content-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 8px;
    }

    .modal-content {
        width: 90%;
    }

    #questionNav {
        grid-template-columns: repeat(5, 1fr);
    }

    .view-card {
        padding: 16px;
    }

    button, input, select {
        font-size: 16px;
    }

    .form-group {
        margin-bottom: 16px;
    }

    #editor,
    #questionList {
        width: 100% !important;
        height: auto;
    }

    #questionList {
        border-right: none;
        border-bottom: 1px solid #ccc;
    }

    #editor {
        padding: 12px;
    }

    .options-list li {
        width: 100%;
    }
}
