/* Import Kanit Font */
body {
    font-family: 'Kanit', sans-serif;
    background-color: #f8f9fa; /* Light grey background */
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

main {
    flex: 1;
}

/* Color Variables */
:root {
    --primary-blue: #0d6efd;
    --primary-yellow: #ffc107;
    --text-black: #212529;
    --bg-white: #ffffff;
}

/* --- Component Styling --- */
.navbar-brand {
    font-size: 1.5rem;
}

.card {
    border-radius: 0.75rem;
}

.btn-primary {
    background-color: var(--primary-blue);
    border-color: var(--primary-blue);
}

.btn-warning {
    background-color: var(--primary-yellow);
    border-color: var(--primary-yellow);
    color: var(--text-black);
}

.btn-warning:hover {
    background-color: #e0a800;
    border-color: #e0a800;
    color: var(--text-black);
}

/* --- Answer Sheet Styling (UPDATED SECTION) --- */
#answer-sheet-container {
    background-color: var(--bg-white);
}

.part-header {
    font-size: 1.5rem;
    font-weight: 500;
    margin-top: 1.5rem;
    margin-bottom: 1rem;
    border-bottom: 2px solid #eee;
    padding-bottom: 0.5rem;
    color: var(--primary-blue);
}

.part-header:first-child {
    margin-top: 0;
}

.questions-container {
    /* ใช้ CSS Columns ในการจัดเรียงบนลงล่าง */
    column-count: 4; /* จำนวนคอลัมน์เริ่มต้นสำหรับจอใหญ่ */
    column-gap: 2rem; /* ระยะห่างระหว่างคอลัมน์ */
}

.question-row {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding-bottom: 0.75rem;
    break-inside: avoid; /* ป้องกันไม่ให้ข้อความถูกแบ่งครึ่งระหว่างคอลัมน์ */
}

.question-number {
    font-weight: 500;
    color: var(--text-black);
    width: 35px; /* Fixed width for alignment */
    flex-shrink: 0;
}

.choices-container {
    display: flex;
    gap: 0.5rem;
}

.choice-label {
    display: flex;
    justify-content: center;
    align-items: center;
    width: 30px;
    height: 30px;
    border: 1px solid #ccc;
    border-radius: 50%;
    cursor: pointer;
    transition: background-color 0.2s, color 0.2s, border-color 0.2s;
    user-select: none; /* ป้องกันการเลือก text เวลาดับเบิ้ลคลิก */
}

.choice-label:hover {
    background-color: #e9ecef;
    border-color: #adb5bd;
}

/* NEW: Style for selected choice */
.choice-label.selected {
    background-color: var(--primary-blue);
    color: var(--bg-white);
    border-color: var(--primary-blue);
    font-weight: 500;
}

/* --- Media Queries for Responsiveness --- */
@media (max-width: 1200px) {
    .questions-container {
        column-count: 3;
    }
}

@media (max-width: 992px) {
    .questions-container {
        column-count: 2;
    }
    h1 {
        font-size: 1.8rem;
    }
}

@media (max-width: 576px) {
    .questions-container {
        column-count: 1; /* เหลือ 1 คอลัมน์สำหรับจอมือถือ */
    }
}