/* =============================================================================
   ỨNG DỤNG LMS — thành phần dùng chung + responsive (điện thoại / tablet / máy tính)
   Dùng biến màu của giao-dien.css. Điểm ngắt: 1000px (tablet ngang), 720px (điện thoại).
============================================================================= */

html { -webkit-text-size-adjust: 100%; }
img, video, iframe { max-width: 100%; }

/* ---------- Header + menu ---------- */
.thanh-dau {
    position: sticky; top: 0; z-index: 100;
    background: rgba(255, 255, 255, .88);
    backdrop-filter: blur(16px); -webkit-backdrop-filter: blur(16px);
    border-bottom: 1px solid var(--mau-vien);
}
.thanh-dau-trong {
    max-width: 1140px; margin: 0 auto; padding: 10px 20px;
    display: flex; align-items: center; gap: 12px;
}
.menu-chinh { display: flex; gap: 4px; flex: 1; margin-left: 12px; flex-wrap: wrap; }
.menu-muc {
    padding: 9px 14px; border-radius: 10px; font-size: 13px; font-weight: 800;
    color: var(--mau-chu-phu); background: none; border: none; cursor: pointer;
    font-family: inherit; text-align: left; white-space: nowrap;
}
.menu-muc:hover { background: #F1F5F9; color: var(--mau-chu); }
.menu-muc.dang-chon { background: rgba(0, 71, 255, .09); color: var(--mau-chinh); }
.thanh-dau-phai { display: flex; align-items: center; gap: 10px; margin-left: auto; }
.pill-nguoi-dung {
    display: none; align-items: center; gap: 8px; background: #F1F5F9; padding: 6px 12px;
    border-radius: 9999px; border: 1px solid var(--mau-vien);
}
.pill-nguoi-dung:hover { background: #E8EEF5; }
.pill-nguoi-dung .cham { width: 8px; height: 8px; border-radius: 50%; background: var(--mau-thanh-cong); flex: none; }
.pill-ten { font-size: 12px; font-weight: 800; max-width: 170px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.nut-menu {
    display: none; width: 44px; height: 44px; border-radius: 12px; border: 1px solid var(--mau-vien);
    background: #fff; cursor: pointer; align-items: center; justify-content: center; flex: none;
    font-size: 20px; font-weight: 800; color: var(--mau-chu); font-family: inherit; line-height: 1;
}
.chi-di-dong { display: none; }

@media (max-width: 900px) {
    .thanh-dau-trong { flex-wrap: wrap; }
    .nut-menu { display: inline-flex; }
    .chi-may-tinh { display: none; }
    .menu-chinh {
        display: none; order: 3; flex-basis: 100%; flex-direction: column; margin: 4px 0 4px; gap: 2px;
        padding: 8px; background: #fff; border: 1px solid var(--mau-vien); border-radius: 16px;
    }
    .thanh-dau.mo .menu-chinh { display: flex; }
    .menu-muc { padding: 14px 16px; font-size: 15px; width: 100%; }
    .chi-di-dong { display: block; }
    .menu-muc.chi-di-dong { color: var(--mau-canh-bao); border-top: 1px solid var(--mau-vien); border-radius: 0 0 10px 10px; margin-top: 4px; }
    .pill-ten { max-width: 110px; }
}
@media (max-width: 480px) {
    .pill-ten { display: none; }
}

/* ---------- Bố cục trang ---------- */
.khung-chinh { padding-top: 24px; }
.luoi-hoc { display: grid; grid-template-columns: minmax(0, 2fr) minmax(260px, 1fr); gap: 28px; align-items: start; }
.luoi-soan { display: grid; grid-template-columns: 290px minmax(0, 1fr); gap: 20px; align-items: start; }
.cot-dinh { position: sticky; top: 84px; }
@media (max-width: 1000px) {
    .luoi-hoc, .luoi-soan { grid-template-columns: minmax(0, 1fr); gap: 20px; }
    .cot-dinh { position: static; }
}
.the-apple { padding: 22px; }
.tieu-de-trang { font-size: 24px; font-weight: 900; letter-spacing: -.5px; }
.phu { color: var(--mau-chu-phu); font-size: 13px; font-weight: 600; }
.trong { text-align: center; color: var(--mau-chu-phu); padding: 32px 12px; font-weight: 600; font-size: 14px; }
.luoi-tu-dong { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 14px; }
.so-lon { font-size: 30px; font-weight: 900; letter-spacing: -1px; line-height: 1.1; }
.nhan-nho { font-size: 11px; font-weight: 800; text-transform: uppercase; letter-spacing: .5px; color: var(--mau-chu-phu); }
.cuon-ngang { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.gian-cach { gap: 12px; flex-wrap: wrap; }

@media (max-width: 720px) {
    .khung-chinh { padding: 16px 14px 28px; }
    .the-apple { padding: 16px; border-radius: 18px; }
    .tieu-de-trang { font-size: 21px; }
    .so-lon { font-size: 26px; }
    .banner-gradient { padding: 22px 18px; }
}

/* ---------- Thanh tiến độ, chip, tab ---------- */
.thanh-tien { height: 8px; border-radius: 9999px; background: #E2E8F0; overflow: hidden; }
.thanh-tien > span { display: block; height: 100%; border-radius: 9999px; background: var(--mau-chinh); transition: width .4s ease; }
.thanh-tien.xanh > span { background: var(--mau-thanh-cong); }
.thanh-tien.vang > span { background: var(--mau-phu); }
.chip { display: inline-block; padding: 3px 10px; border-radius: 9999px; font-size: 11px; font-weight: 800; white-space: nowrap; background: #F1F5F9; color: #475569; }
.chip.xanh { background: rgba(22, 163, 74, .15); color: #15803D; }
.chip.vang { background: rgba(255, 199, 0, .22); color: #854D0E; }
.chip.do { background: rgba(220, 38, 38, .15); color: #B91C1C; }
.chip.xanh-duong { background: rgba(0, 71, 255, .1); color: var(--mau-chinh); }
button.chip { font-family: inherit; border: none; }
.chip-chon { display: inline-flex; align-items: center; gap: 8px; padding: 8px 14px; font-size: 12px; cursor: pointer; }
.chip-chon input { accent-color: var(--mau-chinh); margin: 0; }
.tab-hang { display: flex; gap: 6px; border-bottom: 1px solid var(--mau-vien); flex-wrap: wrap; }
.tab { padding: 10px 16px; font-weight: 800; font-size: 13px; color: var(--mau-chu-phu); border: none; background: none; cursor: pointer; border-bottom: 3px solid transparent; font-family: inherit; }
.tab.dang-chon { color: var(--mau-chinh); border-bottom-color: var(--mau-chinh); }

/* ---------- Bảng: cuộn ngang (ma trận) hoặc thẻ trên điện thoại ---------- */
.bang-bao-cao { width: 100%; border-collapse: collapse; font-size: 13px; }
.bang-bao-cao th { text-align: left; font-size: 11px; text-transform: uppercase; letter-spacing: .5px; color: var(--mau-chu-phu); padding: 10px 12px; border-bottom: 1px solid var(--mau-vien); white-space: nowrap; }
.bang-bao-cao td { padding: 10px 12px; border-bottom: 1px solid rgba(226, 232, 240, .6); vertical-align: middle; }
.bang-bao-cao tr:hover td { background: rgba(241, 245, 249, .6); }
.bang-ma-tran th:first-child, .bang-ma-tran td:first-child { position: sticky; left: 0; background: #fff; z-index: 1; min-width: 150px; box-shadow: 1px 0 0 var(--mau-vien); }
.bang-ma-tran th { white-space: normal; min-width: 110px; }
.lien-ket { color: var(--mau-chinh); font-weight: 800; }
.lien-ket:hover { text-decoration: underline; }
@media (max-width: 720px) {
    .the-hang, .the-hang tbody, .the-hang tr, .the-hang td { display: block; width: 100%; }
    .the-hang thead { display: none; }
    .the-hang tr { border: 1px solid var(--mau-vien); border-radius: 14px; padding: 10px 14px; margin-bottom: 10px; background: #fff; }
    .the-hang tr:hover td { background: none; }
    .the-hang td { border: none; padding: 5px 0; display: flex; justify-content: space-between; align-items: center; gap: 14px; text-align: right; }
    .the-hang td::before { content: attr(data-nhan); font-size: 11px; font-weight: 800; text-transform: uppercase; color: var(--mau-chu-phu); text-align: left; flex: none; }
    .the-hang td.khong-nhan::before { display: none; }
    .the-hang td.khong-nhan { justify-content: flex-start; text-align: left; flex-wrap: wrap; }
}

/* ---------- Form, nút ---------- */
.truong { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.truong > label { font-size: 12px; font-weight: 800; }
.luoi-form { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.luoi-form .rong { grid-column: 1 / -1; }
@media (max-width: 720px) { .luoi-form { grid-template-columns: minmax(0, 1fr); } }
textarea.o-nhap-lieu { min-height: 90px; resize: vertical; }
select.o-nhap-lieu { cursor: pointer; }
.nut-nho { padding: 7px 13px; font-size: 12px; border-radius: 9px; }
.nut-viet { background: none; border: none; color: var(--mau-chinh); font-weight: 800; cursor: pointer; font-family: inherit; font-size: 12px; padding: 5px 7px; border-radius: 8px; }
.nut-viet:hover { background: rgba(0, 71, 255, .07); }
.nut-viet.do { color: var(--mau-canh-bao); }
.nut-viet.do:hover { background: rgba(220, 38, 38, .08); }
.nut-bam:disabled { opacity: .6; cursor: not-allowed; transform: none; }
@media (pointer: coarse), (max-width: 720px) {
    .nut-bam { min-height: 44px; }
    .nut-nho { min-height: 38px; }
    .nut-viet { padding: 9px 10px; }
    .o-nhap-lieu { font-size: 16px; }  /* tránh iOS tự phóng to khi bấm vào ô nhập */
    .muc-bai { padding: 13px 12px; }
}

/* ---------- Thông báo ---------- */
.canh-bao-do { background: #FEF2F2; border: 1px solid #FECACA; color: #991B1B; border-radius: 14px; padding: 14px 16px; font-weight: 700; font-size: 14px; }
.thanh-cong-xanh { background: #F0FDF4; border: 1px solid #BBF7D0; color: #166534; border-radius: 14px; padding: 14px 16px; font-weight: 700; font-size: 14px; }
.luu-y-vang { background: #FFFBEB; border: 1px solid #FDE68A; color: #854D0E; border-radius: 14px; padding: 14px 16px; font-weight: 700; font-size: 14px; }
.thong-bao-noi { position: fixed; right: 20px; bottom: 20px; z-index: 9999; padding: 12px 18px; border-radius: 12px; font-size: 13px; font-weight: 700; color: #fff; box-shadow: 0 10px 30px rgba(0, 0, 0, .2); max-width: min(380px, calc(100vw - 32px)); background: #16A34A; }
.thong-bao-noi.loi { background: #DC2626; }
@media (max-width: 720px) { .thong-bao-noi { left: 16px; right: 16px; bottom: 16px; max-width: none; } }

/* ---------- Bài thi + danh sách bài ---------- */
.cau-thi { padding: 16px; border: 1px solid var(--mau-vien); border-radius: 16px; background: #fff; }
.lua-chon { display: flex; gap: 10px; align-items: flex-start; padding: 11px 12px; border-radius: 12px; border: 1px solid var(--mau-vien); cursor: pointer; margin-top: 8px; font-size: 14px; font-weight: 600; }
.lua-chon:hover { background: #F8FAFC; }
.lua-chon input { margin-top: 3px; accent-color: var(--mau-chinh); flex: none; }
.lua-chon.dung { background: #F0FDF4; border-color: #86EFAC; }
.lua-chon.sai { background: #FEF2F2; border-color: #FCA5A5; }
.dong-ho { font-variant-numeric: tabular-nums; font-weight: 900; font-size: 18px; }
.muc-bai { display: flex; gap: 10px; align-items: center; padding: 10px 12px; border-radius: 12px; border: 1px solid transparent; font-size: 13px; font-weight: 700; cursor: pointer; }
.muc-bai:hover { background: #F1F5F9; }
.muc-bai.dang-hoc { background: rgba(0, 71, 255, .07); border-color: rgba(0, 71, 255, .25); }
.muc-bai .stt { width: 26px; height: 26px; border-radius: 50%; background: #E2E8F0; display: flex; align-items: center; justify-content: center; font-size: 12px; flex: none; }
.muc-bai.xong .stt { background: var(--mau-thanh-cong); color: #fff; }
.video-html { width: 100%; aspect-ratio: 16 / 9; background: #000; border-radius: 16px; display: block; }

/* ---------- Hộp thoại ---------- */
dialog.hop-thoai { margin: auto; border: none; border-radius: 20px; padding: 0; width: min(640px, 94vw); box-shadow: 0 30px 80px rgba(15, 23, 42, .35); color: var(--mau-chu); }
dialog.hop-thoai.nho { width: min(440px, 94vw); }
dialog.hop-thoai::backdrop { background: rgba(15, 23, 42, .45); backdrop-filter: blur(3px); }
.hop-thoai-noi-dung { padding: 24px; display: flex; flex-direction: column; gap: 16px; max-height: 88vh; overflow: auto; }
.hop-thoai-nut { display: flex; gap: 10px; justify-content: flex-end; flex-wrap: wrap; }
@media (max-width: 720px) {
    dialog.hop-thoai, dialog.hop-thoai.nho { width: 100vw; max-width: 100vw; margin: auto 0 0 0; border-radius: 22px 22px 0 0; }
    .hop-thoai-nut .nut-bam { flex: 1; }
}

/* ---------- Danh sách thiết lập ban đầu ---------- */
.buoc-khoi-dau { display: flex; gap: 12px; align-items: center; padding: 12px; border-radius: 14px; border: 1px solid var(--mau-vien); background: #fff; }
.buoc-khoi-dau .dau { width: 30px; height: 30px; border-radius: 50%; background: #E2E8F0; display: flex; align-items: center; justify-content: center; font-weight: 900; font-size: 13px; flex: none; }
.buoc-khoi-dau.xong .dau { background: var(--mau-thanh-cong); color: #fff; }
.buoc-khoi-dau.xong { background: #F8FAFC; }
.buoc-khoi-dau.xong .tieu { text-decoration: line-through; color: var(--mau-chu-phu); }
.buoc-khoi-dau .tieu { font-weight: 800; font-size: 14px; }

/* ---------- Chứng chỉ ---------- */
.chung-chi {
    background: #fff; border: 10px solid var(--mau-chinh); outline: 3px solid var(--mau-phu); outline-offset: -22px;
    padding: 56px 36px; text-align: center; border-radius: 6px; box-shadow: 0 30px 70px -20px rgba(0, 31, 102, .35);
}
.chung-chi .nhan { font-size: 13px; font-weight: 800; letter-spacing: 3px; text-transform: uppercase; color: var(--mau-chu-phu); }
.chung-chi h1 { font-size: clamp(26px, 5vw, 44px); font-weight: 900; letter-spacing: -1px; color: var(--mau-chinh); margin: 10px 0 22px; }
.chung-chi .ten { font-size: clamp(26px, 5vw, 40px); font-weight: 900; border-bottom: 2px solid var(--mau-phu); display: inline-block; padding: 0 20px 6px; }
.chung-chi .khoa { font-size: clamp(18px, 3vw, 24px); font-weight: 800; margin-top: 12px; }
.chung-chi .chan { display: flex; justify-content: space-between; gap: 20px; margin-top: 46px; font-size: 13px; font-weight: 700; color: var(--mau-chu-phu); flex-wrap: wrap; justify-content: center; }
@media (max-width: 720px) { .chung-chi { padding: 34px 18px; border-width: 6px; outline-offset: -14px; } }
@media print {
    @page { size: A4 landscape; margin: 10mm; }
    body { background: #fff; }
    body .thanh-dau, body .khong-in { display: none; }
    body .chung-chi { box-shadow: none; }
}
