/* =========================================================
   EDUPRO MATERIAL POPUP VIEWER - Merge an toàn
========================================================= */
html.edupro-material-viewer-open,
html.edupro-material-viewer-open body {
    overflow: hidden !important;
}

.edupro-material-viewer-overlay {
    position: fixed;
    inset: 0;
    z-index: 999999;
    background: rgba(15, 23, 42, 0.62);
    backdrop-filter: blur(8px);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
}

.edupro-material-viewer-modal {
    width: min(96vw, 1480px);
    height: min(92vh, 920px);
    background: #f5f7fb;
    border-radius: 24px;
    box-shadow: 0 28px 80px rgba(15, 23, 42, 0.35);
    display: grid;
    grid-template-rows: auto 1fr auto;
    overflow: hidden;
    border: 1px solid rgba(255,255,255,.8);
}

.edupro-material-viewer-head {
    min-height: 82px;
    padding: 18px 24px;
    background: rgba(255,255,255,.96);
    border-bottom: 1px solid #e4ebf4;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
}

.edupro-material-viewer-title-wrap {
    display: flex;
    align-items: center;
    gap: 14px;
    min-width: 0;
}

.edupro-material-viewer-icon {
    width: 48px;
    height: 48px;
    border-radius: 16px;
    background: linear-gradient(135deg, #eef2ff, #f5f3ff);
    color: #5b21b6;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 15px;
    font-weight: 900;
    flex: 0 0 auto;
}

.edupro-material-viewer-head h2 {
    margin: 0 0 5px;
    color: #061733;
    font-size: 20px;
    line-height: 1.25;
    font-weight: 900;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 72vw;
}

.edupro-material-viewer-head p {
    margin: 0;
    color: #64748b;
    font-size: 13px;
    font-weight: 700;
}

.edupro-material-viewer-close {
    width: 44px;
    height: 44px;
    border: 0;
    border-radius: 14px;
    background: #f1f5f9;
    color: #0f172a;
    font-size: 24px;
    font-weight: 900;
    cursor: pointer;
}

.edupro-material-viewer-close:hover {
    background: #fee2e2;
    color: #dc2626;
}

.edupro-material-viewer-body {
    min-height: 0;
    overflow: auto;
    background: #f4f7fb;
}

.edupro-material-viewer-foot {
    padding: 12px 20px;
    background: #fff;
    border-top: 1px solid #e4ebf4;
    text-align: center;
    color: #64748b;
    font-size: 12px;
    font-weight: 700;
}

.edupro-material-media-shell,
.edupro-material-image-shell,
.edupro-material-audio-shell {
    width: 100%;
    height: 100%;
    min-height: 520px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
    box-sizing: border-box;
}

.edupro-material-media-shell video {
    width: 100%;
    max-width: 1180px;
    max-height: 72vh;
    background: #000;
    border-radius: 18px;
    box-shadow: 0 18px 48px rgba(15, 23, 42, 0.22);
}

.edupro-material-audio-shell {
    flex-direction: column;
    gap: 24px;
}

.edupro-material-audio-icon {
    width: 104px;
    height: 104px;
    border-radius: 34px;
    background: linear-gradient(135deg, #5b5cf6, #8b5cf6);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 48px;
    box-shadow: 0 22px 45px rgba(91, 92, 246, 0.26);
}

.edupro-material-audio-shell audio {
    width: min(720px, 90%);
}

.edupro-material-image-shell img {
    max-width: 100%;
    max-height: 76vh;
    object-fit: contain;
    border-radius: 18px;
    box-shadow: 0 18px 48px rgba(15, 23, 42, 0.16);
}

.edupro-material-office-iframe,
.edupro-material-link-iframe {
    width: 100%;
    height: 100%;
    min-height: 720px;
    border: 0;
    background: #fff;
}

.edupro-material-pdf-viewer {
    min-height: 100%;
    display: grid;
    grid-template-rows: auto 1fr;
}

.edupro-material-pdf-toolbar {
    position: sticky;
    top: 0;
    z-index: 2;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    padding: 12px;
    background: rgba(255,255,255,.96);
    border-bottom: 1px solid #e4ebf4;
}

.edupro-material-pdf-toolbar button,
.edupro-material-excel-tabs button {
    border: 1px solid #d7e0ee;
    border-radius: 12px;
    background: #fff;
    color: #172554;
    min-height: 38px;
    padding: 0 14px;
    font-weight: 800;
    cursor: pointer;
}

.edupro-material-pdf-toolbar button:disabled {
    opacity: .45;
    cursor: not-allowed;
}

.edupro-material-pdf-canvas-wrap {
    padding: 22px;
    display: flex;
    justify-content: center;
    align-items: flex-start;
}

.edupro-material-pdf-canvas-wrap canvas {
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 14px 36px rgba(15, 23, 42, 0.15);
    max-width: 100%;
    height: auto;
}

.edupro-material-office-body {
    min-height: 100%;
    padding: 22px;
    box-sizing: border-box;
}

.edupro-material-docx-page,
.edupro-material-excel-content {
    background: #fff;
    border-radius: 18px;
    padding: 28px;
    box-shadow: 0 16px 42px rgba(15, 23, 42, 0.08);
    color: #0f172a;
    line-height: 1.75;
    overflow: auto;
}

.edupro-material-excel-tabs {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 14px;
}

.edupro-material-excel-tabs button.active {
    background: #5b5cf6;
    border-color: #5b5cf6;
    color: #fff;
}

.edupro-material-excel-table {
    overflow: auto;
}

.edupro-material-excel-table table {
    width: 100%;
    border-collapse: collapse;
}

.edupro-material-excel-table td,
.edupro-material-excel-table th {
    border: 1px solid #e2e8f0;
    padding: 8px 10px;
    white-space: nowrap;
}

.edupro-material-loading,
.edupro-material-empty,
.edupro-material-unsupported {
    min-height: 420px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    color: #475569;
    padding: 24px;
}

.edupro-material-unsupported-icon {
    width: 78px;
    height: 78px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #eef2ff;
    color: #4f46e5;
    font-size: 30px;
    margin-bottom: 16px;
}

.edupro-material-unsupported h3 {
    margin: 0 0 8px;
    font-size: 22px;
    color: #0f172a;
}

.edupro-material-unsupported p {
    margin: 0 0 8px;
    max-width: 520px;
    line-height: 1.6;
}

.edupro-material-unsupported small {
    color: #b91c1c;
    font-weight: 800;
}

.edupro-material-view-trigger[download],
.edupro-material-viewer-modal a[download] {
    display: none !important;
}

@media (max-width: 768px) {
    .edupro-material-viewer-overlay {
        padding: 8px;
    }
    .edupro-material-viewer-modal {
        width: 100%;
        height: 94vh;
        border-radius: 18px;
    }
    .edupro-material-viewer-head {
        padding: 14px;
    }
    .edupro-material-viewer-head h2 {
        font-size: 16px;
        max-width: 58vw;
    }
    .edupro-material-media-shell,
    .edupro-material-image-shell,
    .edupro-material-audio-shell {
        min-height: 360px;
        padding: 14px;
    }
    .edupro-material-office-iframe,
    .edupro-material-link-iframe {
        min-height: 620px;
    }
}

/* =========================================================
   EduPro - Bộ lọc kho tài liệu học viên
========================================================= */
.edupro-student-materials-filter-bar {
    display: grid;
    grid-template-columns: minmax(220px, 1fr) minmax(220px, 1fr) auto;
    gap: 14px;
    align-items: end;
    margin: 0 0 22px;
    padding: 18px;
    border: 1px solid rgba(203, 213, 225, 0.86);
    border-radius: 22px;
    background: linear-gradient(135deg, #ffffff 0%, #f8faff 100%);
    box-shadow: 0 14px 34px rgba(15, 23, 42, 0.055);
}

.edupro-student-materials-filter-field label {
    display: block;
    margin: 0 0 8px;
    color: #263b5e;
    font-size: 13px;
    font-weight: 900;
}

.edupro-student-materials-filter-field select {
    width: 100%;
    height: 48px;
    padding: 0 42px 0 15px;
    border: 1px solid #ccd8ea;
    border-radius: 14px;
    background: #fff;
    color: #0f172a;
    font-size: 14px;
    font-weight: 700;
    outline: none;
    box-shadow: 0 8px 20px rgba(15, 23, 42, 0.035);
    transition: border-color .2s ease, box-shadow .2s ease;
}

.edupro-student-materials-filter-field select:focus {
    border-color: #7c3aed;
    box-shadow: 0 0 0 4px rgba(124, 58, 237, 0.12);
}

.edupro-student-materials-filter-reset {
    height: 48px;
    padding: 0 18px;
    border: 1px solid #ddd6fe;
    border-radius: 14px;
    background: #f5f3ff;
    color: #6d28d9;
    font-weight: 900;
    cursor: pointer;
    white-space: nowrap;
    transition: transform .2s ease, box-shadow .2s ease, background .2s ease;
}

.edupro-student-materials-filter-reset:hover,
.edupro-student-materials-filter-reset.is-active {
    background: linear-gradient(135deg, #6d5dfc, #8b5cf6);
    color: #fff;
    box-shadow: 0 14px 26px rgba(109, 93, 252, 0.22);
    transform: translateY(-1px);
}

.edupro-student-materials-filter-empty {
    min-height: 220px;
    place-items: center;
    text-align: center;
    margin: 0 0 22px;
    padding: 28px;
    border: 1px dashed #cbd5e1;
    border-radius: 22px;
    background: #f8faff;
    color: #64748b;
}

.edupro-student-materials-filter-empty div {
    width: 62px;
    height: 62px;
    display: grid;
    place-items: center;
    margin: 0 auto 12px;
    border-radius: 999px;
    background: #eef2ff;
    font-size: 28px;
}

.edupro-student-materials-filter-empty h3 {
    margin: 0 0 6px;
    color: #0f172a;
    font-size: 20px;
    font-weight: 900;
}

.edupro-student-materials-filter-empty p {
    margin: 0;
    color: #64748b;
}

@media (max-width: 900px) {
    .edupro-student-materials-filter-bar {
        grid-template-columns: 1fr;
        gap: 12px;
        padding: 15px;
        border-radius: 18px;
    }

    .edupro-student-materials-filter-reset {
        width: 100%;
    }
}

/* EduPro: PowerPoint viewer fallback */
.edupro-material-ppt-shell {
    display: flex;
    flex-direction: column;
    width: 100%;
    height: 100%;
    min-height: 70vh;
    background: #fff;
}
.edupro-material-ppt-note {
    padding: 10px 16px;
    background: #0f172a;
    color: #fff;
    font-size: 13px;
    font-weight: 700;
}
.edupro-material-ppt-iframe {
    flex: 1 1 auto;
    width: 100%;
    min-height: 68vh;
    border: 0;
}

/* EduPro - iSpring / HTML5 package viewer */
.edupro-material-ispring-shell {
    width: 100%;
    height: min(78vh, 860px);
    min-height: 560px;
    border-radius: 18px;
    overflow: hidden;
    background: #020617;
    border: 1px solid rgba(148, 163, 184, .28);
}

.edupro-material-ispring-iframe {
    display: block;
    width: 100%;
    height: 100%;
    border: 0;
    background: #fff;
}

@media (max-width: 768px) {
    .edupro-material-ispring-shell {
        height: 72vh;
        min-height: 420px;
        border-radius: 14px;
    }
}

/* =========================================================
   EduPro - Kho tài liệu học viên mở full window như phòng học
   Merge-safe: chỉ áp dụng khi mở từ kho tài liệu học viên.
========================================================= */
.edupro-material-viewer-overlay.is-student-full-window {
    padding: 0 !important;
    align-items: stretch !important;
    justify-content: stretch !important;
    background: #020617 !important;
    backdrop-filter: none !important;
}

.edupro-material-viewer-overlay.is-student-full-window .edupro-material-viewer-modal {
    width: 100vw !important;
    height: 100dvh !important;
    max-width: none !important;
    max-height: none !important;
    border-radius: 0 !important;
    border: 0 !important;
    box-shadow: none !important;
    background: #020617 !important;
    grid-template-rows: auto minmax(0, 1fr) !important;
}

.edupro-material-viewer-overlay.is-student-full-window .edupro-material-viewer-head {
    min-height: 64px !important;
    padding: 10px 22px !important;
    background: #0f172a !important;
    border-bottom: 1px solid rgba(148, 163, 184, .22) !important;
    color: #fff !important;
}

.edupro-material-viewer-overlay.is-student-full-window .edupro-material-viewer-icon {
    width: 40px !important;
    height: 40px !important;
    border-radius: 13px !important;
    background: rgba(99, 102, 241, .22) !important;
    color: #fff !important;
}

.edupro-material-viewer-overlay.is-student-full-window .edupro-material-viewer-head h2 {
    color: #fff !important;
    font-size: 17px !important;
    max-width: 70vw !important;
}

.edupro-material-viewer-overlay.is-student-full-window .edupro-material-viewer-head p {
    color: rgba(226, 232, 240, .78) !important;
}

.edupro-material-viewer-overlay.is-student-full-window .edupro-material-viewer-close {
    background: rgba(255, 255, 255, .10) !important;
    color: #fff !important;
}

.edupro-material-viewer-overlay.is-student-full-window .edupro-material-viewer-body {
    min-height: 0 !important;
    height: 100% !important;
    overflow: hidden !important;
    background: #e5e7eb !important;
}

.edupro-material-viewer-overlay.is-student-full-window .edupro-material-viewer-foot {
    display: none !important;
}

.edupro-material-viewer-overlay.is-student-full-window .edupro-material-office-iframe,
.edupro-material-viewer-overlay.is-student-full-window .edupro-material-link-iframe,
.edupro-material-viewer-overlay.is-student-full-window .edupro-material-ppt-iframe,
.edupro-material-viewer-overlay.is-student-full-window .edupro-material-ispring-iframe {
    width: 100% !important;
    height: 100% !important;
    min-height: 0 !important;
    border: 0 !important;
}

.edupro-material-viewer-overlay.is-student-full-window .edupro-material-ispring-shell,
.edupro-material-viewer-overlay.is-student-full-window .edupro-material-ppt-shell,
.edupro-material-viewer-overlay.is-student-full-window .edupro-material-media-shell,
.edupro-material-viewer-overlay.is-student-full-window .edupro-material-image-shell,
.edupro-material-viewer-overlay.is-student-full-window .edupro-material-audio-shell {
    width: 100% !important;
    height: 100% !important;
    min-height: 0 !important;
    border-radius: 0 !important;
    border: 0 !important;
    padding: 0 !important;
    box-shadow: none !important;
}

.edupro-material-viewer-overlay.is-student-full-window .edupro-material-media-shell video {
    width: 100% !important;
    height: 100% !important;
    max-width: none !important;
    max-height: none !important;
    border-radius: 0 !important;
    object-fit: contain !important;
}

.edupro-material-viewer-overlay.is-student-full-window .edupro-material-image-shell img {
    width: 100% !important;
    height: 100% !important;
    max-width: none !important;
    max-height: none !important;
    border-radius: 0 !important;
    object-fit: contain !important;
    box-shadow: none !important;
}

.edupro-material-viewer-overlay.is-student-full-window .edupro-material-pdf-viewer {
    height: 100% !important;
    min-height: 0 !important;
    grid-template-rows: auto minmax(0, 1fr) !important;
    background: #dfe3ea !important;
}

.edupro-material-viewer-overlay.is-student-full-window .edupro-material-pdf-toolbar {
    flex: 0 0 auto !important;
}

.edupro-material-viewer-overlay.is-student-full-window .edupro-material-pdf-canvas-wrap {
    min-height: 0 !important;
    height: 100% !important;
    overflow: auto !important;
    padding: 18px !important;
    align-items: flex-start !important;
    box-sizing: border-box !important;
}

.edupro-material-viewer-overlay.is-student-full-window .edupro-material-office-body {
    height: 100% !important;
    min-height: 0 !important;
    overflow: auto !important;
    padding: 18px !important;
    box-sizing: border-box !important;
}

.edupro-material-viewer-overlay.is-student-full-window .edupro-material-docx-page,
.edupro-material-viewer-overlay.is-student-full-window .edupro-material-excel-content {
    min-height: 100% !important;
}

@media (max-width: 768px) {
    .edupro-material-viewer-overlay.is-student-full-window .edupro-material-viewer-head {
        min-height: 58px !important;
        padding: 8px 12px !important;
    }
    .edupro-material-viewer-overlay.is-student-full-window .edupro-material-viewer-head h2 {
        font-size: 15px !important;
        max-width: 58vw !important;
    }
}


/* EduPro fix: chọn trang PDF trong popup tài liệu */
.edupro-material-pdf-toolbar .edupro-pdf-page-picker{
    display:inline-flex;
    align-items:center;
    gap:8px;
    min-height:38px;
    padding:0 10px;
    border:1px solid #d7e0ee;
    border-radius:12px;
    background:#fff;
    color:#172554;
    font-weight:800;
    white-space:nowrap;
}
.edupro-material-pdf-toolbar .edupro-pdf-page-picker select{
    height:32px;
    min-width:108px;
    border:1px solid #d7e0ee;
    border-radius:10px;
    padding:0 28px 0 10px;
    background:#fff;
    color:#0f172a;
    font-weight:800;
    outline:none;
}

/* Office Online viewer: giữ đúng layout Word/Excel/PowerPoint, không để CSS LMS can thiệp nội dung file */
.edupro-material-office-body{
    width:100%;
    height:100%;
    min-height:calc(100vh - 150px);
    padding:0 !important;
    overflow:hidden;
    background:#eef2f7;
}
.edupro-material-office-online-shell{
    width:100%;
    height:100%;
    min-height:calc(100vh - 150px);
    background:#eef2f7;
    overflow:hidden;
}
.edupro-material-office-online-iframe{
    display:block;
    width:100%;
    height:calc(100vh - 150px);
    min-height:720px;
    border:0;
    background:#fff;
}
.edupro-material-viewer-overlay.is-student-full-window .edupro-material-office-online-iframe,
.edupro-material-viewer-overlay.is-student-full-window .edupro-material-office-online-shell,
.edupro-material-viewer-overlay.is-student-full-window .edupro-material-office-body{
    min-height:calc(100vh - 116px);
}
.edupro-material-viewer-overlay.is-student-full-window .edupro-material-office-online-iframe{
    height:calc(100vh - 116px);
}

/* EduPro fix: Ẩn thanh trạng thái/zoom mặc định ở cuối Microsoft Office Online Viewer.
   Vì Office chạy trong iframe khác domain nên không thể chỉnh trực tiếp bên trong iframe;
   cách ổn định nhất là phủ/cắt riêng vùng thanh dưới, giữ nguyên nội dung Word. */
.edupro-material-office-online-shell{
    position:relative !important;
    overflow:hidden !important;
}
.edupro-material-office-online-shell::after{
    content:"";
    position:absolute;
    left:0;
    right:0;
    bottom:0;
    height:42px;
    background:#f8fafc;
    z-index:5;
    pointer-events:auto;
}
.edupro-material-office-online-iframe{
    position:relative;
    z-index:1;
}

/* =========================================================
   EduPro fix: Ẩn thanh dưới Office Online không che nội dung khi màn hình thấp
   Cách mới: kéo iframe cao hơn khung 42px để thanh status/zoom nằm ra ngoài vùng nhìn thấy,
   không dùng lớp phủ đè lên tài liệu nữa.
========================================================= */
.edupro-material-office-online-shell::after{
    display:none !important;
    content:none !important;
}
.edupro-material-office-online-shell{
    position:relative !important;
    overflow:hidden !important;
    height:100% !important;
}
.edupro-material-office-online-iframe{
    width:100% !important;
    height:calc(100% + 42px) !important;
    min-height:calc(100vh - 108px) !important;
    margin:0 !important;
    border:0 !important;
    display:block !important;
}
.edupro-material-viewer-body .edupro-material-office-body{
    height:calc(100vh - 150px) !important;
    min-height:420px !important;
}
@media (max-height:760px){
    .edupro-material-viewer-body .edupro-material-office-body{
        height:calc(100vh - 128px) !important;
        min-height:360px !important;
    }
    .edupro-material-office-online-iframe{
        min-height:calc(100vh - 86px) !important;
    }
}
@media (max-width:768px){
    .edupro-material-viewer-body .edupro-material-office-body{
        height:calc(100vh - 132px) !important;
        min-height:360px !important;
    }
}
