/* Professional Navigation Styles */

/* Dropdown icon styles */
.has-dropdown-icon .dropdown-icon {
    margin-left: 5px;
    font-size: 0.8em;
    transition: transform 0.3s ease;
}

.has-dropdown-icon.show .dropdown-icon {
    transform: rotate(180deg);
}

/* Active nav item styling */
.nav-item.active > .nav-link,
.nav-item.dropdown.active > .nav-link {
    background-color: rgba(37, 99, 235, 0.1);
    color: #2563eb;
    font-weight: 600;
    border-radius: 8px;
}

.nav-item.active > .nav-link:hover,
.nav-item.dropdown.active > .nav-link:hover {
    background-color: rgba(37, 99, 235, 0.2);
}

/* User dropdown styles */
.user-dropdown .dropdown-toggle {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 16px;
}

.user-dropdown .dropdown-menu {
    min-width: 250px;
    border-radius: 12px;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.15);
    border: none;
    margin-top: 10px;
    z-index: 1050; /* Ensure it's above navbar */
}

.user-dropdown .dropdown-header {
    padding: 15px 20px 10px;
    background-color: #f8f9fa;
    border-bottom: 1px solid #e9ecef;
}

.user-info-dropdown {
    display: flex;
    flex-direction: column;
}

.user-name-dropdown {
    font-weight: 600;
    color: #212529;
    font-size: 1.1rem;
}

.user-role-dropdown {
    font-size: 0.85rem;
    color: #6c757d;
    margin-top: 3px;
}

.user-dropdown .dropdown-item {
    padding: 10px 20px;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
}

.user-dropdown .dropdown-item:hover {
    background-color: rgba(37, 99, 235, 0.1);
    color: #2563eb;
    transform: translateX(3px);
}

.user-dropdown .dropdown-item i {
    width: 20px;
    text-align: center;
}

/* Desktop styles */
@media (min-width: 992px) {
    .navbar-nav .dropdown-menu {
        margin-top: 0;
        border-radius: 8px;
        box-shadow: 0 10px 25px rgba(0, 0, 0, 0.15);
        border: none;
        min-width: 200px;
        padding: 0.5rem 0;
        font-family: 'Inter', sans-serif;
        z-index: 1050;
    }
    
    .dropdown:hover .dropdown-menu {
        display: block;
        opacity: 1;
        visibility: visible;
        transform: translateY(0);
    }
    
    .navbar-nav .dropdown-menu.show {
        display: block;
        opacity: 1;
        visibility: visible;
        transform: translateY(0);
    }
    
    /* Improve navbar link styling */
    .navbar-nav .nav-link {
        position: relative;
        margin: 0 5px;
        border-radius: 8px;
        transition: all 0.3s ease;
        font-family: 'Inter', sans-serif;
        font-weight: 500;
    }
    
    .navbar-nav .nav-link:hover {
        background-color: rgba(37, 99, 235, 0.1);
        color: #2563eb;
    }
    
    .navbar-nav .nav-link.dropdown-toggle::after {
        border-top-color: #6c757d;
        transition: border-color 0.3s ease;
    }
    
    .navbar-nav .nav-link.dropdown-toggle:hover::after {
        border-top-color: #2563eb;
    }
    
    /* Dropdown item styling */
    .dropdown-item {
        padding: 10px 20px;
        transition: all 0.2s ease;
        font-family: 'Inter', sans-serif;
        font-weight: 400;
        color: #495057;
    }
    
    .dropdown-item:hover {
        background-color: rgba(37, 99, 235, 0.1);
        color: #2563eb;
        transform: translateX(5px);
    }
    
    .dropdown-item:focus {
        background-color: rgba(37, 99, 235, 0.1);
        color: #2563eb;
        outline: none;
    }
}

/* Mobile-specific dropdown fixes */
@media (max-width: 991.98px) {
    .dropdown-menu {
        opacity: 0;
        visibility: hidden;
        transform: none;
        box-shadow: none;
        margin-top: 0;
        border-radius: 0;
        position: static;
        float: none;
        background-color: #f8f9fa;
        transition: opacity 0.3s ease, visibility 0.3s ease, max-height 0.3s ease;
        display: block;
        margin-left: 0;
        margin-right: 0;
        margin-bottom: 0;
        border: none;
        padding: 0;
        max-height: 0;
        overflow: hidden;
        font-family: 'Inter', sans-serif;
        z-index: 1050;
    }

    /* When opened, make visible and accessible in layout */
    .dropdown.show > .dropdown-menu,
    .dropdown-menu.show {
        opacity: 1;
        visibility: visible;
        max-height: 500px; /* Allow content to expand */
        padding: 0.5rem 0;
    }

    .dropdown-item {
        padding: 12px 20px;
        border-radius: 0;
        margin: 0;
        transform: none;
        border-bottom: 1px solid #e9ecef;
        font-family: 'Inter', sans-serif;
        font-weight: 400;
        color: #495057;
        transition: all 0.2s ease;
    }
    
    .dropdown-item:hover,
    .dropdown-item:focus {
        background-color: rgba(37, 99, 235, 0.1);
        color: #2563eb;
        outline: none;
    }

    .dropdown-item:last-child {
        border-bottom: none;
    }

    /* Make sure parent dropdown occupies width & flows */
    .nav-item.dropdown {
        width: 100%;
    }

    /* keep collapsed navbar styling */
    .navbar-collapse {
        position: absolute;
        top: 100%;
        left: 0;
        right: 0;
        background: white;
        box-shadow: 0 10px 20px rgba(0,0,0,0.1);
        z-index: 1040;
        max-height: calc(100vh - 70px);
        overflow-y: auto;
        padding: 1rem 0;
    }
    
    /* Ensure navbar toggler works properly */
    .navbar-toggler {
        border: none;
        outline: none;
    }
    
    .navbar-toggler:focus {
        box-shadow: none;
    }
    
    /* Mobile dropdown toggle improvement */
    .nav-link.dropdown-toggle {
        display: flex;
        justify-content: space-between;
        align-items: center;
    }
    
    .nav-link.dropdown-toggle::after {
        transition: transform 0.3s ease;
    }
    
    .nav-link.dropdown-toggle[aria-expanded="true"]::after {
        transform: rotate(180deg);
    }
    
    /* Mobile auth buttons */
    .auth-container {
        padding: 1rem 0;
        border-top: 1px solid #e9ecef;
        margin-top: 1rem;
        width: 100%;
    }
    
    .auth-buttons {
        width: 100%;
        display: flex;
        flex-direction: column;
        gap: 0.5rem;
        padding: 0 1rem;
    }
    
    .auth-buttons .btn {
        width: 100%;
        margin: 0;
    }
    
    /* Mobile user dropdown */
    .user-dropdown {
        width: 100%;
        padding: 1rem 0;
        border-top: 1px solid #e9ecef;
        margin-top: 1rem;
        padding: 0 1rem;
        position: relative;
        z-index: 1050;
    }
    
    .user-dropdown .dropdown-toggle {
        width: 100%;
        justify-content: center;
    }
    
    .user-dropdown .dropdown-menu {
        position: absolute;
        width: calc(100% - 2rem);
        left: 1rem;
        right: 1rem;
        margin-top: 10px;
        z-index: 1050;
    }
}

/* General navbar styles */
.navbar {
    padding: 1rem 0;
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    z-index: 1030;
}

.navbar-brand {
    font-weight: 700;
    background: linear-gradient(90deg, #2563eb, #7c3aed, #f59e0b);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.navbar-nav .nav-link {
    font-weight: 500;
    padding: 0.5rem 1rem;
    color: #333;
    transition: color 0.3s ease;
    border-radius: 8px;
    font-family: 'Inter', sans-serif;
}

.navbar-nav .nav-link:hover {
    color: #2563eb;
    background-color: rgba(37, 99, 235, 0.05);
}

/* Auth buttons */
.auth-buttons .btn {
    border-radius: 8px;
    font-weight: 600;
    padding: 8px 20px;
}

.btn-outline-primary {
    border-width: 2px;
}

.btn-primary {
    background: linear-gradient(135deg, #2563eb, #7c3aed);
    border: none;
}

.btn-primary:hover {
    background: linear-gradient(135deg, #1d4ed8, #6d28d9);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(37, 99, 235, 0.25);
}

/* Responsive adjustments */
@media (max-width: 767px) {
    .navbar {
        padding: 0.75rem 0;
    }
    
    .navbar-brand {
        font-size: 1.5rem;
    }
    
    /* Ensure all navbar items are visible on mobile */
    .navbar-nav {
        width: 100%;
        padding: 0 1rem;
    }
    
    .nav-item {
        width: 100%;
        margin-bottom: 0;
    }
    
    .nav-link {
        padding: 0.75rem 1rem;
        border-radius: 0;
        margin: 0;
        border-bottom: 1px solid #e9ecef;
    }
    
    /* Remove border from last item */
    .nav-item:last-child .nav-link {
        border-bottom: none;
    }
    
    /* Mobile dropdown items */
    .dropdown-menu {
        margin: 0;
        border-radius: 0;
        background-color: #f1f5f9;
    }
    
    /* Remove extra padding from navbar-collapse */
    .navbar-collapse {
        padding: 0;
    }
    
    /* Auth container in mobile */
    .auth-container {
        padding: 1rem 1rem 0.5rem;
        border-top: 1px solid #e9ecef;
        margin-top: 0.5rem;
    }
    
    /* When there are no auth buttons, remove extra space */
    .auth-container:empty {
        display: none;
    }
    
    /* Active item styling on mobile */
    .nav-item.active > .nav-link,
    .nav-item.dropdown.active > .nav-link {
        background-color: rgba(37, 99, 235, 0.1);
        color: #2563eb;
        font-weight: 600;
        border-left: 3px solid #2563eb;
    }
}