/* ===== PREMIUM NAVBAR (Glassmorphism) ===== */
.custom-navbar {
    background-color: rgba(33, 37, 41, 0.85);
    /* Dark transparent */
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    transition: background-color 0.3s ease;
}

.navbar-brand {
    font-size: 1.25rem;
    letter-spacing: 0.5px;
}

/* Toggler: remove default ugly border */
.navbar-toggler {
    box-shadow: none !important;
    outline: none !important;
    background-color: transparent;
}

.navbar-toggler-icon {
    width: 24px;
    height: 24px;
}

/* ===== OFFCANVAS (Mobile Menu) ===== */
.custom-offcanvas {
    background-color: rgba(28, 30, 33, 0.95) !important;
    /* Solid-ish dark */
    color: #fff;
    /* FIX: Ensure offcanvas takes full height and uses flex layout */
    display: flex !important;
    flex-direction: column !important;
    height: 100vh !important;
    height: 100dvh !important;
    /* Dynamic viewport height for mobile browsers */
}

.offcanvas-header {
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

/* Fix for iOS Safari - ensure offcanvas body is scrollable and visible */
.offcanvas-body {
    overflow-y: auto !important;
    -webkit-overflow-scrolling: touch;
    padding-bottom: env(safe-area-inset-bottom, 20px);
    /* FIX: Ensure body takes full available height */
    flex: 1 1 auto !important;
    height: auto !important;
    min-height: 0 !important;
    /* Allow dropdown to overflow */
    overflow-x: visible !important;
}

/* Ensure dropdown menu parent doesn't clip */
.navbar-nav {
    overflow: visible !important;
}

/* Ensure offcanvas is above everything */
.offcanvas {
    z-index: 1055 !important;
}

.offcanvas-backdrop {
    z-index: 1050 !important;
}

/* Link Styles */
.navbar-nav .nav-link {
    color: rgba(255, 255, 255, 0.75) !important;
    transition: all 0.2s ease;
    font-weight: 500;
}

.navbar-nav .nav-link:hover {
    color: #fff !important;
    background-color: rgba(255, 255, 255, 0.1);
    border-radius: 6px;
}

/* Active State */
.navbar-nav .nav-link.active {
    color: #fff !important;
    font-weight: 700;
    background-color: rgba(13, 110, 253, 0.2);
    /* Blue tint */
    border-radius: 6px;
}

/* Dashboard submenu - Dropdown style */
.dashboard-menu {
    position: relative;
    z-index: 2001;
}

.dashboard-menu .dashboard-submenu {
    list-style: none;
    padding: 0;
    margin: 0;
    position: absolute;
    top: 100%;
    left: 0;
    background-color: rgba(28, 30, 33, 0.98);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
    padding: 8px 0;
    margin-top: 8px;
    min-width: 220px;
    z-index: 2002 !important;
    display: none;
    opacity: 0;
    transform: translateY(-10px);
    transition: opacity 0.2s ease, transform 0.2s ease;
}

.dashboard-menu:hover .dashboard-submenu {
    /* Position will be set by JavaScript */
    opacity: 1;
    transform: translateY(0);
}

.dashboard-menu .dashboard-submenu li {
    margin: 0;
}

.dashboard-menu .dashboard-submenu .nav-link {
    color: rgba(255, 255, 255, 0.85);
    padding: 10px 20px;
    font-size: 0.95rem;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    border-radius: 0;
    margin: 0;
}

.dashboard-menu .dashboard-submenu .nav-link:hover {
    background-color: rgba(255, 255, 255, 0.1);
    color: #fff;
}

.dashboard-menu .dashboard-submenu .nav-link.active {
    background-color: rgba(13, 110, 253, 0.2);
    color: #fff;
    font-weight: 600;
}

.dashboard-menu .dashboard-submenu .nav-link i {
    width: 20px;
    text-align: center;
}

/* Mobile: always show submenu as list */
@media (max-width: 991.98px) {
    .dashboard-menu .dashboard-submenu {
        position: static !important;
        display: block !important;
        opacity: 1 !important;
        transform: none !important;
        box-shadow: none;
        border: none;
        background-color: transparent;
        padding-left: 20px;
        margin-top: 0;
        min-width: auto;
    }
    
    .dashboard-menu .dashboard-submenu .nav-link {
        padding: 8px 15px;
        font-size: 0.9rem;
        color: rgba(255, 255, 255, 0.7);
    }
    
    .dashboard-menu .dashboard-submenu .nav-link::before {
        content: "• ";
        margin-right: 8px;
        color: rgba(255, 255, 255, 0.5);
    }
    
    .dashboard-menu .nav-link .fa-chevron-down {
        display: none;
    }
}

/* User Info in Navbar (Desktop) */
.navbar-text {
    color: rgba(255, 255, 255, 0.8);
    font-size: 0.9rem;
}

/* ===== MOBILE SPECIFIC (< 992px) ===== */
@media (max-width: 991.98px) {

    /* Increase touch targets significantly */
    .navbar-nav .nav-item {
        margin-bottom: 5px;
    }

    .navbar-nav .nav-link {
        font-size: 1.1rem !important;
        /* Text bigger */
        padding: 12px 15px !important;
        /* Fat fingers friendly */
        display: flex;
        align-items: center;
        border-radius: 8px;
        /* Softer look */
    }

    .navbar-nav .nav-link i {
        font-size: 1.3rem;
        /* Icons bigger */
        width: 30px;
        /* Fixed width for icons alignment */
        text-align: center;
        margin-right: 10px !important;
    }

    /* Active Indicator for Mobile */
    .navbar-nav .nav-link.active {
        background-color: rgba(13, 110, 253, 0.15);
        color: #4da3ff !important;
        /* Brighter blue */
        border: 1px solid rgba(13, 110, 253, 0.3);
    }

    .border-top {
        border-color: rgba(255, 255, 255, 0.15) !important;
    }

    /* Logout Button */
    .nav-link.text-danger {
        margin-top: 10px;
        background-color: rgba(220, 53, 69, 0.1);
        color: #ff6b6b !important;
        justify-content: center;
    }
}

/* Scroll padding to prevent anchor jumps being hidden */
body {
    scroll-padding-top: 70px;
}