/* Large avatar for sidebar footer */
.sidebar-user-avatar-lg {
    width: 32px;
    height: 32px;
    font-size: 1rem;
}
/* Dashboard Sidebar and Layout Styles (moved from dashboard.php) */
:root {
    --primary: #4361ee;
    --primary-dark: #3a56d4;
    --sidebar-width: 250px;
    --sidebar-collapsed-width: 56px;
    --transition: all 0.2s cubic-bezier(.4,2,.6,1);
}
body {
    font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
    background-color: #f8f9fa;
    overflow-x: hidden;
}
.sidebar {
    width: var(--sidebar-width);
    background: linear-gradient(180deg, var(--primary) 0%, var(--primary-dark) 100%);
    color: white;
    transition: var(--transition);
    position: fixed;
    height: 100vh;
    z-index: 1030;
    box-shadow: 0 0.25rem 0.5rem rgba(0,0,0,0.10);
    /* allow dropdowns to overflow the sidebar area (avoid clipping) */
    overflow-x: hidden;
    overflow: visible;
}
.sidebar.collapsed {
    width: var(--sidebar-collapsed-width);
}

/* Temporary hover expand: when collapsed and hovered, show full sidebar visually without persisting state */
.sidebar.collapsed.hovered {
    width: var(--sidebar-width);
    transition: width 0.18s cubic-bezier(.4,2,.6,1);
}

/* Reveal hidden texts while hovered */
.sidebar.collapsed.hovered .nav-text,
.sidebar.collapsed.hovered .sidebar-user-details,
.sidebar.collapsed.hovered .sidebar-user-actions,
.sidebar.collapsed.hovered .sidebar-logo-content,
.sidebar.collapsed.hovered .sidebar-logo-title,
.sidebar.collapsed.hovered .sidebar-logo-sublabel {
    opacity: 1 !important;
    width: auto !important;
    margin-left: 0.5rem !important;
    display: block !important;
}

/* Keep content area from shifting — sidebar overlaps on hover */
.sidebar.collapsed.hovered {
    position: fixed;
    z-index: 1040; /* above content but below modals */
}

.sidebar-logo {
    padding: 0.75rem 0.5rem 0rem;
    border-bottom: 1px solid rgba(255,255,255,0.08);
}
.sidebar-logo-link {
    display: block;
    text-align: center;
    text-decoration: none;
    color: white;
}
.sidebar-logo-circle {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: rgba(255,255,255,0.98);
    border: 1px solid rgba(0,0,0,0.08);
    box-shadow: 0 6px 14px rgba(0,0,0,0.14);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1rem;
}

.sidebar-logo-img{
    width: 32px;
    height: 32px;
    object-fit: contain;
    display: block;
}
.sidebar-logo-text {
    margin: 0;
    font-weight: 600;
    font-size: 1rem;
    transition: var(--transition);
    white-space: nowrap;
    overflow: hidden;
    text-align: center;
}
.sidebar.collapsed .sidebar-logo-text {
    opacity: 0;
    width: 0;
    margin-left: 0;
}
.sidebar-nav {
    padding: 0.25rem 0;
    overflow-y: auto;
    overflow-x: hidden;
    height: calc(100vh - 120px);
}
.sidebar-nav {
    padding: 0.25rem 0;
    overflow-y: auto;
    overflow-x: hidden;
    height: calc(100vh - 120px);
    -webkit-overflow-scrolling: touch;
    /* Firefox scrollbar colors */
    scrollbar-width: auto;
    scrollbar-color: rgba(255,255,255,0.45) rgba(255,255,255,0.06);
    position: relative; /* needed for custom scroll indicator */
}

/* WebKit (Chrome, Edge, Safari) scrollbar styles */
.sidebar-nav::-webkit-scrollbar {
    width: 12px;
}
.sidebar-nav::-webkit-scrollbar-track {
    background: rgba(255,255,255,0.06);
}
.sidebar-nav::-webkit-scrollbar-thumb {
    background: rgba(255,255,255,0.45);
    border-radius: 8px;
    transition: background 0.12s ease;
    border: 2px solid transparent;
    background-clip: padding-box;
}
.sidebar-nav:hover::-webkit-scrollbar-thumb,
.sidebar-nav:focus::-webkit-scrollbar-thumb {
    background: rgba(255,255,255,0.75);
}

.sidebar-nav-link:hover, .sidebar-nav-link:focus {
    background: rgba(255,255,255,0.08);
    color: white;
}
.sidebar-nav-link.active {
    background: rgba(255,255,255,0.13);
    color: white;
    box-shadow: 0 1px 2px rgba(0,0,0,0.04);
}
.nav-icon {
    font-size: 1rem;
    width: 20px;
    text-align: center;
}
.nav-text {
    margin-left: 0.5rem;
    font-weight: 500;
    transition: var(--transition);
    white-space: nowrap;
    overflow: hidden;
    font-size: 0.95rem;
}
.sidebar.collapsed .nav-text {
    opacity: 0;
    width: 0;
    margin-left: 0;
}
.sidebar-footer {
    padding: 0.5rem;
    border-top: 1px solid rgba(255,255,255,0.08);
    position: absolute;
    bottom: 0;
    width: 100%;
    background: rgba(0,0,0,0.06);
}

/* Fix dropdown clipping inside the sidebar/footer */
.sidebar-footer {
    overflow: visible;
}
.sidebar .dropdown-menu {
    z-index: 3000; /* above sidebar and other elements */
}
.dropdown-menu {
    will-change: transform; /* help Popper positioning */
}
.sidebar-user-info {
    display: flex;
    align-items: center;
}
.sidebar-user-avatar {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: rgba(255,255,255,0.18);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    flex-shrink: 0;
    font-size: 0.95rem;
}
.sidebar-user-details {
    margin-left: 0.5rem;
    transition: var(--transition);
    white-space: nowrap;
    overflow: hidden;
    flex-grow: 1;
}
.sidebar.collapsed .sidebar-user-details {
    opacity: 0;
    width: 0;
    margin-left: 0;
}
.sidebar-user-name {
    font-weight: 500;
    font-size: 0.8rem;
    margin-bottom: 0.05rem;
}
.sidebar-user-email {
    font-size: 0.7rem;
    opacity: 0.7;
}
.sidebar-user-actions {
    display: flex;
    gap: 0.25rem;
    transition: var(--transition);
}
.sidebar.collapsed .sidebar-user-actions {
    opacity: 0;
    width: 0;
    overflow: hidden;
}
.sidebar-user-actions .btn {
    padding: 0.15rem 0.3rem;
    color: rgba(255,255,255,0.7);
    border: none;
    background: transparent;
    font-size: 0.95rem;
}
.sidebar-user-actions .btn:hover {
    color: white;
    background: rgba(255,255,255,0.08);
}
/* Role badges */
.role-badge {
    font-size: 0.6rem;
    padding: 0.1rem 0.3rem;
    background: rgba(255,255,255,0.15);
    margin-right: 0.15rem;
}
/* Content Wrapper */
.content-wrapper {
    margin-left: var(--sidebar-width);
    transition: var(--transition);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}
.sidebar.collapsed + .content-wrapper {
    margin-left: var(--sidebar-collapsed-width);
}
/* Top Navbar */
.navbar-top {
    background: white;
    padding: 0.5rem 1rem;
    box-shadow: 0 1px 2px rgba(0,0,0,0.05);
    position: sticky;
    top: 0;
    z-index: 1020;
}
#sidebarToggle {
    border: none;
    background: transparent;
    color: #6c757d;
    font-size: 1.1rem;
    padding: 0.25rem 0.5rem;
    border-radius: 0.25rem;
}
#sidebarToggle:hover {
    background-color: #e9ecef;
    color: #495057;
}
.user-menu .dropdown-toggle {
    display: flex;
    align-items: center;
    padding: 0.25rem 0.5rem;
    border-radius: 0.25rem;
    font-size: 0.95rem;
}
.user-menu .dropdown-toggle:hover {
    background-color: #e9ecef;
}
.user-avatar {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: var(--primary);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 0.95rem;
}
/* Main Content */
.main-content {
    flex: 1;
    padding: 0.75rem 0.5rem;
    background: #f8f9fa;
    font-size: 0.97rem;
}
@media (max-width: 768px) {
    .sidebar {
        transform: translateX(-100%);
    }
    .sidebar.show {
        transform: translateX(0);
    }
    .content-wrapper {
        margin-left: 0 !important;
    }
    .mobile-overlay {
        position: fixed;
        top: 0;
        left: 0;
        width: 100%;
        height: 100%;
        background: rgba(0,0,0,0.5);
        z-index: 1029;
        display: none;
    }
    .mobile-overlay.show {
        display: block;
    }
}
.sidebar-nav {
    -webkit-overflow-scrolling: touch;
    scrollbar-width: thin;
    scrollbar-color: rgba(255,255,255,0.35) rgba(255,255,255,0.06);
}

.sidebar-nav::-webkit-scrollbar {
    width: 8px;
}
.sidebar-nav::-webkit-scrollbar-track {
    background: rgba(255,255,255,0.06);
}
.sidebar-nav::-webkit-scrollbar-thumb {
    background: rgba(255,255,255,0.35);
    border-radius: 8px;
    transition: background 0.15s ease;
    border: 2px solid transparent;
    background-clip: padding-box;
}
.sidebar-nav:hover::-webkit-scrollbar-thumb,
.sidebar-nav:focus::-webkit-scrollbar-thumb {
    background: rgba(255,255,255,0.6);
}
:root {
    --primary: #4361ee;
    --primary-dark: #3a56d4;
    --sidebar-width: 250px;
    --sidebar-collapsed-width: 56px;
    --transition: all 0.2s cubic-bezier(.4, 2, .6, 1);
}

body {
    font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
    background-color: #f8f9fa;
    overflow-x: hidden;
}

/* Sidebar Styles */
.sidebar {
    width: var(--sidebar-width);
    background: linear-gradient(180deg, var(--primary) 0%, var(--primary-dark) 100%);
    color: white;
    transition: var(--transition);
    position: fixed;
    height: 100vh;
    z-index: 1030;
    box-shadow: 0 0.25rem 0.5rem rgba(0, 0, 0, 0.10);
}

.sidebar.collapsed {
    width: var(--sidebar-collapsed-width);
}

.sidebar-logo {
    padding: 0.75rem 0.5rem 0rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

/* Sidebar logo: stack icon above text */
.sidebar-logo-link {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-decoration: none;
    color: white;
}

.sidebar-logo-circle {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: rgba(255,255,255,0.98);
    border: 1px solid rgba(0,0,0,0.08);
    box-shadow: 0 6px 14px rgba(0,0,0,0.14);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1rem;
}

.sidebar-logo-text {
    margin-left: 0.5rem;
    font-weight: 600;
    font-size: 1rem;
    transition: var(--transition);
    white-space: nowrap;
    overflow: hidden;
}

.sidebar.collapsed .sidebar-logo-text {
    opacity: 0;
    width: 0;
    margin-left: 0;
}

.sidebar-nav {
    padding: 0rem 0;
    overflow-y: auto;
    height: calc(100vh - 120px);
}

.sidebar-nav-link {
    display: flex;
    align-items: center;
    padding: 0.4rem 0.75rem;
    color: rgba(255, 255, 255, 0.85);
    text-decoration: none;
    transition: var(--transition);
    margin: 0.1rem 0.25rem;
    border-radius: 0.25rem;
    border: none;
    background: transparent;
    width: 100%;
    text-align: left;
    font-size: 0.95rem;
    min-height: 36px;
}

.sidebar-nav-link:hover,
.sidebar-nav-link:focus {
    background: rgba(255, 255, 255, 0.08);
    color: white;
}

.sidebar-nav-link.active {
    background: rgba(255, 255, 255, 0.13);
    color: white;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04);
}

.nav-icon {
    font-size: 1rem;
    width: 20px;
    text-align: center;
}

.nav-text {
    margin-left: 0.5rem;
    font-weight: 500;
    transition: var(--transition);
    white-space: nowrap;
    overflow: hidden;
    font-size: 0.95rem;
}

.sidebar.collapsed .nav-text {
    opacity: 0;
    width: 0;
    margin-left: 0;
}

.sidebar-footer {
    padding: 0.5rem;
    border-top: 1px solid rgba(255, 255, 255, 0.08);
    position: absolute;
    bottom: 0;
    width: 100%;
    background: rgba(0, 0, 0, 0.06);
}

.sidebar-user-info {
    display: flex;
    align-items: center;
}

.sidebar-user-avatar {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.18);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    flex-shrink: 0;
    font-size: 0.95rem;
}

.sidebar-user-details {
    margin-left: 0.5rem;
    transition: var(--transition);
    white-space: nowrap;
    overflow: hidden;
    flex-grow: 1;
}

.sidebar.collapsed .sidebar-user-details {
    opacity: 0;
    width: 0;
    margin-left: 0;
}

.sidebar-user-name {
    font-weight: 500;
    font-size: 0.8rem;
    margin-bottom: 0.05rem;
}

.sidebar-user-email {
    font-size: 0.7rem;
    opacity: 0.7;
}

.sidebar-user-actions {
    display: flex;
    gap: 0.25rem;
    transition: var(--transition);
}

.sidebar.collapsed .sidebar-user-actions {
    opacity: 0;
    width: 0;
    overflow: hidden;
}

.sidebar-user-actions .btn {
    padding: 0.15rem 0.3rem;
    color: rgba(255, 255, 255, 0.7);
    border: none;
    background: transparent;
    font-size: 0.95rem;
}

.sidebar-user-actions .btn:hover {
    color: white;
    background: rgba(255, 255, 255, 0.08);
}

/* Role badges */
.role-badge {
    font-size: 0.6rem;
    padding: 0.1rem 0.3rem;
    background: rgba(255, 255, 255, 0.15);
    margin-right: 0.15rem;
}

/* Content Wrapper */
.content-wrapper {
    margin-left: var(--sidebar-width);
    transition: var(--transition);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

.sidebar.collapsed+.content-wrapper {
    margin-left: var(--sidebar-collapsed-width);
}

/* Top Navbar */
.navbar-top {
    background: white;
    padding: 0.5rem 1rem;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
    position: sticky;
    top: 0;
    z-index: 1020;
}

#sidebarToggle {
    border: none;
    background: transparent;
    color: #6c757d;
    font-size: 1.1rem;
    padding: 0.25rem 0.5rem;
    border-radius: 0.25rem;
}

#sidebarToggle:hover {
    background-color: #e9ecef;
    color: #495057;
}

.user-menu .dropdown-toggle {
    display: flex;
    align-items: center;
    padding: 0.25rem 0.5rem;
    border-radius: 0.25rem;
    font-size: 0.95rem;
}

.user-menu .dropdown-toggle:hover {
    background-color: #e9ecef;
}

.user-avatar {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: var(--primary);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 0.95rem;
}

/* Main Content */
.main-content {
    flex: 1;
    padding: 0.75rem 0.5rem;
    background: #f8f9fa;
    font-size: 0.97rem;
}

/* Mobile Styles */
@media (max-width: 768px) {
    .sidebar {
        transform: translateX(-100%);
    }

    .sidebar.show {
        transform: translateX(0);
    }

    .content-wrapper {
        margin-left: 0 !important;
    }

    .mobile-overlay {
        position: fixed;
        top: 0;
        left: 0;
        width: 100%;
        height: 100%;
        background: rgba(0, 0, 0, 0.5);
        z-index: 1029;
        display: none;
    }

    .mobile-overlay.show {
        display: block;
    }
}

/* Scrollbar Styling (cross-browser, improved visibility) */
.sidebar-nav {
    /* Ensure custom scrollbars apply consistently */
    -webkit-overflow-scrolling: touch;
    scrollbar-width: thin;
    scrollbar-color: rgba(255,255,255,0.35) rgba(255,255,255,0.06);
}

/* WebKit (Chrome, Edge, Safari) scrollbar styles */
.sidebar-nav::-webkit-scrollbar {
    width: 8px;
}
.sidebar-nav::-webkit-scrollbar-track {
    background: rgba(255,255,255,0.06);
}
.sidebar-nav::-webkit-scrollbar-thumb {
    background: rgba(255,255,255,0.35);
    border-radius: 8px;
    transition: background 0.15s ease;
    border: 2px solid transparent;
    background-clip: padding-box;
}
.sidebar-nav:hover::-webkit-scrollbar-thumb,
.sidebar-nav:focus::-webkit-scrollbar-thumb {
    background: rgba(255,255,255,0.6);
}

/* Section Headers */
.sidebar-section-header {
    display: flex;
    align-items: center;
    padding: 0rem 0.75rem 0.2rem;
    margin: 0rem 0.25rem 0.2rem;
    font-size: 0.7rem;
    font-weight: 700;
    letter-spacing: 0.5px;
    color: rgba(255, 255, 255, 0.6);
    text-transform: uppercase;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.sidebar-section-header i {
    font-size: 0.75rem;
}

.sidebar.collapsed .sidebar-section-header span {
    opacity: 0;
    width: 0;
    overflow: hidden;
}

/* Section Divider */
.sidebar-section-divider {
    height: 1px;
    background: rgba(255, 255, 255, 0.1);
    margin: 0.75rem 0.5rem;
}

/* Submenu Styles */
.sidebar-menu-item {
    position: relative;
}

.sidebar-parent {
    position: relative;
}

.submenu-arrow {
    position: absolute;
    right: 15px;
    transition: transform 0.3s ease;
    font-size: 0.75rem;
    margin-left: auto;
}

.sidebar-parent[aria-expanded="true"] .submenu-arrow {
    transform: rotate(180deg);
}

.submenu {
    background: rgba(0, 0, 0, 0.06);
    padding: 0.15rem 0 0.15rem 0;
    margin: 0 0 0 0;
}

.submenu-link {
    padding-left: 2rem !important; /* reduced indent for subtler hierarchy */
    font-size: 0.9rem;
    border-left: 2px solid rgba(255,255,255,0.02);
    margin-left: 0;
}

.submenu-link .nav-icon {
    font-size: 0.85rem;
    width: 1.2rem;
}

.sidebar.collapsed .submenu {
    display: none !important;
}

.sidebar.collapsed .submenu-arrow {
    display: none;
}

/* Logo content tweaks for improved alignment and responsive label */
.sidebar-logo-img {
    width: 28px !important;
    height: 28px !important;
    object-fit: contain;
    display: block;
}
.sidebar-logo-firstline {
    gap: 0.5rem;
}
.sidebar-logo-title {
    font-weight: 600;
    font-size: 1rem;
    color: white;
    line-height: 1;
    text-align: center;
}
.sidebar-logo-content {
    display: block;
    line-height: 1.1;
}
.sidebar-logo-sublabel {
    font-size: 0.72rem;
    color: rgba(255,255,255,0.85);
    max-width: 200px;
    margin: 0 auto;
}

/* Hide extended text when sidebar is collapsed */
.sidebar.collapsed .sidebar-logo-sublabel,
.sidebar.collapsed .sidebar-logo-title {
    display: none !important;
}

/* When collapsed, keep only circle visible and center it */
.sidebar.collapsed .sidebar-logo {
    padding: 0.45rem 0.25rem;
}
.sidebar.collapsed .sidebar-logo-circle {
    margin: 0 auto;
}
.sidebar.collapsed .sidebar-logo-content {
    display: none !important;
}

@media (max-width: 768px) {
    .sidebar-logo-sublabel {
        display: none;
    }
}

/* Utility: text-justify (Bootstrap 5 removed this utility) */
.text-justify {
    text-align: justify !important;
    text-align-last: left; /* keep last line left-aligned */
    -webkit-hyphens: auto;
    -ms-hyphens: auto;
    hyphens: auto;
}
