/* elms-shell.css - style dùng chung cho khung trang (sidebar, topbar, dropdown tìm kiếm).
   Tách ra khỏi _GlobalAssets.cshtml để trình duyệt cache được thay vì nhúng lại ~10KB
   vào mọi response HTML. */

body { font-family: 'Be Vietnam Pro', sans-serif; }
.gradient-brand { background: linear-gradient(135deg, #282e3e 0%, rgb(var(--brand-500)) 100%); }
.gradient-soft  { background: linear-gradient(120deg, #f6f7fb 0%, #ffffff 100%); }
/* Scrollbar ẩn cho sidebar */
.sidebar-scroll::-webkit-scrollbar { width: 4px; }
.sidebar-scroll::-webkit-scrollbar-track { background: transparent; }
.sidebar-scroll::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.15); border-radius: 2px; }
/* Smooth transition cho sidebar items */
.sidebar-item { transition: all 0.15s ease; }

/* ── Light sidebar nav (Admin & Student) ── */
.light-sidebar {
    background: #ffffff;
    border-right: 1px solid #e2e8f0;
    box-shadow: 2px 0 12px rgba(0,0,0,0.03);
}
.light-sidebar::-webkit-scrollbar { width: 4px; }
.light-sidebar::-webkit-scrollbar-track { background: transparent; }
.light-sidebar::-webkit-scrollbar-thumb { background: #e2e8f0; border-radius: 2px; }

.light-nav-item {
    color: #475569;
    transition: all .2s cubic-bezier(.4,0,.2,1);
    position: relative;
}
.light-nav-item:hover {
    background: linear-gradient(135deg, #f8fafc 0%, rgb(var(--brand-50)) 100%);
    color: #1e293b;
    transform: translateX(2px);
}
.light-nav-active {
    background: linear-gradient(135deg, rgb(var(--brand-50)) 0%, #eff6ff 100%) !important;
    color: rgb(var(--brand-500)) !important;
    font-weight: 600;
    border-left: 3px solid rgb(var(--brand-500));
}
.light-nav-active:hover {
    background: linear-gradient(135deg, #e8ebff 0%, #e0eaff 100%) !important;
    transform: none;
}
.light-nav-active .light-nav-icon-wrap {
    box-shadow: 0 0 0 3px rgb(var(--brand-500) / 0.12);
}

.light-nav-icon-wrap {
    width: 32px;
    height: 32px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    font-size: 13px;
    transition: box-shadow .2s ease, transform .2s ease;
}
.light-nav-item:hover .light-nav-icon-wrap {
    transform: scale(1.08);
}

.light-section-label {
    font-size: 10px;
    font-weight: 800;
    color: #94a3b8;
    text-transform: uppercase;
    letter-spacing: 0.1em;
}

/* Nút ☰ trên thanh trên cùng: chỉ hiện dưới 1024px (menu ẩn hẳn, mở bằng nút này — sidebar-toggle.js). */
@media (min-width: 1024px) {
    #sidebarOpen {
        display: none !important;
    }
}
#sidebar {
    overflow: hidden;
    scrollbar-width: none;
    -ms-overflow-style: none;
    transition: width .3s cubic-bezier(.4,0,.2,1),
                transform .3s ease-in-out,
                box-shadow .3s ease-in-out;
    will-change: width, transform;
}
#sidebar::-webkit-scrollbar {
    display: none;
}
#sidebarOverlay:not(.hidden) {
    animation: sidebarOverlayFadeIn .3s ease forwards;
}
@keyframes sidebarOverlayFadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}
#sidebarClose {
    width: 2.5rem;
    height: 2.5rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    border-radius: .875rem;
    color: #64748b;
    transition: color .2s ease, background .2s ease;
}
#sidebarClose:hover {
    color: rgb(var(--brand-500));
    background: rgb(var(--brand-50));
}
#sidebar > nav {
    min-height: 0;
    overflow-y: auto;
    scrollbar-width: none;
    -ms-overflow-style: none;
}
#sidebar > nav::-webkit-scrollbar {
    display: none;
}
#sidebar-user-footer {
    flex-shrink: 0;
    margin-top: 0;
    background: #ffffff;
}
.sidebar-logout-button {
    width: 100%;
    min-height: 2.75rem;
    display: inline-flex;
    align-items: center;
    justify-content: flex-start;
    gap: .625rem;
    padding: 0 .875rem;
    border-radius: .875rem;
    color: #94a3b8;
    transition: color .2s ease, background .2s ease;
}
.sidebar-logout-button:hover {
    color: #ef4444;
    background: #fff1f2;
}
:is(#sidebar.sidebar-collapsed, html[data-sidebar="collapsed"] #sidebar) {
    overflow-x: hidden;
}
:is(#sidebar.sidebar-collapsed, html[data-sidebar="collapsed"] #sidebar) .sidebar-header {
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: .65rem;
    padding: .75rem .5rem;
}
:is(#sidebar.sidebar-collapsed, html[data-sidebar="collapsed"] #sidebar) .sidebar-header > .flex {
    justify-content: center;
}
:is(#sidebar.sidebar-collapsed, html[data-sidebar="collapsed"] #sidebar) .sidebar-brand-copy,
:is(#sidebar.sidebar-collapsed, html[data-sidebar="collapsed"] #sidebar) .sidebar-text,
:is(#sidebar.sidebar-collapsed, html[data-sidebar="collapsed"] #sidebar) .sidebar-section-label {
    display: none;
}
/* Nút ✕ (#sidebarClose) chỉ dành cho drawer dưới 1024px: KHÔNG hiện lại khi sidebar thu gọn trên màn rộng,
   vì nút thu/mở duy nhất ở đó là #sidebarDesktopToggle trên topbar (trước đây hiện thành 2 nút). */
@media (min-width: 1024px) {
    #sidebarClose {
        display: none;
    }
}
:is(#sidebar.sidebar-collapsed, html[data-sidebar="collapsed"] #sidebar) nav {
    padding-left: .5rem;
    padding-right: .5rem;
}
:is(#sidebar.sidebar-collapsed, html[data-sidebar="collapsed"] #sidebar) .light-nav-item {
    width: 2.75rem;
    min-height: 2.75rem;
    justify-content: center;
    margin-left: auto;
    margin-right: auto;
    padding-left: 0;
    padding-right: 0;
    border-radius: .9rem;
    border: 0;
    transform: none;
}
:is(#sidebar.sidebar-collapsed, html[data-sidebar="collapsed"] #sidebar) .light-nav-item > div {
    justify-content: center;
}
:is(#sidebar.sidebar-collapsed, html[data-sidebar="collapsed"] #sidebar) .light-nav-active {
    border-left: none;
    border-bottom: 0;
    box-shadow: inset 0 0 0 2px rgb(var(--brand-500) / .18);
}
:is(#sidebar.sidebar-collapsed, html[data-sidebar="collapsed"] #sidebar) .sidebar-badge {
    position: absolute;
    top: .35rem;
    right: .25rem;
    min-width: 1rem;
    height: 1rem;
    padding: 0 .25rem;
    font-size: 9px;
    line-height: 1rem;
    text-align: center;
}
:is(#sidebar.sidebar-collapsed, html[data-sidebar="collapsed"] #sidebar) #sidebar-user-footer {
    padding-left: .75rem;
    padding-right: .75rem;
}
:is(#sidebar.sidebar-collapsed, html[data-sidebar="collapsed"] #sidebar) #sidebar-user-footer > div {
    justify-content: center;
}
:is(#sidebar.sidebar-collapsed, html[data-sidebar="collapsed"] #sidebar) #sidebar-user-footer button {
    display: inline-flex;
}
:is(#sidebar.sidebar-collapsed, html[data-sidebar="collapsed"] #sidebar) .sidebar-logout-button {
    justify-content: center;
    padding-left: 0;
    padding-right: 0;
}

/* ── Trạng thái thu gọn ngay từ lần vẽ đầu (không nháy khi chuyển trang) ──
   _SidebarInitialState.cshtml (trong <head>) gắn html[data-sidebar="collapsed"] trước khi trang được vẽ;
   sidebar-toggle.js giữ thuộc tính này đồng bộ với class .sidebar-collapsed. */
@media (min-width: 1024px) {
    html[data-sidebar="collapsed"] #sidebar {
        width: var(--sidebar-w-collapsed);
    }
    html[data-sidebar="collapsed"] #mainContentWrapper {
        margin-left: var(--sidebar-w-collapsed);
    }
    /* Icon nút thu/mở trên topbar đúng trạng thái ngay từ đầu (» = mở rộng) */
    html[data-sidebar="collapsed"] #sidebarDesktopToggle .fa-angles-left::before {
        content: "\f101";
    }
}
/* Tắt hiệu ứng trong lúc tải trang; sidebar-toggle.js gỡ class này sau khi trang ổn định,
   nên transition chỉ chạy khi người dùng bấm thu/mở. */
html.sidebar-no-transition #sidebar,
html.sidebar-no-transition #sidebar *,
html.sidebar-no-transition #mainContentWrapper {
    transition: none !important;
}

/* ── Lesson Search Dropdown ── */
#lessonSearchWrapper { position: relative; }

.ls-dropdown {
    position: absolute;
    top: calc(100% + 6px);
    left: 0;
    right: 0;
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 16px;
    box-shadow: 0 16px 40px rgba(15,43,61,0.12);
    overflow: hidden;
    z-index: 200;
    max-height: 420px;
    overflow-y: auto;
}
.ls-dropdown::-webkit-scrollbar { width: 4px; }
.ls-dropdown::-webkit-scrollbar-thumb { background: #cbd5e1; border-radius: 4px; }

.ls-section-header {
    padding: 10px 14px 4px;
    font-size: 11px;
    font-weight: 800;
    color: #0f2b3d;
    text-transform: ;
    letter-spacing: .1em;
    background: #f1f5f9;
    display: flex;
    align-items: center;
    gap: 8px;
}
.ls-section-header i { font-size: 10px; color: #1e88e5; }

.ls-total {
    padding: 8px 14px 6px;
    font-size: 10px;
    font-weight: 600;
    color: #94a3b8;
    text-transform: ;
    letter-spacing: .06em;
    border-bottom: 1px solid #f1f5f9;
}
.ls-course-header {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 8px 14px 4px;
    font-size: 10px;
    font-weight: 700;
    color: #1e88e5;
    text-transform: ;
    letter-spacing: .05em;
    background: #f8fafc;
}
.ls-course-header i { font-size: 9px; }

.ls-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 9px 14px;
    text-decoration: none;
    border-bottom: 1px solid #f8fafc;
    transition: background .1s;
    cursor: pointer;
}
.ls-item:hover, .ls-item--active { background: #f0f7fe; }
.ls-item:last-child { border-bottom: none; }

.ls-icon {
    width: 32px;
    height: 32px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    font-size: 12px;
}
.ls-body {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 2px;
}
.ls-title {
    font-size: 12px;
    font-weight: 600;
    color: #0f2b3d;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.ls-path {
    font-size: 10px;
    color: #94a3b8;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.ls-right { flex-shrink: 0; }
.ls-badge {
    display: inline-flex;
    align-items: center;
    padding: 2px 7px;
    border-radius: 99px;
    font-size: 10px;
    font-weight: 700;
    white-space: nowrap;
}
.ls-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    padding: 20px 16px;
    color: #94a3b8;
    font-size: 12px;
}
.ls-empty i { font-size: 18px; color: #cbd5e1; }
.ls-more {
    padding: 8px 14px;
    font-size: 10px;
    color: #94a3b8;
    text-align: center;
    font-style: italic;
    background: #f8fafc;
    border-top: 1px solid #f1f5f9;
}

/* ── Generic Search Dropdown (sd-) ── */
.sd-wrapper { position: relative; }

.sd-dropdown {
    position: absolute;
    top: calc(100% + 4px);
    left: 0;
    right: 0;
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 14px;
    box-shadow: 0 18px 40px rgba(15,43,61,0.12);
    z-index: 300;
    max-height: 380px;
    overflow-y: auto;
    overflow-x: hidden;
}
.sd-dropdown::-webkit-scrollbar { width: 4px; }
.sd-dropdown::-webkit-scrollbar-thumb { background: #cbd5e1; border-radius: 4px; }

.sd-total {
    padding: 9px 14px 7px;
    font-size: 10px;
    font-weight: 800;
    color: #94a3b8;
    text-transform: ;
    letter-spacing: .08em;
    border-bottom: 1px solid #eef2f7;
    line-height: 1;
}

.sd-group-title {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 9px 14px;
    background: #f1f5f9;
    color: #0f2b3d;
    font-size: 11px;
    font-weight: 900;
    text-transform: ;
    letter-spacing: .08em;
    line-height: 1;
}

.sd-group-title i {
    color: #1e88e5;
    font-size: 11px;
}

.sd-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 14px;
    text-decoration: none;
    border-bottom: 1px solid #f8fafc;
    transition: background .1s;
    cursor: pointer;
}
.sd-item:hover, .sd-item--active { background: #f0f7fe; }
.sd-item:last-child { border-bottom: none; }

.sd-icon {
    width: 34px;
    height: 34px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    font-size: 12px;
}
.sd-body {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 2px;
}
.sd-title {
    font-size: 13px;
    font-weight: 800;
    color: #0f2b3d;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.sd-subtitle {
    font-size: 11px;
    color: #94a3b8;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.sd-right { flex-shrink: 0; }
.sd-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    padding: 16px 12px;
    color: #94a3b8;
    font-size: 12px;
}

.sd-empty--inline {
    min-height: 58px;
    justify-content: center;
}
.sd-empty i { font-size: 18px; color: #cbd5e1; }
.sd-more {
    padding: 8px 12px;
    font-size: 10px;
    color: #94a3b8;
    text-align: center;
    font-style: italic;
    background: #f8fafc;
    border-top: 1px solid #f1f5f9;
}

/* ── Bảng cuộn ngang trên màn nhỏ (wwwroot/js/table-scroll.js) ── */
.elms-table-scroll {
    max-width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}
@media (max-width: 767px) {
    /* Bảng từ 4 cột: giữ độ rộng tối thiểu, kéo ngang trong khung bảng thay vì ép cột */
    table.elms-table-wide {
        min-width: 40rem;
    }
    table.elms-table-wide th {
        white-space: nowrap;
    }
}
