/* ============================================
   APP SHELL — Modern Dashboard Layout
   ============================================ */
* {
    box-sizing: border-box;
}

html {
    overflow: hidden;
    font-family: 'Poppins', 'Segoe UI', sans-serif;
}

body {
    margin: 0;
    padding: 0;
    background: #F1F5F9;
}

.app-shell {
    display: flex;
    width: 100%;
    height: 100vh;
    overflow: hidden;
}

/* ============================================
   SIDEBAR
   ============================================ */
.app-sidebar {
    width: 250px;
    min-width: 250px;
    height: 100vh;
    background: #0B3D91;
    color: #fff;
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 0;
    left: 0;
    z-index: 1000;
    overflow-y: auto;
    overflow-x: hidden;
}

    .app-sidebar.collapsed {
        width: 48px;
        min-width: 48px;
    }

.app-sidebar-header {
    display: flex;
    align-items: center;
    justify-content: center; /* Căn giữa toàn bộ cụm logo + chữ */
    gap: 10px;
    padding: 0 10px;
    background: #082E6E;
    height: 52px;
    min-height: 52px;
    border-bottom: 1px solid rgba(255,255,255,0.08);
    overflow: hidden;
}

.sidebar-logo-img {
    height: 40px;
    width: auto;
    flex-shrink: 0;
}

.sidebar-brand {
    font-size: 20px;
    font-weight: 700;
    color: #fff;
    letter-spacing: 0.08em;
    white-space: nowrap;
}

.app-sidebar.collapsed .sidebar-brand {
    display: none;
}

.app-sidebar.collapsed .app-sidebar-header {
    padding: 0;
    justify-content: center;
}

.app-sidebar.collapsed .sidebar-logo-img {
    height: 24px;
    margin: 0;
}

/* Sidebar Menu Items Override */
.app-sidebar li.nav-header.hidden-folded {
    margin-top: 0;
    background: rgba(255,255,255,0.08);
    padding: 10px 16px;
    font-size: 9px;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: rgba(255,255,255,0.4);
    user-select: none;
}

.app-sidebar nav ul li a {
    background: transparent;
    border-bottom: none;
    padding: 9px 16px;
    color: rgba(255,255,255,0.75);
    font-size: 13px;
    display: flex;
    align-items: center;
    gap: 10px;
    margin: 1px 8px;
    border-radius: 6px;
    border-left: none;
}

    .app-sidebar nav ul li a:hover {
        background: rgba(255,255,255,0.12);
        color: #fff;
        border-left: none;
    }

    .app-sidebar nav ul li a.active {
        background: rgba(255,255,255,0.15);
        color: #fff;
        border-right: 3px solid #60A5FA;
    }

    .app-sidebar nav ul li a .fa {
        width: 18px;
        text-align: center;
        font-size: 15px;
        color: rgba(255,255,255,0.5);
        flex-shrink: 0;
    }

    .app-sidebar nav ul li a:hover .fa,
    .app-sidebar nav ul li a.active .fa {
        color: #93C5FD;
    }

.app-sidebar nav ul li ul li a {
    background: transparent;
    border-left: none;
    padding: 7px 16px 7px 32px;
    font-size: 12px;
    margin: 0 8px;
}

    .app-sidebar nav ul li ul li a:hover {
        background: rgba(255,255,255,0.1);
        border-left: none;
    }

.app-sidebar .title-menu,
.app-sidebar .title-menu-sub {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Collapsed sidebar: hide text, minimize padding */
.app-sidebar.collapsed .title-menu,
.app-sidebar.collapsed .title-menu-sub,
.app-sidebar.collapsed .right,
.app-sidebar.collapsed .nav-header {
    display: none;
}

.app-sidebar.collapsed nav ul li a {
    justify-content: center;
    padding: 10px 0;
    margin: 1px 2px;
    border-radius: 4px;
}

    .app-sidebar.collapsed nav ul li a .fa {
        margin: 0;
        width: auto;
        font-size: 16px;
    }

.app-sidebar.collapsed nav ul li ul {
    display: none !important;
}

/* Sidebar scrollbar */
.app-sidebar::-webkit-scrollbar {
    width: 3px;
}

.app-sidebar::-webkit-scrollbar-track {
    background: transparent;
}

.app-sidebar::-webkit-scrollbar-thumb {
    background: rgba(255,255,255,0.2);
    border-radius: 3px;
}

/* ============================================
   MAIN CONTENT
   ============================================ */
.app-main {
    flex: 1;
    margin-left: 250px;
    min-width: 0;
    height: 100vh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

    .app-main.expanded {
        margin-left: 48px;
    }

/* ============================================
   TOPBAR
   ============================================ */
.app-topbar {
    height: 52px;
    min-height: 52px;
    background: #fff;
    border-bottom: 1px solid #E2E8F0;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 20px;
    gap: 12px;
    z-index: 100;
}

.topbar-left {
    display: flex;
    align-items: center;
    gap: 12px;
    flex: 1;
    min-width: 0;
}

.topbar-toggle {
    width: 34px;
    height: 34px;
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    color: #64748B;
    background: transparent;
    border: 1px solid #E2E8F0;
    transition: all 0.2s;
    flex-shrink: 0;
}

    .topbar-toggle:hover {
        background: #F1F5F9;
        color: #0B3D91;
    }

.topbar-title {
    font-size: 14px;
    font-weight: 700;
    color: Orange;
    text-transform: uppercase;
    letter-spacing: 0.01em;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.topbar-right {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-shrink: 0;
}

.topbar-icon {
    width: 34px;
    height: 34px;
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #64748B;
    cursor: pointer;
    border: 1px solid #E2E8F0;
    background: #fff;
    transition: all 0.2s;
}

    .topbar-icon:hover {
        background: #F8FAFC;
        color: #0B3D91;
    }

.topbar-user {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 4px 12px 4px 4px;
    border: 1px solid #E2E8F0;
    border-radius: 20px;
    background: #fff;
}

.user-avatar {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: #0B3D91;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 10px;
    font-weight: 600;
    color: #fff;
    flex-shrink: 0;
}

.user-name {
    font-size: 12px;
    color: #334155;
    white-space: nowrap;
}

.topbar-logout {
    cursor: pointer;
    padding: 6px;
    color: #94A3B8;
    font-size: 16px;
    transition: color 0.2s;
}

    .topbar-logout:hover {
        color: #EF4444;
    }

/* ============================================
   PAGE CONTENT
   ============================================ */
.app-content {
    flex: 1;
    padding: 14px 18px;
    overflow-x: hidden;
    overflow-y: auto;
    background: #e1edf5;
}

/* Mobile Overlay */
.sidebar-overlay {
    display: none;
    position: fixed;
    width: 100vw;
    height: 100vh;
    background: rgba(0, 0, 0, 0.5);
    z-index: 999;
    backdrop-filter: blur(2px);
}

    .sidebar-overlay.active {
        display: block;
    }

/* ============================================
   RESPONSIVE
   ============================================ */
@media (max-width: 768px) {
    .app-sidebar {
        margin-left: -250px;
    }

        .app-sidebar.mobile-open {
            margin-left: 0;
        }

    .app-main {
        margin-left: 0;
    }

    .topbar-title {
        display: none;
    }

    .topbar-user .user-info {
        display: none;
    }

    .app-content {
        padding: 10px;
    }
}

/* Tắt hiệu ứng trượt của Bootstrap Collapse (Menu con) */
.collapse {
    transition: none !important;
}

.collapsing {
    transition: none !important;
    display: none; /* Hiện ngay lập tức */
}

    .collapsing.in {
        display: block;
    }

/* Fix: Override inherited form>label styles that mess up non-form labels */
.app-topbar label,
.app-sidebar label {
    display: inline;
    padding: 0;
    border: none;
    margin: 0;
}

/* NOTIFICATION STYLES */
.noti-dropdown-wrapper {
    position: relative;
}

.noti-bell {
    position: relative;
}

.noti-badge {
    position: absolute;
    top: -4px;
    right: -4px;
    background: #EF4444;
    color: #fff;
    font-size: 10px;
    font-weight: 700;
    min-width: 16px;
    height: 16px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 4px;
    border: 2px solid #fff;
}

.noti-dropdown-panel {
    position: absolute;
    top: 42px;
    right: 0;
    width: 320px;
    background: #fff;
    border-radius: 8px;
    box-shadow: 0 10px 15px -3px rgba(0,0,0,0.1), 0 4px 6px -2px rgba(0,0,0,0.05);
    border: 1px solid #E2E8F0;
    display: none;
    flex-direction: column;
    z-index: 1100;
    overflow: hidden;
}

    .noti-dropdown-panel.show {
        display: flex;
    }

.noti-header {
    padding: 12px 16px;
    background: #F8FAFC;
    border-bottom: 1px solid #E2E8F0;
    font-size: 12px;
    font-weight: 700;
    color: #1E293B;
    letter-spacing: 0.05em;
}

.noti-list {
    max-height: 360px;
    overflow-y: auto;
}

.noti-item {
    padding: 12px 16px;
    border-bottom: 1px solid #F1F5F9;
    cursor: pointer;
    transition: background 0.2s;
    display: flex;
    align-items: flex-start;
    gap: 12px;
    position: relative;
}

    .noti-item:hover {
        background: #F1F5F9;
    }

    .noti-item.unread {
        background: #EFF6FF;
    }

.noti-body {
    flex: 1;
    min-width: 0;
}

.noti-item .noti-title {
    font-size: 13px;
    font-weight: 600;
    color: #0F172A;
    margin-bottom: 2px;
}

.noti-item .noti-content {
    font-size: 12px;
    color: #64748B;
    line-height: 1.4;
}

.noti-item .noti-time {
    font-size: 11px;
    color: #94A3B8;
    margin-top: 4px;
}

.noti-action {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 100%;
    padding-left: 8px;
}

.btn-go-noti {
    width: 28px;
    height: 28px;
    border-radius: 4px;
    background: #fff;
    border: 1px solid #E2E8F0;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #0B3D91;
    transition: all 0.2s;
    text-decoration: none !important;
}

    .btn-go-noti:hover {
        background: #0B3D91;
        color: #fff;
        border-color: #0B3D91;
    }

.noti-empty {
    padding: 30px 20px;
    text-align: center;
    color: #94A3B8;
    font-size: 13px;
}

.noti-footer {
    padding: 10px;
    text-align: center;
    border-top: 1px solid #E2E8F0;
    background: #fff;
}

    .noti-footer a {
        font-size: 12px;
        color: #0B3D91;
        font-weight: 600;
        text-decoration: none;
    }
