/* ===== Reset & Base ===== */
*,
*::before,
*::after {
    box-sizing: border-box;
}

html, body {
    margin: 0;
    padding: 0;
}

body {
    font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    min-height: 100vh;
    color: #0f172a;
    /* Nền xanh kiểu Windows 11, nhẹ nhàng */
    background:
        radial-gradient(circle at top left, #e0f2fe 0%, #bfdbfe 35%, #93c5fd 70%, #60a5fa 100%);
}

/* ===== Layout chính: căn giữa, glass card ===== */
.app-shell {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 16px;
}

.card {
    width: 100%;
    max-width: 900px;
    padding: 18px 18px 20px;
    border-radius: 22px;

    /* Glassmorphism */
    background: linear-gradient(
        135deg,
        rgba(255, 255, 255, 0.86),
        rgba(248, 250, 252, 0.9)
    );
    border: 1px solid rgba(148, 163, 184, 0.45);
    box-shadow:
        0 18px 40px rgba(15, 23, 42, 0.35),
        0 0 0 1px rgba(255, 255, 255, 0.5);
    backdrop-filter: blur(14px);
}

/* Mobile: card gọn hơn */
@media (max-width: 480px) {
    .app-shell {
        padding: 10px;
    }
    .card {
        padding: 14px 14px 16px;
        border-radius: 18px;
    }
}

/* ===== Header chung ===== */
.app-header {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 16px;
}

.app-logo {
    width: 42px;
    height: 42px;
    border-radius: 16px;
    background: radial-gradient(circle at 20% 0, #eff6ff 0%, #2563eb 45%, #1d4ed8 100%);
    color: #f9fafb;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 800;
    font-size: 1rem;
    box-shadow: 0 8px 25px rgba(37, 99, 235, 0.65);
}

.app-title {
    margin: 0;
    font-size: 1.25rem;
    font-weight: 700;
    color: #0f172a;
}

.app-subtitle {
    margin: 2px 0 0;
    font-size: 0.9rem;
    color: #64748b;
}

/* ===== Tiêu đề, mô tả ===== */
.app-main-title {
    margin: 16px 0 6px;
    font-size: 1.05rem;
    font-weight: 600;
    color: #0f172a;
}

.app-main-desc {
    margin: 0 0 8px;
    font-size: 0.9rem;
    color: #475569;
}

/* ===== Lưới thông tin ===== */
.info-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px 14px;
}

.info-item-label {
    font-size: 0.78rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: #94a3b8;
    margin-bottom: 2px;
}

.info-item-value {
    font-size: 0.95rem;
    font-weight: 600;
    color: #0f172a;
}

/* Mobile: 1 cột */
@media (max-width: 640px) {
    .info-grid {
        grid-template-columns: 1fr;
    }
}

/* ===== Buttons (dùng chung toàn hệ thống) ===== */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 150px;
    padding: 9px 18px;
    border-radius: 999px;
    border: 1px solid transparent;
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    text-decoration: none;
    transition:
        background 0.15s ease,
        color 0.15s ease,
        box-shadow 0.15s ease,
        transform 0.06s ease,
        border-color 0.15s ease;
    white-space: nowrap;
}

/* Nút chính – xanh glass */
.btn-primary {
    background: linear-gradient(135deg, #60a5fa, #2563eb);
    border-color: rgba(37, 99, 235, 0.8);
    color: #eff6ff;
    box-shadow: 0 6px 18px rgba(37, 99, 235, 0.65);
}
.btn-primary:hover {
    transform: translateY(-1px) scale(1.01);
    box-shadow: 0 10px 24px rgba(37, 99, 235, 0.75);
}
.btn-primary:active {
    transform: translateY(0) scale(0.98);
    box-shadow: 0 4px 12px rgba(37, 99, 235, 0.6);
}

/* Nút viền */
.btn-outline {
    background: rgba(248, 250, 252, 0.92);
    border-color: rgba(148, 163, 184, 0.7);
    color: #0f172a;
}
.btn-outline:hover {
    background: rgba(241, 245, 249, 0.95);
    box-shadow: 0 6px 18px rgba(15, 23, 42, 0.2);
}

/* Nút nộp bài / hành động quan trọng */
.btn-danger {
    background: linear-gradient(135deg, #f97373, #b91c1c);
    border-color: rgba(185, 28, 28, 0.9);
    color: #fef2f2;
    box-shadow: 0 6px 18px rgba(185, 28, 28, 0.65);
}
.btn-danger:hover {
    transform: translateY(-1px) scale(1.01);
    box-shadow: 0 10px 24px rgba(185, 28, 28, 0.75);
}

/* Hàng nút – căn giữa */
.btn-row {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 8px;
    margin-top: 12px;
}

/* ===== Câu hỏi & đáp án ===== */
.question-body {
    margin-top: 10px;
    margin-bottom: 10px;
    padding: 10px 12px;
    border-radius: 12px;
    background: rgba(248, 250, 252, 0.92);
    border: 1px solid rgba(209, 213, 219, 0.8);
    font-size: 0.95rem;
    color: #0f172a;
}

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

.answer-option {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    padding: 8px 10px;
    border-radius: 12px;
    border: 1px solid rgba(209, 213, 219, 0.9);
    background: rgba(255, 255, 255, 0.95);
    cursor: pointer;
    font-size: 0.93rem;
    color: #0f172a;
    transition: background 0.15s, border-color 0.15s, box-shadow 0.15s;
}
.answer-option input[type="radio"] {
    margin-top: 4px;
}
.answer-option .answer-label {
    font-weight: 600;
    min-width: 22px;
}
.answer-option.selected {
    border-color: #2563eb;
    background: rgba(239, 246, 255, 0.95);
    box-shadow: 0 0 0 1px rgba(37, 99, 235, 0.35);
}

/* Footer câu hỏi – nút sang phải */
.question-footer {
    margin-top: 16px;
    display: flex;
    justify-content: flex-end;
    gap: 8px;
}

/* ===== Alert / thông báo ===== */
.alert {
    border-radius: 12px;
    padding: 8px 10px;
    font-size: 0.9rem;
    margin-top: 8px;
}

.alert-info {
    background: rgba(239, 246, 255, 0.96);
    border: 1px solid #bfdbfe;
    color: #1d4ed8;
}
.alert-success {
    background: rgba(240, 253, 250, 0.96);
    border: 1px solid #6ee7b7;
    color: #047857;
}
.alert-warning {
    background: rgba(254, 252, 232, 0.96);
    border: 1px solid #facc15;
    color: #92400e;
}
.alert-danger {
    background: rgba(254, 242, 242, 0.96);
    border: 1px solid #fecaca;
    color: #b91c1c;
}

/* ===== Text phụ ===== */
.text-muted {
    font-size: 0.85rem;
    color: #64748b;
}

/* ===== Form chung (login, nhập SBD, ...) ===== */
.form-group {
    margin-bottom: 10px;
}
.label {
    display: block;
    font-size: 0.9rem;
    margin-bottom: 4px;
    color: #475569;
}
.input {
    width: 100%;
    padding: 8px 10px;
    border-radius: 12px;
    border: 1px solid #d1d5db;
    font-size: 0.95rem;
    background: rgba(255, 255, 255, 0.95);
}
.input:focus {
    outline: none;
    border-color: #2563eb;
    box-shadow: 0 0 0 1px rgba(37, 99, 235, 0.35);
}

/* ===== Bảng xếp hạng / bảng dữ liệu ===== */
.table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.9rem;
}
.table th,
.table td {
    padding: 8px 10px;
    border-bottom: 1px solid #e5e7eb;
    text-align: left;
}
.table th {
    background: rgba(241, 245, 249, 0.96);
    font-weight: 600;
    color: #0f172a;
}

/* ===== Một số layout phụ (dùng ở lam_bai, ket_qua, thong_tin) ===== */

/* Thanh top trên màn làm bài (điểm, thời gian...) */
.exam-top-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
    font-size: 0.9rem;
    color: #475569;
}

.countdown {
    font-weight: 600;
    padding: 4px 10px;
    border-radius: 999px;
    background: rgba(248, 250, 252, 0.95);
    border: 1px solid rgba(148, 163, 184, 0.7);
}
.countdown.time-warning {
    background: #fef9c3;
    color: #92400e;
}
.countdown.time-danger {
    background: #fee2e2;
    color: #b91c1c;
}

/* Thanh số câu ở lam_bai */
.question-nav-wrapper {
    margin-bottom: 12px;
    padding: 8px 10px;
    border-radius: 12px;
    background: rgba(248, 250, 252, 0.96);
    border: 1px solid rgba(209, 213, 219, 0.8);
}
.question-nav-title {
    font-size: 0.9rem;
    color: #475569;
    margin-bottom: 6px;
    display: flex;
    justify-content: space-between;
    gap: 8px;
    flex-wrap: wrap;
}
.question-nav {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}
.q-nav-item {
    min-width: 32px;
    height: 32px;
    padding: 0 6px;
    border-radius: 999px;
    border: 1px solid rgba(209, 213, 219, 0.9);
    background: rgba(241, 245, 249, 0.96);
    font-size: 0.8rem;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: background 0.15s, transform 0.05s, box-shadow 0.05s, border-color 0.15s;
}
.q-nav-item:hover {
    background: rgba(226, 232, 240, 0.96);
    transform: translateY(-1px);
}
.q-nav-item.answered {
    background: #dcfce7;
    border-color: #22c55e;
    color: #14532d;
}
.q-nav-item.unanswered.low-time {
    background: #fef9c3;
    border-color: #facc15;
    color: #92400e;
}
.q-nav-item.current {
    box-shadow: 0 0 0 2px rgba(37, 99, 235, 0.45);
    border-color: #2563eb;
    background: #eff6ff;
    font-weight: 600;
}

/* Bảng trạng thái câu ở trang kết quả */
.qstatus-wrapper {
    margin-top: 16px;
    padding: 10px 12px;
    border-radius: 12px;
    border: 1px solid rgba(209, 213, 219, 0.9);
    background: rgba(248, 250, 252, 0.96);
}
.qstatus-legend {
    font-size: 0.85rem;
    color: #64748b;
    margin-bottom: 6px;
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
}
.qstatus-legend span::before {
    content: "■ ";
    margin-right: 2px;
}
.legend-unanswered::before { color: #9ca3af; }
.legend-correct::before    { color: #16a34a; }
.legend-wrong::before      { color: #dc2626; }

.qstatus-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: 4px;
}
.qstatus {
    min-width: 32px;
    height: 32px;
    padding: 0 6px;
    border-radius: 8px;
    border: 1px solid #e5e7eb;
    font-size: 0.8rem;
    display: flex;
    align-items: center;
    justify-content: center;
}
.qstatus.unanswered {
    background: #f3f4f6;
    color: #4b5563;
}
.qstatus.correct {
    background: #dcfce7;
    border-color: #22c55e;
    color: #14532d;
}
.qstatus.wrong {
    background: #fee2e2;
    border-color: #ef4444;
    color: #991b1b;
}

/* Điểm lớn ở trang kết quả */
.result-score {
    font-size: 1.7rem;
    font-weight: 700;
    color: #0f172a;
}
.result-score-label {
    font-size: 0.9rem;
    color: #64748b;
}
