/* ========================================
   MODERN HEADER CSS - RESTRUCTURED
   ======================================== */

/* ========================================
   1. BASE LAYOUT & CONTAINERS
   ======================================== */

   .header-container {
    background: #011E61;
    position: relative;
    z-index: 1000;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    max-width: none !important;
}

.navbar-header {
    background: #011E61;
    padding: 0.5rem 0;
    min-height: 60px;
}

.navbar-header .container-fluid {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 1rem;
    max-width: 1400px;
    margin: 0 auto;
    width: 100%;
}

/* ========================================
   2. LOGO SECTION
   ======================================== */

.navbar-brand-header {
    flex-shrink: 0;
    padding: 0.5rem 0;
    margin-right: 0;
    margin-left: 0;
    transition: opacity 0.3s ease;
    position: relative;
    left: 0;
}

.navbar-brand-header:hover {
    opacity: 0.9;
}

.navbar-brand-header img {
    height: 40px;
    width: auto;
    max-width: 180px;
    display: block;
}

/* ========================================
   3. DESKTOP NAVIGATION CENTER
   ======================================== */

.navbar-nav-center {
    display: none; /* Hidden by default, shown on xl+ */
    flex: 1;
    justify-content: center;
    align-items: center;
    margin: 0 2rem;
    max-width: 800px;
}

.navbar-nav-center .navbar-nav {
    display: flex;
    justify-content: center;
    align-items: center;
    margin: 0;
    padding: 0;
    list-style: none;
    gap: 0.5rem;
}

.navbar-nav-center .nav-item {
    margin: 0;
    position: relative;
}

.navbar-nav-center .nav-link {
    color: #eee;
    text-decoration: none;
    padding: 0.75rem 1rem;
    font-weight: 600;
    font-size: 0.95rem;
    letter-spacing: 0.02em;
    white-space: nowrap;
    transition: all 0.3s ease;
    border-radius: 6px;
    position: relative;
    display: flex;
    align-items: center;
}

.navbar-nav-center .nav-link:hover {
    color: #75c9a2;
    background: rgba(255, 255, 255, 0.05);
    transform: translateY(-1px);
}

.navbar-nav-center .nav-link.active {
    color: #75c9a2;
    background: rgba(117, 201, 162, 0.1);
    font-weight: 700;
}

.navbar-nav-center .nav-link.active::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 80%;
    height: 2px;
    background: #75c9a2;
    border-radius: 1px;
}

/* ========================================
   4. DESKTOP ACTION BUTTONS
   ======================================== */

.navbar-nav-right {
    display: none; /* Hidden by default, shown on xl+ */
    align-items: center;
    flex-shrink: 0;
    gap: 0.75rem;
    margin-right: 0;
    margin-left: auto;
    position: relative;
    right: 0;
}

.navbar-nav-right .nav-item {
    margin: 0;
}

.navbar-nav-right .btn {
    white-space: nowrap;
    font-size: 0.875rem;
    font-weight: 600;
    padding: 0.5rem 1rem;
    border-radius: 6px;
    transition: all 0.3s ease;
    text-decoration: none;
    border: 1px solid transparent;
    text-align: center;
    overflow: visible; /* Ensure text doesn't get cut off */
    text-overflow: clip; /* Prevent text truncation */
    flex-shrink: 0;
}

.navbar-nav-right .btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.15);
}

.navbar-nav-right .btn-outline-light {
    border-color: rgba(255, 255, 255, 0.3);
    color: #fff;
    --bs-btn-color: #fff;
    --bs-btn-hover-color: #fff;
    --bs-btn-active-color: #fff;
}

.navbar-nav-right .btn-outline-light:hover {
    background: rgba(255, 255, 255, 0.1);
    border-color: rgba(255, 255, 255, 0.5);
    color: #fff !important;
}

.navbar-nav-right .btn-outline-light:focus,
.navbar-nav-right .btn-outline-light:active {
    color: #fff !important;
}

.navbar-nav-right .btn-success:hover {
    background: #4a9c4a;
}

.navbar-nav-right .btn-light:hover {
    background: #e8e8e8;
}

/* ========================================
   5. MOBILE TOGGLE BUTTON
   ======================================== */

.navbar-toggler-header {
    display: block; /* Shown by default */
    border: none;
    padding: 0.5rem;
    background: transparent;
    color: #fff;
    border-radius: 6px;
    transition: background-color 0.3s ease;
}

.navbar-toggler-header:hover {
    background: rgba(255, 255, 255, 0.1);
}

.navbar-toggler-header:focus {
    box-shadow: none;
    outline: none;
}

.navbar-toggler-header .navbar-toggler-icon {
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 30 30'%3e%3cpath stroke='rgba%28255, 255, 255, 0.85%29' stroke-linecap='round' stroke-miterlimit='10' stroke-width='2' d='M4 7h22M4 15h22M4 23h22'/%3e%3c/svg%3e");
    width: 24px;
    height: 24px;
}

/* ========================================
   6. MOBILE NAVIGATION
   ======================================== */

.navbar-collapse {
    width: 100%;
    flex-basis: 100%;
}

/* Mobile navigation styling for standard Bootstrap collapse */
@media (max-width: 1199.98px) {
    .navbar-collapse {
        margin-top: 1rem;
        border-top: 1px solid rgba(255, 255, 255, 0.1);
        padding-top: 1rem;
    }
    
    .navbar-collapse .navbar-nav {
        flex-direction: column;
        align-items: stretch;
        padding: 0;
        margin: 0;
        list-style: none;
        width: 100%;
    }
    
    .navbar-collapse .nav-item {
        width: 100%;
        margin: 0;
        border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    }
    
    .navbar-collapse .nav-item:last-child {
        border-bottom: none;
    }
    
    .navbar-collapse .nav-link {
        display: block;
        padding: 1rem;
        color: #eee;
        text-decoration: none;
        font-weight: 600;
        font-size: 1rem;
        transition: all 0.3s ease;
        border-left: 3px solid transparent;
    }
    
    .navbar-collapse .nav-link:hover {
        color: #75c9a2;
        background: rgba(255, 255, 255, 0.05);
        border-left-color: #75c9a2;
        padding-left: 1.5rem;
    }
    
    .navbar-collapse .nav-link.active {
        color: #75c9a2;
        background: rgba(117, 201, 162, 0.1);
        border-left-color: #75c9a2;
        font-weight: 700;
    }
}

/* ========================================
   7. MOBILE ACTION BUTTONS
   ======================================== */

@media (max-width: 1199.98px) {
    .navbar-collapse .navbar-nav-right {
        display: flex !important;
        flex-direction: column;
        width: 100%;
        margin: 1rem 0 0 0;
        padding: 1rem 0 0 0;
        border-top: 1px solid rgba(255, 255, 255, 0.1);
        gap: 0.75rem;
    }
    
    .navbar-collapse .navbar-nav-right .nav-item {
        width: 100%;
        margin: 0;
        border-bottom: none;
    }
    
    .navbar-collapse .navbar-nav-right .btn {
        width: 100%;
        text-align: center;
        padding: 0.75rem;
        font-size: 1rem;
        font-weight: 600;
        border-radius: 6px;
        transition: all 0.3s ease;
        display: block;
    }
    
    .navbar-collapse .navbar-nav-right .btn:hover {
        transform: none;
        box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    }
}

/* ========================================
   8. RESPONSIVE BREAKPOINTS
   ======================================== */

/* Tablets and smaller - Mobile layout */
@media (max-width: 991px) {
    .navbar-nav-center,
    .navbar-nav-right {
        display: none !important;
    }
    
    .navbar-toggler-header {
        display: block !important;
    }
    
    .navbar-header .container-fluid {
        padding: 0 0.75rem;
        flex-wrap: wrap;
    }
    
    .navbar-brand-header img {
        height: 35px;
        max-width: 140px;
    }
    
    /* Ensure mobile navigation takes full width */
    .navbar-collapse,
    .navbar-collapse-header {
        flex-basis: 100%;
        width: 100%;
        display: block;
    }
    
    /* Handle the old structure that's currently being output */
    .navbar-collapse-header {
        width: 100%;
        margin-top: 1rem;
        border-top: 1px solid rgba(255, 255, 255, 0.1);
        padding-top: 1rem;
    }
    
    .navbar-collapse-header .navbar-nav {
        flex-direction: column;
        align-items: stretch;
        padding: 0;
        margin: 0;
        list-style: none;
        width: 100%;
    }
    
    .navbar-collapse-header .nav-item {
        width: 100%;
        margin: 0;
        border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    }
    
    .navbar-collapse-header .nav-item:last-child {
        border-bottom: none;
    }
    
    .navbar-collapse-header .nav-link {
        display: block;
        padding: 1rem;
        color: #eee;
        text-decoration: none;
        font-weight: 600;
        font-size: 1rem;
        transition: all 0.3s ease;
        border-left: 3px solid transparent;
    }
    
    .navbar-collapse-header .nav-link:hover {
        color: #75c9a2;
        background: rgba(255, 255, 255, 0.05);
        border-left-color: #75c9a2;
        padding-left: 1.5rem;
    }
    
    .navbar-collapse-header .nav-link.active {
        color: #75c9a2;
        background: rgba(117, 201, 162, 0.1);
        border-left-color: #75c9a2;
        font-weight: 700;
    }
    
    /* Mobile buttons at top of dropdown */
    .navbar-collapse-header .navbar-nav-right {
        display: flex !important;
        flex-direction: column;
        width: 100%;
        margin: 0 0 1rem 0;
        padding: 0 0 1rem 0;
        border-bottom: 1px solid rgba(255, 255, 255, 0.1);
        gap: 0.75rem;
    }
    
    .navbar-collapse-header .navbar-nav-right .nav-item {
        width: 100%;
        margin: 0;
        border-bottom: none;
    }
    
    .navbar-collapse-header .navbar-nav-right .btn {
        width: 100%;
        text-align: center;
        padding: 0.75rem;
        font-size: 1rem;
        font-weight: 600;
        border-radius: 6px;
        transition: all 0.3s ease;
        display: block;
    }
    
    .navbar-collapse-header .navbar-nav-right .btn:hover {
        transform: none;
        box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    }
}

/* Large screens and up - Desktop layout */
@media (min-width: 992px) {
    .navbar-toggler-header {
        display: none !important;
    }
    
    .navbar-nav-center,
    .navbar-nav-right {
        display: flex !important;
    }
    
    /* FORCE HIDE mobile navigation on desktop - targeting your exact structure */
    .navbar-collapse,
    .navbar-collapse-header,
    div.navbar-collapse.navbar-collapse-header,
    #navbarHeaderCollapse {
        display: none !important;
        visibility: hidden !important;
        opacity: 0 !important;
        height: 0 !important;
        overflow: hidden !important;
    }
    
    .navbar-header .container-fluid {
        flex-wrap: nowrap;
        justify-content: space-between;
    }
    
    .navbar-nav-right {
        margin-left: auto;
        margin-right: 0;
    }
}

/* Extra wide screens */
@media (min-width: 1400px) {
    .navbar-header .container-fluid {
        max-width: 1400px;
    }
    
    .navbar-nav-center {
        margin: 0 3rem;
    }
    
    .navbar-nav-center .nav-link {
        padding: 0.75rem 1.25rem;
        font-size: 1rem;
    }
    
    .navbar-nav-right {
        gap: 1rem;
    }
}

/* Ensure buttons don't get cut off on medium screens */
@media (min-width: 992px) and (max-width: 1199px) {
    .navbar-nav-right {
        margin-right: 0.5rem; /* Reduced margin on medium screens */
    }
    
    .navbar-nav-right .btn {
        padding: 0.5rem 0.75rem; /* Slightly reduce padding */
        font-size: 0.8rem; /* Slightly smaller font */
    }
}

/* Reduced motion preferences */
@media (prefers-reduced-motion: reduce) {
    .navbar-nav-center .nav-link,
    .navbar-nav-right .btn,
    .navbar-collapse .nav-link,
    .navbar-collapse .navbar-nav-right .btn,
    .navbar-toggler-header,
    .navbar-brand-header {
        transition: none;
    }
    
    .navbar-nav-center .nav-link:hover,
    .navbar-nav-right .btn:hover {
        transform: none;
    }
}

/* ========================================
   9. ACCESSIBILITY ENHANCEMENTS
   ======================================== */

/* Focus states */
.navbar-nav-center .nav-link:focus,
.navbar-collapse .nav-link:focus,
.navbar-nav-right .btn:focus,
.navbar-collapse .navbar-nav-right .btn:focus,
.navbar-toggler-header:focus {
    outline: 2px solid #75c9a2;
    outline-offset: 2px;
}

/* High contrast mode support */
@media (prefers-contrast: high) {
    .navbar-nav-center .nav-link.active::after {
        height: 3px;
    }
    
    .navbar-collapse .nav-link.active {
        border-left-width: 4px;
    }
}

/* ========================================
   10. UTILITY CLASSES
   ======================================== */

.navbar-header .text-nowrap {
    white-space: nowrap;
}

/* Loading states */
.navbar-brand-header img[loading="lazy"] {
    opacity: 0;
    transition: opacity 0.3s ease;
}

.navbar-brand-header img[loading="lazy"].loaded {
    opacity: 1;
}