#search-wrapper.modal:before {
    display: inline;
}
#search-wrapper {
    opacity: 1;
}

/* Header modal search results (unchanged grid) */
#search-content .sugg {
    text-align: center;
    padding: 10px;
}
#search-content .sugg-content a {
    display: inline-block;
    border: 1px solid #0c6eaf;
    border-radius: 10px;
    padding: 5px;
    text-decoration: none;
    width: 100%;
}
#search-content .sugg-content > a:hover {
    color: #0080c0;
    background-color: #dff4ff;
}
#search-content .sugg-img {
    height: 50px;
}
#search-content .sugg-name {
    height: 4rem;
    margin-bottom: 0.5rem;
}
#search-content .sugg-name,
#search-content .sugg-price {
    font-weight: bold;
}

/* Legacy selectors (header modal) */
.sugg {
    text-align: center;
    padding: 10px;
}
.sugg-content a {
    display: inline-block;
    border: 1px solid #0c6eaf;
    border-radius: 10px;
    padding: 5px;
    text-decoration: none;
    width: 100%;
}
.sugg-content > a:hover {
    color: #0080c0;
    background-color: #dff4ff;
}
.sugg-img {
    height: 50px;
}
.sugg-name {
    height: 4rem;
    margin-bottom: 0.5rem;
}
.sugg-name, .sugg-price {
    font-weight: bold;
}

/* Sidebar AJAX search: wide popover + scrollable list */
#search-leftBoxCard,
#search-leftBoxCard .fest-sidebox-search {
    position: relative;
    overflow: visible;
}
.fest-sidebox-search {
    position: relative;
    overflow: visible;
}
.sidebar-search-backdrop {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 1040;
    background: rgba(0, 0, 0, 0.25);
}
.sidebar-search-backdrop.is-open {
    display: block;
}
.sidebar-search-popover {
    display: none;
    position: absolute;
    top: calc(100% - 0.25rem);
    left: 0;
    z-index: 1050;
    min-width: 100%;
    width: clamp(340px, 58vw, 720px);
}
.sidebar-search-popover.is-open {
    display: block;
}
.sidebar-search-popover-inner {
    background: #fff;
    border: 1px solid #dee2e6;
    border-radius: 0.25rem;
    box-shadow: 0 0.5rem 1.25rem rgba(0, 0, 0, 0.18);
    overflow: hidden;
}
.sidebar-search-popover-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
    padding: 0.45rem 0.65rem;
    border-bottom: 1px solid #eee;
    background: #f8f9fa;
}
.sidebar-search-popover-title {
    font-weight: bold;
    font-size: 0.9rem;
    line-height: 1.2;
}
.sidebar-search-popover-close {
    border: 0;
    background: transparent;
    color: #333;
    font-size: 1.1rem;
    line-height: 1;
    padding: 0.15rem 0.35rem;
    cursor: pointer;
    border-radius: 0.2rem;
}
.sidebar-search-popover-close:hover,
.sidebar-search-popover-close:focus {
    background: #e9ecef;
    outline: none;
}
.sidebar-search-popover-body {
    max-height: min(65vh, 480px);
    overflow-x: hidden;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    padding: 0.35rem 0.5rem;
}
#sidebar-search-content .sugg {
    flex: 0 0 100%;
    max-width: 100%;
    width: 100%;
    padding: 0;
    margin: 0;
    text-align: left;
}
#sidebar-search-content .sugg-content a {
    display: grid;
    grid-template-columns: 56px minmax(0, 1fr);
    grid-template-rows: auto auto;
    column-gap: 0.75rem;
    row-gap: 0.15rem;
    align-items: center;
    width: 100%;
    border: 0;
    border-bottom: 1px solid #eee;
    border-radius: 0;
    padding: 0.5rem 0.25rem;
    text-decoration: none;
    color: inherit;
}
#sidebar-search-content .sugg-content > a:hover {
    background-color: #f8f9fa;
    color: inherit;
}
#sidebar-search-content .sugg-img {
    grid-row: 1 / span 2;
    grid-column: 1;
    height: 50px;
    line-height: 50px;
}
#sidebar-search-content .sugg-img img {
    max-height: 50px;
    max-width: 50px;
    width: auto;
    height: auto;
    vertical-align: middle;
}
#sidebar-search-content .sugg-name {
    grid-column: 2;
    grid-row: 1;
    height: auto;
    margin: 0;
    font-weight: bold;
    font-size: 0.95rem;
    line-height: 1.25;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    text-align: left;
}
#sidebar-search-content .sugg-model {
    grid-column: 2;
    grid-row: 2;
    font-size: 0.8rem;
    color: #666;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    padding-right: 4.5rem;
}
#sidebar-search-content .sugg-brand:empty,
#sidebar-search-content .sugg-brand {
    display: none;
}
#sidebar-search-content .sugg-price {
    grid-column: 2;
    grid-row: 2;
    justify-self: end;
    align-self: center;
    font-weight: bold;
    font-size: 0.85rem;
    white-space: nowrap;
}
#sidebar-search-content .sugg-model:not(:empty) + .sugg-price {
    margin-right: 0;
}
#sidebar-search-content > .row {
    width: 100%;
    margin: 0.5rem 0 0;
    padding-top: 0.5rem;
    border-top: 1px solid #eee;
}
#sidebar-search-content > .row .col-12 {
    padding: 0;
    font-size: 0.85rem;
}

@media (max-width: 991.98px) {
    .sidebar-search-popover.is-open {
        width: min(calc(100vw - 1.5rem), 520px);
    }
    .sidebar-search-popover-body {
        max-height: min(55vh, 400px);
    }
}
@media (max-width: 575.98px) {
    .sidebar-search-popover.is-open {
        position: fixed;
        left: 0.75rem;
        right: 0.75rem;
        top: auto;
        width: auto;
        min-width: 0;
    }
    .sidebar-search-popover-body {
        max-height: 50vh;
    }
}

/* Mobile header search modal (#search-wrapper) — larger thumb, tighter rows */
@media (max-width: 991.98px) {
    #search-content .sugg {
        padding: 0.25rem 0.35rem;
    }
    #search-content .sugg-content a {
        padding: 0.35rem 0.5rem;
    }
    #search-content .sugg-img {
        height: auto;
        min-height: 0;
        line-height: 1;
    }
    #search-content .sugg-img img {
        max-height: 72px;
        max-width: 72px;
        width: auto;
        height: auto;
    }
    #search-content .sugg-name {
        height: auto;
        min-height: 0;
        margin-bottom: 0.15rem;
        line-height: 1.2;
    }
    #search-content .sugg-price {
        margin-bottom: 0;
    }
}
