/* Era_Search – fullpage search overlay */

/* Popular products section */
.era-search-popular__heading {
    font-size: 25px;
    font-weight: bold;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: #999;
    margin: 12px 48px 0;
    text-align: center;
}

/* Popular products has no sidebar, so override the flex layout to center the grid. */
.era-search-popular .era-search-results {
    display: block;
}

.era-search-popular .era-search-results__main {
    max-width: 1400px;
    width: 100%;
    margin: 0 auto;
    padding: 0 24px 32px;
    box-sizing: border-box;
}

/* Overlay container */
.era-search-overlay {
    position: fixed;
    top: var(--era-header-height, 60px);
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 500;
    opacity: 0;
    pointer-events: none;
    transform: translateY(-10px);
    transition: opacity 0.25s ease, transform 0.25s ease;
}

.era-search-overlay.is-open {
    opacity: 1;
    pointer-events: all;
    transform: translateY(0);
}

/* No-header variant: full-viewport overlay, stacks the pill header and results card */
.era-search-overlay--no-header {
    top: 0;
    z-index: 600;
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 48px 24px;
    box-sizing: border-box;
}

.era-search-overlay--no-header .era-search-overlay__results {
    border-top: none;
}

/* No-header panel: separate results card below the header pill */
.era-search-overlay--no-header .era-search-overlay__panel {
    width: 100%;
    max-width: 860px;
    height: auto;
    flex: 1;
    min-height: 0;
    max-height: 560px;
    margin-top: 20px;
    border-radius: 16px;
    overflow: hidden;
    overflow-y: scroll;
    scrollbar-width: none;
    overscroll-behavior: contain; /* reaching the end doesn't scroll the page */
    box-shadow: 0 8px 40px rgba(0, 0, 0, 0.25);
}

.era-search-overlay--no-header .era-search-overlay__panel::-webkit-scrollbar {
    display: none;
}

/* Semi-transparent backdrop behind the panel */
.era-search-overlay__backdrop {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0);
    backdrop-filter: blur(0px);
    -webkit-backdrop-filter: blur(0px);
    transition: backdrop-filter 0.35s ease, -webkit-backdrop-filter 0.35s ease, background 0.35s ease;
    /* backdrop-filter creates a compositing layer that can intercept pointer events
       even when visually behind the panel (z-index: 1). Keep it decorative only. */
    pointer-events: none;
}

.era-search-overlay.is-open .era-search-overlay__backdrop {
    background: rgba(0, 0, 0, 0.35);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
}

/* White search panel – flex column so input stays pinned, results scroll below */
.era-search-overlay__panel {
    position: relative;
    background: #fff;
    z-index: 1;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    display: flex;
    flex-direction: column;
    height: 100%;
}

/* Close button – floats at the same level as the section titles */
.era-search-overlay__close {
    position: absolute;
    top: 16px;
    right: 24px;
    z-index: 2;
    background: none;
    border: none;
    border-radius: 50%;
    cursor: pointer;
    font-size: 32px;
    line-height: 1;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #666;
    transition: color 0.15s, background 0.15s;
}

.era-search-overlay__close:hover {
    color: #000;
    background: rgba(0, 0, 0, 0.06);
}

/* No-header variant: header row containing the search form + close button */
.era-search-overlay__header {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 8px 56px;
    border-bottom: 1px solid #eee;
    flex-shrink: 0;
    position: relative;
    background: #fff;
}

.era-search-overlay--no-header .era-search-overlay__header {
    width: 100%;
    max-width: 860px;
    padding: 6px 16px 6px 20px;
    justify-content: flex-start;
    gap: 8px;
    border: 1px solid #e5e5e5;
    border-radius: 999px;
    box-shadow: 0 2px 16px rgba(0, 0, 0, 0.1);
    box-sizing: border-box;
}

.era-search-overlay__header .form.minisearch {
    flex: 0 1 600px;
    width: 100%;
    margin: 0;
    position: relative;
}

.era-search-overlay--no-header .era-search-overlay__header .form.minisearch {
    flex: 1;
}

/* Search icon shown in the no-header header */
.era-search-overlay__search-icon {
    display: none;
    flex-shrink: 0;
    align-items: center;
    color: #888;
    pointer-events: none;
}

.era-search-overlay--no-header .era-search-overlay__search-icon {
    display: flex;
}

/* Hide the label visually, same as Magento does in desktop view */
.era-search-overlay__header .label {
    border: 0;
    clip: rect(0, 0, 0, 0);
    height: 1px;
    margin: -1px;
    overflow: hidden;
    padding: 0;
    position: absolute;
    width: 1px;
}

.era-search-overlay__header .field.search {
    margin: 0;
}

/* Position relative so the search button can be absolute inside */
.era-search-overlay__header .control {
    margin: 0;
    padding: 0;
    border: 0;
    position: relative;
}

/* Replicate .block-search input styles that the theme applies via that ancestor selector */
.era-search-overlay__header .input-text {
    width: 100%;
    height: 32px;
    padding: 0 35px 0 9px;
    border: 1px solid #c2c2c2;
    border-radius: 1px;
    font-size: 14px;
    line-height: 1.42;
    color: inherit;
    background: #fff;
    box-sizing: border-box;
    margin: 0;
    position: static;
}

.era-search-overlay--no-header .era-search-overlay__header .input-text {
    height: 52px;
    padding: 0 12px;
    border: none;
    border-radius: 0;
    font-size: 17px;
    background: transparent;
    box-shadow: none;
}

.era-search-overlay--no-header .era-search-overlay__header .input-text:focus {
    outline: none;
    box-shadow: none;
    border: none;
}

/* Replicate .block-search .action.search absolute positioning */
.era-search-overlay__header .actions {
    position: absolute;
    right: 0;
    top: 0;
    bottom: 0;
    display: flex;
    align-items: center;
}

.era-search-overlay__header .action.search {
    display: inline-block;
    background: none;
    border: 0;
    padding: 0 10px;
    cursor: pointer;
    line-height: 1;
}

.era-search-overlay__header .action.search span {
    display: none;
}

.era-search-overlay__header .era-search-overlay__close {
    position: absolute;
    top: 50%;
    right: 16px;
    transform: translateY(-50%);
    padding: 0;
}

/* No-header: hide submit button (icon on left replaces it visually; Enter still submits) */
.era-search-overlay--no-header .era-search-overlay__header .actions {
    display: none;
}

/* No-header: pill-style close button, inline in the header row */
.era-search-overlay--no-header .era-search-overlay__header .era-search-overlay__close {
    position: static;
    transform: none;
    top: auto;
    right: auto;
    width: auto;
    height: auto;
    background: #0f0f1a;
    color: #fff;
    border-radius: 99px;
    padding: 9px 18px;
    font-size: 14px;
    font-weight: 500;
    flex-shrink: 0;
    gap: 6px;
}

.era-search-overlay--no-header .era-search-overlay__header .era-search-overlay__close:hover {
    background: #252540;
    color: #fff;
}

.era-search-overlay--no-header .era-search-overlay__header .era-search-overlay__close kbd {
    background: rgba(255, 255, 255, 0.18);
    border-radius: 4px;
    padding: 1px 6px;
    font-family: inherit;
    font-size: 12px;
    letter-spacing: 0;
    line-height: 1.4;
}

/* Results area – full width, no centering so sidebar reaches the left edge */
.era-search-overlay__results {
    flex: 1;
    overflow-y: scroll;
    scrollbar-width: none;
    overscroll-behavior: contain; /* reaching the end doesn't scroll the page */
    position: relative;
    width: 100%;
    box-sizing: border-box;
    border-top: 1px solid #eee;
}

.era-search-overlay__results::-webkit-scrollbar {
    display: none;
}

@keyframes era-spin {
    to { transform: rotate(360deg); }
}

.era-search-overlay__loading {
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    gap: 12px;
    height: 100%;
    min-height: 200px;
    color: #666;
    font-style: italic;
}

.era-search-overlay__spinner {
    width: 32px;
    height: 32px;
    border: 3px solid #ddd;
    border-top-color: #333;
    border-radius: 50%;
    animation: era-spin 0.7s linear infinite;
}

.era-search-overlay__no-results {
    padding: 24px 24px;
    color: #666;
}

/* Results layout: sidebar flush-left + main content */
.era-search-results {
    display: flex;
    align-items: flex-start;
    min-height: 100%;
}

.era-search-results__sidebar {
    flex-shrink: 0;
    width: 200px;
    padding: 16px 16px 32px 24px;
    position: sticky;
    top: 0;
    align-self: flex-start;
}

.era-search-results__main {
    flex: 1;
    min-width: 0;
    padding: 0 24px 32px;
}

/* Products heading in main column */
.era-search-results__heading {
    font-size: 18px;
    font-weight: bold;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: #999;
    margin: 0 0 0;
    padding: 16px 0 0;
}

/* Category sidebar */
.era-search-sidebar__label {
    font-size: 18px;
    font-weight: bold;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: #999;
    margin: 0 0 8px;
}

.era-search-sidebar__list {
    list-style: none;
    margin: 0;
    padding: 0;
    border-right: 1px solid #eee;
}

.era-search-sidebar__list li {
    margin: 0;
}

.era-search-sidebar__item {
    display: block;
    padding: 7px 16px 7px 0;
    font-size: 14px;
    color: #444;
    text-decoration: none;
    border-left: 3px solid transparent;
    transition: color 0.15s, border-color 0.15s;
}

.era-search-sidebar__item:hover {
    color: #000;
    text-decoration: none;
    border-left-color: #ccc;
}

/* Horizontal filter bar – sits above the product grid inside the main column */
.era-search-filters {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
    padding: 12px 0;
    border-bottom: 1px solid #eee;
    margin-bottom: 4px;
}

/* Each filter is a positioned wrapper so the dropdown anchors to it */
.era-search-filter {
    position: relative;
}

/* Dropdown toggle button – matches the category-page filter style */
.era-search-filter__toggle {
    display: flex;
    align-items: center;
    gap: 8px;
    background: #fff;
    border: 1px solid #d1d5db;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
    color: #333;
    padding: 7px 14px;
    white-space: nowrap;
    transition: border-color 0.15s, background 0.15s;
    min-width: 144px;
    justify-content: space-between;
}

/* The theme styles every button:hover/:focus/:active (Porto: white text on its
   primary color), so the filter controls set their own colors for those states. */
.era-search-filter__toggle:hover,
.era-search-filter__toggle:focus,
.era-search-filter__toggle:active {
    border-color: #888;
    background: #fff;
    color: #333;
}

.era-search-filter.is-open .era-search-filter__toggle,
.era-search-filter__toggle.is-active,
.era-search-filter__toggle.is-active:hover,
.era-search-filter__toggle.is-active:focus,
.era-search-filter__toggle.is-active:active {
    border-color: #333;
    background: #f5f5f5;
    color: #333;
}

/* Chevron arrow */
.era-search-filter__chevron {
    display: inline-block;
    width: 0;
    height: 0;
    border-left: 4px solid transparent;
    border-right: 4px solid transparent;
    border-top: 5px solid #555;
    transition: transform 0.15s;
    flex-shrink: 0;
    margin-top: 1px;
}

.era-search-filter.is-open .era-search-filter__chevron {
    transform: rotate(180deg);
}

/* Dropdown panel */
.era-search-filter__dropdown {
    position: absolute;
    top: calc(100% + 4px);
    left: 0;
    z-index: 200;
    background: #fff;
    border: 1px solid #d1d5db;
    border-radius: 4px;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.12);
    min-width: 180px;
    padding: 4px 0;
}

/* Category option list */
.era-search-filter__list {
    list-style: none;
    margin: 0;
    padding: 0;
    max-height: 260px;
    overflow-y: auto;
    overscroll-behavior: contain; /* reaching the end doesn't scroll the page */
}

/* Scoped to the list so it outranks the theme's button:not(.primary) */
.era-search-filter__list .era-search-filter__option {
    display: block;
    width: 100%;
    background: none;
    border: none;
    cursor: pointer;
    text-align: left;
    padding: 9px 16px;
    font-size: 14px;
    color: #333;
    transition: background 0.12s;
}

.era-search-filter__list .era-search-filter__option:hover,
.era-search-filter__list .era-search-filter__option:focus,
.era-search-filter__list .era-search-filter__option:active {
    background: #f5f5f5;
    border: none;
    color: #333;
}

.era-search-filter__list .era-search-filter__option.is-active {
    font-weight: 600;
    color: #000;
}

.era-search-filter__count {
    color: #999;
    font-size: 0.8em;
}

/* Price slider inside dropdown */
.era-price-slider {
    padding: 16px 20px 20px;
    width: 240px;
}

.era-price-slider__values {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 14px;
    color: #333;
    margin-bottom: 16px;
}

.era-price-slider__sep {
    color: #999;
}

/* Track + dual range inputs */
.era-price-slider__track-wrap {
    position: relative;
    height: 28px;
    display: flex;
    align-items: center;
    margin-bottom: 16px;
}

.era-price-slider__track {
    position: absolute;
    left: 0;
    right: 0;
    height: 4px;
    background: #ddd;
    border-radius: 2px;
}

.era-price-slider__range {
    position: absolute;
    height: 4px;
    background: #222;
    border-radius: 2px;
}

.era-price-slider__input {
    position: absolute;
    width: 100%;
    height: 4px;
    -webkit-appearance: none;
    appearance: none;
    background: transparent;
    pointer-events: none;
}

.era-price-slider__input::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: #222;
    cursor: pointer;
    pointer-events: all;
    border: 2px solid #fff;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.3);
}

.era-price-slider__input::-moz-range-thumb {
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: #222;
    cursor: pointer;
    pointer-events: all;
    border: 2px solid #fff;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.3);
}

/* Scoped to the slider so it outranks the theme's button:not(.primary) */
.era-price-slider .era-price-slider__apply {
    display: block;
    width: 100%;
    background: #222;
    color: #fff;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
    padding: 8px 0;
    transition: background 0.15s;
}

.era-price-slider .era-price-slider__apply:hover,
.era-price-slider .era-price-slider__apply:focus,
.era-price-slider .era-price-slider__apply:active {
    background: #000;
    color: #fff;
}

/* Clear filters button */
.era-search-filters__clear {
    background: none;
    border: 1px solid #d1d5db;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
    color: #666;
    padding: 7px 14px;
    transition: border-color 0.15s, color 0.15s;
    white-space: nowrap;
}

.era-search-filters__clear:hover,
.era-search-filters__clear:focus,
.era-search-filters__clear:active {
    border-color: #888;
    background: none;
    color: #333;
}

/* Product grid */
.era-search-results__category-note {
    padding: 12px 0 0;
    font-size: 14px;
    color: #555;
}

.era-search-results__count {
    padding: 12px 0 4px;
    font-size: 14px;
    color: #888;
}

/* Container that receives the full list.phtml output. */
.era-search-results__grid {
    padding: 16px 0 32px;
}

/* Hide the toolbar (sort / pagination) — the modal has its own "show more" */
.era-search-results__grid .toolbar-products {
    display: none;
}

/* Override Luma's flex-based product grid with CSS Grid for compact, consistent columns. */
.era-search-results__grid .products-grid .product-items {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 16px;
    margin: 0;
    width: 100%;
    box-sizing: border-box;
}

.era-search-results__grid .products-grid .product-item {
    width: 100% !important;
    min-width: 0 !important;
    max-width: 100% !important;
    margin: 0;
    box-sizing: border-box;
}

/* 4 columns only on the full-height overlay (not the card modal, which is max 860px wide) */
@media (min-width: 1200px) {
    .era-search-overlay:not(.era-search-overlay--no-header) .era-search-results__grid .products-grid .product-items {
        grid-template-columns: repeat(4, 1fr);
    }
}

@media (max-width: 767px) {
    .era-search-results__grid .products-grid .product-items {
        grid-template-columns: repeat(2, 1fr);
        gap: 12px;
    }
}

/* Show more button */
.era-search-results__more-wrap {
    text-align: center;
    padding: 24px 0 8px;
}

.era-search-results__more {
    background: none;
    border: 2px solid #333;
    border-radius: 4px;
    cursor: pointer;
    font-size: 15px;
    padding: 10px 32px;
    text-align: center;
    transition: background 0.15s, color 0.15s;
}

.era-search-results__more:hover {
    background: #333;
    color: #fff;
}

.era-search-results__more:disabled {
    opacity: 0.5;
    cursor: default;
}

/* Prevent body scroll when overlay is open. The theme's overflow-x on <html> makes
   <html> the page's scroller, so this alone doesn't stop it: the JS also blocks
   wheel/touch scrolling outside the overlay's own scroll areas. */
body.era-search-open {
    overflow: hidden;
}

/* Keep the Magento search input on-screen while the overlay is open on mobile.
   Luma hides it with position:absolute;left:-300% when the label loses its active
   class (triggered by blur). The overlay should own that lifecycle instead. */
@media (max-width: 767px) {
    body.era-search-open .block-search input#search {
        position: static !important;
        left: auto !important;
    }
}

/* Mobile */
@media (max-width: 767px) {
    .era-search-overlay__close {
        top: 6px;
    }

    .era-search-popular {
        padding: 0 24px;
    }

    .era-search-popular .era-search-results__main {
        padding: 0 0 32px;
        width: 100%;
    }

    .era-search-popular__heading {
        margin: 12px 0 0;
    }

    .era-search-overlay__inner {
        padding: 8px 16px 16px;
    }

    .era-search-results {
        flex-direction: column;
    }

    .era-search-results__sidebar {
        width: 100%;
        padding: 12px 16px;
        border-right: none;
        border-bottom: 1px solid #eee;
        position: static;
    }

    .era-search-sidebar__list {
        display: flex;
        flex-wrap: wrap;
        gap: 8px;
        border-right: none;
    }

    .era-search-sidebar__item {
        border: 1px solid #ccc;
        border-left: 1px solid #ccc;
        border-radius: 99px;
        padding: 5px 12px;
        font-size: 14px;
    }

    .era-search-sidebar__item:hover {
        border-color: #000;
        border-left-color: #000;
    }

    .era-search-filters {
        gap: 6px;
        padding: 8px 0;
    }

    .era-search-filter__toggle {
        min-width: 0;
        font-size: 14px;
        padding: 6px 11px;
    }

    .era-price-slider {
        width: 200px;
    }

    .era-search-results__grid {
        padding: 8px 0 24px;
    }
}
