/* ============================================================================
   Superkul Search - Mobile-First Responsive CSS
   ============================================================================ */

/* Base Layout */
body {
    position: relative;
}

.searchkit-results-wrapper {
    display: none;
    position: absolute;
    background: #fff;
    z-index: 901;
    top: 150px;
    left: 50%;
    transform: translateX(-50%);
    max-width: 1400px;
    width: calc(100% - 40px);
    box-sizing: border-box;
    padding: 10px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

.searchkit-container {
    display: contents;
}


.searchkit-results-wrapper ul,
.searchkit-results-wrapper ol {
    padding-left: 0;
    margin: 0;
}

.searchkit-results-wrapper li {
    list-style: none;
}

/* Mobile-First: Filters Hidden by Default */
#searchkit-left {
    display: none;
    margin-bottom: 20px;
}

#searchkit-left.expanded {
    display: block;
}

#searchkit-left h2 {
    font-size: 16px;
    margin: 15px 0 10px;
    font-weight: 600;
    color: #333;
}

/* Hide facet wrapper when refinement list is empty */
.filter-facet-wrapper:has(.ais-RefinementList:not(:has(.ais-RefinementList-item))) {
    display: none;
}

/* Fallback for browsers that don't support :has() */
.filter-facet-wrapper.empty-facet {
    display: none;
}

#searchkit-right {
    width: 100%;
}

/* Filter Toggle Button (Mobile) */
#searchkit-filter-expand {
    display: block;
    text-align: center;
    border: 1px solid #ddd;
    padding: 10px;
    margin: 10px 0;
    background-color: #f9f9f9;
    cursor: pointer;
    border-radius: 4px;
    font-weight: 500;
}

#searchkit-filter-expand:hover {
    background-color: #eee;
}

/* Header (Stats + Hits Per Page) */
#searchkit-header {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-bottom: 15px;
}

#searchkit-stats {
    width: 100%;
    font-size: 14px;
    color: #666;
}

#hits-per-page {
    width: 100%;
}

#sort-by select,
#hits-per-page select {
    max-width: 200px;
    padding: 1px 30px;
    font-size: 14px;
    border: 1px solid #ccc;
    border-radius: 4px;
    background-color: white;
}

/* Product Grid - CSS Grid (Mobile: 2 columns) */
.ais-Hits-list {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
    margin: 0;
    padding: 0;
}

.ais-Hits-list.products.list.items.product-items,
.ais-Hits-list.products.list.items,
.ais-Hits-list.products {
    width: 100%;
}

.ais-Hits-list>.ais-Hits-item,
.ais-Hits-list>.item.product.product-item {
    width: auto;
    min-width: 0;
    margin: 0;
    float: none;
}

.ais-Hits-item {
    box-sizing: border-box;
    text-align: center;
    min-width: 0;
}

.ais-Hits-item .product-item-info {
    width: 100%;
    min-width: 0;
    margin: 0;
    padding: 2px;
    position: relative;
    border: 1px solid #e9e9e9;
    background: #fff;
    display: flex;
    flex-direction: column;
}

.ais-Hits-item .product-item-details,
.ais-Hits-item .product.name.product-item-name,
.ais-Hits-item .product-item-link {
    min-width: 0;
}

.ais-Hits-item .product-item-link {
    display: block;
    overflow-wrap: anywhere;
    font-size: 12px;
    line-height: 1.15;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
    min-height: 3.45em;
}

/* Product Image */
.ais-Hits-item .product-image-container {
    position: relative;
    width: 100%;
    display: block;
}

.ais-Hits-item .product-image-wrapper {
    position: relative;
    display: block;
    width: 100%;
    overflow: hidden;
}

.ais-Hits-item .product-image-photo {
    width: 100%;
    height: auto;
    display: block;
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    object-fit: cover;
}

/* Product Actions */


.ais-Hits-list .action.primary {
    background-color: #ff9e4d;
    border-color: #ff9e4d;
    flex: 1;
    font-size: 12px;
    padding: 6px 10px !important;
    border-radius: 18px;
    line-height: 1.1;
}

.ais-Hits-list .action.primary:hover {
    background-color: #ff8c33;
    border-color: #ff8c33;
}

.ais-Hits-list .action.primary,
.ais-Hits-list .view-product {
    background: none;
    border: none;
    flex: 1;
    font-size: 12px;
    padding: 6px 10px !important;
    color: #000000;
}

.ais-Hits-list .action.primary,
.ais-Hits-list .view-product:hover {
    text-decoration: none;
    color: #FFF;
}

.ais-Hits-item .stock.unavailable {
    position: absolute;
    z-index: 2;
    right: 2px;
    top: 2px;
    color: #FFF;
    background: red;
    padding: 4px 6px;
    font-size: 11px;
    line-height: 1.1;
    border-radius: 0;
    max-width: calc(100% - 8px);
    white-space: nowrap;
}

.ais-Hits-list .towishlist {
    border-radius: 25px;
    background-color: white;
    width: 40%;
    justify-content: center;
    align-items: center;
    height: 29px;
    display: flex;
}

.ais-Hits-list .towishlist:before {
    font-size: 16px;
    width: 18px;
    line-height: 18px;
    content: '\e600';
}

.ais-Hits-item .price-box {
    margin: 2px 0 6px;
}

.ais-Hits-item .price-box .price {
    font-size: 14px !important;
}

.ais-Hits-item .old-price .price {
    font-size: 11px !important;
}

.ais-Hits-item .product-item-actions {
    display: flex;
    flex-direction: row-reverse;
    justify-content: space-between;
    align-items: center;
    margin-top: auto;
}

.ais-Hits-item .actions-primary {
    width: 58%;
}

.ais-Hits-item .actions-primary+.actions-secondary {
    width: 42%;
    height: 29px;
    display: flex;
    align-items: center;
    justify-content: space-evenly;
    border-radius: 25px;
    background-color: #fff;
}

.ais-Hits-item .actions-secondary .action {
    width: 28px;
    min-width: 28px;
    height: 100%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.ais-Hits-item .actions-secondary .action.info-detail {
    font-size: 18px;
    color: #ff9e4d;
}

/* Facet Refinement Lists */
.ais-RefinementList-count {
    color: #888;
}

.ais-RefinementList-count:before {
    content: " (";
}

.ais-RefinementList-count:after {
    content: ")";
}

.ais-RefinementList-showMore {
    padding: 5px 7px;
    font-weight: normal;
    font-size: 13px;
}

.ais-RefinementList-showMore--disabled {
    display: none;
}

/* Pagination */
.ais-Pagination {
    margin: 30px 0;
    clear: both;
}

.ais-Pagination-list {
    display: flex;
    justify-content: center;
    flex-wrap: wrap;
    gap: 5px;
    list-style: none;
    padding: 0;
    margin: 0;
}

.ais-Pagination-item {
    margin: 0;
}

.ais-Pagination-link {
    display: inline-block;
    padding: 8px 14px;
    min-width: 40px;
    line-height: 1.42857;
    text-align: center;
    text-decoration: none;
    color: #333;
    background-color: #fff;
    border: 1px solid #ddd;
    border-radius: 3px;
    transition: all 0.2s ease;
}

.ais-Pagination-link:hover {
    background-color: #f5f5f5;
    border-color: #ccc;
    text-decoration: none;
}

.ais-Pagination-item--selected .ais-Pagination-link {
    background-color: #1979c3;
    color: #fff;
    border-color: #1979c3;
    cursor: default;
}

.ais-Pagination-item--selected .ais-Pagination-link:hover {
    background-color: #1979c3;
    border-color: #1979c3;
}

.ais-Pagination-item--disabled .ais-Pagination-link {
    color: #ccc;
    cursor: not-allowed;
    pointer-events: none;
}

.ais-Pagination-item--previousPage .ais-Pagination-link:before,
.ais-Pagination-item--nextPage .ais-Pagination-link:after {
    font-size: 16px;
    vertical-align: middle;
}

.ais-Pagination-item--previousPage .ais-Pagination-link:before {
    content: '\e617';
    margin-right: 5px;
}

.ais-Pagination-item--nextPage .ais-Pagination-link:after {
    content: '\e608';
    margin-left: 5px;
}

/* Discount Badge */
.ais-Hits-item .searchkit-discount-badge {
    position: absolute;
    bottom: 0;
    left: 0;
    z-index: 1;
    background: #ffff00;
    color: #000;
    font-size: 13px;
    font-weight: 600;
    padding: 2px 6px;
    line-height: 1.4;
    white-space: nowrap;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.3);
}

/* Loading & Empty States */
.searchkit-loading {
    text-align: center;
    padding: 40px 20px;
    color: #666;
    font-size: 16px;
}

.searchkit-no-results {
    padding: 40px 20px;
    text-align: center;
    color: #888;
    font-size: 16px;
}

/* Loading Skeleton */
.searchkit-skeleton {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
    margin: 20px 0;
}

.searchkit-skeleton-item {
    background: #f0f0f0;
    border-radius: 4px;
    overflow: hidden;
}

.searchkit-skeleton-image {
    width: 100%;
    padding-bottom: 125%;
    background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
    background-size: 200% 100%;
    animation: skeleton-loading 1.5s infinite;
}

.searchkit-skeleton-text {
    height: 15px;
    margin: 10px;
    background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
    background-size: 200% 100%;
    animation: skeleton-loading 1.5s infinite;
    border-radius: 3px;
}

#searchkit-results-container .product-item-link {
    text-transform: capitalize;
}

@keyframes skeleton-loading {
    0% {
        background-position: 200% 0;
    }

    100% {
        background-position: -200% 0;
    }
}

/* In-field search icon (mobile)
   Desktop keeps the existing .actions .action.search button, so this tappable
   icon is scoped to mobile where that button is hidden by the parent theme. */
.searchkit-input-search {
    display: none;
}

/* In-field clear ("X") control — lets customers wipe the current query.
   Rendered hidden and toggled by searchkit-app.js when the field has text. */
.block-search .control {
    position: relative;
}

.searchkit-input-clear {
    position: absolute;
    top: 0;
    bottom: 0;
    right: 40px;
    z-index: 3;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    min-width: 28px;
    margin: auto 0;
    padding: 0;
    border: 0;
    background: transparent;
    box-shadow: none;
    cursor: pointer;
    color: #323232;
    opacity: 0.65;
    transition: opacity 0.15s ease;
}

.searchkit-input-clear[hidden] {
    display: none;
}

button.searchkit-input-clear:hover {
    opacity: 1;
    background: none;
    border: none;
}

.searchkit-input-clear svg {
    display: block;
    width: 20px;
    height: 20px;
}

/* Visually hide the accessible label text. */
.searchkit-input-clear span {
    position: absolute;
    width: 1px;
    height: 1px;
    margin: -1px;
    padding: 0;
    border: 0;
    overflow: hidden;
    clip: rect(0 0 0 0);
    clip-path: inset(50%);
    white-space: nowrap;
}

/* Keep typed text clear of the X on desktop. */
#searchkit-input {
    padding-right: 40px;
}

@media (max-width: 767px) {
    .block-search .control {
        position: relative;
    }

    /* Reserve space so the icons never overlap typed text
       (44px search icon + the clear control to its left). */
    #searchkit-input {
        padding-right: 80px;
    }

    /* Sit to the left of the in-field search icon. */
    .searchkit-input-clear {
        right: 44px;
    }

    .searchkit-input-search {
        position: absolute;
        top: 0;
        right: 0;
        bottom: 0;
        z-index: 2;
        display: flex;
        align-items: center;
        justify-content: center;
        width: 44px;
        min-width: 44px;
        margin: 0;
        padding: 0;
        border: 0;
        background: transparent;
        box-shadow: none;
        cursor: pointer;
    }

    button.searchkit-input-search:hover {
        background: none;
        border: none;
    }

    .searchkit-input-search svg {
        display: block;
        width: 24px;
        height: 24px;
    }

    /* Visually hide the accessible label text. */
    .searchkit-input-search span {
        position: absolute;
        width: 1px;
        height: 1px;
        margin: -1px;
        padding: 0;
        border: 0;
        overflow: hidden;
        clip: rect(0 0 0 0);
        clip-path: inset(50%);
        white-space: nowrap;
    }
}

@media (max-width: 640px) {
    .searchkit-results-wrapper {
        width: 100%;
        position: absolute;
        top: var(--searchkit-sticky-height, 0);
        left: 0;
        transform: none;
        padding: 12px 12px 20px;
        box-shadow: none;
        border-radius: 12px;
    }
}

@media (max-width: 767px) {
    body.searchkit-results-mobile-open {
        padding-top: 0;
    }

    .searchkit-results-wrapper {
        top: var(--searchkit-sticky-height, 0);
        left: 0;
        transform: none;
        width: 100%;
        max-width: none;
        z-index: 901;
    }

    .ammenu-header-container.searchkit-header-container-stuck {
        position: sticky;
        top: 0;
        z-index: 929;
    }

    .header.content.searchkit-header-content-stuck {
        position: fixed;
        top: 0;
        left: var(--searchkit-sticky-left, 0);
        width: var(--searchkit-sticky-width, 100%);
        z-index: 930;
        margin: 0;
        box-shadow: 0 10px 24px rgba(0, 0, 0, 0.12);
    }

    body.searchkit-header-collapsed .page-header .panel.wrapper {
        display: none;
    }

    .block-search.searchkit-block-stuck {
        position: relative;
        top: auto;
        left: auto;
        width: 100%;
        z-index: auto;
        margin: 0;
        padding: 8px 10px;
        background: inherit;
    }

    body.searchkit-header-collapsed .block-search.searchkit-block-stuck {
        padding-top: 6px;
        padding-bottom: 6px;
    }

    .block-search.searchkit-block-stuck .block-title,
    .block-search.searchkit-block-stuck .actions {
        display: none;
    }

    .block-search.searchkit-block-stuck .block-content,
    .block-search.searchkit-block-stuck #search_mini_form,
    .block-search.searchkit-block-stuck .field.search,
    .block-search.searchkit-block-stuck .control {
        margin: 0;
        border: 0;
    }

    #searchkit-input.searchkit-input-stuck {
        position: static;
        top: auto;
        left: auto;
        width: 100%;
        z-index: auto;
        background: #fff;
        font-size: 16px;
    }

    .ais-Hits-list {
        gap: 4px;
    }

    .ais-Hits-item .product-item-info {
        padding: 2px;
    }

    .ais-Hits-item .product-item-link {
        font-size: 12px;
    }

    .searchkit-results-container {
        padding-left: 0;
        padding-right: 0;
    }
}

@media (max-width: 400px) {
    .ais-Hits-item .actions-secondary .action.info-detail {
        display: none !important;
    }

    .ais-Hits-item .actions-primary {
        width: 68%;
    }

    .ais-Hits-item .actions-primary+.actions-secondary {
        width: 32%;
    }
}

/* ============================================================================
   Tablet Breakpoint (@screen__s: 640px)
   ============================================================================ */
@media (min-width: 640px) {
    .searchkit-results-wrapper {
        padding: 15px;
    }

    /* 3 columns on small tablets */
    .ais-Hits-list {
        grid-template-columns: repeat(3, 1fr);
        gap: 15px;
    }

    .searchkit-skeleton {
        grid-template-columns: repeat(3, 1fr);
        gap: 15px;
    }

    #searchkit-header {
        flex-direction: row;
        justify-content: space-between;
        align-items: center;
    }

    #searchkit-stats,
    #hits-per-page {
        width: auto;
    }

    #hits-per-page {
        text-align: right;
    }
}

/* ============================================================================
   Desktop Breakpoint (@screen__m: 768px)
   ============================================================================ */
@media (min-width: 768px) {
    .searchkit-results-wrapper {
        display: grid;
        grid-template-columns: minmax(180px, 200px) 1fr;
        gap: 15px;
        padding: 15px;
    }

    /* Show filters permanently on desktop */
    #searchkit-left {
        display: block;
        margin-bottom: 0;
    }

    /* Hide filter toggle on desktop */
    #searchkit-filter-expand {
        display: none;
    }

    /* 3 columns on desktop */
    .ais-Hits-list {
        grid-template-columns: repeat(3, 1fr);
        gap: 15px;
    }

    .searchkit-skeleton {
        grid-template-columns: repeat(3, 1fr);
    }

    /* Fix for specific theme issue */
    body .ammenu-header-container .header.content .block-search input {
        top: auto;
    }
}

/* ============================================================================
   Large Desktop Breakpoint (@screen__l: 1024px)
   ============================================================================ */
@media (min-width: 1024px) {
    .searchkit-results-wrapper {
        grid-template-columns: minmax(190px, 210px) 1fr;
        gap: 15px;
        padding: 15px;
    }

    /* 4 columns on large desktop.
       Keep the wider column gutter but use the compact 15px row spacing
       so search rows match the category grid. */
    .ais-Hits-list {
        grid-template-columns: repeat(4, 1fr);
        column-gap: 20px;
        row-gap: 30px;
    }

    .searchkit-skeleton {
        grid-template-columns: repeat(4, 1fr);
        column-gap: 20px;
        row-gap: 15px;
    }

    #searchkit-left h2 {
        font-size: 18px;
    }

    .ais-Hits-list .action.primary {
        font-size: 15px;
        padding: 10px 12px;
    }
}

/* ============================================================================
   Extra Large Desktop Breakpoint (@screen__xl: 1440px)
   ============================================================================ */
@media (min-width: 1440px) {
    .searchkit-results-wrapper {
        grid-template-columns: minmax(260px, 270px) 1fr;
        gap: 15px;
        padding: 20px;
    }

    /* 4 columns on extra large screens */
    .ais-Hits-list {
        grid-template-columns: repeat(4, 1fr);
        column-gap: 20px;
        row-gap: 30px;
    }

    .searchkit-skeleton {
        grid-template-columns: repeat(4, 1fr);
    }
}

.searchkit-score-debug {
    position: relative;
    display: inline-block;
    font-size: 11px;
    color: #888;
    padding: 2px 6px;
    margin-top: 4px;
    background: #f5f5f5;
    border-radius: 3px;
    font-family: monospace;
    cursor: default;
}

.searchkit-score-tooltip {
    display: none;
    position: absolute;
    bottom: calc(100% + 5px);
    left: 0;
    background: rgba(0, 0, 0, 0.85);
    color: #fff;
    padding: 5px 10px;
    border-radius: 4px;
    font-size: 11px;
    font-family: monospace;
    white-space: nowrap;
    z-index: 999;
    pointer-events: none;
}

.searchkit-score-tooltip::after {
    content: '';
    position: absolute;
    top: 100%;
    left: 10px;
    border: 5px solid transparent;
    border-top-color: rgba(0, 0, 0, 0.85);
}

.searchkit-score-debug:hover .searchkit-score-tooltip {
    display: block;
}

/* Constrain footer/copyright to match results wrapper width when search is open */
body.searchkit-results-open .page-footer,
body.searchkit-results-open .copyright {
    max-width: 1400px;
    width: calc(100% - 40px);
    margin-left: auto;
    margin-right: auto;
    box-sizing: border-box;
}

body .searchkit-results-container .grid .products.list .product-item {
    margin-bottom: 0 !important;
}