/* Lines-limit-guard: 500 */
/**
 * Wamia Header - Responsive Improvements
 * Comprehensive responsive design for all header components
 * Ensures smooth responsive behavior at 992px, 768px, and 480px breakpoints
 */

/* ========================================
   RESPONSIVE LAYOUT IMPROVEMENTS
   ======================================== */

/* Medium desktops - Fix layout issues between 1200px-1000px */
@media (max-width: 1200px) and (min-width: 1001px) {
    /* Container adjustments for medium screens */
    .wamia-header {
        max-width: 100%;
        padding: 0 20px;
    }
    
    .wamia-header-top-container {
        max-width: 1200px;
        margin: 0 0;
        gap: 24px;
    }
    
    /* Search section optimization */
    .header-search-section {
        flex: 1;
        min-width: 250px;
        max-width: 450px;
    }
    
    /* Logo section adjustments */
    .header-logo-section {
        flex: 0 0 160px;
    }
    
    /* Actions section adjustments */
    .header-actions-section {
        flex: 0 0 180px;
        gap: 16px;
    }
    
    /* Navigation adjustments */
    .wamia-header-bottom-container {
        max-width: 1200px;
        margin: 0 auto;
        padding: 0 20px;
    }
    
    .desktop-navigation {
        gap: 20px;
    }
    
    /* Mega menu adjustments for medium screens */
    .wamia-megamenu__panel {
        width: 1000px;
        max-width: 90vw;
    }
    
    /* Featured categories adjustments */
    .featured-categories-nav {
        gap: 20px;
        justify-content: flex-start;
        flex-wrap: nowrap;
        overflow-x: auto;
        scrollbar-width: none;
        -ms-overflow-style: none;
    }
    
    .featured-categories-nav::-webkit-scrollbar {
        display: none;
    }
    
    .featured-category-item {
        padding: 8px 16px;
        font-size: 14px;
        white-space: nowrap;
        flex-shrink: 0;
    }
    
    /* Prevent layout shifts in this range */
    .wamia-header-top {
        min-height: 60px;
        display: flex;
        align-items: center;
    }
    
    .wamia-header-bottom {
        min-height: 50px;
        display: flex;
        align-items: center;
    }
    
    /* Ensure proper flexbox behavior */
    .header-search-form {
        width: 100%;
        max-width: 450px;
        min-width: 250px;
    }
    
    /* Action items spacing fix */
    .header-actions-section {
        justify-content: flex-end;
        align-items: center;
    }
    
    .action-item {
        flex-shrink: 0;
    }
}

/* Critical transition zone: 1000px-1080px */
@media (min-width: 1000px) and (max-width: 1080px) {
    /* Container with precise control for this narrow range */
    .wamia-header {
        width: 100%;
        max-width: none;
        padding: 0 16px;
    }
    
    .wamia-header-top-container {
        max-width: 1080px;
        margin: 0 0;
        gap: 16px;
        display: flex;
        align-items: center;
        justify-content: space-around;
    }
    
    /* Logo section - fixed width to prevent shrinking */
    .header-logo-section {
        flex: 0 0 140px;
        min-width: 140px;
    }
    
    /* Search section - flexible but controlled */
    .header-search-section {
        flex: 1;
        min-width: 200px;
        max-width: 350px;
        margin: 0 12px;
    }
    
    .search-input {
        font-size: 14px;
        padding: 8px 12px;
        width: 100%;
    }
    
    /* Actions section - compact but usable */
    .header-actions-section {
        flex: 0 0 160px;
        min-width: 160px;
        gap: 12px;
        justify-content: flex-end;
    }
    
    .action-item {
        margin: 0 4px;
        flex-shrink: 0;
    }
    
    .action-text {
        font-size: 11px;
        display: block;
    }
    
    /* Bottom navigation adjustments */
    .wamia-header-bottom-container {
        max-width: 1080px;
        margin: 0 auto;
        padding: 0 16px;
    }
    
    /* Featured categories - horizontal scroll for overflow */
    .featured-categories-nav {
        gap: 12px;
        overflow-x: auto;
        scrollbar-width: none;
        -ms-overflow-style: none;
        padding: 0 4px;
    }
    
    .featured-categories-nav::-webkit-scrollbar {
        display: none;
    }
    
    .featured-category-item {
        padding: 6px 12px;
        font-size: 13px;
        white-space: nowrap;
        flex-shrink: 0;
        min-width: fit-content;
    }
    
    /* Mega menu specific sizing for this range */
    .wamia-megamenu__panel {
        width: 950px;
        max-width: 95vw;
        height: 580px;
        left: 50%;
        transform: translateX(-50%);
    }
    
    .wamia-megamenu__sidebar {
        width: 180px;
    }
    
    .wamia-megamenu__content {
        margin-left: 180px;
        height: 580px;
    }
    
    .wamia-megamenu__grid {
        grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
        gap: 16px;
        padding: 16px;
    }
    
         /* Prevent layout shifts */
     .wamia-header-top {
         min-height: 58px;
         display: flex;
         align-items: center;
     }
     
     .wamia-header-bottom {
         min-height: 48px;
         display: flex;
         align-items: center;
     }
}

/* JavaScript-controlled critical transition zone styling */
.critical-transition-zone {
    /* Enhanced positioning for mega-menu */
    .wamia-megamenu__panel {
        position: absolute !important;
        left: 50% !important;
        transform: translateX(-50%) !important;
        width: 950px !important;
        max-width: 95vw !important;
    }
    
    /* Ensure proper z-index layering */
    .wamia-megamenu {
        position: relative;
        z-index: 1000;
    }
    
    /* Enhanced header stability */

    
    /* Search bar specific adjustments */
    .header-search-section {
        overflow: hidden;
    }
    
    .search-input {
        min-width: 0 !important;
    }
    
    /* Action items - prevent overflow */
    .header-actions-section {
        overflow: visible;
        white-space: nowrap;
    }
    
    .action-item {
        display: inline-flex;
        align-items: center;
        flex-shrink: 0;
    }
    
    /* Navigation specific improvements */
    .featured-categories-nav {
        -webkit-overflow-scrolling: touch;
        scroll-behavior: smooth;
    }
    
    /* Logo adjustments */
    .header-logo-section {
        overflow: hidden;
    }
    
    .logo-image {
        max-width: 100%;
        height: auto;
        object-fit: contain;
    }
}

/* Large tablets and small desktops (≤992px) */
@media (max-width: 992px) {
    /* Header container adjustments */
    .wamia-header {
        width: 100%;
        max-width: none;
    }
    
    /* Search bar adjustments */
    .header-search-section {
        flex: 1;
        min-width: 200px;
        max-width: 400px;
    }
    
    .search-input {
        font-size: 14px;
        padding: 8px 12px;
    }
    
    /* Navigation adjustments */
    .desktop-navigation {
        overflow-x: auto;
        scrollbar-width: none;
        -ms-overflow-style: none;
    }
    
    .desktop-navigation::-webkit-scrollbar {
        display: none;
    }
    
    /* Action buttons - reduce spacing */
    .header-actions-section .action-item {
        margin: 0 8px;
    }
}

/* Tablets (≤768px) */
@media (max-width: 768px) {
    /* Hide desktop-only elements */
    .desktop-only {
        display: none !important;
    }
    
    /* Show mobile-only elements */
    .mobile-only {
        display: block !important;
    }
    
    /* Ensure mobile header is responsive */
    .wamia-mobile-header {
        width: 100%;
        padding: 0 12px;
    }
    
    /* Mobile search improvements */
    .mobile-search-bar {
        width: 100%;
        margin: 8px 0;
    }
    
    .mobile-search-input {
        width: 100%;
        min-height: 24px; /* Touch-friendly */
        font-size: 16px; /* Prevent zoom on iOS */
        padding: 10px 16px;
        border-radius: 8px;
    }
    
    /* Mobile navigation drawer */
    .mobile-nav-drawer {
        width: 280px;
        max-width: 85vw;
    }
    
    /* Touch-friendly buttons */
    .mobile-header-actions .action-button {
        min-width: 44px;
        min-height: 44px;
        padding: 10px;
    }
}

/* Small phones (≤480px) */
@media (max-width: 480px) {
    /* Ultra-compact header */
    .wamia-mobile-header {
        padding: 0 8px;
    }
    
    /* Smaller logo on tiny screens */
    .mobile-logo-image {
        max-width: 100px;
        max-height: 32px;
    }
    
    /* Adjust mobile drawer width */
    .mobile-nav-drawer {
        width: 260px;
        max-width: 90vw;
    }
    
    /* Stack mobile actions vertically if needed */
    .mobile-header-actions {
        gap: 8px;
    }
    
    /* Smaller touch targets for very small screens */
    .mobile-header-actions .action-button {
        min-width: 40px;
        min-height: 40px;
        padding: 8px;
    }
}

/* ========================================
   RESPONSIVE TYPOGRAPHY
   ======================================== */

/* Tablet typography adjustments */
@media (max-width: 992px) {
    .header-title,
    .navigation-title {
        font-size: 16px;
    }
    
    .action-text {
        font-size: 12px;
    }
    
    .category-link {
        font-size: 14px;
        padding: 8px 12px;
    }
}

/* Mobile typography adjustments */
@media (max-width: 768px) {
    .mobile-header-title {
        font-size: 18px;
        font-weight: 600;
    }
    
    .mobile-nav-item {
        font-size: 16px;
        line-height: 1.5;
        padding: 12px 16px;
    }
    
    .mobile-search-placeholder {
        font-size: 16px; /* Prevent iOS zoom */
    }
}

/* ========================================
   RESPONSIVE SPACING & LAYOUT
   ======================================== */

/* Tablet spacing */
@media (max-width: 992px) {
    .header-section {
        padding: 12px 16px;
    }
    
    .navigation-section {
        padding: 8px 16px;
    }
    
    .category-nav {
        gap: 16px;
    }
}

/* Mobile spacing */
@media (max-width: 768px) {
    .mobile-header-section {
        padding: 10px 12px;
    }
    
    .mobile-nav-section {
        padding: 8px 0;
    }
    
    .mobile-category-list {
        gap: 0;
    }
    
    .mobile-category-item {
        border-bottom: 1px solid #f0f0f0;
    }
    
    .mobile-category-item:last-child {
        border-bottom: none;
    }
}

/* ========================================
   RESPONSIVE INTERACTIONS
   ======================================== */

/* Touch-friendly hover states for tablets */
@media (max-width: 992px) and (min-width: 769px) {
    .touchable-element:hover {
        background-color: #f8f9fa;
        transition: background-color 0.2s ease;
    }
}

/* Mobile-specific interaction improvements */
@media (max-width: 768px) {
    /* Remove hover effects on mobile */
    .mobile-element:hover {
        background-color: transparent;
    }
    
    /* Enhanced touch states */
    .mobile-button:active {
        background-color: #e9ecef;
        transform: scale(0.98);
        transition: all 0.1s ease;
    }
    
    /* Smooth drawer animations */
    .mobile-drawer {
        transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    }
    
    .mobile-drawer.open {
        transform: translateX(0);
    }
    
    .mobile-drawer.closed {
        transform: translateX(-100%);
    }
}

/* ========================================
   RESPONSIVE UTILITIES
   ======================================== */

/* Hide/show utilities for different breakpoints */
@media (min-width: 993px) {
    .hide-desktop {
        display: none !important;
    }
}

@media (max-width: 992px) and (min-width: 769px) {
    .hide-tablet {
        display: none !important;
    }
    
    .show-tablet-only {
        display: block !important;
    }
}

@media (max-width: 768px) {
    .hide-mobile {
        display: none !important;
    }
    
    .show-mobile-only {
        display: block !important;
    }
}

/* Responsive flexbox utilities */
.responsive-flex {
    display: flex;
}

@media (max-width: 768px) {
    .responsive-flex {
        flex-direction: column;
    }
    
    .responsive-flex.mobile-row {
        flex-direction: row;
    }
}

/* ========================================
   ACCESSIBILITY IMPROVEMENTS
   ======================================== */

/* Enhanced focus states for all breakpoints */
@media (max-width: 992px) {
    .focusable-element:focus {
        outline: 2px solid #ED6F26;
        outline-offset: 2px;
        border-radius: 4px;
    }
}

/* Mobile accessibility improvements */
@media (max-width: 768px) {
    /* Larger focus areas for mobile */
    .mobile-focusable:focus {
        outline: 3px solid #ED6F26;
        outline-offset: 3px;
    }
    
    /* Screen reader improvements */
    .sr-only-mobile {
        position: absolute;
        width: 1px;
        height: 1px;
        padding: 0;
        margin: -1px;
        overflow: hidden;
        clip: rect(0, 0, 0, 0);
        white-space: nowrap;
        border: 0;
    }
}

/* ========================================
   PERFORMANCE OPTIMIZATIONS
   ======================================== */

/* Reduce animations on mobile for better performance */
@media (max-width: 768px) {
    .mobile-optimized {
        animation-duration: 0.2s;
        transition-duration: 0.2s;
    }
    
    /* Reduce motion for users who prefer it */
    @media (prefers-reduced-motion: reduce) {
        .mobile-optimized {
            animation: none;
            transition: none;
        }
    }
}

/* GPU acceleration for smooth mobile scrolling */
@media (max-width: 768px) {
    .mobile-scroll-container {
        -webkit-overflow-scrolling: touch;
        transform: translateZ(0);
        backface-visibility: hidden;
        perspective: 1000px;
    }
} 