/* Modern Navbar Styling with Glassmorphism */

:root {
    --sidebar-width: 280px;
    --primary-dark: #1E3A5F;
    --primary-medium: #2B5A8E;
    --accent-blue: #3D7CC9;
    --light-blue: #7CA3D4;
    --light-blue-soft: #BAD4EC;
    --sidebar-radius: 16px;
}

/* Modern Mobile Header */
.mobile-header {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 1040;
    background: linear-gradient(135deg, #1A3254 0%, #264B73 100%);
    border-bottom: 1px solid rgba(61, 124, 201, 0.3);
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.2);
}

.mobile-header-content {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.75rem 1rem;
    max-width: 100%;
}

.mobile-brand {
    font-size: 1.25rem;
    font-weight: 700;
    color: white;
    margin: 0;
    letter-spacing: 0.5px;
    background: linear-gradient(135deg, white, var(--light-blue-soft));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.btn-menu-toggle {
    background: transparent;
    border: none;
    padding: 0.5rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    border-radius: 8px;
    transition: background 0.2s ease;
}

.btn-menu-toggle:hover {
    background: rgba(255, 255, 255, 0.1);
}

.btn-menu-toggle:active {
    background: rgba(255, 255, 255, 0.2);
}

.menu-icon {
    width: 24px;
    height: 18px;
    position: relative;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}

.menu-icon span {
    display: block;
    height: 2px;
    width: 100%;
    background: white;
    border-radius: 2px;
    transition: background 0.2s ease;
}

.btn-menu-toggle:hover .menu-icon span {
    background: var(--light-blue-soft);
}

/* Adjust body padding when mobile header is present */
@media (max-width: 991.98px) {
    body {
        padding-top: 70px !important;
    }

    /* Ensure container doesn't overlap with header */
    .container-fluid {
        padding-top: 0.5rem;
    }

    /* Better mobile spacing */
    .main-content {
        padding: 0.5rem;
    }
}

/* Sidebar Styles */
.sidebar {
    position: fixed;
    top: 0;
    left: 0;
    height: 100vh;
    width: var(--sidebar-width);
    background: linear-gradient(180deg, #1A3254 0%, #264B73 50%, #2B5A8E 100%);
    color: white;
    z-index: 1000;
    border-right: 1px solid rgba(61, 124, 201, 0.3);
    box-shadow: 4px 0 20px rgba(0, 0, 0, 0.25);
    overflow: hidden;
}

.sidebar::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: 
        repeating-linear-gradient(
            0deg,
            rgba(255, 255, 255, 0.03) 0px,
            transparent 1px,
            transparent 2px,
            rgba(255, 255, 255, 0.03) 3px
        );
    pointer-events: none;
    z-index: 1;
}

.sidebar > * {
    position: relative;
    z-index: 2;
}

/* Sidebar Header */
.sidebar-header {
    padding: 1.5rem 1.25rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: rgba(0, 0, 0, 0.15);
    backdrop-filter: blur(10px);
    position: relative;
}

.sidebar-brand {
    color: white;
    text-decoration: none;
    font-size: 1.5rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    letter-spacing: 0.5px;
    white-space: nowrap;
    transition: color 0.2s ease;
}

.sidebar-brand .brand-text {
    display: inline-block;
}

.sidebar-brand:hover {
    color: var(--light-blue-soft);
    text-decoration: none;
}

/* Sidebar Navigation */
.sidebar-nav {
    padding: 1rem 0;
    overflow-y: auto;
    overflow-x: hidden;
    flex-grow: 1;
}

.sidebar-nav::-webkit-scrollbar {
    width: 6px;
}

.sidebar-nav::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.05);
}

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

.sidebar-nav::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.3);
}

/* Sidebar Links */
.sidebar-link {
    display: flex;
    align-items: center;
    padding: 0.875rem 1.25rem;
    color: rgba(255, 255, 255, 0.9);
    text-decoration: none;
    border: 2px solid transparent;
    position: relative;
    overflow: hidden;
    white-space: nowrap;
    margin: 0.35rem 0.75rem;
    border-radius: 10px;
    font-weight: 500;
    transition: all 0.2s ease;
}

.sidebar-link i {
    font-size: 1.2rem;
    margin-right: 1rem;
    flex-shrink: 0;
    transition: color 0.2s ease;
}

.sidebar-link .link-text {
    flex-grow: 1;
}

.sidebar-link:hover {
    background: rgba(255, 255, 255, 0.12);
    color: white;
    text-decoration: none;
    border-color: rgba(186, 212, 236, 0.3);
}

.sidebar-link:hover i {
    color: var(--light-blue-soft);
}

.sidebar-link.active {
    background: linear-gradient(135deg, rgba(43, 90, 142, 0.7) 0%, rgba(61, 124, 201, 0.6) 100%);
    color: white;
    border-color: rgba(61, 124, 201, 0.5);
    box-shadow: 0 2px 8px rgba(43, 90, 142, 0.3);
    font-weight: 600;
}

.sidebar-link.active i {
    color: white;
}

/* Sidebar Category */
.sidebar-category {
    display: flex;
    align-items: center;
    padding: 0.875rem 1.25rem;
    color: var(--light-blue-soft);
    font-weight: 700;
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 1.2px;
    margin: 1rem 0.75rem 0.5rem 0.75rem;
    white-space: nowrap;
    overflow: hidden;
    border-bottom: 2px solid rgba(186, 212, 236, 0.2);
    padding-bottom: 0.5rem;
}

/* Sidebar Sublinks */
.sidebar-sublink {
    display: flex;
    align-items: center;
    padding: 0.75rem 1.25rem 0.75rem 2rem;
    color: rgba(255, 255, 255, 0.8);
    text-decoration: none;
    font-size: 0.9rem;
    border: 2px solid transparent;
    position: relative;
    overflow: hidden;
    white-space: nowrap;
    margin: 0.25rem 0.75rem;
    border-radius: 8px;
    font-weight: 500;
    transition: all 0.2s ease;
}

.sidebar-sublink i {
    font-size: 1rem;
    margin-right: 0.875rem;
    flex-shrink: 0;
    transition: color 0.2s ease;
}

.sidebar-sublink:hover {
    background: rgba(255, 255, 255, 0.1);
    color: white;
    text-decoration: none;
    border-color: rgba(124, 163, 212, 0.3);
}

.sidebar-sublink:hover i {
    color: var(--light-blue);
}

.sidebar-sublink.active {
    background: linear-gradient(135deg, rgba(43, 90, 142, 0.5) 0%, rgba(61, 124, 201, 0.4) 100%);
    color: white;
    border-color: rgba(61, 124, 201, 0.4);
    font-weight: 600;
}

/* Admin Link Styling */
.sidebar-admin {
    background: rgba(220, 53, 69, 0.15);
    border-color: rgba(220, 53, 69, 0.3);
}

.sidebar-admin:hover {
    background: rgba(220, 53, 69, 0.25);
    border-color: rgba(255, 77, 90, 0.5);
}

.sidebar-admin.active {
    background: linear-gradient(135deg, #dc3545 0%, #ff6b7a 100%);
    border-color: #ff8894;
    box-shadow: 0 4px 16px rgba(220, 53, 69, 0.5);
}

/* Sidebar Divider */
.sidebar-divider {
    border: 0;
    height: 1px;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.1), transparent);
    margin: 0.75rem 1rem;
}

/* Sidebar Footer */
.sidebar-footer {
    padding: 1rem;
    border-top: 1px solid rgba(255, 255, 255, 0.08);
    background: rgba(0, 0, 0, 0.2);
    backdrop-filter: blur(10px);
}

.sidebar-footer .navbar-nav {
    margin: 0;
    padding: 0;
}

.sidebar-footer .nav-item {
    margin: 0;
    list-style: none;
}

.sidebar-footer-link {
    display: flex;
    align-items: center;
    color: rgba(255, 255, 255, 0.9);
    padding: 0.75rem 0.75rem;
    border-radius: 8px;
    text-decoration: none;
    border: 2px solid transparent;
    font-weight: 500;
    transition: all 0.2s ease;
}

.sidebar-footer-link i {
    font-size: 1.1rem;
    margin-right: 0.75rem;
    flex-shrink: 0;
    transition: color 0.2s ease;
}

.sidebar-footer-link:hover {
    color: white;
    background: rgba(255, 255, 255, 0.12);
    border-color: rgba(186, 212, 236, 0.3);
    text-decoration: none;
}

.sidebar-footer-link:hover i {
    color: var(--light-blue-soft);
}

.sidebar-footer-link.active {
    background: linear-gradient(135deg, rgba(43, 90, 142, 0.7) 0%, rgba(61, 124, 201, 0.6) 100%);
    color: white;
    border-color: rgba(61, 124, 201, 0.5);
    box-shadow: 0 2px 8px rgba(43, 90, 142, 0.3);
    font-weight: 600;
}

.sidebar-footer-link.active i {
    color: white;
}

.sidebar-footer .nav-link {
    color: rgba(255, 255, 255, 0.85);
    padding: 0.5rem 0.5rem;
    border-radius: 8px;
    transition: all 0.2s ease;
}

.sidebar-footer .nav-link:hover {
    color: white;
    background: rgba(255, 255, 255, 0.1);
}

/* Main content area adjustments */
.main-content {
    margin-left: var(--sidebar-width);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* Mobile adjustments */
@media (max-width: 991.98px) {
    .main-content {
        margin-left: 0;
    }
}

/* Offcanvas customizations */
.offcanvas-start {
    width: 85vw;
    max-width: 320px;
    background: linear-gradient(180deg, #1A3254 0%, #264B73 50%, #2B5A8E 100%);
    border-right: none;
    display: flex;
    flex-direction: column;
}

/* On very small screens, use more width */
@media (max-width: 375px) {
    .offcanvas-start {
        width: 90vw;
    }
}

/* On larger tablets, use sidebar width */
@media (min-width: 576px) and (max-width: 991.98px) {
    .offcanvas-start {
        width: var(--sidebar-width);
        max-width: var(--sidebar-width);
        border-right: 1px solid rgba(61, 124, 201, 0.3);
    }
}

.offcanvas-start::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: 
        repeating-linear-gradient(
            0deg,
            rgba(255, 255, 255, 0.03) 0px,
            transparent 1px,
            transparent 2px,
            rgba(255, 255, 255, 0.03) 3px
        );
    pointer-events: none;
    z-index: 1;
}

.offcanvas-start > * {
    position: relative;
    z-index: 2;
}

.offcanvas-start .offcanvas-body {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.offcanvas-header {
    background: rgba(0, 0, 0, 0.15);
    backdrop-filter: blur(10px);
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    padding: 1.5rem 1.25rem;
    flex-shrink: 0;
}

.offcanvas-title {
    color: white;
    font-weight: 700;
    font-size: 1.35rem;
}

.offcanvas-title i {
    color: var(--light-blue-soft);
}

.offcanvas .btn-close {
    filter: invert(1) brightness(2);
    opacity: 0.8;
    transition: opacity 0.2s ease;
}

.offcanvas .btn-close:hover {
    opacity: 1;
}

.offcanvas .sidebar-nav {
    padding: 1rem 0;
    overflow-y: auto;
}

.offcanvas .sidebar-nav::-webkit-scrollbar {
    width: 6px;
}

.offcanvas .sidebar-nav::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.05);
}

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

.offcanvas .sidebar-link {
    color: rgba(255, 255, 255, 0.9);
    margin: 0.35rem 0.75rem;
    border: 2px solid transparent;
}

.offcanvas .sidebar-link:hover {
    background: rgba(255, 255, 255, 0.12);
    color: white;
    border-color: rgba(186, 212, 236, 0.3);
}

.offcanvas .sidebar-link.active {
    background: linear-gradient(135deg, rgba(43, 90, 142, 0.7) 0%, rgba(61, 124, 201, 0.6) 100%);
    color: white;
    border-color: rgba(61, 124, 201, 0.5);
}

.offcanvas .sidebar-divider {
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.1), transparent);
}

.offcanvas .sidebar-admin {
    background: rgba(220, 53, 69, 0.15);
    border-color: rgba(220, 53, 69, 0.3);
}

.offcanvas .sidebar-admin:hover {
    background: rgba(220, 53, 69, 0.25);
    border-color: rgba(255, 77, 90, 0.5);
}

.offcanvas .sidebar-admin.active {
    background: linear-gradient(135deg, #dc3545 0%, #ff6b7a 100%);
    border-color: #ff8894;
}

.offcanvas .sidebar-sublink {
    color: rgba(255, 255, 255, 0.8);
    border: 2px solid transparent;
}

.offcanvas .sidebar-sublink:hover {
    color: white;
    background: rgba(255, 255, 255, 0.1);
    border-color: rgba(124, 163, 212, 0.3);
}

.offcanvas .sidebar-sublink.active {
    background: linear-gradient(135deg, rgba(43, 90, 142, 0.5) 0%, rgba(61, 124, 201, 0.4) 100%);
    color: white;
    border-color: rgba(61, 124, 201, 0.4);
}

.offcanvas .sidebar-category {
    color: var(--light-blue-soft);
    border-bottom: 2px solid rgba(186, 212, 236, 0.2);
}

.offcanvas .sidebar-footer {
    background: rgba(0, 0, 0, 0.2);
    border-top: 1px solid rgba(255, 255, 255, 0.08);
    padding: 1rem;
}

.offcanvas .sidebar-footer-link {
    color: rgba(255, 255, 255, 0.9);
}

.offcanvas .sidebar-footer-link:hover {
    color: white;
    background: rgba(255, 255, 255, 0.12);
    border-color: rgba(186, 212, 236, 0.3);
}

.offcanvas .sidebar-footer-link.active {
    background: linear-gradient(135deg, rgba(43, 90, 142, 0.7) 0%, rgba(61, 124, 201, 0.6) 100%);
    color: white;
    border-color: rgba(61, 124, 201, 0.5);
}

.offcanvas .sidebar-footer .nav-link {
    color: rgba(255, 255, 255, 0.85);
}

.offcanvas .sidebar-footer .navbar-nav {
    margin: 0;
    padding: 0;
}

.offcanvas .sidebar-footer .nav-item {
    margin: 0;
}

/* Footer adjustments */
.footer {
    margin-top: auto;
    padding: 1.25rem 0;
    background: rgba(248, 249, 250, 0.5);
    backdrop-filter: blur(10px);
}

/* Ensure proper scrolling */
body {
    overflow-x: hidden;
}

/* Mobile-specific improvements */
@media (max-width: 991.98px) {
    /* Better touch targets for mobile */
    .offcanvas .sidebar-link,
    .offcanvas .sidebar-sublink {
        min-height: 48px;
        padding: 1rem 1.25rem;
    }

    .offcanvas .sidebar-sublink {
        padding: 1rem 1.25rem 1rem 2.5rem;
    }

    /* Better spacing for mobile offcanvas */
    .offcanvas .sidebar-link {
        margin: 0.25rem 1rem;
    }

    .offcanvas .sidebar-sublink {
        margin: 0.15rem 1rem;
    }

    /* Larger icons for better visibility on mobile */
    .offcanvas .sidebar-link i,
    .offcanvas .sidebar-sublink i {
        font-size: 1.3rem;
    }

    /* Better footer link touch targets */
    .offcanvas .sidebar-footer-link {
        min-height: 48px;
        padding: 1rem;
    }

    /* Improve mobile header readability */
    .mobile-brand {
        font-size: 1.4rem;
    }

    /* Better offcanvas header */
    .offcanvas-header {
        padding: 1.25rem 1.5rem;
    }

    .offcanvas-title {
        font-size: 1.5rem;
    }
}

/* Extra mobile improvements for small screens */
@media (max-width: 575.98px) {
    /* Even better touch targets on small screens */
    .offcanvas .sidebar-link,
    .offcanvas .sidebar-sublink,
    .offcanvas .sidebar-footer-link {
        font-size: 1rem;
    }

    /* Reduce padding on very small screens to fit more content */
    .main-content {
        padding: 0.25rem;
    }

    .container-fluid {
        padding-left: 0.5rem;
        padding-right: 0.5rem;
    }
}

/* Print styles */
@media print {
    .sidebar,
    .offcanvas,
    .mobile-menu-bar,
    .btn-toggle-sidebar {
        display: none !important;
    }

    .main-content {
        margin-left: 0 !important;
    }
}
