/**
 * Typesense Search Popup Styles
 */

:root {
    --typesense-search-popup-gap: 6px;
    --typesense-search-popup-outer-margin: 24px;
    --typesense-search-popup-max-height: 687px;
    --typesense-search-popup-max-width: 1370px;
    --typesense-popular-searches-max-width: 171px;
    --typesense-search-bar-height: 52px;
    --typesense-results-list-grid-row-items-count: 5;
}

/* Main popup backdrop â€” display/hide handled by popup.js via fadeIn/fadeOut */
#typesense-search {
    position: fixed;
    top: 0;
    left: 0;
    height: 100%;
    width: 100%;
    background-color: rgba(0, 0, 0, 0.30);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    z-index: 10000;
}

/* Popup container â€” fixed-positioned content box inside the backdrop */
.typesense-search-popup {
    position: fixed;
    top: var(--typesense-search-popup-outer-margin, 24px);
    left: 0;
    right: 0;
    gap: var(--typesense-search-popup-gap, 6px);
    display: flex;
    flex-direction: column;
    height: 100vh;
    width: calc(100vw - var(--typesense-search-popup-outer-margin, 0px) * 2);
    max-height: var(--typesense-search-popup-max-height, 635px);
    max-width: var(--typesense-search-popup-max-width, 768px);
    margin: 0 auto;
    overflow: hidden;
    z-index: 10001;
}

/* Search form */
.typesense-search-popup .typesense-form {
    flex: 0 0 auto;
    height: var(--typesense-search-bar-height, 40px);
    padding: 0 20px;
    background-color: #FFF;
    border-radius: 2px;
    border: 1px solid #E8E8E8;
}

.typesense-search-popup .typesense-form input {
    height: 50px;
    width: 100%;
    padding: 10px 0;
    font-size: 18px;
    line-height: 20px;
    background-color: #FFF;
    border: 0;
    min-height: auto;
}

.typesense-search-popup .typesense-form input::-webkit-search-cancel-button {
    display: none;
}

.typesense-search-popup .ais-SearchBox-form {
    position: relative;
    display: flex;
    align-items: center;
}

.typesense-search-popup .ais-SearchBox-input {
    order: 1;
    outline: none;
}

.typesense-search-popup .ais-SearchBox-loadingIndicator,
.typesense-search-popup .ais-SearchBox-submit,
.typesense-search-popup .ais-SearchBox-reset,
.header-search-toolbar .ais-SearchBox-loadingIndicator,
.header-search-toolbar .ais-SearchBox-submit,
.header-search-toolbar .ais-SearchBox-reset {
    display: flex;
    align-items: center;
    justify-content: center;
    flex: 0 0 auto;
    height: 32px;
    width: 32px;
    padding: 0;
    text-align: center;
    background-color: transparent;
    border-radius: 100%;
    min-height: auto;
}

.typesense-search-popup .ais-SearchBox-loadingIndicator[hidden],
.header-search-toolbar .ais-SearchBox-loadingIndicator[hidden]{
    visibility: hidden;
    opacity: 0;
    pointer-events: none;
    transition: none;
}

.typesense-search-popup .ais-SearchBox-submit,
.header-search-toolbar .ais-SearchBox-submit {
    order: 3;
}

.typesense-search-popup .ais-SearchBox-reset,
.header-search-toolbar .ais-SearchBox-reset {
    order: 2;
}

/* Image search button */
.typesense-search-popup .ais-SearchBox-image-upload,
.header-search-toolbar .ais-SearchBox-image-upload {
    display: flex;
    align-items: center;
    justify-content: center;
    flex: 0 0 auto;
    height: 32px;
    width: 32px;
    padding: 0;
    text-align: center;
    background-color: transparent;
    border: none;
    border-radius: 100%;
    cursor: pointer;
    order: 3;
    transition: 0.2s opacity ease-in-out;
    min-height: auto;
}

.typesense-search-popup .ais-SearchBox-image-upload:hover,
.header-search-toolbar .ais-SearchBox-image-upload:hover {
    opacity: 0.7;
}

.typesense-search-popup .ais-SearchBox-image-upload svg,
.header-search-toolbar .ais-SearchBox-image-upload svg {
    height: 20px;
    width: 18px;
}

.typesense-search-popup .ais-SearchBox-submit svg,
.typesense-search-popup .ais-SearchBox-reset svg,
.header-search-toolbar .ais-SearchBox-submit svg,
.header-search-toolbar .ais-SearchBox-reset svg {
    height: 18px;
    width: 18px;
}

.typesense-search-popup .ais-SearchBox-loadingIndicator,
.header-search-toolbar .ais-SearchBox-loadingIndicator {
    order: 1;
}

/* Content area */
.typesense-search-popup .typesense-content,
.header-search-toolbar .typesense-content {
    display: flex;
    flex-direction: column;
    color: var(--Text-Main, #1C1C1C);
    font-size: 18px;
    font-style: normal;
    font-weight: 400;
    line-height: 28px;
    background-color: #FFF;
    overflow: hidden;
    border-radius: 2px;
    border: 1px solid #E8E8E8;
}

.header-search-toolbar .typesense-content {
    position: absolute;
    width: 1024px;
    top: 52px;
    display: none;
}

.header-search-toolbar.opened .typesense-content{
    display: flex;
}

.typesense-content-inner {
    display: flex;
    gap: 36px;
    height: 100%;
    padding: 0 36px;
    overflow: hidden;
}

.typesense-search-header {
    display: block;
    flex: 0 0 auto;
    color: #0F0F0F;
    /* Paragraph 16/Medium */
    font-size: 16px;
    font-weight: 500;
    line-height: 26px;
}

/* Popular searches and results sections */
.typesense-popular-searches,
.typesense-results {
    display: flex;
    flex-direction: column;
    gap: 16px;
    padding: 24px 0;
}

.typesense-search-product-type-selector {
    margin: 0;
    list-style: none;
    display: flex;
    gap: 6px 12px;
    flex-wrap: wrap;
}

.typesense-search-product-type-selector > li,
.typesense-search-product-type-selector.search-page-type-tabs > a {
    cursor: pointer;
    color: #0F0F0F;
    text-align: center;

    /* Paragraph 14/Regular */
    font-size: 14px;
    line-height: 24px; /* 171.429% */
    border-radius: 30px;
    background: rgba(232, 232, 232, 0.30);
    padding: 6px 16px;
}

.typesense-search-product-type-selector > li.active,
.typesense-search-product-type-selector > li:hover,
.typesense-search-product-type-selector.search-page-type-tabs > a:hover,
.typesense-search-product-type-selector.search-page-type-tabs > a.active {
    color: white;
    border-radius: 30px;
    background: #0F0F0F;
}

.typesense-search-result-wrapper:not(.active) {
    display: none;
}

.typesense-popular-searches {
    width: var(--typesense-popular-searches-max-width, 171px);
    padding-right: 12px;
    border-right: 1px solid rgba(0, 0, 0, 0.15);
}

.typesense-results {
    display: flex;
    flex-direction: column;
    width: 100%;
}

.typesense-results > span {
    color: #0F0F0F;
    font-size: 16px;
    font-weight: 500;
    line-height: 26px;
}

/* Popular searches list */
#typesensePopularSearchesList ol {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 12px;
    margin: 0;
    padding: 0;
    list-style: none;
}

#typesensePopularSearchesList mark {
    border: 1px solid #E8E8E8;
    background: rgba(232, 232, 232, 0.70);
    color: #0F0F0F;
}

#typesensePopularSearchesList li {
    display: inline-block;
    max-width: 100%;
    padding: 6px 8px;
    color: var(--Text-Second, #585858);
    text-align: center;
    font-size: 14px;
    line-height: 21px;
    border-radius: 6px;
    cursor: pointer;
    border: 1px solid var(--Bg-Main, #E8E8E8);
    background: rgba(232, 232, 232, 0.20);
}

#typesensePopularSearchesList li:hover {
    background: rgba(232, 232, 232, 0.50);
}

#typesensePopularSearchesList li > div {
    white-space: nowrap;
    text-overflow: ellipsis;
    overflow: hidden;
}

.typesense-search-popup #typesensePopularSearchesList,
.header-search-toolbar #typesensePopularSearchesList,
.typesense-search-result-wrapper
{
    height: 100%;
}

.typesense-search-result-wrapper {
    overflow-x: hidden;
    overflow-y: auto;
}

.typesense-search-popup #typesensePopularSearchesList,
.header-search-toolbar #typesensePopularSearchesList {
    overflow-x: hidden;
    overflow-y: auto;
}

.typesense-search-popup .typesense-results-list .ais-Hits-list,
.typesense-search-popup .typesense-results-list .ais-Hits-list,
.header-search-toolbar .typesense-results-list .ais-Hits-list,
.header-search-toolbar .typesense-results-list .ais-Hits-list
{
    display: grid;
    grid-template-columns: repeat(var(--typesense-results-list-grid-row-items-count), minmax(0, 1fr));
    gap: 18px;
    margin: 0;
    list-style: none;
}

.typesense-search-popup .typesense-results-list .ais-Hits-item a,
.typesense-search-popup .typesense-results-list .ais-Hits-item a,
.header-search-toolbar .typesense-results-list .ais-Hits-item a,
.header-search-toolbar .typesense-results-list .ais-Hits-item a
{
    display: flex;
    height: auto;
    width: 100%;
    aspect-ratio: 1;
    background-color: var(--Bg-Second, #F3F3F3);
    border-radius: 8px;
}

.typesense-search-popup .typesense-results-list .ais-Hits-item picture,
.typesense-search-popup .typesense-results-list .ais-Hits-item picture,
.header-search-toolbar .typesense-results-list .ais-Hits-item picture,
.header-search-toolbar .typesense-results-list .ais-Hits-item picture
{
    height: 100%;
    width: 100%;
}

.typesense-search-popup .typesense-results-list .ais-Hits-item img,
.typesense-search-popup .typesense-results-list .ais-Hits-item img,
.header-search-toolbar .typesense-results-list .ais-Hits-item img,
.header-search-toolbar .typesense-results-list .ais-Hits-item img
{
    height: 100%;
    width: 100%;
    font-size: 0;
    background-color: var(--Bg-Second, #F3F3F3);
    object-fit: cover;
    object-position: center;
    border-radius: 8px;
    transition: 0.2s opacity ease-in-out;
}

.typesense-search-popup .typesense-all-results-wrapper,
.header-search-toolbar .typesense-all-results-wrapper {
    display: flex;
    align-items: center;
    justify-content: center;
    flex: 0 0 auto;
}

.typesense-search-popup .typesense-all-results-wrapper a,
.header-search-toolbar .typesense-all-results-wrapper a {
    letter-spacing: 0.56px;
    text-transform: uppercase;
    text-decoration: none;
    color: #0F0F0F;
    text-align: center;
    font-size: 16px;
    font-weight: 500;
    line-height: 26px; /* 162.5% */
    border: 1px solid #000;
    padding: 9px 32px;
    align-items: center;
}

.typesense-search-popup .typesense-all-results-wrapper a:hover,
.header-search-toolbar .typesense-all-results-wrapper a:hover {
    background: #000;
    color: white;
}

ul.search-product-type-selector {
    list-style: none;
    display: flex;
    justify-content: center;
    gap: 16px;
    margin: 0;
    flex-wrap: wrap;
}

ul.search-product-type-selector > li.active a,
ul.search-product-type-selector > li:hover a {
    background: var(--Text-Main, #1C1C1C);
}

ul.search-product-type-selector > li.active a,
ul.search-product-type-selector > li:hover a {
    color: #fff;
}

ul.search-product-type-selector > li a {
    display: inline-block;
    max-width: 100%;
    padding: 6px 12px;
    color: var(--Text-Second, #585858);
    text-align: center;
    font-size: 14px;
    line-height: 21px;
    background-color: var(--Bg-Second, #F3F3F3);
    border-radius: 30px;
    cursor: pointer;
    text-decoration: none;
}

#typesense-search .typesense-close-btn,
.header-search-toolbar .typesense-close-btn {
    position: absolute;
    right: 0px;
    height: 44px;
    width: 44px;
    padding: 14px;
    display: flex;
    align-items: center;
    cursor: pointer;
}

#typesense-search .typesense-close-btn svg,
.header-search-toolbar .typesense-close-btn svg {
    width: 100%;
    height: 100%;
}

@media (max-width: 1920px) {
    :root {
        --typesense-search-popup-max-height: 640px;
        --typesense-search-popup-max-width: 1025px;
        --typesense-results-list-grid-row-items-count: 4;
    }

    .typesense-search-popup .typesense-results-list .ais-Hits-item:nth-child(8) ~ .ais-Hits-item,
    .typesense-search-popup .typesense-results-list .ais-Hits-item:nth-child(8) ~ .ais-Hits-item,
    .header-search-toolbar .typesense-results-list .ais-Hits-item:nth-child(8) ~ .ais-Hits-item,
    .header-search-toolbar .typesense-results-list .ais-Hits-item:nth-child(8) ~ .ais-Hits-item
    {
        display: none;
    }

    @media (max-width: 1440px) {
        :root {
            --typesense-search-popup-max-height: 640px;
            --typesense-search-popup-max-width: 972px;
        }

        @media (max-width: 768px) {
            :root {
                --typesense-search-popup-outer-margin: 16px;
                --typesense-search-popup-max-height: 719px;
                --typesense-search-popup-max-width: 515px;
                --typesense-popular-searches-max-width: 100%;
                --typesense-results-list-grid-row-items-count: 3;
            }

            .typesense-search-popup {
                height: calc(100vh - var(--typesense-search-popup-outer-margin, 0px) * 2);
                max-height: calc(100vh - var(--typesense-search-popup-outer-margin, 0px) * 2);
            }

            .typesense-content-inner {
                flex-direction: column;
                gap: 12px;
                padding: 0 20px;
            }

            .typesense-popular-searches {
                padding: 20px 0 12px;
                border-right: none;
                border-bottom: 1px solid rgba(0, 0, 0, 0.15);
            }

            #typesensePopularSearchesList ol {
                flex-direction: row;
                flex-wrap: wrap;
            }

            .typesense-results {
                height: 100%;
                padding-top: 0;
                overflow: hidden;
            }

            .typesense-search-popup .typesense-results-list .ais-Hits-item:nth-child(6) ~ .ais-Hits-item,
            .typesense-search-popup .typesense-results-list .ais-Hits-item:nth-child(6) ~ .ais-Hits-item,
            .header-search-toolbar .typesense-results-list .ais-Hits-item:nth-child(6) ~ .ais-Hits-item,
            .header-search-toolbar .typesense-results-list .ais-Hits-item:nth-child(6) ~ .ais-Hits-item
            {
                display: none;
            }

            #typesensePopularSearchesList li {
                padding: 6px 8px;
                font-size: 12px;
                line-height: 18px;
            }

            .typesense-search-product-type-selector > li {
                font-size: 12px;
                padding: 4px 12px;
            }

            #typesensePopularSearchesList ol {
                gap: 8px;
            }

            .typesense-search-popup .typesense-form {
                padding: 0 16px;
            }

            @media (max-width: 500px) {
                :root {
                    --typesense-search-popup-max-height: 592px;
                    --typesense-results-list-grid-row-items-count: 2;
                }
            }
        }
    }
}

@-webkit-keyframes typesense-ball-beat {
    50% {
        opacity: 0.2;
        -webkit-transform: scale(0.75);
        transform: scale(0.75);
    }

    100% {
        opacity: 1;
        -webkit-transform: scale(1);
        transform: scale(1);
    }
}

@keyframes typesense-ball-beat {
    50% {
        opacity: 0.2;
        -webkit-transform: scale(0.75);
        transform: scale(0.75);
    }

    100% {
        opacity: 1;
        -webkit-transform: scale(1);
        transform: scale(1);
    }
}

.typesense-ball-beat > div {
    background-color: #b20200;
    width: 15px;
    height: 15px;
    border-radius: 100%;
    margin: 2px;
    -webkit-animation-fill-mode: both;
    animation-fill-mode: both;
    display: inline-block;
    -webkit-animation: typesense-ball-beat 0.7s 0s infinite linear;
    animation: typesense-ball-beat 0.7s 0s infinite linear;
}

.typesense-ball-beat > div:nth-child(2n-1) {
    -webkit-animation-delay: -0.35s !important;
    animation-delay: -0.35s !important;
}

.ais-SearchBox .search-image-control {
    display: none;
    height: var(--typesense-search-bar-height, 40px);
}

.ais-SearchBox.image-search-active .search-image-control {
    display: flex;
    width: 100%;
    align-items: center;
}

.ais-SearchBox.image-search-active .ais-SearchBox-submit {
    display: none;
}

.ais-SearchBox.image-search-active .ais-SearchBox-input {
    display: none;
}

.search-image-control .search-image {
    width: 24px;
    height: 24px;
    border-radius: 4px;
    overflow: hidden;
    background: var(--Bg-Second, #F3F3F3);
    display: inline-block;
}

.search-image-control .search-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.search-image-control .search-image-delete {display: inline-block;}

.search-image-control .search-image-delete svg {
    width: 14px;
    display: block;
}

.search-image-control-container {
    cursor: pointer;
    display: flex;
    padding-left: 12px;
    padding-right: 12px;
    border-radius: calc(var(--typesense-search-bar-height, 40px) * 0.8);
    flex-direction: row;
    gap: 8px;
    align-items: center;
    background-color: var(--Bg-Second, #F3F3F3);
    height: 80%;
}

.typesense-search-product-type-selector {
    font-size: 14px;
}

.typesense-search-product-type-selector.search-page-type-tabs {
    display: flex;
    align-items: center;
    justify-content: center;
    margin-top: 60px;
    gap: 12px;
}

@media (max-width: 1024px) {
    .header-search-toolbar .typesense-content{
        width: 100%;
    }
}

@media (max-width: 768px) {
    .typesense-search-product-type-selector.search-page-type-tabs {
        margin-top: 40px;
    }
}

.image-search-page-indicator {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 16px;
    padding: 0 var(--header-search-field-h-padding);
}
.image-search-page-thumb {
    width: 48px !important;
    height: 48px !important;
    object-fit: cover;
    border-radius: 4px;
    border: 1px solid #e0e0e0;
}
.image-search-page-label {
    font-size: 16px;
    color: #555;
}
