/* Mobile Responsiveness Fixes for Search Functionality */

/* Add a visible search icon in header on mobile when main search is hidden */
@media (max-width: 991px) {
    /* Show a compact search icon in the header on mobile */
    .header-middle .header-left {
        display: flex;
        align-items: center;
        gap: 10px;
    }

    /* Make mobile menu toggle more prominent */
    .mobile-menu-toggle {
        min-width: 44px;
        min-height: 44px;
        display: flex;
        align-items: center;
        justify-content: center;
        padding: 8px;
    }

    .mobile-menu-toggle i {
        font-size: 24px;
    }

    /* Keep header search hidden but ensure mobile alternatives are visible */
    .header-middle .header-search.hs-simple {
        display: none !important;
    }
}

/* Ensure sticky footer search is visible and functional on mobile */
@media (max-width: 991px) {
    /* Make sticky footer more prominent on mobile */
    .sticky-footer {
        z-index: 9999;
        box-shadow: 0 -2px 8px rgba(0,0,0,0.1);
    }

    /* Improve sticky footer search visibility and tap target size */
    .sticky-footer .header-search {
        position: relative;
    }

    .sticky-footer .search-toggle {
        min-height: 44px; /* iOS minimum tap target */
        display: flex;
        flex-direction: column;
        align-items: center;
        justify-content: center;
        padding: 8px 12px;
    }

    .sticky-footer .search-toggle i {
        font-size: 20px;
        margin-bottom: 2px;
    }

    .sticky-footer .search-toggle span {
        font-size: 11px;
    }

    /* Ensure search form appears properly when toggled */
    .sticky-footer .hs-toggle.dir-up .input-wrapper {
        position: fixed;
        bottom: 60px;
        left: 0;
        right: 0;
        width: 100%;
        max-width: 100%;
        margin: 0;
        padding: 15px;
        background: #fff;
        box-shadow: 0 -4px 12px rgba(0,0,0,0.15);
        border-radius: 0;
        z-index: 9998;
        display: none;
    }

    .sticky-footer .hs-toggle.show .input-wrapper,
    .sticky-footer .hs-toggle:hover .input-wrapper {
        display: block !important;
    }

    .sticky-footer .hs-toggle .form-control {
        width: 100%;
        padding: 12px 50px 12px 15px;
        font-size: 16px; /* Prevents zoom on iOS */
        border: 2px solid #ddd;
        border-radius: 4px;
    }

    .sticky-footer .hs-toggle .btn-search {
        position: absolute;
        right: 15px;
        top: 50%;
        transform: translateY(-50%);
        width: 40px;
        height: 40px;
        padding: 0;
        display: flex;
        align-items: center;
        justify-content: center;
    }

    /* Mobile menu search improvements */
    .mobile-menu-container .input-wrapper {
        margin-bottom: 20px;
        padding: 0 15px;
    }

    .mobile-menu-container .form-control {
        width: 100%;
        padding: 12px 50px 12px 15px;
        font-size: 16px; /* Prevents zoom on iOS */
        border: 2px solid #ddd;
        border-radius: 4px;
    }

    .mobile-menu-container .btn-search {
        position: absolute;
        right: 20px;
        top: 50%;
        transform: translateY(-50%);
        width: 40px;
        height: 40px;
        background: transparent;
        border: none;
        padding: 0;
    }
}

/* Tablet specific adjustments */
@media (min-width: 768px) and (max-width: 991px) {
    .sticky-footer .hs-toggle.dir-up .input-wrapper {
        left: 50%;
        transform: translateX(-50%);
        width: 90%;
        max-width: 600px;
        border-radius: 8px;
    }
}

/* Small mobile devices */
@media (max-width: 480px) {
    .sticky-footer .sticky-link {
        font-size: 10px;
        padding: 6px 8px;
    }

    .sticky-footer .sticky-link i {
        font-size: 18px;
    }

    .sticky-footer .hs-toggle.dir-up .input-wrapper {
        padding: 12px;
    }

    .sticky-footer .hs-toggle .form-control {
        padding: 10px 45px 10px 12px;
        font-size: 16px;
    }
}

/* Ensure search overlay doesn't interfere with page content */
.sticky-footer .hs-toggle.show:before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0,0,0,0.3);
    z-index: 9997;
}

/* Fix for iOS Safari */
@supports (-webkit-touch-callout: none) {
    .sticky-footer .hs-toggle .form-control {
        font-size: 16px !important; /* Prevents zoom */
    }
}
