/* GB Search Overlay */
:root {
    --gb-search-primary: #111;
    --gb-search-accent: #dc2626;
    --gb-search-bg: #ffffff;
}

/* Hide Avada native search overlay */
.fusion-overlay-search {
    display: none !important;
}

.gb-search-overlay {
    position: fixed;
    inset: 0;
    z-index: 99999;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(4px);
    display: none;
    align-items: flex-start;
    justify-content: center;
    padding-top: 5vh;
    opacity: 0;
    transition: opacity 0.2s ease;
}

.gb-search-overlay.is-open {
    display: flex;
    opacity: 1;
}

.gb-search-container {
    width: 90vw;
    max-width: 1100px;
    max-height: 85vh;
    background: var(--gb-search-bg);
    border-radius: 12px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    animation: gb-search-slide-in 0.25s ease-out;
}

@keyframes gb-search-slide-in {
    from {
        opacity: 0;
        transform: translateY(-20px) scale(0.98);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

/* Header / Input */
.gb-search-header {
    padding: 16px 20px;
    border-bottom: 1px solid #e5e7eb;
}

.gb-search-input-wrap {
    display: flex;
    align-items: center;
    gap: 12px;
}

.gb-search-icon {
    width: 22px;
    height: 22px;
    color: #9ca3af;
    flex-shrink: 0;
}

.gb-search-input {
    flex: 1;
    border: none;
    outline: none;
    font-size: 18px;
    padding: 8px 0;
    color: var(--gb-search-primary);
    background: transparent;
    font-family: inherit;
}

.gb-search-input::placeholder {
    color: #9ca3af;
}

.gb-search-close {
    background: none;
    border: none;
    font-size: 28px;
    color: #6b7280;
    cursor: pointer;
    padding: 0 4px;
    line-height: 1;
    transition: color 0.15s;
}

.gb-search-close:hover {
    color: var(--gb-search-primary);
}

/* Active filters */
.gb-search-active-filters {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 6px 20px;
}

.gb-search-active-filters:empty {
    display: none;
}

.gb-search-filter-tag {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    background: var(--gb-search-primary);
    color: #fff;
    border: none;
    border-radius: 20px;
    padding: 4px 12px;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: opacity 0.15s;
    font-family: inherit;
}

.gb-search-filter-tag:hover {
    opacity: 0.8;
}

.gb-search-filter-tag span {
    font-size: 15px;
    line-height: 1;
    color: inherit;
}

.gb-search-filter-clear {
    background: none;
    border: 1px solid #d1d5db;
    border-radius: 20px;
    padding: 4px 12px;
    font-size: 13px;
    color: #6b7280;
    cursor: pointer;
    transition: border-color 0.15s, color 0.15s;
    font-family: inherit;
}

.gb-search-filter-clear:hover {
    border-color: #9ca3af;
    color: #374151;
}

/* Body */
.gb-search-body {
    display: flex;
    flex: 1;
    overflow: hidden;
    min-height: 0;
}

/* Sidebar */
.gb-search-sidebar {
    width: 220px;
    flex-shrink: 0;
    padding: 20px;
    border-right: 1px solid #e5e7eb;
    overflow-y: auto;
}

.gb-search-sidebar h3 {
    font-size: 13px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: #374151;
    margin: 0;
    padding: 10px 0;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: space-between;
    user-select: none;
}

.gb-search-sidebar h3::after {
    content: '';
    width: 8px;
    height: 8px;
    border-right: 2px solid #9ca3af;
    border-bottom: 2px solid #9ca3af;
    transform: rotate(45deg);
    transition: transform 0.2s;
    flex-shrink: 0;
}

.gb-search-sidebar h3.is-open::after {
    transform: rotate(-135deg);
}

.gb-search-facet-group {
    border-bottom: 1px solid #e5e7eb;
}

.gb-search-facet-group ul {
    overflow: hidden;
    max-height: 0;
    transition: max-height 0.25s ease;
}

.gb-search-facet-group.is-open ul {
    max-height: 500px;
}

.gb-search-sidebar ul {
    list-style: none;
    margin: 0;
    padding: 0;
}

.gb-search-sidebar li {
    margin-bottom: 4px;
}

.gb-search-sidebar a {
    color: #374151;
    text-decoration: none;
    font-size: 14px;
    display: block;
    padding: 4px 8px;
    border-radius: 6px;
    transition: background 0.15s;
}

.gb-search-sidebar a:hover {
    background: #f3f4f6;
    color: var(--gb-search-primary);
}

.gb-search-sidebar li.is-active a {
    background: var(--gb-search-primary);
    color: #fff;
    font-weight: 600;
}

.gb-search-sidebar li.is-active a span {
    color: rgba(255, 255, 255, 0.7);
}

.gb-search-sidebar span {
    color: #9ca3af;
    font-size: 12px;
}

/* Price range slider */
.gb-search-price-filter {
    margin-bottom: 0;
    padding-bottom: 0;
    border-bottom: 1px solid #e5e7eb;
}

.gb-search-price-slider {
    overflow: hidden;
    max-height: 0;
    transition: max-height 0.25s ease;
    padding: 0;
}

.gb-search-price-filter.is-open .gb-search-price-slider {
    max-height: 200px;
    padding-bottom: 12px;
}

.gb-search-price-filter:empty {
    display: none;
}

.gb-search-price-filter h3 {
    font-size: 13px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: #374151;
    margin: 0;
}

.gb-search-price-labels {
    display: flex;
    justify-content: space-between;
    font-size: 13px;
    font-weight: 600;
    color: var(--gb-search-primary);
    margin-bottom: 8px;
}

.gb-search-price-range-wrap {
    position: relative;
    height: 24px;
}

.gb-search-price-range-wrap input[type="range"] {
    position: absolute;
    width: 100%;
    top: 0;
    left: 0;
    -webkit-appearance: none;
    appearance: none;
    background: transparent;
    pointer-events: none;
    margin: 0;
    height: 24px;
}

.gb-search-price-range-wrap input[type="range"]::-webkit-slider-runnable-track {
    height: 4px;
    background: #e5e7eb;
    border-radius: 2px;
}

.gb-search-price-range-wrap input[type="range"]:first-child::-webkit-slider-runnable-track {
    background: #e5e7eb;
}

.gb-search-price-range-wrap input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: var(--gb-search-primary);
    border: 2px solid #fff;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.2);
    cursor: pointer;
    pointer-events: auto;
    margin-top: -7px;
    position: relative;
    z-index: 1;
}

.gb-search-price-range-wrap input[type="range"]::-moz-range-track {
    height: 4px;
    background: #e5e7eb;
    border-radius: 2px;
    border: none;
}

.gb-search-price-range-wrap input[type="range"]::-moz-range-thumb {
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: var(--gb-search-primary);
    border: 2px solid #fff;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.2);
    cursor: pointer;
    pointer-events: auto;
}

/* Main results */
.gb-search-main {
    flex: 1;
    padding: 20px;
    overflow-y: auto;
    min-width: 0;
}

.gb-search-status {
    margin-bottom: 16px;
}

.gb-search-count {
    font-size: 14px;
    color: #6b7280;
    margin: 0;
}

.gb-search-count strong {
    color: var(--gb-search-primary);
    font-size: 16px;
}

.gb-search-count span {
    margin-left: 8px;
}

.gb-search-no-results {
    font-size: 15px;
    color: #6b7280;
    text-align: center;
    padding: 40px 0;
}

.gb-search-error {
    color: var(--gb-search-accent);
    text-align: center;
    padding: 20px;
}

/* Product grid */
.gb-search-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 20px;
}

.gb-search-product {
    display: flex;
    flex-direction: column;
    text-decoration: none;
    color: var(--gb-search-primary);
    background: #fff;
    border-radius: 12px;
    overflow: hidden;
    transition: box-shadow 0.2s;
    border: none;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.06);
}

.gb-search-product:hover {
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12);
}

.gb-search-product-img {
    position: relative;
    aspect-ratio: 3/4;
    background: #f5f5f5;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

.gb-search-product-img img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.gb-search-no-img {
    width: 60px;
    height: 60px;
}

.gb-search-no-img svg {
    width: 100%;
    height: 100%;
}

.gb-search-badge-discount {
    position: absolute;
    top: 10px;
    right: 10px;
    background: var(--gb-search-accent);
    color: #fff;
    font-size: 13px;
    font-weight: 700;
    padding: 4px 10px;
    border-radius: 6px;
    line-height: 1;
}

.gb-search-badge-oos {
    position: absolute;
    top: 10px;
    left: 10px;
    background: rgba(0, 0, 0, 0.6);
    color: #fff;
    font-size: 11px;
    font-weight: 600;
    padding: 4px 8px;
    border-radius: 4px;
}

.gb-search-badge-custom {
    position: absolute;
    bottom: 10px;
    left: 10px;
    background: var(--gb-search-primary);
    color: #fff;
    font-size: 11px;
    font-weight: 600;
    padding: 4px 8px;
    border-radius: 4px;
}

.gb-search-product-info {
    padding: 12px 14px;
    text-align: center;
}

.gb-search-product-info h4 {
    font-size: 13px;
    font-weight: 400;
    line-height: 1.5;
    margin: 0 0 8px 0;
    color: #374151;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.gb-search-product-info h4 mark {
    background: #fef3c7;
    color: inherit;
    border-radius: 2px;
    padding: 0 1px;
}

.gb-search-product-price {
    font-size: 15px;
    font-weight: 600;
    color: var(--gb-search-primary);
}

.gb-search-price-old {
    text-decoration: line-through;
    color: #9ca3af;
    font-weight: 400;
    font-size: 13px;
    margin-right: 6px;
}

.gb-search-price-sale {
    color: var(--gb-search-accent);
    font-weight: 700;
}

.gb-search-product-extra {
    font-size: 12px;
    color: #6b7280;
    margin-top: 4px;
}

/* See all link */
.gb-search-see-all {
    margin-top: 20px;
    text-align: center;
}

.gb-search-see-all-link {
    display: inline-block;
    padding: 10px 24px;
    background: var(--gb-search-primary);
    color: #fff;
    text-decoration: none;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    transition: opacity 0.15s;
}

.gb-search-see-all-link:hover {
    opacity: 0.85;
    color: #fff;
}

/* Logo */
.gb-search-logo {
    display: flex;
    align-items: center;
    flex-shrink: 0;
}

.gb-search-logo img {
    height: 32px;
    width: auto;
    object-fit: contain;
}

/* Mobile tabs (hidden on desktop) */
.gb-search-mobile-tabs {
    display: none;
}

.gb-search-tab {
    background: none;
    border: none;
    border-bottom: 2px solid transparent;
    border-radius: 0;
    padding: 10px 16px;
    font-size: 13px;
    font-weight: 500;
    color: #9ca3af;
    cursor: pointer;
    transition: color 0.15s, border-color 0.15s;
    font-family: inherit;
    white-space: nowrap;
}

.gb-search-tab.is-active {
    color: var(--gb-search-primary);
    border-bottom-color: var(--gb-search-primary);
    font-weight: 700;
}

/* Mobile */
@media (max-width: 768px) {
    .gb-search-overlay {
        padding-top: 0;
    }

    .gb-search-container {
        width: 100vw;
        max-width: 100vw;
        max-height: 100vh;
        height: 100vh;
        border-radius: 0;
    }

    .gb-search-body {
        flex-direction: column;
    }

    .gb-search-sidebar {
        width: 100%;
        border-right: none;
        border-bottom: 1px solid #e5e7eb;
        padding: 0;
        max-height: none;
        overflow: visible;
    }

    .gb-search-mobile-tabs {
        display: flex;
        gap: 8px;
        padding: 10px 16px;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        border-bottom: 1px solid #e5e7eb;
    }

    .gb-search-mobile-tabs:empty {
        display: none;
    }

    .gb-search-sidebar-content {
        padding: 12px 16px;
        max-height: 180px;
        overflow-y: auto;
    }

    .gb-search-sidebar h3 {
        display: none;
    }

    .gb-search-facet-group ul,
    .gb-search-price-slider {
        max-height: none !important;
        padding-bottom: 0 !important;
    }

    .gb-search-facet-group {
        border-bottom: none;
    }

    .gb-search-price-filter {
        border-bottom: none;
    }

    .gb-search-sidebar ul {
        display: flex;
        flex-wrap: wrap;
        gap: 6px;
    }

    .gb-search-sidebar li {
        margin: 0;
    }

    .gb-search-sidebar a {
        padding: 4px 10px;
        background: #f3f4f6;
        border-radius: 20px;
        font-size: 13px;
        white-space: nowrap;
    }

    .gb-search-price-filter {
        margin-bottom: 10px;
        padding-bottom: 10px;
    }

    .gb-search-main {
        padding: 12px 16px;
    }

    .gb-search-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 12px;
    }

    .gb-search-input {
        font-size: 16px;
    }
}
