/**
 * Mobile Menu Button Positioning Fix for Sector Pages
 * Task 2-2: Mobile Menu Button Positioning Fix for Sector Pages
 * 
 * This CSS file specifically addresses the mobile menu button positioning 
 * issue on sector pages where the button appears centered and on a lower 
 * line than the logo instead of properly aligned to the right.
 */

/* CSS Constants for sector page fixes */
:root {
    --sector-header-mobile-padding: 1rem;
    --sector-logo-mobile-height: 2rem;
    --sector-mobile-menu-size: 44px;
    --sector-mobile-breakpoint: 768px;
}

/* Sector Page Header Fix */
.site-header {
    /* Ensure consistent header behavior across all pages */
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    background: #fff;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
    z-index: 50;
    width: 100%;
}

/* Sector Page Header Container Fix */
.site-header .container {
    width: 100%;
    margin: 0 auto;
    padding-left: 1rem;
    padding-right: 1rem;
}

/* Main Header Flex Container - Critical Fix */
.site-header .flex {
    display: flex;
    flex-wrap: nowrap; /* Changed from flex-wrap to nowrap for sectors */
    justify-content: space-between;
    align-items: center;
    width: 100%;
    min-height: 4rem; /* Ensure consistent height */
}

/* Logo Container Fix for Sector Pages */
.site-header__logo-link {
    flex-shrink: 0; /* Prevent logo from shrinking */
    display: flex;
    align-items: center;
    max-width: calc(100% - 60px); /* Leave space for mobile menu button */
}

.site-header__logo-image {
    height: var(--sector-logo-mobile-height);
    width: auto;
    max-width: 100%;
    object-fit: contain;
}

/* Mobile Menu Button Fix for Sector Pages */
.site-header__mobile-menu-button {
    /* Ensure proper positioning */
    flex-shrink: 0;
    margin-left: auto; /* Push to the right */
    min-width: var(--sector-mobile-menu-size);
    min-height: var(--sector-mobile-menu-size);
    padding: 0.5rem;
    border-radius: 0.375rem;
    
    /* Ensure it stays on the same line as logo */
    align-self: center;
    
    /* Remove any margin that might cause wrapping */
    margin-top: 0;
    margin-bottom: 0;
    margin-right: 0;
    
    /* Positioning fix */
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Mobile-specific fixes */
@media (max-width: 767px) {
    /* Ensure header content doesn't wrap on mobile */
    .site-header .container {
        padding-left: var(--sector-header-mobile-padding);
        padding-right: var(--sector-header-mobile-padding);
    }
    
    .site-header .flex {
        flex-wrap: nowrap; /* Critical: prevent wrapping */
        gap: 0.5rem; /* Small gap between logo and menu button */
        padding: 1rem 0;
    }
    
    .site-header__logo-link {
        flex: 1;
        min-width: 0; /* Allow flex shrinking if needed */
        max-width: calc(100% - 56px); /* Account for button + gap */
    }
    
    .site-header__logo-image {
        height: var(--sector-logo-mobile-height);
        max-width: 100%;
    }
    
    .site-header__mobile-menu-button {
        /* Ensure button stays on right side */
        flex: none;
        width: var(--sector-mobile-menu-size);
        height: var(--sector-mobile-menu-size);
        
        /* Remove any styles that might cause centering */
        margin: 0;
        position: static;
        
        /* Ensure proper stacking context */
        z-index: 10;
    }
    
    /* Fix for navigation positioning */
    .site-header__nav {
        /* Ensure nav doesn't interfere with header layout */
        position: absolute;
        top: 100%;
        left: 0;
        right: 0;
        background: white;
        box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
        z-index: 40;
    }
    
    /* Ensure hidden navigation doesn't affect layout */
    .site-header__nav.hidden {
        display: none;
    }
}

/* Tablet-specific adjustments */
@media (min-width: 768px) and (max-width: 1023px) {
    .site-header__logo-image {
        height: 2.5rem;
    }
    
    .site-header__mobile-menu-button {
        display: none; /* Hidden on tablet and desktop */
    }
}

/* Desktop adjustments */
@media (min-width: 1024px) {
    .site-header__logo-image {
        height: 2.5rem;
    }
    
    .site-header__mobile-menu-button {
        display: none; /* Hidden on desktop */
    }
}

/* Breadcrumb spacing adjustment for sector pages */
.breadcrumb-nav {
    margin-top: 4rem; /* Account for fixed header */
}

@media (max-width: 767px) {
    .breadcrumb-nav {
        margin-top: 4rem; /* Adjust for mobile header height */
    }
    
    /* Ensure body has proper top padding for fixed header */
    body {
        padding-top: 4rem;
    }
}

/* Override any conflicting flex properties on sector pages */
.site-header .flex.flex-wrap {
    flex-wrap: nowrap !important;
}

/* Specific fix for justify-between spacing */
.site-header .justify-between {
    justify-content: space-between;
    align-items: center;
}

/* Prevent any text alignment issues */
.site-header {
    text-align: left;
}

.site-header__mobile-menu-button {
    text-align: center;
}

/* Icon alignment within button */
.site-header__mobile-menu-button i {
    display: inline-block;
    line-height: 1;
    vertical-align: middle;
}

/* Screen reader text positioning */
.site-header__mobile-menu-button .sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

/* Additional safety measures for problematic pages */
.site-header .items-center {
    align-items: center !important;
}

.site-header .py-4 {
    padding-top: 1rem !important;
    padding-bottom: 1rem !important;
}

.site-header .md\:py-5 {
    @media (min-width: 768px) {
        padding-top: 1.25rem !important;
        padding-bottom: 1.25rem !important;
    }
}

/* Emergency Mobile Menu Fix - Higher Specificity */
@media (max-width: 767px) {
  .site-header .flex.flex-wrap.justify-between.items-center {
    flex-wrap: nowrap !important;
    display: flex !important;
    justify-content: space-between !important;
    align-items: center !important;
  }
  
  .site-header .site-header__mobile-menu-button {
    flex-shrink: 0 !important;
    margin-left: auto !important;
    width: 44px !important;
    height: 44px !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
  }
} 