/* ===================================
    CSS CUSTOM PROPERTIES (VARIABLES)
    =================================== */
:root {
    --sidebar-width: 215px;
    --sidebar-collapsed-width: 60px;
    --header-height: 60px;
    --primary-color: #3b82f6;
    --sidebar-bg: #ffffff;
    --sidebar-text: #000000;
    --sidebar-hover: #f7f8f7;
    --sidebar-active: #f7f8f7;
    --sidebar-border: #e2e8f0;
    --uncg-blue: #0f2044;
}

/* ===================================
    BASE STYLES
    =================================== */
* {
    font-family: 'Inter', sans-serif;
}

/* Reusable form styling */
.required::after {
    content: " *";
    color: red;
}

/* Custom scrollbar styling */
::-webkit-scrollbar {
    width: 3px;
    height: 3px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: #888;
    border-radius: 1.5px;
}

::-webkit-scrollbar-thumb:hover {
    background: #555;
}

/* For Firefox */
* {
    scrollbar-width: thin;
    scrollbar-color: #888 transparent;
}

/* Ensure content doesn't shift when scrollbar appears */
html {
    overflow-y: overlay;
}

body {
    background-color: #f0f0f0 !important;
    overflow-x: hidden;
}


/* Modal Backdrop and Modal Z-Index */
/* Ensure modal backdrop and modal have higher z-index than sidebar */
.modal-backdrop {
z-index: 100000 !important;
}
.modal {
z-index: 100001 !important;
}

.dropdown-toggle::after {
    border: none !important;
}

/* List group hover effect (mirrors Bootstrap table-hover) */
.list-group-item-hover:hover {
    background-color: rgba(0, 0, 0, 0.02);
}


/* ===================================
    SIDEBAR COMPONENT
    =================================== */
.sidebar {
    position: fixed;
    top: 0;
    left: 0;
    height: 100vh;
    width: var(--sidebar-width);
    background: white;
    transition: all 0.25s ease-out;
    z-index: 1000;
    overflow-y: auto;
    overflow-x: hidden;
    display: flex;
    flex-direction: column;
}

.sidebar.collapsed {
    width: var(--sidebar-collapsed-width);
}

/* Sidebar Header */
.sidebar-header {
    background-color: var(--uncg-blue);
    color: white;
    padding: .75rem;
    height: var(--header-height);
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-weight: 600;
    font-size: 1.1rem;
    white-space: nowrap;
    overflow: hidden;
    background-color: var(--uncg-blue);
}

.sidebar.collapsed .sidebar-header .brand-text {
    display: none;
}

/* Sidebar Toggle Button */
.sidebar-toggle-btn {
    background: none;
    border: none;
    font-size: 1rem;
    cursor: pointer;
    padding: 0.25rem;
    border-radius: 0.25rem;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.sidebar-toggle-btn i {
    transition: transform 0.25s ease;
}

.sidebar.collapsed .sidebar-toggle-btn i {
    transform: rotate(180deg);
}

/* Sidebar Navigation */
.sidebar-nav {
    padding: 0.5rem 0;
    padding-left: 5px;
    padding-right: 5px;
}

.sidebar.collapsed .sidebar-nav {
    padding-left: 0;
    padding-right: 0;
}

.nav-item {
    margin-bottom: 1px;
}

.nav-link-sidebar {
    display: flex;
    align-items: center;
    padding: 0.75rem 1rem;
    font-size: 0.9rem;
    color: var(--sidebar-text);
    text-decoration: none;
    transition: background-color 0.2s ease, color 0.2s ease;
    border-radius: 0;
    position: relative;
    white-space: nowrap;
    overflow: hidden;
    border-top-right-radius: 0.4rem;
    border-bottom-right-radius: 0.4rem;
    border-top-left-radius: 0;
    border-bottom-left-radius: 0;
    background-color: transparent;
    border: none;
}

.sidebar.collapsed .nav-link-sidebar {
    border-radius: 0;
    justify-content: center;
    padding: 0.75rem;
}

.nav-link-sidebar:hover {
    background-color: var(--sidebar-hover);
    color: var(--sidebar-text);
}

.nav-link-sidebar.active {
    background-color: var(--sidebar-active);
    color: var(--sidebar-text);
}

.nav-link-sidebar::before {
    content: '';
    position: absolute;
    top: 100%;
    left: 0;
    width: 4px;
    height: 100%;
    background-color: #a6b0b7;
    transition: top 0.2s ease-out, opacity 0.2s ease-out;
    opacity: 0;
}

.nav-link-sidebar:hover::before {
    top: 0;
    opacity: 0.5;
}

.nav-link-sidebar.active::before {
    top: 0;
    opacity: 1;
}

.nav-link-sidebar i {
    width: 20px;
    margin-right: 0.875rem;
    text-align: center;
    font-size: 1rem;
}

.sidebar.collapsed .nav-link-sidebar span {
    display: none;
}

.sidebar.collapsed .nav-link-sidebar i {
    margin-right: 0;
}

/* Hide section headers when sidebar is collapsed */
.sidebar.collapsed .sidebar-nav small {
    display: none;
}

/* ===================================
    MAIN CONTENT AREA
    =================================== */
.main-content {
    margin-left: var(--sidebar-width);
    transition: all 0.25s ease-out;
}

footer {
    padding: 10px 15px;
    text-align: right;
    font-size: 0.875rem;
    color: #6c757d;
    margin-top: auto;
}

.main-content.collapsed {
    margin-left: var(--sidebar-collapsed-width);
}

.top-header {
    background: var(--uncg-blue);
    color: white;
    height: var(--header-height);
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    display: none; /* Hidden by default */
    align-items: center;
    padding: 0 1.5rem;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 999;
    transition: transform 0.3s ease;
}

.top-header.hidden {
    transform: translateY(-100%);
}

.content-area {
    padding: 1rem;
}

/* ===================================
    SIDEBAR OVERLAY
    =================================== */
.sidebar-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.5);
    z-index: 999;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
}

.sidebar-overlay.show {
    opacity: 1;
    visibility: visible;
}

/* ===================================
    TOOLTIPS & SMOOTH TRANSITIONS
    =================================== */
.sidebar.collapsed [data-bs-toggle="tooltip"] {
    pointer-events: auto;
}

.sidebar,
.main-content {
    transition: all 0.25s ease-out;
}

/* ===================================
    RESPONSIVE BREAKPOINTS
    =================================== */

/* Mobile Devices (< 768px) */
@media (max-width: 767.98px) {
    .sidebar {
        transform: translateX(-100%);
        width: var(--sidebar-width) !important; /* Force full width on mobile */
    }

    .sidebar.show {
        transform: translateX(0);
        width: var(--sidebar-width) !important; /* Ensure full width when shown */
    }

    /* Ensure mobile sidebar shows full navigation with text */
    .sidebar.show .nav-link-sidebar {
        justify-content: flex-start;
        padding: 0.75rem 1.25rem;
        border-top-right-radius: 0.4rem;
        border-bottom-right-radius: 0.4rem;
    }

    .sidebar.show .nav-link-sidebar span {
        display: inline;
    }

    .sidebar.show .nav-link-sidebar i {
        margin-right: 0.75rem;
    }

    .sidebar.show .sidebar-header .brand-text {
        display: inline;
    }

    .sidebar.show .sidebar-nav {
        padding-left: 5px;
        padding-right: 5px;
    }

    /* Force remove collapsed state on mobile */
    .sidebar.collapsed {
        width: var(--sidebar-width) !important;
    }

    .main-content {
        margin-left: 0;
        padding-top: var(--header-height);
    }

    .main-content.collapsed {
        margin-left: 0;
        padding-top: var(--header-height);
    }

    .top-header {
        display: flex !important; /* Show header only on mobile */
        left: 0;
        right: 0;
    }

    .mobile-header {
        display: flex !important;
    }

    .desktop-toggle {
        display: none !important;
    }

    .sidebar-toggle-btn {
        display: flex !important; /* Show header toggle on mobile */
    }

    /* Mobile toggle button rotation */
    .sidebar:not(.show) .sidebar-toggle-btn i {
        transform: rotate(0deg) !important;
    }

    .sidebar.show .sidebar-toggle-btn i {
        transform: rotate(0deg) !important;
    }
}

/* Tablet Devices (768px - 991.98px) */
@media (min-width: 768px) and (max-width: 991.98px) {
    .sidebar {
        width: var(--sidebar-collapsed-width);
    }

    .sidebar .nav-link-sidebar {
        justify-content: center;
        padding: 0.75rem;
        border-radius: 0;
    }

    .sidebar .nav-link-sidebar span {
        display: none;
    }

    .sidebar .nav-link-sidebar i {
        margin-right: 0;
    }

    .sidebar .sidebar-header .brand-text {
        display: none;
    }

    .sidebar .sidebar-nav {
        padding-left: 0;
        padding-right: 0;
    }

    .main-content {
        margin-left: var(--sidebar-collapsed-width);
    }

    .mobile-header {
        display: none !important;
    }

    .desktop-toggle {
        display: none !important;
    }

    .top-header {
        display: none !important; /* Hide header on tablet */
    }

    .sidebar-toggle-btn {
        display: flex !important; /* Show header toggle on tablet */
    }

    /* When sidebar is shown as off-canvas on tablet */
    .sidebar.show {
        width: var(--sidebar-width);
        z-index: 1001;
    }

    .sidebar.show .nav-link-sidebar {
        justify-content: flex-start;
        padding: 0.75rem 1.25rem;
        border-top-right-radius: 0.4rem;
        border-bottom-right-radius: 0.4rem;
    }

    .sidebar.show .nav-link-sidebar span {
        display: inline;
    }

    .sidebar.show .nav-link-sidebar i {
        margin-right: 0.75rem;
    }

    .sidebar.show .sidebar-header .brand-text {
        display: inline;
    }

    .sidebar.show .sidebar-nav {
        padding-left: 5px;
        padding-right: 5px;
    }

    /* Tablet toggle button rotation */
    .sidebar.show .sidebar-header .sidebar-toggle-btn i {
        transform: rotate(0deg) !important;
    }

    .sidebar.show .sidebar-toggle-btn i {
        transform: rotate(0deg) !important;
    }
}

/* Desktop Devices (≥ 992px) */
@media (min-width: 992px) {
    .mobile-header {
        display: none !important;
    }

    .desktop-toggle {
        display: block !important; /* Show desktop toggle button */
    }

    .top-header {
        display: none !important; /* Hide header on desktop */
    }

    /* Position the desktop toggle button */
    .desktop-toggle {
        left: calc(var(--sidebar-width) + 10px) !important;
        transition: left 0.25s ease-out;
    }

    .main-content.collapsed .desktop-toggle {
        left: calc(var(--sidebar-collapsed-width) + 10px) !important;
    }
}


/* Minimal custom styles - only for elements not covered by Bootstrap */

/* Mobile offcanvas link styling */
.mobile-nav-link {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}
.mobile-nav-link i {
    width: 1.25rem;
}

/* Nav spacer to account for fixed navbar */
.nav-spacer {
    height: 56px;
}
@media (min-width: 992px) {
    .nav-spacer {
        height: 56px;
    }
}

/* Push navbar down when impersonation banner is visible */
body.impersonating #mainNav {
    top: 50px;
}
body.impersonating .nav-spacer {
    height: 106px;
}
@media (max-width: 768px) {
    body.impersonating #mainNav {
        top: 80px;
    }
    body.impersonating .nav-spacer {
        height: 136px;
    }
}

/* Desktop nav badge sizing - prevent scaling with parent font-size */
.desktop-nav .nav-link {
    font-size: 0.875rem !important;
}

.desktop-nav .badge {
    font-size: 0.65rem !important;
    padding: 0.25em 0.5em !important;
    vertical-align: middle;
}

/* Desktop nav visibility */
@media (max-width: 1099.98px) {
    .desktop-nav {
        display: none !important;
    }
}
@media (min-width: 1100px) {
    .mobile-toggle-btn {
        display: none !important;
    }
}

/* Header nav link underline animation */
.desktop-nav .nav-link {
    position: relative;
    transition: color 0.3s ease;
}

.desktop-nav .nav-link::after {
    content: '';
    position: absolute;
    bottom: 0.25rem;
    left: 50%;
    right: 50%;
    height: 2px;
    background-color: currentColor;
    transition: left 0.3s ease, right 0.3s ease;
}

.desktop-nav .nav-link:hover::after,
.desktop-nav .nav-link.text-dark::after {
    left: 0.75rem;
    right: 0.75rem;
}

.desktop-nav .nav-link:hover {
    color: #212529 !important;
}

/* Footer link underline animation */
.link-light {
    position: relative;
    transition: color 0.3s ease;
    color: #e5e6e4 !important;
}

.link-light::after {
    content: '';
    position: absolute;
    bottom: -4px;
    left: 50%;
    right: 50%;
    height: 2px;
    background-color: #e5e6e4;
    transition: left 0.3s ease, right 0.3s ease, background-color 0.3s ease;
}

.link-light:hover {
    color: #ffffff !important;
}

.link-light:hover::after {
    left: 0;
    right: 0;
    background-color: #ffffff;
}

/* Footer text colors */
.site-footer {
    color: #e5e6e4;
}

.site-footer li,
.site-footer p {
    color: #e5e6e4;
}