/* Mobile-specific styles for the Algolia search */

/* Full-screen search overlay for mobile */
.fullscreen-search-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background-color: #fff;
    z-index: 999999;
    display: none;
    flex-direction: column;
    overflow: hidden;
}

.fullscreen-search-overlay.active {
    display: flex;
}

.fullscreen-search-header {
    background-color: #fff;
    border-bottom: 1px solid #ddd;
    padding: 15px;
    display: flex;
    align-items: center;
    flex-shrink: 0;
}

.fullscreen-search-input {
    flex: 1;
    border: 1px solid #ddd;
    border-radius: 4px;
    padding: 12px 15px;
    font-size: 16px;
    outline: none;
    -webkit-user-select: text !important;
    user-select: text !important;
    cursor: text !important;
    pointer-events: auto !important;
    -webkit-appearance: none;
    appearance: none;
}

.fullscreen-search-input:focus {
    outline: none;
    border-color: #5f534f;
    -webkit-user-select: text !important;
    user-select: text !important;
}

.fullscreen-close-btn {
    background: none;
    border: none;
    font-size: 24px;
    color: #666;
    cursor: pointer;
    margin-left: 15px;
    padding: 5px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.fullscreen-close-btn:hover {
    color: #333;
}

.fullscreen-search-results {
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
    /* padding: 15px; */
    background-color: #fff;
    height: calc(100vh - 80px);
    /* Account for header height */
    -webkit-overflow-scrolling: touch;
    /* Smooth scrolling on iOS */
}

.fullscreen-no-results {
    text-align: center;
    color: #666;
    padding: 40px 20px;
    font-size: 16px;
}

.fullscreen-search-sections {
    margin-bottom: 20px;
}

.fullscreen-section-title {
    font-size: 16px;
    /* font-weight: bold; */
    /* color: #333; */
    /* margin-bottom: 15px; */
    /* padding-bottom: 8px; */
    /* border-bottom: 2px solid #ff7100; */

    padding: 10px 15px;
    font-weight: bold;
    background-color: #f8f4ee;
    border-bottom: 1px solid #ddd;
    color: #5f534f;

}

.fullscreen-product-item {
    display: flex;
    padding: 5px 0;
    border-bottom: 1px solid #eee;
    cursor: pointer;
}

.fullscreen-product-item:hover {
    background-color: #f9f9f9;
}

.fullscreen-product-image {
    width: 65px;
    height: 65px;
    margin-right: 15px;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    /* background-color: #f5f5f5; */
    /* border-radius: 4px; */
}

.fullscreen-product-image img {
    max-width: 100%;
    max-height: 100%;
    border-radius: 4px;
}

.fullscreen-product-info {
    flex: 1;
}

.fullscreen-product-info h3 {
    margin: 0 0 2px 0;
    font-size: 14px;
    color: #333;
    line-height: 1.3;
}

.fullscreen-product-info p {
    margin: 0 0 8px 0;
    font-size: 14px;
    color: #666;
    line-height: 1.4;
    /* Limit to 2 lines */
    display: -webkit-box;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    text-overflow: ellipsis;
}

.fullscreen-product-price {
    font-weight: bold;
    color: #ff7100;
    font-size: 16px;
}

.fullscreen-faq-item {
    padding: 5px 15px;
    border-bottom: 1px solid #eee;
    cursor: pointer;
}

.fullscreen-faq-item:hover {
    background-color: #f9f9f9;
}

.fullscreen-faq-item h3 {
    margin: 0 0 8px 0;
    font-size: 16px;
    color: #333;
    line-height: 1.3;
}

.fullscreen-faq-item p {
    margin: 0;
    font-size: 14px;
    color: #666;
    line-height: 1.4;
    /* Limit to 2 lines */
    display: -webkit-box;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Loading state */
.fullscreen-loading {
    text-align: center;
    padding: 40px 20px;
    font-size: 16px;
    color: #666;
}

/* Match highlighting in fullscreen */
.fullscreen-search-results .highlight {
    font-weight: 600;
    color: #ff7100;
    background-color: rgba(255, 113, 0, 0.1);
}

/* Main container - adjusted for mobile */
#searchDropdownHeader {
    width: 100%;
    position: unset !important;
    max-width: 100%;
    border-radius: 4px;
    margin-top: 5px;
    border: none;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.15);
}

/* Search container - adjusted for mobile */
.search-container-header {
    margin: 10px auto;
    float: none;
    width: 95%;
    margin-left: auto;
    margin-right: auto;
}

/* Search dropdown styling - adjusted for mobile */
.search-dropdown {
    width: 100%;
    max-width: 100%;
}

/* Product items - improved for smaller screens */
.product-item-dropdown {
    padding: 8px 10px;
}

.product-image-small {
    width: 40px;
    height: 40px;
    margin-right: 8px;
}

.product-info-dropdown h3 {
    font-size: 13px;
}

/* Search box - adjusted for mobile */
#searchBox {
    width: 100%;
    max-width: 100%;
    font-size: 16px;
    padding: 8px 10px;
    cursor: pointer;
    /* Show it's clickable on mobile */
    transition: background-color 0.2s ease;
    /* background-position: 95% center; */
}

#searchBox:focus {
    outline: none;
    background-color: #f8f8f8;
}

/* Bottom results area - adjusted for mobile */
.search-results-title {
    font-size: 16px;
}

.product-item {
    flex-direction: column;
    padding: 12px;
}

.product-image {
    width: 100%;
    margin-bottom: 10px;
}

.product-info h3 {
    font-size: 14px;
}

.price {
    font-size: 16px;
}

/* Debug panel adjustments */
#debug-output {
    max-height: 150px;
    font-size: 10px;
}

/* Ensure full-screen overlay takes precedence on mobile */
@media (max-width: 768px) {
    .fullscreen-search-overlay {
        z-index: 999999;
    }

    .fullscreen-search-input {
        font-size: 16px;
        /* Prevent zoom on iOS */
        -webkit-appearance: none;
        appearance: none;
        border-radius: 4px;
    }

    .fullscreen-search-results {
        -webkit-overflow-scrolling: touch;
        /* Smooth scrolling on iOS */
    }

    .fullscreen-product-item:active,
    .fullscreen-faq-item:active {
        background-color: #f0f0f0;
    }

    /* Hide the regular dropdown on mobile when fullscreen is available */
    #searchDropdownHeader {
        display: none !important;
    }

    /* Ensure body doesn't scroll when fullscreen search is active */
    body.fullscreen-search-active {
        overflow: hidden !important;
        /* Don't use position fixed to avoid layout issues */
    }

    /* Make search input clickable on mobile */
    #zoekenheader,
    #searchBox {
        cursor: pointer !important;
        -webkit-user-select: none;
        user-select: none;
    }

    /* Add visual feedback when tapping search input */
    #zoekenheader:active,
    #searchBox:active {
        background-color: #f8f8f8 !important;
    }
}

/* Improve overall mobile experience */
@media screen and (max-width: 768px) {
    .fullscreen-search-overlay.active {
        /* Only apply aggressive positioning when overlay is actually active */
        position: fixed !important;
        top: 0 !important;
        left: 0 !important;
        right: 0 !important;
        bottom: 0 !important;
        width: 100vw !important;
        height: 100vh !important;
        max-width: none !important;
        max-height: none !important;
        margin: 0 !important;
        padding: 0 !important;
    }

    /* Ensure hidden overlay doesn't affect layout */
    .fullscreen-search-overlay:not(.active) {
        display: none !important;
        position: absolute !important;
        top: -9999px !important;
        left: -9999px !important;
        width: 0 !important;
        height: 0 !important;
        opacity: 0 !important;
        visibility: hidden !important;
        pointer-events: none !important;
        z-index: -1 !important;
    }

    .fullscreen-search-header {
        position: sticky;
        top: 0;
        z-index: 10;
        box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    }

    /* copilot:disable */
    .fullscreen-search-results {
        padding-bottom: 400px;
        /* Reduced from 400px to prevent white space */
    }

    .fullscreen-search-overlay:not(.active) .fullscreen-search-results {
        padding-bottom: 0;
        /* No padding when overlay is hidden */
    }

    /* copilot:enable */
}

/* Fix for Chrome mobile white space issue */
@media screen and (max-width: 768px) {
    /* copilot:disable */
    body {
        min-height: 100vh; /* Ensure body doesn't extend beyond viewport */
        overflow-x: hidden; /* Prevent horizontal scrolling issues */
    }
    
    .fullscreen-search-overlay:not(.active) {
        display: none !important;
        height: 0 !important;
        overflow: hidden !important;
        transform: translate3d(-100%, -100%, 0) !important; /* Move completely out of view */
    }
    /* copilot:enable */
}

/* Fullscreen suggestion items */
.fullscreen-suggestion-item {
    padding: 12px 15px;
    border-bottom: 1px solid #eee;
    cursor: pointer;
    transition: background-color 0.2s ease;
}

.fullscreen-suggestion-item:hover,
.fullscreen-suggestion-item:active {
    background-color: #f9f9f9;
}

.fullscreen-suggestion-content {
    display: flex;
    align-items: center;
}

.fullscreen-suggestion-content .search-icon {
    margin-right: 10px;
    font-size: 14px;
    color: #666;
}

.fullscreen-suggestion-content .suggestion-text {
    font-size: 15px;
    color: #333;
    line-height: 1.4;
}

/* Highlight search terms in suggestions */
.fullscreen-suggestion-content .highlight {
    font-weight: 600;
    color: #ff7100;
    background-color: rgba(255, 113, 0, 0.1);
}

/* Search input container with button */
.search-input-container {
    position: relative;
    display: flex;
    align-items: center;
    width: 100%;
}

.search-input-container #searchBox {
    flex: 1;
    padding-right: 45px;
    /* Make room for the search button */
    border-radius: 4px 0 0 4px;
}

.search-button {
    position: absolute;
    right: 0;
    top: 0;
    bottom: 0;
    width: 40px;
    background: #ff7100;
    border: 1px solid #ff7100;
    border-left: none;
    border-radius: 0 4px 4px 0;
    color: white;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    transition: background-color 0.2s ease;
}

.search-button:hover {
    background: #e6640a;
}

.search-button:active {
    background: #cc5a09;
}

/* Adjust search box when it has a button */
.search-input-container #searchBox {
    border-radius: 4px 0 0 4px;
    border-right: none;
}

.search-input-container #searchBox:focus {
    border-color: #ff7100;
    outline: none;
}