/* BBJ Custom Tabbed Search Styles */

html.bbj-search-scroll-locked,
body.bbj-search-scroll-locked {
    overflow: hidden !important;
}
.utility-icons-megamenu.open{
    height: var(--bbj-mm-open-h, 100vh) !important;
    max-height: var(--bbj-mm-open-h, 100vh) !important;
    overflow-y: auto !important;
    overscroll-behavior: contain;
    -webkit-overflow-scrolling: touch;
}
/* Fullscreen results mode — container is teleported to <body> by JS */
.bbj-search-container.bbj-search-fullscreen-open {
    /* Inline styles set by JS are the source of truth.
       These are fallback declarations only. */
    display: flex;
    flex-direction: column;
    align-items: center;
}

.bbj-search-container.bbj-search-fullscreen-open .bbj-search-input-group {
    position: sticky;
    top: 0;
    z-index: 2;
    background: #fff;
    padding-top: 6px;
    width: 100%;
}

.bbj-custom-search-wrapper {
    display: inline-block;
    vertical-align: middle;
}

.bbj-search-icon-trigger {
    background: transparent;
    border: none;
    cursor: pointer;
    color: #333;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
}

.bbj-search-icon-trigger svg {
    stroke: currentColor;
    stroke-width: 1.5;
}

.bbj-search-icon-trigger:hover {
    color: #000;
}

/* Inline Search Container */
.bbj-search-container {
    width: 100%;
    max-width: 100% !important;
    margin: 0 auto;
    box-sizing: border-box;
    display: flex;
    flex-direction: column;
    align-items: center;
    background: #fff;
    max-height: min(calc(100vh - 180px), 800px);
    overflow-y: auto;
}


.bbj-search-container.no-scroll {
    overflow-y: hidden;
    max-height: none;
}

/* Custom scrollbar for search container */
.bbj-search-container::-webkit-scrollbar {
    width: 7px;
}

.bbj-search-container::-webkit-scrollbar-track {
    background: #EAEAEA;
}

.bbj-search-container::-webkit-scrollbar-thumb {
    background-color: #53565A;
}

/* Search Input */
.bbj-search-input-group {
    position: relative;
    width: 100%;
    max-width: 1440px;
    margin-left: auto;
    margin-right: auto;
}

.bbj-search-input-group input {
    width: 100%;
    padding: 15px 45px 15px 35px !important;
    font-size: 20px  !important;
    border: none;
    border-radius: 2px;
    background: #fff;
    outline: none;
    color: #333;
    box-sizing: border-box;
    font-family: inherit;
    transition: border-color 0.2s;
}

.bbj-search-input-group input::placeholder{
color: #2B2B2B !important;
}

.bbj-search-input-group input:focus {
    border-color: #000;
}

.bbj-search-submit-icon {
    position: absolute;
    left: 5px !important;
    top: 50% !important;
    transform: translateY(-50%);
    color: #666;
    display: flex;
    pointer-events: none;
}

.bbj-spinner {
    position: absolute;
    right: 50% !important;
    top: 85px !important;
    transform: translateY(-50%);
    width: 20px;
    height: 20px;
    border: 2px solid rgba(0, 0, 0, 0.1);
    border-top-color: #333;
    border-radius: 50%;
    animation: bbj-spin 1s linear infinite;
}

@keyframes bbj-spin {
    100% {
        transform: translateY(-50%) rotate(360deg);
    }
}

/* Tabs */
.bbj-search-tabs {
    width: 100%;
    display: flex;
    flex-wrap: wrap;
    justify-content: flex-start;
    gap: 40px;
    padding-bottom: 0px !important;
}

.bbj-tab-button {
    background: none;
    border: none;
    color: #868C98;
    font-size: 16px;
    font-weight: 400;
    cursor: pointer;
    padding: 0px 0 15px 0;
    font-family: inherit;
    transition: color 0.2s;
    position: relative;
}

.bbj-tab-button:hover {
    color: #666;
}

.bbj-tab-button.active {
    color: #2B2B2B;
}

.bbj-tab-button.active::after {
    content: '';
    position: absolute;
    bottom: -1px;
    left: 0;
    width: 100%;
    height: 1px;
    background-color: #2B2B2B;
}

/* Results Grid */
.bbj-search-results {
    width: 100%;
    max-width: 1400px;
    display: grid;
    grid-template-columns: repeat(4, 330px);
    gap: 10px;
    justify-content: center;
    margin-left: auto;
    margin-right: auto;
    padding: 20px 30px;
    margin-bottom: 40px !important;
    border-top: 1px solid #868C9840 !important;
}

.bbj-search-results > .bbj-product-item {
    width: 330px;
    height: 330px;
    overflow: hidden;
}

/* Image fills the card width; leave room below for the title. */
.bbj-search-results > .bbj-product-item .bbj-product-image-wrapper {
    width: 100%;
    height: 290px;
    aspect-ratio: auto;
    margin-bottom: 8px;
}

.bbj-search-results > .bbj-product-item .bbj-product-title {
    flex: 0 0 auto;
}

.bbj-product-item {
    display: flex;
    flex-direction: column;
    text-decoration: none;
    color: inherit;
}

.bbj-product-item .bbj-product-image-wrapper {
    width: 300px;
    aspect-ratio: 1 / 1;
    overflow: hidden;
    background: #f8f8f8;
    margin-bottom: 12px;
}

.bbj-product-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.3s ease;
}

.bbj-product-item:hover img {
    transform: scale(1.05);
}

.bbj-product-title {
    font-size: 13px;
    color: #333;
    font-weight: 500;
    line-height: 1.4;
    text-align: center;
}

.bbj-no-results {
    grid-column: 1 / -1;
    text-align: center;
    font-size: 16px;
    color: #666;
    padding: 40px 0;
}

/* View Results Button */
.bbj-search-footer {
    width: 100%;
    display: flex;
    justify-content: center;
    margin-bottom: 30px !important;
}

.bbj-view-results-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background-color: #333333;
    color: #fff !important;
    padding: 12px 24px;
    min-width: 240px;
    text-decoration: none;
    border: none;
    cursor: pointer;
    font-size: 16px;
    letter-spacing: 1px;
    text-transform: uppercase;
    font-family: "Avenir", "Avenir Medium", Arial, sans-serif;
    transition: background-color 0.2s;
}

.bbj-view-results-btn:hover {
    background-color: #7D675E;
    color: #fff;
}

/* Was 100vw (viewport width used as height) — broke portrait layouts; match open panel sizing. */
.utility-icons-megamenu.bbj-results-active {
    height: auto !important;
    max-height: 100vh !important;
    max-height: 100dvh !important;
    max-height: 100svh !important;
    min-height: 0 !important;
    overflow-y: auto !important;
}

.utility-icons-megamenu .row{
    max-width: 100% !important;
    margin: 0 20px !important;
    padding-left: 92px !important;
    padding-right: 92px !important;
    padding-bottom: 0  !important;
}

.bbj-search-container::-webkit-scrollbar {
    display: none  !important;
}


.cross-icon-search{
    position: absolute;
    top: 25%;
    right: 0;
    display: inline-block;
    background: transparent;
    border: none;
    color: #2B2B2B;
    font-size: 32px;
    line-height: 1;
    padding: 0;
    cursor: pointer;
    text-decoration: none;
}
/* Responsive adjustments */
@media (max-width: 768px) {
    .bbj-search-results {
        grid-template-columns: repeat(2, 1fr);
    }

    .bbj-search-tabs {
        justify-content: flex-start;
        overflow-x: auto;
        flex-wrap: nowrap;
        white-space: nowrap;
        padding-bottom: 2px;
        /* For the active border */
    }

    .bbj-search-input-group {
        max-width: 100%;
    }
}

@media (max-width: 480px) {
    .bbj-search-results {
        grid-template-columns: 1fr;
    }
}

/* ── Plugin-controlled search results page ───────────────────────────────── */
.bbj-results-page {
    max-width: 1200px;
    margin: 40px auto;
    padding: 0 20px;
}

.bbj-results-page__breadcrumb {
    font-size: 13px;
    color: #666;
    margin-bottom: 16px;
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 6px;
}
.bbj-results-page__breadcrumb a {
    color: #666;
    text-decoration: none;
}
.bbj-results-page__breadcrumb a:hover {
    text-decoration: underline;
}

.bbj-results-page__title {
    font-size: 28px;
    font-weight: 600;
    margin: 0 0 6px;
    color: #1a1a1a;
}
.bbj-results-page__title small {
    font-size: 18px;
    font-weight: 400;
    color: #666;
}

.bbj-results-page__count {
    font-size: 13px;
    color: #888;
    margin: 0 0 32px;
}

.bbj-results-page__grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 24px;
}

.bbj-results-page__item {
    display: block;
    text-decoration: none;
    color: inherit;
    transition: transform 0.15s ease;
}
.bbj-results-page__item:hover {
    transform: translateY(-2px);
}

.bbj-results-page__img-wrap {
    aspect-ratio: 1 / 1;
    overflow: hidden;
    background: #f5f5f5;
    margin-bottom: 10px;
}
.bbj-results-page__img-wrap img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.bbj-results-page__name {
    font-size: 14px;
    font-weight: 500;
    color: #1a1a1a;
    line-height: 1.4;
    text-align: center;
}

.bbj-results-page__empty {
    font-size: 16px;
    color: #666;
    padding: 40px 0;
}

@media (max-width: 1024px) {
    .bbj-results-page__grid {
        grid-template-columns: repeat(3, 1fr);
    }
}
@media (max-width: 768px) {
    .bbj-results-page__grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 16px;
    }
}
@media (max-width: 480px) {
    .bbj-results-page__grid {
        grid-template-columns: 1fr;
    }
}
