/* ── Theme variables ────────────────────────────────────────────────────── */
/* Defaults inherit from the active WP block-theme palette when available.  */
/* Override any of these in Appearance → Customize → Additional CSS.        */

:root {
    --eb-font-family:         Inter, sans-serif;
    --eb-color-primary:       #2271b1;
    --eb-color-primary-hover: #135e96;
    --eb-color-text:          #222;
    --eb-color-muted:         #666;
    --eb-color-border:        #e0e0e0;
    --eb-color-sale:          #c0392b;
    --eb-input-border:        #8c8f94;
    --eb-input-border-hover:  #72777c;
    --eb-input-bg:            #fff;
    --eb-sidebar-bg:          #f3f4f6;
    --eb-card-bg:             #fff;
    --eb-card-image-bg:       #f5f5f5;
}

/* ── Form element styles (no WP frontend equivalent) ───────────────────── */

.eb-select {
    font-size: 0.85rem;
    padding: 0.3rem 0.5rem;
    border: 1px solid var(--eb-input-border);
    border-radius: 4px;
    background: var(--eb-input-bg);
    color: var(--eb-color-text);
    cursor: pointer;
}

.eb-select:hover,
.eb-select:focus {
    border-color: var(--eb-input-border-hover);
    outline: none;
}

.eb-input {
    font-size: 0.85rem;
    padding: 0.3rem 0.5rem;
    border: 1px solid var(--eb-input-border);
    border-radius: 4px;
    background: var(--eb-input-bg);
    color: var(--eb-color-text);
}

.eb-input:focus {
    border-color: var(--eb-color-primary);
    outline: 1px solid var(--eb-color-primary);
}

/* ── Layout ─────────────────────────────────────────────────────────────── */

/* Apply theme font to the entire search page */
.eb-item-search-wrap,
.eb-item-search-wrap *:not(.BuyNowButton):not(.CheckPriceButton) {
    font-family: var(--eb-font-family);
}

.eb-item-search-wrap {
    display: flex;
    gap: 2rem;
    align-items: flex-start;
    max-width: 1400px;
    margin: 0 auto;
}

/* ── Toolbar ────────────────────────────────────────────────────────────── */

.eb-results-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: 0.5rem 0.75rem;
    margin-bottom: 1.25rem;
    border: 1px solid var(--eb-color-border);
    border-radius: 6px;
    flex-wrap: wrap;
}

.eb-toolbar-left {
    display: flex;
    align-items: center;
    gap: 0.25rem;
}

.eb-toolbar-right {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.eb-toolbar-right label {
    white-space: nowrap;
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--eb-color-text);
}


/* Toolbar buttons: just layout tweaks, let WP .button handle the rest */
.eb-toolbar-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    position: relative;
    border-color: var(--eb-color-border);
}

/* Active state = primary hover colors to stand out from inactive */
.eb-toolbar-btn.active,
.eb-item-search-wrap:not(.eb-sidebar-hidden) #eb-sidebar-toggle {
    background: var(--eb-color-primary-hover);
    border-color: var(--eb-color-primary-hover);
    color: #fff;
}

/* Hover tooltips for all toolbar buttons */
.eb-toolbar-btn[aria-label]::after {
    content: attr(aria-label);
    position: absolute;
    bottom: calc(100% + 6px);
    left: 50%;
    transform: translateX(-50%);
    background: rgba(0, 0, 0, 0.75);
    color: #fff;
    font-size: 0.7rem;
    white-space: nowrap;
    padding: 0.2rem 0.45rem;
    border-radius: 3px;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.15s;
    z-index: 10;
}

.eb-toolbar-btn[aria-label]:hover::after {
    opacity: 1;
}

/* View toggle button group */
.eb-view-btn-group {
    display: flex;
    margin-left: 0.25rem;
}

.eb-view-btn-group .eb-toolbar-btn {
    border-radius: 0;
}

.eb-view-btn-group .eb-toolbar-btn:first-child {
    border-radius: 3px 0 0 3px;
}

.eb-view-btn-group .eb-toolbar-btn:last-child {
    border-radius: 0 3px 3px 0;
}

.eb-results-count {
    margin-left: 0.6rem;
    font-size: 0.9rem;
    color: var(--eb-color-muted);
    white-space: nowrap;
}

/* Sidebar hidden */
.eb-sidebar-hidden .eb-item-search-sidebar {
    display: none;
}

/* ── Sidebar ────────────────────────────────────────────────────────────── */

.eb-item-search-sidebar {
    flex: 0 0 220px;
    min-width: 180px;
    position: sticky;
    top: 2rem;
    max-height: calc(100vh - 4rem);
    overflow-y: auto;
    background: var(--eb-sidebar-bg);
    border-radius: 8px;
    padding: 0.75rem 1rem 1rem;
}

.eb-sidebar-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 0.75rem;
}

.eb-sidebar-heading {
    font-size: 0.85rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--eb-color-text);
}

/* Clear button sizing inside sidebar */
.eb-sidebar-header .button {
    font-size: 0.78rem;
    padding: 0.15rem 0.55rem;
    min-height: 0;
}

.eb-filter-section-title {
    display: block;
    font-size: 0.8rem;
    font-weight: 700;
    margin: 0 0 0.4rem;
    color: var(--eb-color-text);
}

.eb-filter-sections {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    margin-bottom: 1rem;
}

.eb-filter-options {
    list-style: none;
    margin: 0;
    padding: 0;
}

.eb-filter-options li label {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    cursor: pointer;
    font-size: 0.8rem;
}


.eb-tag-count {
    margin-left: auto;
    font-size: 0.75em;
    opacity: 0.5;
}

.eb-filter-options li:nth-child(n+6) {
    display: none;
}

.eb-filter-section.eb-expanded .eb-filter-options li:nth-child(n+6) {
    display: list-item;
}

.eb-see-more {
    background: none;
    border: none;
    box-shadow: none;
    color: inherit;
    font-family: inherit;
    font-size: 0.8rem;
    font-weight: normal;
    text-transform: none;
    letter-spacing: normal;
    padding: 0.2rem 0;
    margin: 0;
    cursor: pointer;
    opacity: 0.6;
    text-decoration: underline;
}

.eb-see-more:hover,
.eb-see-more:focus {
    background: none;
    color: inherit;
    opacity: 1;
    text-decoration: underline;
}

/* ── Price filter ───────────────────────────────────────────────────────── */

.eb-price-filter {
    margin-top: 1rem;
}

.eb-no-price-label,
.eb-sale-filter label,
.eb-available-filter label,
.eb-reviewed-filter label {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    cursor: pointer;
    font-size: 0.8rem;
    font-weight: 700;
    color: var(--eb-color-text);
}

.eb-no-price-label {
    margin-top: 0.5rem;
}

.eb-sale-filter,
.eb-available-filter,
.eb-reviewed-filter {
    margin-top: 0.6rem;
}

.eb-price-inputs {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    margin-bottom: 0.75rem;
}

.eb-price-number {
    width: 0;
    flex: 1;
    min-width: 0;
}

.eb-price-slider-wrap {
    position: relative;
    height: 20px;
    display: flex;
    align-items: center;
}

.eb-price-track {
    position: absolute;
    left: 0;
    right: 0;
    height: 4px;
    background: var(--eb-color-border);
    border-radius: 2px;
    pointer-events: none;
}

.eb-price-track-fill {
    position: absolute;
    height: 100%;
    background: var(--eb-color-primary);
    border-radius: 2px;
}

.eb-price-range {
    position: absolute;
    width: 100%;
    height: 4px;
    background: transparent;
    -webkit-appearance: none;
    appearance: none;
    pointer-events: none;
    outline: none;
    margin: 0;
}

.eb-price-range::-webkit-slider-runnable-track { background: transparent; }
.eb-price-range::-moz-range-track             { background: transparent; }

.eb-price-range::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: var(--eb-color-primary);
    border: 2px solid #fff;
    box-shadow: 0 1px 4px rgba(0,0,0,0.25);
    cursor: pointer;
    pointer-events: all;
}

.eb-price-range::-moz-range-thumb {
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: var(--eb-color-primary);
    border: 2px solid #fff;
    box-shadow: 0 1px 4px rgba(0,0,0,0.25);
    cursor: pointer;
    pointer-events: all;
}

/* ── Results grid ───────────────────────────────────────────────────────── */

.eb-item-search-results {
    flex: 1;
    min-width: 0;
}

.eb-item-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 1.25rem;
}

/* ── Card ───────────────────────────────────────────────────────────────── */

.eb-item-card {
    background: var(--eb-card-bg);
    border: 1px solid var(--eb-color-border);
    border-radius: 6px;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    transition: box-shadow 0.15s ease;
}

.eb-item-card:hover {
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.10);
}

.eb-card-image {
    background: var(--eb-card-image-bg);
    aspect-ratio: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

.eb-card-image img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    padding: 0.5rem;
}

.eb-card-no-image {
    width: 100%;
    height: 100%;
    background: var(--eb-card-image-bg);
}

.eb-card-body {
    padding: 0.75rem;
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    flex: 1;
}

.eb-card-category {
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--eb-color-muted);
    margin: 0;
}

.eb-card-tags {
    font-size: 0.72rem;
    color: var(--eb-color-primary);
    margin: 0;
}

.eb-card-title {
    font-size: 0.9rem;
    font-weight: 600;
    margin: 0.15rem 0;
    line-height: 1.35;
    color: var(--eb-color-text);
}

.eb-card-review {
    font-size: 0.9rem;
    margin: 0.15rem 0;
}

.eb-card-price {
    font-size: 0.85rem;
    font-weight: 700;
    color: inherit;
    margin: 0;
}

.eb-card-price::before {
    content: 'Reg. Price: ';
    font-size: 0.72rem;
    font-weight: 400;
}

.eb-card-sale-price {
    font-size: 0.85rem;
    font-weight: 700;
    color: var(--eb-color-sale);
    margin: 0;
}

.eb-card-sale-price::before {
    content: 'On Sale: ';
    font-size: 0.72rem;
    font-weight: 400;
}

.eb-card-buy {
    margin-top: 0.5rem;
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
}

/* Buy buttons: use standard button styling in card context */
.eb-buy-btn {
    font-size: 0.78rem !important;
    padding: 0.3rem 0.65rem !important;
}

/* ── Infinite scroll sentinel ───────────────────────────────────────────── */

#eb-scroll-sentinel {
    height: 1px;
    margin-top: 2rem;
}

#eb-scroll-sentinel.eb-sentinel-loading::after {
    content: '';
    display: block;
    width: 28px;
    height: 28px;
    margin: 0 auto;
    border: 3px solid var(--eb-color-border);
    border-top-color: var(--eb-color-primary);
    border-radius: 50%;
    animation: eb-spin 0.7s linear infinite;
}

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

/* ── States ─────────────────────────────────────────────────────────────── */

.eb-loading,
.eb-error,
#eb-no-results {
    grid-column: 1 / -1;
    text-align: center;
    color: var(--eb-color-muted);
    padding: 2rem 0;
}

/* ── Card item ID (grid: hidden, list: shown) ───────────────────────────── */

.eb-card-item-id {
    display: none;
    font-size: 0.8rem;
    color: var(--eb-color-muted);
    margin: 0;
}

/* ── List view ──────────────────────────────────────────────────────────── */

#eb-item-grid.eb-view-list {
    grid-template-columns: 1fr;
    gap: 0;
}

#eb-item-grid.eb-view-list .eb-item-card {
    flex-direction: row;
    border-radius: 0;
    border-left: none;
    border-right: none;
    border-top: none;
    box-shadow: none;
}

#eb-item-grid.eb-view-list .eb-item-card:first-child {
    border-top: 1px solid var(--eb-color-border);
}

#eb-item-grid.eb-view-list .eb-card-image {
    flex: 0 0 130px;
    aspect-ratio: 1;
    border-radius: 0;
}

#eb-item-grid.eb-view-list .eb-card-body {
    padding: 0.875rem 1.25rem;
    gap: 0.2rem;
    justify-content: center;
}

#eb-item-grid.eb-view-list .eb-card-title {
    font-size: 1rem;
    margin: 0.1rem 0;
}


#eb-item-grid.eb-view-list .eb-card-prices {
    display: flex;
    flex-direction: row;
    align-items: baseline;
}

#eb-item-grid.eb-view-list .eb-card-price,
#eb-item-grid.eb-view-list .eb-card-sale-price {
    font-size: 0.95rem;
    margin: 0;
}

#eb-item-grid.eb-view-list .eb-card-price {
    color: inherit;
}

#eb-item-grid.eb-view-list .eb-card-price::before {
    content: 'Reg. Price: ';
    font-size: 0.72rem;
    font-weight: 400;
    color: inherit;
}

#eb-item-grid.eb-view-list .eb-card-sale-price::before {
    content: '\00a0\00a0\2014\00a0\00a0On Sale: ';
    font-size: 0.72rem;
    font-weight: 400;
}

#eb-item-grid.eb-view-list .eb-card-buy {
    margin-top: 0.4rem;
}

/* ── Card clickable ─────────────────────────────────────────────────────── */

.eb-item-card {
    cursor: pointer;
}

/* ── Modal ───────────────────────────────────────────────────────────────── */

.eb-modal-overlay,
.eb-modal-overlay * {
    font-family: var(--eb-font-family);
}

.eb-modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.72);
    z-index: 99999;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1.5rem;
    box-sizing: border-box;
}

body.eb-modal-open {
    overflow: hidden;
}

.eb-modal {
    background: var(--eb-card-bg);
    color: var(--eb-color-text);
    border-radius: 10px;
    width: clamp(320px, 75vw, 1400px);
    max-height: 90vh;
    overflow-y: auto;
    display: flex;
    gap: 0;
    position: relative;
    box-shadow: 0 24px 64px rgba(0, 0, 0, 0.3);
}

.eb-modal-close {
    position: absolute;
    top: 0.75rem;
    right: 0.75rem;
    background: var(--eb-color-border);
    border: none;
    color: var(--eb-color-text);
    width: 2rem;
    height: 2rem;
    border-radius: 50%;
    font-size: 1.1rem;
    line-height: 1;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1;
    transition: background 0.15s;
}

.eb-modal-close:hover {
    background: var(--eb-color-muted);
}

.eb-modal-image {
    flex: 0 0 45%;
    background: var(--eb-card-image-bg);
    border-radius: 10px 0 0 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1.5rem;
    min-height: 300px;
}

.eb-modal-image img {
    max-width: 100%;
    max-height: 360px;
    object-fit: contain;
}

.eb-modal-body {
    flex: 1;
    padding: 2rem 2rem 2rem 1.75rem;
    display: flex;
    flex-direction: column;
    gap: 0.6rem;
    overflow-y: auto;
}


.eb-modal-tags {
    color: var(--eb-color-primary);
    margin: 0.25rem 0 0;
}

.eb-modal-title {
    font-size: 1.35rem;
    font-weight: 700;
    color: var(--eb-color-text);
    margin: 0;
    line-height: 1.3;
}

.eb-modal-prices {
    display: flex;
    flex-direction: row;
    align-items: baseline;
    margin: 0.25rem 0;
}

.eb-modal-price {
    font-size: 1.5rem;
    font-weight: 800;
    color: inherit;
    margin: 0;
}

.eb-modal-price::before {
    content: 'Reg. Price: ';
    font-size: 0.85rem;
    font-weight: 400;
}

.eb-modal-sale-price {
    font-size: 1.5rem;
    font-weight: 800;
    color: var(--eb-color-sale);
    margin: 0;
}

.eb-modal-sale-price::before {
    content: '\00a0\00a0\2014\00a0\00a0On Sale: ';
    font-size: 0.85rem;
    font-weight: 400;
}

.eb-modal-features {
    margin-top: 0.25rem;
}

.eb-modal-features ul {
    margin: 0;
    padding: 0 0 0 1.2rem;
    display: flex;
    flex-direction: column;
    gap: 0.3rem;
}

.eb-modal-features li {
    font-size: 0.88rem;
    color: var(--eb-color-muted);
    line-height: 1.45;
}

.eb-modal-buy {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-top: 1rem;
}

/* ── Mobile filters FAB + drawer ─────────────────────────────────────────── */

.eb-filters-fab {
    display: none; /* shown only on mobile via media query */
}

.eb-sidebar-overlay {
    display: none; /* shown only on mobile when sidebar is open */
}

/* ── Responsive ─────────────────────────────────────────────────────────── */

@media (max-width: 700px) {
    .eb-item-search-wrap {
        flex-direction: column;
    }

    /* Sidebar becomes a fixed left-side drawer on mobile */
    .eb-item-search-sidebar {
        position: fixed !important;
        top: 0;
        left: 0;
        height: 100%;
        width: 75%;
        max-height: 100%;
        overflow-y: auto;
        border-radius: 0;
        z-index: 10000;
        transform: translateX(-100%);
        transition: transform 0.25s ease;
        /* keep the background/padding from the base rule */
    }

    body.eb-mobile-sidebar-open .eb-item-search-sidebar {
        transform: translateX(0);
    }

    /* Dim overlay */
    .eb-sidebar-overlay {
        display: block;
        position: fixed;
        inset: 0;
        background: rgba(0, 0, 0, 0.45);
        z-index: 9999;
        opacity: 0;
        pointer-events: none;
        transition: opacity 0.25s ease;
    }

    body.eb-mobile-sidebar-open .eb-sidebar-overlay {
        opacity: 1;
        pointer-events: auto;
    }

    /* Floating Filters button */
    .eb-filters-fab {
        display: flex;
        align-items: center;
        gap: 0.4rem;
        position: fixed;
        bottom: 1.5rem;
        right: 1.5rem;
        z-index: 9998;
        background: var(--eb-color-primary);
        color: #fff;
        border: none;
        border-radius: 999px;
        padding: 0.6rem 1.1rem;
        font-size: 0.9rem;
        font-weight: 600;
        box-shadow: 0 4px 14px rgba(0, 0, 0, 0.25);
        cursor: pointer;
        transition: background 0.15s;
    }

    .eb-filters-fab:hover {
        background: var(--eb-color-primary-hover);
    }

    /* Hide the toolbar hamburger on mobile — FAB replaces it */
    #eb-sidebar-toggle {
        display: none;
    }

    .eb-filter-sections {
        display: grid;
        grid-template-columns: repeat(2, 1fr);
        gap: 1rem;
    }

    .eb-item-grid {
        grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    }

    .eb-modal {
        flex-direction: column;
        max-height: 95vh;
    }

    .eb-modal-image {
        flex: none;
        border-radius: 10px 10px 0 0;
        min-height: 200px;
        padding: 1rem;
    }

    .eb-modal-image img {
        max-height: 220px;
    }

    .eb-modal-body {
        padding: 1.25rem;
    }
}
