/* RsElasticSearch — narrow centered input; wide results panel below */

/* —— Palette: every colour of the search widget lives here —— */
:root {
    /* surfaces */
    --rsel-panel-bg: #14161a;
    --rsel-panel-border: #2a2f37;
    --rsel-rail-bg: #191c21;
    --rsel-card-bg: #1b1f25;
    --rsel-card-border: #2a2f37;
    --rsel-chip-bg: #242a32;
    --rsel-flyout-bg: #14161a;
    --rsel-img-bg: #fff;
    --rsel-input-bg: #22262c;

    /* type */
    --rsel-text: #f5f6f7;
    --rsel-text-strong: #e8eaed;
    --rsel-text-dim: #8b939d;
    --rsel-input-text: #dfe3e8;
    --rsel-input-placeholder: #98a0aa;
    --rsel-label: #8b939d;

    /* brand accent */
    --rsel-accent: #e2382f;
    --rsel-accent-hover: #f04a3f;
    --rsel-accent-contrast: #fff;

    /* stock states — product-list semantics, toned down for the dark panel */
    --rsel-avail-in-stock: #5cc98a;
    --rsel-avail-on-order: #9aa4b2;
    --rsel-avail-unavailable: #e2382f;

    /* chrome */
    --rsel-scroll-thumb: #3a424c;
    --rsel-scroll-track: #1b1f25;
    --rsel-skeleton-base: #1b1f25;
    --rsel-skeleton-shine: #262c34;

    /* light hint on the results page */
    --rsel-serp-hint-bg: #f5f7fa;
    --rsel-serp-hint-border: #dfe3e8;
    --rsel-serp-hint-text: #2f353c;
    --rsel-serp-chip-bg: #fff;
    --rsel-serp-chip-border: #d8dde3;
    --rsel-serp-chip-text: #23282e;
}

/* Theme + header: keep search visible; fixed height on mobile so lupa stays aligned with cart/user */
#header .main-top .block-top,
#header .block-top {
  overflow: visible !important;
}

@media (min-width: 992px) {
  #header .main-top .block-top,
  #header .block-top {
    height: auto !important;
    min-height: 76px;
  }

  #header .block-top .rsel-search-widget {
    display: block !important;
    visibility: visible !important;
    clear: both;
    float: none;
    width: 440px;
    max-width: calc(100vw - 32px);
    margin: 10px auto 6px;
  }
}

@media (min-width: 992px) {
  #header .block-top .ac-form.ssa-searchblock-top {
    display: block !important;
    visibility: visible !important;
    clear: both;
    float: none;
    width: 440px;
    max-width: calc(100vw - 32px);
    margin: 10px auto 6px;
  }

  #header .block-top .ac-form.ssa-searchblock-top .search-input-content {
    display: block !important;
  }

  #header .block-top .ac-form.ssa-searchblock-top .ssa-search-query-input {
    display: block !important;
    width: calc(100% - 50px);
    min-width: 120px;
  }

  #header .rsel-search-widget .ac-form,
  .rsel-search-widget .ac-form {
    float: none;
    display: block;
    width: 440px;
    max-width: calc(100vw - 32px);
    margin: 0 auto;
    padding: 0 0 0 12px !important;
    color: var(--rsel-input-text);
    background-color: var(--rsel-input-bg) !important;
    border: 0;
    border-radius: 6px;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.25);
  }

  .rsel-search-widget .ac-form .search-input-content {
    display: block;
    overflow: hidden;
  }
}

.rsel-search-widget {
    position: relative;
    z-index: 100050;
    display: block;
    width: auto;
    max-width: none;
    margin: 10px auto 0;
    padding: 0;
    float: none;
    clear: both;
    font-family: "Helvetica Neue", Helvetica, Arial, sans-serif;
}

.rsel-search-widget *,
.rsel-search-widget *::before,
.rsel-search-widget *::after {
    box-sizing: border-box;
}

.rsel-search-widget .ac-form .search-icon {
    display: none;
    font-family: "FontAwesome" !important;
    font-size: 32px;
    line-height: 1;
    color: var(--rsel-input-text);
    text-align: center;
    cursor: pointer;
}

.rsel-search-widget .ac-form .search-icon::before {
  content: "\f002";
}

@media (min-width: 992px) {
  .rsel-search-widget .ssa-search-query-input,
  .rsel-search-widget .ac-form .ssa-search-query-input {
    float: left;
    width: calc(100% - 50px);
    height: 45px;
    line-height: 45px;
    padding: 6px;
    margin: 0;
    border: 0;
    font-size: 15px;
    color: var(--rsel-text) !important;
    background: none !important;
  }
}

.rsel-search-widget .ssa-search-query-input::placeholder {
  color: var(--rsel-input-text);
  opacity: 1;
}

.rsel-search-widget .ac-form .ae_icon {
    float: right;
    width: 50px;
    height: 45px;
    margin: 0;
    padding: 8px 10px;
    border: 0;
    background: none !important;
    cursor: pointer;
    line-height: 29px;
    text-align: center;
}

.rsel-search-widget .ac-form .ae_close_icon {
    display: none;
}

.rsel-search-widget .ac-form .ae_icon .fa::before {
    font-size: 25px;
    color: var(--rsel-input-placeholder) !important;
}

/* —— Mega panel: wide, centered under the input bar —— */
.rsel-search-widget .ae_megaautocomplete {
    position: absolute !important;
    top: calc(100% + 4px) !important;
    left: 50% !important;
    right: auto !important;
    width: 90vw !important;
    max-width: min(1400px, calc(100vw - 32px)) !important;
    min-width: min(440px, calc(100vw - 32px));
    margin: 0 !important;
    transform: translateX(-50%) !important;
    padding: 8px 10px;
    max-height: var(--rsel-ac-max-height, min(75vh, calc(100dvh - 96px)));
    background-color: var(--rsel-panel-bg) !important;
    border: 1px solid var(--rsel-panel-border);
    border-radius: 8px;
    box-shadow: 0 14px 42px rgba(0, 0, 0, 0.55);
    z-index: 100051;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    font-size: 12px;
    line-height: 1.35;
    color: var(--rsel-text);
}

#header .rsel-search-widget .ae_megaautocomplete,
#header .block-top .rsel-search-widget .ae_megaautocomplete {
    top: calc(100% + 4px) !important;
    left: 50% !important;
    right: auto !important;
    width: 90vw !important;
    max-width: min(1400px, calc(100vw - 32px)) !important;
    transform: translateX(-50%) !important;
}

#header .block-top .rsel-search-widget .ae_megaautocomplete {
    width: 90vw !important;
    max-width: min(1400px, calc(100vw - 32px)) !important;
}

/* Legacy elasticsearch / theme rules — scoped off inside our widget */
.rsel-search-widget .ae_megaautocomplete a {
    height: auto !important;
    overflow: visible !important;
    font-weight: 400;
}

.rsel-search-widget .ae_category,
.rsel-search-widget #ae_manufacturer {
    flex: 0 0 auto;
    margin: 0 0 6px;
    padding: 0;
    border: 0;
    font-size: 13px;
    font-weight: 700;
    color: var(--rsel-label);
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

/* —— Categories: fixed one-row height, horizontal scroll on desktop —— */
.rsel-search-widget .rsel-ac-section,
.rsel-search-widget #ae_c {
    flex: 0 0 auto;
    margin: 0 0 8px;
    padding: 0 0 8px;
    border-bottom: 1px solid var(--rsel-panel-border);
    background: transparent;
    float: none;
    width: 100%;
    max-width: 100%;
    min-width: 0;
    box-sizing: border-box;
}

.rsel-search-widget #ae_categories {
    display: flex;
    flex-wrap: nowrap;
    align-items: center;
    gap: 6px;
    margin: 0;
    padding: 0 2px 8px 0;
    height: auto;
    max-height: 44px;
    min-height: 36px;
    overflow-x: auto;
    overflow-y: hidden;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: thin;
    scrollbar-color: var(--rsel-scroll-thumb) var(--rsel-scroll-track);
    box-sizing: border-box;
}

.rsel-search-widget #ae_categories::-webkit-scrollbar {
    height: 4px;
}

.rsel-search-widget #ae_categories::-webkit-scrollbar-track {
    background: var(--rsel-scroll-track);
    border-radius: 4px;
}

.rsel-search-widget #ae_categories::-webkit-scrollbar-thumb {
    background: var(--rsel-scroll-thumb);
    border-radius: 4px;
}

.rsel-search-widget #ae_categories.rsel-can-scroll {
    mask-image: linear-gradient(to right, #000 0%, #000 94%, transparent 100%);
    -webkit-mask-image: linear-gradient(to right, #000 0%, #000 94%, transparent 100%);
}

.rsel-search-widget .ae_autocomplete_category {
    float: none;
    flex: 0 0 auto;
    width: auto;
    max-width: none;
    margin: 0;
    padding: 0;
    background-color: var(--rsel-rail-bg);
    border-radius: 4px;
}

.rsel-search-widget .ae_autocomplete_category a {
    display: flex;
    align-items: center;
    gap: 5px;
    padding: 5px 9px;
    color: var(--rsel-text);
    font-size: 11px;
    font-weight: 600;
    line-height: 1.25;
    text-decoration: none;
    white-space: nowrap;
    height: auto;
}

.rsel-search-widget .ae_autocomplete_category a:hover {
    color: var(--rsel-accent);
}

.rsel-search-widget .ae_autocomplete_category a:hover .rsel-ac-cat-icon {
    color: var(--rsel-accent);
}

.rsel-search-widget .rsel-ac-cat-icon {
    display: inline-flex;
    flex: 0 0 auto;
    align-items: center;
    justify-content: center;
    width: 12px;
    height: 12px;
    color: var(--rsel-text-dim);
    line-height: 0;
}

.rsel-search-widget .rsel-ac-cat-icon svg {
    display: block;
    width: 12px;
    height: 12px;
}

.rsel-search-widget .rsel-ac-cat-label,
.rsel-search-widget .ae_autocomplete_category span {
    display: inline;
    height: auto;
    line-height: inherit;
    font-size: inherit;
}

.rsel-search-widget .ae_autocomplete_category div {
    float: none;
    margin: 0;
}

/* Desktop: readable category type; full width above manufacturers + products */
@media (min-width: 992px) {
    .rsel-search-widget .rsel-ac-section,
    .rsel-search-widget #ae_c {
        width: 100%;
        max-width: 100%;
        margin-left: 0;
        padding-left: 0;
        padding-bottom: 10px;
        margin-bottom: 8px;
    }

    .rsel-search-widget .rsel-ac-section .ae_category {
        font-size: 12px;
        margin-bottom: 6px;
    }

    .rsel-search-widget #ae_categories {
        gap: 5px;
        height: auto;
        max-height: 44px;
        min-height: 36px;
        padding: 0 2px 10px 0;
        box-sizing: border-box;
    }

    .rsel-search-widget .ae_autocomplete_category a {
        padding: 5px 9px;
        font-size: 11px;
        letter-spacing: 0.01em;
        gap: 5px;
    }

    .rsel-search-widget .rsel-ac-cat-icon,
    .rsel-search-widget .rsel-ac-cat-icon svg {
        width: 12px;
        height: 12px;
    }
}

/* —— Manufacturers + products: fit viewport, scroll inside columns —— */
.rsel-search-widget .rsel-ac-body {
    display: flex;
    flex: 1 1 auto;
    align-items: stretch;
    gap: 0;
    min-height: 0;
    margin: 0;
    overflow: hidden;
}

.rsel-search-widget .rsel-ac-mfr,
.rsel-search-widget #ae_m {
    display: flex;
    flex-direction: column;
    flex: 0 0 16%;
    width: 16%;
    max-width: 16%;
    min-height: 0;
    margin: 0;
    padding: 0 8px 0 0;
    background: transparent;
    float: none;
}

.rsel-search-widget #ae_links {
    flex: 1 1 auto;
    min-height: 0;
    margin: 0;
    padding: 0;
    overflow-x: hidden;
    overflow-y: auto;
    scrollbar-width: thin;
    scrollbar-color: var(--rsel-scroll-thumb) var(--rsel-scroll-track);
}

.rsel-search-widget #ae_links a,
.rsel-search-widget .ae_megaautocomplete #ae_links a {
    display: block;
    margin: 0;
    padding: 0;
    font-size: 12px;
    font-weight: 700;
    line-height: 26px;
    color: var(--rsel-text);
    text-decoration: none;
    height: auto;
}

.rsel-search-widget #ae_links a:hover {
    color: var(--rsel-accent);
}

/* Desktop: cap manufacturers to products grid height (12 items = 4 rows) */
@media (min-width: 992px) {
    .rsel-search-widget .rsel-ac-body {
        align-items: flex-start;
    }

    .rsel-search-widget .rsel-ac-mfr,
    .rsel-search-widget #ae_m {
        align-self: flex-start;
        max-height: calc(4 * (86px + 5px));
        overflow: hidden;
    }

    .rsel-search-widget #ae_manufacturer {
        flex-shrink: 0;
    }

    .rsel-search-widget #ae_links {
        flex: 1 1 auto;
        min-height: 0;
        max-height: calc(4 * (86px + 5px) - 2rem);
        overflow-x: hidden;
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: thin;
        scrollbar-color: var(--rsel-scroll-thumb) var(--rsel-scroll-track);
        padding-right: 4px;
    }

    .rsel-search-widget #ae_links::-webkit-scrollbar {
        width: 6px;
    }

    .rsel-search-widget #ae_links::-webkit-scrollbar-track {
        background: var(--rsel-scroll-track);
        border-radius: 4px;
    }

    .rsel-search-widget #ae_links::-webkit-scrollbar-thumb {
        background: var(--rsel-scroll-thumb);
        border-radius: 4px;
    }

    .rsel-search-widget #ae_links.rsel-can-scroll {
        mask-image: linear-gradient(to bottom, #000 0%, #000 88%, transparent 100%);
        -webkit-mask-image: linear-gradient(to bottom, #000 0%, #000 88%, transparent 100%);
    }
}

/* —— Products grid: scroll inside panel when many results —— */
.rsel-search-widget .rsel-ac-products,
.rsel-search-widget #ae_p {
    display: flex;
    flex-direction: column;
    flex: 1 1 auto;
    min-width: 0;
    min-height: 0;
    width: auto;
    margin: 0;
    padding: 0;
    background: transparent;
    float: none;
}

.rsel-search-widget #ae_products {
    display: flex;
    flex: 1 1 auto;
    flex-wrap: wrap;
    align-content: flex-start;
    gap: 5px;
    width: 100%;
    min-height: 0;
    margin: 0;
    padding: 0;
    overflow-x: hidden;
    overflow-y: auto;
    scrollbar-width: thin;
    scrollbar-color: var(--rsel-scroll-thumb) var(--rsel-scroll-track);
}

.rsel-search-widget .ae_product_autocomplete {
    position: relative;
    float: none;
    flex: 0 0 calc(33.333% - 4px);
    width: calc(33.333% - 4px) !important;
    max-width: calc(33.333% - 4px);
    height: auto !important;
    min-height: 86px;
    margin: 0 !important;
    padding: 5px 6px !important;
    background-color: var(--rsel-card-bg) !important;
    border: 1px solid var(--rsel-card-border);
    border-radius: 4px;
    overflow: hidden;
    box-sizing: border-box;
}

.rsel-search-widget .ae_product_autocomplete.rsel-title-clamped:hover {
    overflow: visible;
    z-index: 25;
}

.rsel-search-widget .ae_product_autocomplete > a {
    display: block;
    height: auto;
    color: var(--rsel-text);
    font-size: 12px;
    font-weight: 400;
    line-height: 1.35;
    text-decoration: none;
}

.rsel-search-widget .ae_product_autocomplete > a:hover {
    color: var(--rsel-accent);
}

.rsel-search-widget .product_img {
    float: left;
    width: 28%;
    max-width: 72px;
}

.rsel-search-widget .product_img img {
    display: block;
    width: 100%;
    max-width: 86px;
    height: auto;
    background: var(--rsel-img-bg);
    border-radius: 3px;
}

.rsel-search-widget .product_name {
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
    margin-left: 30%;
    min-height: 72px;
    height: auto;
    line-height: 1.35;
    padding-right: 4px;
    overflow: hidden;
}

.rsel-search-widget .product_title,
.rsel-search-widget .product_name > div:first-child {
    flex: 0 1 auto;
    max-height: calc(1.35em * 2);
    margin: 0;
    font-size: 12px;
    font-weight: 500;
    color: var(--rsel-text);
    overflow: hidden;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    -webkit-box-orient: vertical;
    text-overflow: ellipsis;
    word-break: break-word;
    overflow-wrap: anywhere;
}

.rsel-search-widget .product_price {
    flex: 0 0 auto;
    margin: 4px 0 0;
    font-size: 12px;
    font-weight: 700;
    color: var(--rsel-text);
}

.rsel-search-widget .product_avail {
    flex: 0 0 auto;
    margin: 2px 0 0;
    font-size: 11px;
    font-weight: 600;
    line-height: 1.2;
    text-transform: uppercase;
}

/* Stock state comes from the indexed availability rank, so the dropdown can be
   recoloured without reindexing; rows indexed before the rank existed keep the
   inline colour the renderer falls back to. */
.rsel-search-widget .product_avail.rsel-avail-1 {
    color: var(--rsel-avail-in-stock);
}

.rsel-search-widget .product_avail.rsel-avail-2 {
    color: var(--rsel-avail-on-order);
}

.rsel-search-widget .product_avail.rsel-avail-3 {
    color: var(--rsel-avail-unavailable);
}

.rsel-search-widget .rsel-ac-precision-hint {
    margin: 10px 2px 2px;
    padding: 9px 0 0;
    border-radius: 0;
    background: transparent;
    border: 0;
    border-top: 1px solid var(--rsel-panel-border);
    color: var(--rsel-text-strong);
    font-size: 12px;
    line-height: 1.35;
}

.rsel-search-widget .rsel-ac-precision-hint .rsel-precision-head {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 7px;
}

.rsel-search-widget .rsel-ac-precision-hint .rsel-precision-message {
    margin: 0;
    color: var(--rsel-text-dim);
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.05em;
    text-transform: uppercase;
}

.rsel-search-widget .rsel-ac-precision-hint .rsel-precision-suggestions {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 5px;
}

.rsel-search-widget .rsel-ac-precision-hint .rsel-precision-suggestion {
    appearance: none;
    display: inline-flex;
    align-items: center;
    width: auto;
    max-width: 100%;
    text-align: left;
    border: 1px solid var(--rsel-panel-border);
    background: transparent;
    color: var(--rsel-text-strong);
    border-radius: 999px;
    padding: 4px 12px;
    font-size: 11px;
    line-height: 1.3;
    cursor: pointer;
    transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}

.rsel-search-widget .rsel-ac-precision-hint .rsel-precision-suggestion:hover {
    background: var(--rsel-chip-bg);
    border-color: var(--rsel-accent);
    color: var(--rsel-text);
}

.rsel-search-widget .rsel-ac-precision-hint .rsel-suggestion-query {
    font-size: 12px;
    font-weight: 700;
    line-height: 1.2;
    white-space: nowrap;
}

.rsel-serp-precision-hint {
    margin: 0 0 14px;
    padding: 10px 12px;
    border-radius: 6px;
    border: 1px solid var(--rsel-serp-hint-border);
    background: var(--rsel-serp-hint-bg);
    color: var(--rsel-serp-hint-text);
}

.rsel-serp-precision-hint .rsel-serp-precision-head {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 8px;
}

.rsel-serp-precision-hint .rsel-serp-precision-message {
    margin: 0;
    font-size: 13px;
    line-height: 1.35;
}

.rsel-serp-precision-hint .rsel-serp-precision-suggestions {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 6px;
}

.rsel-serp-precision-hint .rsel-serp-precision-suggestion {
    display: inline-flex;
    align-items: center;
    width: auto;
    max-width: 100%;
    text-align: left;
    border-radius: 999px;
    padding: 4px 12px;
    border: 1px solid var(--rsel-serp-chip-border);
    background: var(--rsel-serp-chip-bg);
    color: var(--rsel-serp-chip-text);
    text-decoration: none;
    transition: border-color 0.15s ease, color 0.15s ease;
}

.rsel-serp-precision-hint .rsel-serp-precision-suggestion:hover {
    border-color: var(--rsel-accent);
    color: var(--rsel-accent);
}

.rsel-serp-precision-hint .rsel-serp-suggestion-query {
    font-size: 13px;
    font-weight: 700;
    white-space: nowrap;
}

.rsel-search-widget .product_price.is-loading {
    opacity: 0.55;
}

.rsel-search-widget .rsel-ac-title-flyout {
    position: absolute;
    left: 4px;
    right: 4px;
    bottom: 100%;
    margin-bottom: 4px;
    padding: 8px 10px;
    font-size: 12px;
    font-weight: 500;
    line-height: 1.4;
    color: var(--rsel-text-strong);
    background: var(--rsel-flyout-bg);
    border: 1px solid var(--rsel-accent);
    border-radius: 4px;
    box-shadow: 0 6px 18px rgba(0, 0, 0, 0.55);
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    z-index: 30;
    word-break: break-word;
    overflow-wrap: anywhere;
    transition:
        opacity 0.15s ease,
        visibility 0.15s ease;
}

/* Flipped below the card when there is no room above inside the scroll area */
.rsel-search-widget .rsel-ac-title-flyout.rsel-ac-title-flyout--below {
    top: 100%;
    bottom: auto;
    margin-top: 4px;
    margin-bottom: 0;
}

.rsel-search-widget
    .ae_product_autocomplete.rsel-title-clamped:hover
    .rsel-ac-title-flyout {
    opacity: 1;
    visibility: visible;
}

/* —— Loading: dim existing results while re-searching —— */
.rsel-search-widget #ae_products.rsel-products-pending {
    position: relative;
    pointer-events: none;
}

.rsel-search-widget
    #ae_products.rsel-products-pending
    > .ae_product_autocomplete {
    opacity: 0.38;
    filter: grayscale(0.15);
    transition:
        opacity 0.12s ease,
        filter 0.12s ease;
}

.rsel-search-widget #ae_products.rsel-products-pending::after {
    content: "";
    position: absolute;
    inset: 0;
    z-index: 2;
    background: rgba(0, 0, 0, 0.28);
    border-radius: 4px;
    pointer-events: none;
}

/* —— Skeleton —— */
.rsel-search-widget .ae_product_skeleton {
    pointer-events: none;
}

.rsel-search-widget .ae_skeleton_block {
    background: linear-gradient(90deg, var(--rsel-skeleton-base) 0%, var(--rsel-skeleton-shine) 50%, var(--rsel-skeleton-base) 100%);
    background-size: 200% 100%;
    animation: rsel-skeleton 1s ease-in-out infinite;
    border-radius: 3px;
}

.rsel-search-widget .ae_skeleton_line {
    height: 10px;
    margin-bottom: 6px;
}

.rsel-search-widget .ae_skeleton_line.short {
    width: 55%;
}

.rsel-search-widget .product_img.ae_skeleton_block {
    width: 86px;
    height: 70px;
}

@keyframes rsel-skeleton {
    0% {
        background-position: 100% 0;
    }
    100% {
        background-position: -100% 0;
    }
}

/* —— Legacy grid reset —— */
.rsel-search-widget .ae_grid_1-4,
.rsel-search-widget .ae_grid_3-4,
.rsel-search-widget .ae_grid_4-4,
.rsel-search-widget .ae_grid_3-3 {
    float: none;
    width: auto;
    margin: 0;
    padding: 0;
    background: transparent;
}

.rsel-search-widget .ae_megaautocomplete #links,
.rsel-search-widget .ae_megaautocomplete #products {
    padding-top: 0;
}

.rsel-search-widget .rsel-ac-footer {
    flex: 0 0 auto;
    margin: 6px 0 0;
    padding: 8px 0 2px;
    border-top: 1px solid var(--rsel-panel-border);
    text-align: center;
}

.rsel-search-widget .rsel-ac-show-all-btn {
    display: inline-block;
    min-width: 220px;
    padding: 10px 20px;
    border: 1px solid var(--rsel-accent);
    border-radius: 5px;
    background: var(--rsel-accent);
    color: var(--rsel-accent-contrast) !important;
    font-size: 13px;
    font-weight: 700;
    line-height: 1.2;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    cursor: pointer;
}

.rsel-search-widget .rsel-ac-show-all-btn:hover {
    background: var(--rsel-accent-hover);
    border-color: var(--rsel-accent-hover);
    color: var(--rsel-accent-contrast) !important;
}

@media (min-width: 992px) {
  #header .block-top .rsel-search-widget {
    display: block !important;
    visibility: visible !important;
    overflow: visible;
    float: none;
    clear: both;
    width: auto;
    margin: 10px auto 4px;
  }

  #header .block-top:has(.rsel-search-widget) {
    min-height: 118px;
  }
}

/* —— Responsive grid: 3 cols → 12 products, 2 cols → 10, 1 col → 10 —— */
@media (max-width: 1100px) {
    .rsel-search-widget .ae_product_autocomplete {
        flex: 0 0 calc(50% - 3px);
        width: calc(50% - 3px) !important;
        max-width: calc(50% - 3px);
    }
}

@media (max-width: 768px) {
    .rsel-search-widget .rsel-ac-body {
        flex-direction: column;
    }

    .rsel-search-widget .rsel-ac-mfr,
    .rsel-search-widget #ae_m {
        flex: 0 0 auto;
        width: 100%;
        max-width: 100%;
        padding: 0 0 8px;
    }

    .rsel-search-widget #ae_links {
        max-height: 7rem;
    }

    .rsel-search-widget .rsel-ac-products,
    .rsel-search-widget #ae_p {
        flex: 1 1 auto;
        width: 100%;
        min-height: 0;
    }
}

@media (max-width: 599px) {
    .rsel-search-widget .ae_product_autocomplete {
        flex: 0 0 100%;
        width: 100% !important;
        max-width: 100%;
    }
}

body.rsel-search-overlay-open {
    overflow: hidden;
}

/* Desktop / tablet wide: always show the text field (not icon-only). */
@media (min-width: 992px) {
    .rsel-search-widget .ac-form .search-input-content {
        display: block !important;
    }

    .rsel-search-widget .ac-form .search-icon {
        display: none !important;
    }
}

@media (max-width: 991px) {
  /* Match theme mobile header (64px) so lupa aligns with user/cart icons */
  #header .main-top .block-top,
  #header .block-top {
    position: relative;
    height: 64px !important;
    min-height: 64px !important;
    max-height: 64px;
  }

  #header .block-top.search-minimalize,
  #header .main-top .block-top.search-minimalize {
    height: 110px !important;
    min-height: 110px !important;
    max-height: none;
  }

  /* Lupa stays in the same spot collapsed + expanded (do NOT depend on :not(.expanded)) */
  #header .block-top .rsel-search-widget,
  .rsel-search-widget {
    display: block !important;
    visibility: visible !important;
    position: static;
    width: 45px !important;
    max-width: 45px !important;
    float: right !important;
    clear: none !important;
    margin: 0 8px 0 0 !important;
    padding: 0 !important;
    z-index: 100050;
  }

  #header .block-top .rsel-search-widget .ac-form,
  .rsel-search-widget .ac-form {
    /* no position:relative — absolute input must bind to .block-top */
    position: static;
    float: right;
    clear: none;
    width: 45px !important;
    max-width: 45px !important;
    min-width: 0 !important;
    height: 45px;
    margin: 9px 0 0 0 !important;
    padding: 0 !important;
    display: block;
    overflow: visible;
    background: none !important;
    border: 0;
    border-radius: 0;
    box-shadow: none !important;
    cursor: pointer;
  }

  #header .block-top .rsel-search-widget .ac-form .search-icon,
  .rsel-search-widget .ac-form .search-icon {
    display: block !important;
    width: 45px;
    height: 45px;
    margin: 0;
    padding: 0;
    line-height: 45px;
    font-size: 28px;
    text-align: center;
    color: var(--rsel-input-text);
  }

  /* Input hidden until search-minimalize; positioned vs block-top, not vs tiny icon box */
  #header .block-top .rsel-search-widget .ac-form .search-input-content,
  .rsel-search-widget .ac-form .search-input-content {
    display: none !important;
  }

  #header .block-top.search-minimalize .rsel-search-widget .ac-form .search-input-content,
  .block-top.search-minimalize .rsel-search-widget .ac-form .search-input-content {
    display: flex !important;
    flex-direction: row;
    align-items: center;
    position: absolute;
    top: 64px;
    left: 3%;
    width: 94%;
    max-width: none;
    height: 40px;
    margin: 0;
    padding: 0 0 0 6px !important;
    transform: none;
    overflow: hidden;
    visibility: visible !important;
    pointer-events: auto !important;
    background-color: var(--rsel-input-bg) !important;
    border-radius: 5px;
    box-shadow: none;
    z-index: 100051;
  }

  .block-top.search-minimalize .rsel-search-widget .ac-form .ssa-search-query-input {
    flex: 1 1 auto;
    float: none;
    width: auto;
    min-width: 0;
    height: 36px;
    line-height: 36px;
    padding: 6px;
    margin: 0;
    border: 0;
    font-size: 15px;
    color: var(--rsel-text) !important;
    background: none !important;
  }

  .block-top.search-minimalize .rsel-search-widget .ac-form .ae_icon {
    flex: 0 0 36px;
    float: none;
    width: 36px;
    height: 36px;
    margin: 0;
    padding: 4px 0;
    line-height: 28px;
    text-align: center;
  }

  .block-top.search-minimalize .rsel-search-widget .ac-form .ae_close_icon {
    display: block !important;
  }

  /* Header lupa opens/closes; lupa inside input is redundant on mobile */
  .block-top.search-minimalize .rsel-search-widget .ac-form .ae_search_icon {
    display: none !important;
  }

  .block-top.search-minimalize .rsel-search-widget .ac-form .fa-close::before {
    font-size: 21px;
    color: var(--rsel-input-placeholder) !important;
  }

  .block-top.search-minimalize .rsel-search-widget .ae_megaautocomplete,
  #header .block-top.search-minimalize .rsel-search-widget .ae_megaautocomplete {
    position: fixed !important;
    top: 110px !important;
    left: 10px !important;
    right: 10px !important;
    width: auto !important;
    max-width: none !important;
    min-width: 0 !important;
    transform: none !important;
    max-height: calc(100dvh - 120px);
    margin: 0 !important;
    overflow: hidden;
    display: flex;
    flex-direction: column;
  }

  .block-top.search-minimalize .rsel-search-widget .rsel-ac-section {
    flex: 0 0 auto;
    width: 100%;
    max-width: 100%;
    margin-left: 0;
    padding-left: 0;
    max-height: none;
    overflow: visible;
    margin: 0 0 4px;
    padding-bottom: 6px;
  }

  .block-top.search-minimalize .rsel-search-widget .ae_category,
  .block-top.search-minimalize .rsel-search-widget #ae_manufacturer {
    margin: 0 0 3px;
    font-size: 11px;
    line-height: 1.2;
    letter-spacing: 0.03em;
  }

  .block-top.search-minimalize .rsel-search-widget #ae_categories {
    position: relative;
    flex-wrap: wrap;
    height: auto;
    max-height: 4.8rem;
    overflow-x: hidden;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    padding: 1px 6px 4px 0;
    gap: 4px;
    scrollbar-width: thin;
    scrollbar-color: var(--rsel-scroll-thumb) var(--rsel-scroll-track);
    mask-image: none;
    -webkit-mask-image: none;
  }

  .block-top.search-minimalize .rsel-search-widget #ae_categories::-webkit-scrollbar {
    width: 5px;
    height: auto;
  }

  .block-top.search-minimalize .rsel-search-widget #ae_categories::-webkit-scrollbar-track {
    background: var(--rsel-scroll-track);
    border-radius: 4px;
  }

  .block-top.search-minimalize .rsel-search-widget #ae_categories::-webkit-scrollbar-thumb {
    background: var(--rsel-scroll-thumb);
    border-radius: 4px;
  }

  .block-top.search-minimalize .rsel-search-widget .ae_autocomplete_category a {
    padding: 4px 8px 5px;
    font-size: 10px;
    line-height: 1.25;
    gap: 5px;
  }

  .block-top.search-minimalize .rsel-search-widget .rsel-ac-cat-icon,
  .block-top.search-minimalize .rsel-search-widget .rsel-ac-cat-icon svg {
    width: 11px;
    height: 11px;
  }

  .block-top.search-minimalize .rsel-search-widget .rsel-ac-mfr,
  .block-top.search-minimalize .rsel-search-widget #ae_m {
    position: relative;
    flex: 0 0 auto;
    max-height: none;
    overflow: hidden;
    padding: 0 0 4px;
  }

  .block-top.search-minimalize .rsel-search-widget #ae_links {
    max-height: 3.4rem;
    overflow-x: hidden;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    padding: 0 6px 2px 0;
    scrollbar-width: thin;
    scrollbar-color: var(--rsel-scroll-thumb) var(--rsel-scroll-track);
  }

  .block-top.search-minimalize .rsel-search-widget #ae_links a,
  .block-top.search-minimalize .rsel-search-widget .ae_megaautocomplete #ae_links a {
    font-size: 11px;
    font-weight: 600;
    line-height: 1.55rem;
    height: auto;
    padding: 0;
  }

  .block-top.search-minimalize .rsel-search-widget #ae_links::-webkit-scrollbar {
    width: 5px;
  }

  .block-top.search-minimalize .rsel-search-widget #ae_links::-webkit-scrollbar-track {
    background: var(--rsel-scroll-track);
    border-radius: 4px;
  }

  .block-top.search-minimalize .rsel-search-widget #ae_links::-webkit-scrollbar-thumb {
    background: var(--rsel-scroll-thumb);
    border-radius: 4px;
  }

  .block-top.search-minimalize .rsel-search-widget #ae_categories.rsel-can-scroll,
  .block-top.search-minimalize .rsel-search-widget #ae_links.rsel-can-scroll {
    mask-image: linear-gradient(to bottom, #000 0%, #000 90%, transparent 100%);
    -webkit-mask-image: linear-gradient(to bottom, #000 0%, #000 90%, transparent 100%);
  }

  .block-top.search-minimalize .rsel-search-widget .rsel-ac-body {
    flex: 1 1 auto;
    min-height: 0;
    overflow: hidden;
  }

  .block-top.search-minimalize .rsel-search-widget .rsel-ac-products,
  .block-top.search-minimalize .rsel-search-widget #ae_p {
    flex: 1 1 auto;
    min-height: 0;
    overflow: hidden;
    display: flex;
    flex-direction: column;
  }

  .block-top.search-minimalize .rsel-search-widget #ae_products {
    flex: 1 1 auto;
    min-height: 0;
    overflow-x: hidden;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    align-content: flex-start;
  }

  .block-top.search-minimalize .rsel-search-widget .rsel-ac-footer {
    flex: 0 0 auto;
    flex-shrink: 0;
    margin-top: auto;
    padding: 10px 0 calc(6px + env(safe-area-inset-bottom, 0));
    background: var(--rsel-panel-bg);
    border-top: 1px solid var(--rsel-panel-border);
  }
}

@media (min-width: 992px) {
    .block-top.search-minimalize {
        height: 110px;
    }

    .block-top.search-minimalize
        .rsel-search-widget
        .ac-form
        .search-input-content {
        position: absolute;
        display: block;
        width: 94%;
        left: 3%;
        top: 64px;
        padding: 0;
        background-color: var(--rsel-input-bg) !important;
    }

    .block-top.search-minimalize
        .rsel-search-widget
        .ac-form
        .ssa-search-query-input {
        width: 80%;
        height: 36px;
        line-height: 36px;
    }

    .block-top.search-minimalize .rsel-search-widget .ac-form .ae_search_icon,
    .block-top.search-minimalize .rsel-search-widget .ac-form .ae_close_icon {
        width: 36px;
        height: 36px;
    }

    .block-top.search-minimalize
        .rsel-search-widget
        .ac-form
        .fa-search::before,
    .block-top.search-minimalize
        .rsel-search-widget
        .ac-form
        .fa-close::before {
        font-size: 21px;
        color: var(--rsel-input-placeholder) !important;
    }
}
