/*
 * REVIEWSENSEI - Mobile Header Complete Fix
 * Comprehensive solution for mobile header layout issues
 * Version: 1.0
 * Author: Claude Code Assistant
 */

/* ========================================
   MOBILE HEADER CONTAINER FIXES
   ======================================== */

@media (max-width: 1199px) {
    /* Header wrapper fixes */
    .axil-header .header-wrap {
        padding: 15px 20px !important;
    }
    
    /* Logo column fixes */
    .axil-header .header-wrap .row > div:first-child {
        flex: 0 0 auto !important;
        width: auto !important;
        max-width: none !important;
    }
    
    .axil-header .logo {
        margin-right: 15px !important;
    }
    
    .axil-header .logo img {
        max-height: 40px !important;
        width: auto !important;
    }
    
    /* Header search column fixes */
    .axil-header .header-wrap .row > div:last-child {
        flex: 1 1 auto !important;
        width: auto !important;
        max-width: none !important;
        min-width: 0 !important;
    }
    
    /* Header search wrapper fixes */
    .axil-header .header-search {
        justify-content: flex-end !important;
        align-items: center !important;
        flex-wrap: nowrap !important;
        gap: 10px !important;
    }
    
    /* Desktop search form - hide on mobile */
    .axil-header .header-search .header-search-form.d-sm-block.d-none {
        display: none !important;
    }
    
    /* Mobile search wrapper */
    .axil-header .header-search .mobile-search-wrapper {
        position: relative !important;
        display: flex !important;
        align-items: center !important;
        flex-shrink: 0 !important;
    }
    
    /* Metabar fixes */
    .axil-header .header-search .metabar-block {
        display: flex !important;
        align-items: center !important;
        gap: 8px !important;
        margin: 0 10px 0 0 !important;
        list-style: none !important;
        padding: 0 !important;
    }
    
    .axil-header .header-search .metabar-block li {
        display: flex !important;
        align-items: center !important;
        justify-content: center !important;
    }
    
    .axil-header .header-search .metabar-block li a {
        display: flex !important;
        align-items: center !important;
        justify-content: center !important;
        width: 35px !important;
        height: 35px !important;
        border-radius: 50% !important;
        background: #f8f9fa !important;
        color: #666666 !important;
        text-decoration: none !important;
        transition: all 0.3s ease !important;
    }
    
    .axil-header .header-search .metabar-block li a:hover {
        background: #3858f6 !important;
        color: #ffffff !important;
    }
    
    .axil-header .header-search .metabar-block li a img {
        width: 20px !important;
        height: 20px !important;
        border-radius: 50% !important;
    }
    
    .axil-header .header-search .metabar-block li a i {
        font-size: 14px !important;
        line-height: 1 !important;
    }
    
    /* Hamburger menu fixes */
    .axil-header .header-search .hamburger-menu {
        display: flex !important;
        align-items: center !important;
        justify-content: center !important;
        flex-shrink: 0 !important;
        margin-left: 10px !important;
    }
    
    .axil-header .header-search .hamburger-menu .hamburger-inner {
        width: 45px !important;
        height: 45px !important;
        background: #f8f9fa !important;
        border-radius: 50% !important;
        display: flex !important;
        align-items: center !important;
        justify-content: center !important;
        cursor: pointer !important;
        transition: all 0.3s ease !important;
        border: none !important;
    }
    
    .axil-header .header-search .hamburger-menu .hamburger-inner:hover {
        background: #3858f6 !important;
    }
    
    .axil-header .header-search .hamburger-menu .hamburger-inner:hover .icon {
        color: #ffffff !important;
    }
    
    .axil-header .header-search .hamburger-menu .hamburger-inner .icon {
        color: #666666 !important;
        transition: all 0.3s ease !important;
    }
    
    .axil-header .header-search .hamburger-menu .hamburger-inner .icon i {
        font-size: 16px !important;
        line-height: 1 !important;
    }
}

/* ========================================
   TABLET SPECIFIC FIXES (768px - 1199px)
   ======================================== */

@media (min-width: 768px) and (max-width: 1199px) {
    /* Show desktop search on tablets */
    .axil-header .header-search .header-search-form.d-sm-block.d-none {
        display: block !important;
        margin-right: 15px !important;
        flex-shrink: 0 !important;
        min-width: 200px !important;
    }
    
    .axil-header .header-search .mobile-search-wrapper {
        display: none !important;
    }
    
    /* Adjust metabar for tablet */
    .axil-header .header-search .metabar-block {
        margin: 0 15px 0 0 !important;
    }
    
    /* Show fewer metabar items on smaller tablets */
    .axil-header .header-search .metabar-block li:nth-child(1),
    .axil-header .header-search .metabar-block li:nth-child(2) {
        display: none !important;
    }
}

/* ========================================
   PHONE SPECIFIC FIXES (< 768px)
   ======================================== */

@media (max-width: 767px) {
    /* Header container adjustments */
    .axil-header .header-wrap {
        padding: 10px 15px !important;
    }
    
    /* Logo adjustments */
    .axil-header .logo img {
        max-height: 35px !important;
    }
    
    /* Hide desktop search completely */
    .axil-header .header-search .header-search-form.d-sm-block.d-none {
        display: none !important;
    }
    
    /* Mobile search wrapper */
    .axil-header .header-search .mobile-search-wrapper {
        display: flex !important;
    }
    
    /* Hide all metabar items except user avatar */
    .axil-header .header-search .metabar-block li:not(:last-child) {
        display: none !important;
    }
    
    .axil-header .header-search .metabar-block li:last-child a {
        width: 32px !important;
        height: 32px !important;
    }
    
    .axil-header .header-search .metabar-block li:last-child a img {
        width: 18px !important;
        height: 18px !important;
    }
    
    /* Hamburger menu adjustments */
    .axil-header .header-search .hamburger-menu .hamburger-inner {
        width: 40px !important;
        height: 40px !important;
        margin-left: 5px !important;
    }
    
    .axil-header .header-search .hamburger-menu .hamburger-inner .icon i {
        font-size: 14px !important;
    }
}

/* ========================================
   MOBILE MENU DROPDOWN FIXES
   ======================================== */

@media (max-width: 767px) {
    /* Mobile dropdown positioning */
    .axil-header .header-search .mobile-search-wrapper {
        position: relative !important;
    }
    
    .axil-header .header-search .mobile-search-wrapper .header-search-form {
        position: absolute !important;
        top: calc(100% + 10px) !important;
        right: 0 !important;
        width: 280px !important;
        max-width: calc(100vw - 30px) !important;
        background: #ffffff !important;
        padding: 15px !important;
        border-radius: 15px !important;
        box-shadow: 0 10px 30px rgba(0,0,0,0.15) !important;
        border: 1px solid #e5e5e5 !important;
        z-index: 1001 !important;
        opacity: 0 !important;
        visibility: hidden !important;
        transform: translateY(-10px) !important;
        transition: all 0.3s ease !important;
    }
    
    /* Active state for mobile dropdown */
    .axil-header .header-search .mobile-search-wrapper .header-search-form.active,
    .axil-header .header-search .mobile-search-wrapper .header-search-form.open {
        opacity: 1 !important;
        visibility: visible !important;
        transform: translateY(0) !important;
    }
    
    /* Mobile dropdown arrow */
    .axil-header .header-search .mobile-search-wrapper .header-search-form::before {
        content: "" !important;
        position: absolute !important;
        top: -8px !important;
        right: 15px !important;
        width: 0 !important;
        height: 0 !important;
        border-left: 8px solid transparent !important;
        border-right: 8px solid transparent !important;
        border-bottom: 8px solid #ffffff !important;
        z-index: 1002 !important;
    }
    
    .axil-header .header-search .mobile-search-wrapper .header-search-form::after {
        content: "" !important;
        position: absolute !important;
        top: -9px !important;
        right: 15px !important;
        width: 0 !important;
        height: 0 !important;
        border-left: 8px solid transparent !important;
        border-right: 8px solid transparent !important;
        border-bottom: 8px solid #e5e5e5 !important;
        z-index: 1001 !important;
    }
}

/* ========================================
   FIX BOOTSTRAP COLUMN CONFLICTS
   ======================================== */

@media (max-width: 1199px) {
    /* Override Bootstrap column widths on mobile */
    .axil-header .header-wrap .row [class*="col-"] {
        position: relative !important;
        width: auto !important;
        padding-right: 8px !important;
        padding-left: 8px !important;
        flex: none !important;
    }
    
    .axil-header .header-wrap .row {
        margin-right: -8px !important;
        margin-left: -8px !important;
        align-items: center !important;
        justify-content: space-between !important;
        flex-wrap: nowrap !important;
    }
    
    /* First column (logo) */
    .axil-header .header-wrap .row > div:first-child {
        flex: 0 0 auto !important;
        width: auto !important;
        max-width: 60% !important;
    }
    
    /* Last column (search/menu) */
    .axil-header .header-wrap .row > div:last-child {
        flex: 1 1 auto !important;
        width: auto !important;
        max-width: none !important;
        min-width: 0 !important;
    }
    
    /* Hide middle column (main menu) completely */
    .axil-header .header-wrap .row > div:nth-child(2) {
        display: none !important;
    }
}

/* ========================================
   EMERGENCY MOBILE FIXES
   ======================================== */

/* Force correct layout on mobile */
@media (max-width: 575px) {
    .axil-header .header-wrap .container,
    .axil-header .header-wrap .container-fluid {
        padding-right: 15px !important;
        padding-left: 15px !important;
        max-width: 100% !important;
    }
    
    /* Ultra-small mobile fixes */
    .axil-header .header-search .mobile-search-wrapper .header-search-form {
        width: 260px !important;
        right: -10px !important;
        padding: 12px !important;
    }
    
    /* Compact header on very small screens */
    .axil-header .header-wrap {
        min-height: 60px !important;
    }
    
    .axil-header .logo img {
        max-height: 30px !important;
    }
    
    .axil-header .header-search .hamburger-menu .hamburger-inner {
        width: 36px !important;
        height: 36px !important;
    }
}