/**
 * Header and Mobile Menu Styles - UNIFIED VERSION
 * This file contains ALL header and mobile menu styles
 * to ensure consistency across all pages
 * Last Updated: December 12, 2025
 */

/* ========================================
   HEADER BASE STYLES
======================================== */

.main-header {
    position: sticky;
    top: 0;
    z-index: 9999 !important;
    /* Higher z-index to stay above everything */
    background: #ffffff;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
    overflow: visible !important;
    width: 100%;
}

.navbar {
    padding: 0.75rem 0;
    /* Reduced vertical padding for more compact header */
    background: #ffffff !important;
    overflow: visible !important;
    z-index: 9999 !important;
}

.navbar-brand {
    font-size: 1.5rem;
    font-weight: 800;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    transition: none !important;
    /* Prevent layout shift on hover */
}

.brand-name {
    font-size: 1.5rem;
    font-weight: 800;
    background: linear-gradient(135deg, #0A47A3, #1E90FF);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    transition: none !important;
    /* Prevent layout shift */
}

.logo-img {
    height: 55px;
    width: auto;
    object-fit: contain;
}

/* ========================================
   DESKTOP NAVIGATION (992px+)
======================================== */

@media (min-width: 992px) {
    .navbar {
        padding: 1rem 0;
    }

    .navbar-brand {
        font-size: 1.5rem;
    }

    .brand-name {
        font-size: 1.5rem;
    }

    .logo-img {
        height: 55px;
    }

    /* Prevent wrapping on medium desktops */
    @media (max-width: 1200px) {
        .nav-link {
            font-size: 0.9rem !important;
            padding: 0.5rem 0.5rem !important;
            margin: 0 0.1rem;
        }

        .brand-name {
            font-size: 1.25rem !important;
        }
    }

    .nav-link {
        color: #1e293b !important;
        font-weight: 600;
        font-size: 1rem;
        padding: 0.5rem 0.75rem !important;
        /* Slightly reduced padding */
        margin: 0 0.15rem;
        /* Slightly reduced margin */
        border-radius: 8px;
        transition: all 0.3s ease;
        white-space: nowrap !important;
        /* Prevent text wrapping */
    }

    .nav-link:hover {
        color: #0A47A3 !important;
        background-color: rgba(0, 174, 239, 0.1);
        /* Removed transform to prevent layout shift */
    }

    .nav-link.active {
        color: #ffffff !important;
        background: linear-gradient(135deg, #0A47A3, #1E90FF);
        /* Removed box-shadow to prevent potential layout shift */
    }

    .nav-link i {
        font-size: 1rem;
        margin-right: 0.5rem;
        vertical-align: middle;
    }

    /* Ensure single line on desktop */
    .navbar-nav {
        flex-wrap: nowrap !important;
    }

    /* Desktop dropdown (User Profile) */
    .dropdown-menu {
        border: 1px solid rgba(0, 0, 0, 0.08);
        box-shadow: 0 15px 35px rgba(0, 0, 0, 0.2);
        border-radius: 12px;
        z-index: 10000 !important;
        position: absolute !important;
        background: #ffffff !important;
        top: 105% !important;
        right: 0 !important;
        left: auto !important;
        margin-top: 5px;
        border: none !important;
        min-width: 220px;
        overflow: hidden;
        animation: dropdownFadeIn 0.3s ease;
    }

    @keyframes dropdownFadeIn {
        from {
            opacity: 0;
            transform: translateY(10px);
        }

        to {
            opacity: 1;
            transform: translateY(0);
        }
    }

    .dropdown-item {
        padding: 0.75rem 1.5rem;
        transition: all 0.3s ease;
        display: flex;
        align-items: center;
        gap: 0.75rem;
        color: #475569 !important;
        font-weight: 500;
    }

    .dropdown-item i {
        font-size: 1.1rem;
        width: 20px;
        text-align: center;
        color: #0A47A3;
    }

    .dropdown-item:hover {
        background-color: rgba(0, 174, 239, 0.08);
        color: #0A47A3 !important;
        padding-left: 1.75rem;
    }

    .dropdown-item.text-danger:hover {
        background-color: rgba(239, 68, 68, 0.08);
        color: #dc2626 !important;
    }

    .dropdown-divider {
        margin: 0.5rem 0;
        border-top: 1px solid rgba(0, 0, 0, 0.05);
    }
}

/* Ensure parents don't clip dropdown */
.nav-item.dropdown {
    position: relative !important;
}

/* ========================================
   MOBILE NAVIGATION (max-width: 991px)
======================================== */

@media (max-width: 991px) {

    /* Header adjustments */
    .main-header .navbar {
        padding: 0.75rem 0 !important;
    }

    .navbar-brand {
        font-size: 1.125rem !important;
    }

    .brand-name {
        font-size: 1.125rem !important;
    }

    .logo-img {
        height: 38px !important;
    }

    /* HAMBURGER MENU BUTTON */
    .navbar-toggler {
        margin-right: 0.75rem !important;
        padding: 0.5rem !important;
        border: 2px solid rgba(0, 174, 239, 0.3) !important;
        border-radius: 8px !important;
        transition: all 0.3s ease;
        position: relative;
        z-index: 10000 !important;
        background: #ffffff;
    }

    .navbar-toggler:hover {
        border-color: #0A47A3 !important;
        background-color: rgba(0, 174, 239, 0.1) !important;
    }

    .navbar-toggler:focus {
        box-shadow: 0 0 0 0.2rem rgba(0, 174, 239, 0.25) !important;
        outline: none !important;
    }

    .navbar-toggler-icon {
        width: 24px !important;
        height: 24px !important;
        background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 30 30'%3e%3cpath stroke='rgba(10, 71, 163, 1)' stroke-linecap='round' stroke-miterlimit='10' stroke-width='2' d='M4 7h22M4 15h22M4 23h22'/%3e%3c/svg%3e") !important;
    }

    /* MOBILE SLIDE-OUT MENU */
    .navbar-collapse {
        position: fixed !important;
        top: 0 !important;
        right: -100% !important;
        width: 280px !important;
        height: 100vh !important;
        background: #ffffff !important;
        padding: 1.5rem 1rem !important;
        box-shadow: -4px 0 30px rgba(0, 0, 0, 0.2) !important;
        border-left: 2px solid rgba(0, 174, 239, 0.2) !important;
        z-index: 10000 !important;
        /* Above header */
        transition: right 0.4s cubic-bezier(0.4, 0, 0.2, 1) !important;
        overflow-y: auto !important;
        overflow-x: hidden !important;
    }

    /* When menu is open */
    .navbar-collapse.show,
    .navbar-collapse.collapsing {
        right: 0 !important;
    }

    /* MOBILE MENU ITEMS */
    .navbar-collapse .navbar-nav {
        margin-top: 3rem;
    }

    .nav-item {
        border-bottom: 1px solid rgba(0, 174, 239, 0.15) !important;
        margin: 0 !important;
    }

    .nav-item:last-child {
        border-bottom: none !important;
    }

    .nav-link {
        color: #1e293b !important;
        font-weight: 600 !important;
        font-size: 1rem !important;
        padding: 0.75rem 1rem !important;
        margin: 0 !important;
        border-radius: 0 !important;
        transition: all 0.3s ease;
        display: flex !important;
        align-items: center !important;
    }

    /* MOBILE USER DROPDOWN */
    .nav-item.dropdown {
        border-bottom: 1px solid rgba(0, 174, 239, 0.15) !important;
    }

    .dropdown-toggle {
        color: #1e293b !important;
        font-weight: 600 !important;
        font-size: 1rem !important;
        padding: 0.75rem 1rem !important;
        margin: 0 !important;
        border-radius: 0 !important;
        transition: all 0.3s ease;
        display: flex !important;
        align-items: center !important;
        justify-content: space-between !important;
        width: 100% !important;
    }

    .dropdown-toggle::after {
        margin-left: auto !important;
    }

    .dropdown-menu {
        background: #ffffff !important;
        border: none !important;
        border-radius: 12px !important;
        box-shadow: 0 10px 25px rgba(0, 0, 0, 0.15) !important;
        position: absolute !important;
        top: 100% !important;
        right: 10px !important;
        left: auto !important;
        width: 240px !important;
        z-index: 10001 !important;
        margin-top: 5px !important;
        padding: 0.5rem 0 !important;
        display: none;
        /* Controlled by .show class */
    }

    .dropdown-menu.show {
        display: block !important;
    }

    .dropdown-item {
        color: #475569 !important;
        padding: 0.875rem 1.5rem !important;
        font-weight: 500 !important;
        border-bottom: 1px solid rgba(0, 0, 0, 0.05) !important;
        display: flex !important;
        align-items: center !important;
        gap: 0.75rem !important;
        transition: all 0.2s ease !important;
    }

    .dropdown-item i {
        color: #0A47A3 !important;
        font-size: 1.1rem !important;
        width: 20px !important;
        text-align: center !important;
    }

    .dropdown-item:last-child {
        border-bottom: none !important;
    }

    .dropdown-item:active,
    .dropdown-item:hover {
        background-color: rgba(0, 174, 239, 0.08) !important;
        color: #0A47A3 !important;
    }

    .dropdown-item.text-danger:active,
    .dropdown-item.text-danger:hover {
        background-color: rgba(239, 68, 68, 0.08) !important;
        color: #dc2626 !important;
    }

    .dropdown-divider {
        margin: 0 !important;
        border-top: 1px solid rgba(0, 0, 0, 0.05) !important;
    }
}

/* ========================================
   TABLET ADJUSTMENTS (768px - 991px)
======================================== */

@media (min-width: 768px) and (max-width: 991px) {
    .navbar-collapse {
        width: 320px !important;
    }

    .navbar-toggler {
        margin-right: 1rem !important;
    }
}

/* ========================================
   SMALL MOBILE (max-width: 374px)
======================================== */

@media (max-width: 374px) {
    .navbar-collapse {
        width: 90% !important;
        max-width: 280px !important;
    }

    .navbar-toggler {
        margin-right: 0.5rem !important;
        padding: 0.4rem !important;
    }

    .navbar-toggler-icon {
        width: 20px !important;
        height: 20px !important;
    }

    .nav-link {
        font-size: 0.9rem !important;
        padding: 0.65rem 0.85rem !important;
    }

    .nav-link i {
        font-size: 1rem !important;
        margin-right: 0.6rem !important;
    }

    .brand-name {
        font-size: 1rem !important;
    }

    .logo-img {
        height: 30px !important;
    }
}

/* ========================================
   ACCESSIBILITY & FOCUS STATES
======================================== */

.nav-link:focus,
.dropdown-item:focus,
.navbar-toggler:focus {
    outline: 2px solid #0A47A3;
    outline-offset: 2px;
}

/* Ensure menu is scrollable on small screens */
@media (max-height: 600px) {
    .navbar-collapse {
        overflow-y: auto !important;
    }
}

/* ========================================
   PRINT STYLES
======================================== */

@media print {

    .navbar-toggler,
    .navbar-collapse {
        display: none !important;
    }
}