/* --- 1. CẤU HÌNH MÀU SẮC & FONT (THEME TRUNG ĐOÀN 8) --- */
:root {
    /* Màu chủ đạo: Đỏ cờ & Vàng sao */
    --primary: #b30000;       /* Đỏ đậm truyền thống */
    --primary-hover: #d90000;
    --gold: #ffd700;          /* Vàng kim loại */
    --gold-light: #fff5cc;
    
    /* Màu phụ trợ: Xanh quân đội & Trung tính */
    --army-green: #4b5320;
    --text-main: #2b0505;     /* Đen pha đỏ rất nhẹ */
    --text-light: #666;
    --bg-body: #f4f1ea;       /* Màu giấy cũ / kem nhạt */
    --white: #ffffff;
    
    /* Trạng thái */
    --success: #198754;
    --danger: #dc3545;
    --warning: #ffc107;
    
    /* Kích thước & Khoảng cách */
    --radius: 8px;
    --shadow: 0 4px 15px rgba(179, 0, 0, 0.1);
}

/* --- 2. RESET & BASE --- */
* { box-sizing: border-box; }
body {
    font-family: 'Be Vietnam Pro', sans-serif;
    background-color: var(--bg-body);
    background-image: url('https://www.transparenttextures.com/patterns/cubes.png'); /* Pattern nhẹ */
    color: var(--text-main);
    margin: 0;
    padding: 0;
    line-height: 1.6;
    font-size: 16px;
}

/* --- 3. LAYOUT CHUNG (APP SHELL) --- */
.app-shell {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 20px;
}

.card {
    background: var(--white);
    width: 100%;
    max-width: 1000px; /* Độ rộng tối đa trên PC */
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 30px;
    border-top: 5px solid var(--primary); /* Điểm nhấn màu đỏ trên đầu thẻ */
    position: relative;
}

/* Logo & Header trong Card */
.app-header {
    display: flex;
    align-items: center;
    gap: 15px;
    margin-bottom: 30px;
    border-bottom: 2px solid var(--gold);
    padding-bottom: 15px;
}
.app-logo {
    width: 60px;
    height: 60px;
    background: var(--primary);
    color: var(--gold);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 900;
    font-size: 1.5rem;
    box-shadow: 0 0 0 3px var(--gold);
}
.app-title {
    margin: 0;
    color: var(--primary);
    font-family: 'Playfair Display', serif;
    text-transform: uppercase;
    font-size: 1.5rem;
    line-height: 1.2;
}
.app-subtitle {
    margin: 0;
    font-size: 0.9rem;
    color: var(--text-light);
    font-style: italic;
}

/* --- 4. FORM ELEMENTS --- */
.form-group { margin-bottom: 20px; }
label { display: block; margin-bottom: 8px; font-weight: 600; color: var(--army-green); }
.input {
    width: 100%;
    padding: 12px 15px;
    border: 1px solid #ccc;
    border-radius: var(--radius);
    font-size: 1rem;
    transition: 0.3s;
}
.input:focus {
    border-color: var(--primary);
    outline: none;
    box-shadow: 0 0 0 3px rgba(179, 0, 0, 0.1);
}

/* --- 5. BUTTONS --- */
.btn {
    display: inline-block;
    padding: 10px 25px;
    border-radius: 50px;
    text-decoration: none;
    font-weight: 700;
    text-align: center;
    cursor: pointer;
    transition: 0.3s;
    border: none;
    font-size: 0.95rem;
}
.btn-primary {
    background: linear-gradient(135deg, var(--primary), #800000);
    color: var(--gold);
    border: 1px solid var(--primary);
}
.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(179, 0, 0, 0.3);
    color: #fff;
}
.btn-outline {
    background: transparent;
    border: 2px solid var(--army-green);
    color: var(--army-green);
}
.btn-outline:hover {
    background: var(--army-green);
    color: white;
}
.btn-danger {
    background: #fff;
    color: var(--danger);
    border: 2px solid var(--danger);
}
.btn-row { display: flex; gap: 10px; flex-wrap: wrap; }

/* --- 6. GIAO DIỆN LÀM BÀI (QUAN TRỌNG) --- */
.exam-top-bar {
    background: var(--bg-body);
    padding: 15px;
    border-radius: var(--radius);
    margin-bottom: 25px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-weight: bold;
    border: 1px solid #ddd;
}
.countdown {
    color: var(--primary);
    font-size: 1.4rem;
    font-weight: 900;
    font-family: monospace;
}


/* Nội dung câu hỏi */
.question-body {
    font-size: 1.15rem;
    font-weight: 600;
    margin-bottom: 20px;
    color: #000;
}
.answers-list { list-style: none; padding: 0; }
.answers-list li { margin-bottom: 12px; }

/* Thẻ trả lời (Radio button to dễ bấm trên điện thoại) */
.answer-option {
    display: flex;
    align-items: flex-start;
    padding: 12px 15px;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    cursor: pointer;
    transition: 0.2s;
    background: #fff;
}
.answer-option:hover { background: #fffdf0; border-color: var(--gold); }
.answer-option.selected {
    background: var(--gold-light);
    border-color: var(--primary);
}
.answer-option input[type="radio"] {
    margin-top: 5px;
    margin-right: 12px;
    accent-color: var(--primary); /* Màu radio */
    transform: scale(1.3);
}
.answer-label { font-weight: bold; margin-right: 8px; color: var(--primary); }

/* --- 7. BẢNG (TABLE) RESPONSIVE --- */
.table-wrap { overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; min-width: 600px; }
.table th, .table td { padding: 12px 15px; border-bottom: 1px solid #eee; text-align: left; }
.table th { background: #f8f8f8; color: var(--army-green); text-transform: uppercase; font-size: 0.85rem; }
.table tr:hover { background: #fffdf5; }

/* --- 8. UTILS & MOBILE RESPONSIVE --- */
.alert { padding: 15px; border-radius: var(--radius); margin-bottom: 20px; }
.alert-info { background: #e3f2fd; color: #0c5460; border-left: 4px solid #17a2b8; }
.alert-success { background: #d1e7dd; color: #0f5132; border-left: 4px solid #198754; }
.alert-danger { background: #f8d7da; color: #842029; border-left: 4px solid #dc3545; }

.info-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
    background: #fafafa;
    padding: 20px;
    border-radius: var(--radius);
    border: 1px dashed #ccc;
}
.info-item-label { font-size: 0.85rem; color: #777; text-transform: uppercase; }
.info-item-value { font-size: 1.1rem; font-weight: bold; color: var(--text-main); }

/* Mobile Only Tweaks */
@media (max-width: 768px) {
    .app-shell { padding: 10px; }
    .card { padding: 20px 15px; }
    .app-title { font-size: 1.2rem; }
    .btn-row { flex-direction: column; }
    .btn { width: 100%; }
    .exam-top-bar { flex-direction: column; gap: 10px; text-align: center; }
    .info-grid { grid-template-columns: 1fr; } /* 1 cột trên mobile */
}

/* --- CẬP NHẬT GIAO DIỆN DANH SÁCH CÂU HỎI (Dạng thanh trượt ngang dưới đáy) --- */
.question-nav-wrapper {
    margin-top: 30px;
    padding-top: 20px;
    border-top: 1px dashed #ddd;
}
.question-nav-title {
    font-size: 0.9rem; 
    font-weight: bold; 
    color: var(--army-green); 
    margin-bottom: 10px;
}
.question-nav {
    display: flex;
    gap: 10px;
    overflow-x: auto; /* Cho phép cuộn ngang */
    padding-bottom: 10px; /* Chừa chỗ cho thanh cuộn */
    scrollbar-width: thin; /* Firefox */
}
/* Tùy chỉnh thanh cuộn cho đẹp */
.question-nav::-webkit-scrollbar { height: 6px; }
.question-nav::-webkit-scrollbar-thumb { background: #ccc; border-radius: 10px; }
.question-nav::-webkit-scrollbar-track { background: #f1f1f1; }

.q-nav-item {
    flex-shrink: 0; /* Không cho bị co lại */
    width: 45px; height: 45px; /* To hơn chút để dễ bấm trên đt */
    display: flex; align-items: center; justify-content: center;
    border: 1px solid #ccc;
    border-radius: 8px; /* Bo tròn mềm mại */
    font-size: 0.9rem;
    cursor: pointer;
    background: white;
    font-weight: 600;
    transition: 0.2s;
}
/* Trạng thái hiện tại */
.q-nav-item.current { 
    border-color: var(--primary); 
    background: var(--primary); 
    color: var(--gold); 
    box-shadow: 0 4px 10px rgba(179, 0, 0, 0.3);
    transform: scale(1.1);
}
/* Trạng thái đã làm */
.q-nav-item.answered { 
    background: var(--gold-light); 
    border-color: var(--gold); 
    color: var(--text-main); 
}
/* Khi chưa làm mà không phải hiện tại */
.q-nav-item:not(.answered):not(.current):hover {
    background: #eee;
}

/* CSS cho Logo ảnh */
.app-logo-img {
    width: 80px; height: 80px;
    object-fit: contain; /* Giữ tỷ lệ ảnh */
    border-radius: 50%;  /* Bo tròn nếu muốn, hoặc bỏ đi để vuông */
    background: #fff;
    padding: 5px;
    box-shadow: 0 0 0 3px var(--gold);
}
/* Logo nhỏ trên header mobile */
@media (max-width: 768px) {
    .app-logo-img { width: 50px; height: 50px; }
}