/* Site search overlay (template-parts/search/overlay.php) and results page (search.php). */
html.bambu-search-open {
    overflow: hidden;
}

.bambu-search[hidden] {
    display: none;
}

.bambu-search {
    position: fixed;
    inset: 0;
    z-index: 10000;
    display: flex;
    justify-content: center;
    align-items: flex-start;
    padding: 10vh 16px 16px;
}

.bambu-search-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(5, 14, 33, 0.62);
    backdrop-filter: blur(4px);
    opacity: 0;
    transition: opacity 180ms ease;
}

.bambu-search-dialog {
    position: relative;
    display: flex;
    flex-direction: column;
    width: min(720px, 100%);
    max-height: 78vh;
    overflow: hidden;
    border-radius: 18px;
    background: #fff;
    box-shadow: 0 30px 80px -20px rgba(5, 14, 33, 0.55);
    opacity: 0;
    transform: translateY(-12px) scale(0.98);
    transition: opacity 180ms ease, transform 220ms cubic-bezier(0.22, 1, 0.36, 1);
}

.bambu-search.is-open .bambu-search-backdrop,
.bambu-search.is-open .bambu-search-dialog {
    opacity: 1;
    transform: none;
}

.bambu-search-form {
    position: relative;
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 18px 20px;
    border-bottom: 1px solid #e2e8f0;
}

.bambu-search-form::after {
    content: "";
    position: absolute;
    left: 0;
    right: 0;
    bottom: -1px;
    height: 2px;
    background: linear-gradient(90deg, #43b263 0%, #3ba295 25%, #3b7ab5 55%, #7147a7 80%, #814272 100%);
}

.bambu-search-icon {
    flex: none;
    color: #3ba295;
}

.bambu-search-input {
    flex: 1;
    min-width: 0;
    padding: 4px 0;
    border: 0;
    outline: 0;
    background: transparent;
    color: #0f172a;
    font: inherit;
    font-size: 18px;
}

.bambu-search-input::-webkit-search-cancel-button {
    display: none;
}

.bambu-search-spinner {
    flex: none;
    width: 18px;
    height: 18px;
    border: 2px solid #cbd5e1;
    border-top-color: #3ba295;
    border-radius: 50%;
    animation: bambu-search-spin 700ms linear infinite;
}

.bambu-search-spinner[hidden] {
    display: none;
}

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

.bambu-search-close {
    flex: none;
    padding: 0;
    border: 0;
    background: none;
    cursor: pointer;
}

.bambu-search kbd {
    display: inline-block;
    min-width: 22px;
    padding: 2px 6px;
    border: 1px solid #e2e8f0;
    border-bottom-width: 2px;
    border-radius: 6px;
    background: #f8fafc;
    color: #475569;
    font: 600 11px/1.4 inherit;
    text-align: center;
}

.bambu-search-body {
    flex: 1;
    overflow-y: auto;
    padding: 8px 12px 12px;
    overscroll-behavior: contain;
}

.bambu-search-heading {
    margin: 12px 8px 6px;
    color: #64748b;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.06em;
    text-transform: uppercase;
}

.bambu-search-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    padding: 0 8px 4px;
}

.bambu-search-chip {
    padding: 6px 12px;
    border: 1px solid #e2e8f0;
    border-radius: 9999px;
    background: #fff;
    color: #334155;
    font: inherit;
    font-size: 13px;
    cursor: pointer;
    transition: border-color 140ms ease, background-color 140ms ease;
}

.bambu-search-chip:hover,
.bambu-search-chip.is-active {
    border-color: #3ba295;
    background: #ecfdf5;
}

.bambu-search-links {
    margin: 0;
    padding: 0;
    list-style: none;
}

.bambu-search-option {
    text-decoration: none;
}

.bambu-search-links .bambu-search-option {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    padding: 10px 12px;
    border-radius: 10px;
    color: #0f172a;
    font-size: 15px;
    transition: background-color 160ms ease, color 160ms ease, box-shadow 160ms ease;
}

.bambu-search-links .bambu-search-option:hover,
.bambu-search-links .bambu-search-option.is-active {
    background: linear-gradient(90deg, #ecfdf5 0%, #f8fafc 80%);
    box-shadow: inset 3px 0 0 #3ba295;
    color: #047857;
}

.bambu-search-links small {
    color: #94a3b8;
    font-size: 12px;
}

.bambu-search-group + .bambu-search-group {
    margin-top: 6px;
    padding-top: 6px;
    border-top: 1px solid #f1f5f9;
}

.bambu-search-group header {
    display: flex;
    align-items: center;
    gap: 8px;
    margin: 10px 8px 4px;
    color: #64748b;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.06em;
    text-transform: uppercase;
}

.bambu-search-group header small {
    padding: 1px 7px;
    border-radius: 9999px;
    background: #f1f5f9;
    color: #475569;
    font-size: 11px;
    letter-spacing: 0;
}

.bambu-search-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 8px 10px;
    border-radius: 12px;
    color: #0f172a;
    animation: bambu-search-in 260ms cubic-bezier(0.22, 1, 0.36, 1) both;
    transition: background-color 160ms ease, box-shadow 160ms ease;
}

/* Hover and keyboard selection look the same: tinted row, green edge, title in green, arrow slides in. */
.bambu-search-item:hover,
.bambu-search-item.is-active {
    background: linear-gradient(90deg, #ecfdf5 0%, #f8fafc 75%);
    box-shadow: inset 3px 0 0 #3ba295;
}

.bambu-search-item:hover .bambu-search-title,
.bambu-search-item.is-active .bambu-search-title {
    color: #047857;
}

.bambu-search-item .bambu-search-thumb img {
    transition: transform 240ms ease;
}

.bambu-search-item:hover .bambu-search-thumb img,
.bambu-search-item.is-active .bambu-search-thumb img {
    transform: scale(1.08);
}

@keyframes bambu-search-in {
    from { opacity: 0; transform: translateY(6px); }
    to { opacity: 1; transform: none; }
}


.bambu-search-thumb {
    flex: none;
    width: 44px;
    height: 44px;
    overflow: hidden;
    border-radius: 10px;
    background: #e2e8f0;
}

.bambu-search-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.bambu-search-thumb-fallback {
    display: flex;
    width: 100%;
    height: 100%;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #43b263, #3b7ab5);
    color: #fff;
    font-weight: 700;
}

.bambu-search-text {
    display: grid;
    flex: 1;
    min-width: 0;
    gap: 4px;
}

.bambu-search-title {
    overflow: hidden;
    color: #0f172a;
    transition: color 160ms ease;
    font-size: 14px;
    font-weight: 600;
    line-height: 1.35;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.bambu-search-title mark,
.bambu-search-results-page mark {
    padding: 0 1px;
    border-radius: 3px;
    background: #d1fae5;
    color: inherit;
}

.bambu-search-meta {
    display: flex;
    align-items: center;
    gap: 8px;
    overflow: hidden;
    color: #64748b;
    font-size: 12px;
    white-space: nowrap;
}

.bambu-search-meta > span:last-child {
    overflow: hidden;
    text-overflow: ellipsis;
}

.bambu-search-badge {
    flex: none;
    padding: 1px 8px;
    border-radius: 9999px;
    background: #f1f5f9;
    color: #334155;
    font-size: 11px;
    font-weight: 700;
}

.bambu-search-badge.is-offer,
.bambu-search-badge.is-open {
    background: #dcfce7;
    color: #166534;
}

.bambu-search-badge.is-need {
    background: #dbeafe;
    color: #1e40af;
}

.bambu-search-badge.is-members {
    background: #f3e8ff;
    color: #6b21a8;
}

.bambu-search-badge.is-muted {
    background: #f1f5f9;
    color: #64748b;
}

.bambu-search-go {
    flex: none;
    color: #3ba295;
    opacity: 0;
    transform: translateX(-6px);
    transition: opacity 160ms ease, transform 200ms ease;
}

.bambu-search-item:hover .bambu-search-go,
.bambu-search-item.is-active .bambu-search-go {
    opacity: 1;
    transform: none;
}

.bambu-search-more {
    display: inline-block;
    margin: 2px 0 4px;
    padding: 6px 10px;
    border-radius: 8px;
    color: #047857;
    font-size: 13px;
    font-weight: 600;
    transition: background-color 160ms ease, padding 160ms ease;
}

.bambu-search-more:hover,
.bambu-search-more.is-active {
    padding-right: 14px;
    background: #ecfdf5;
}

.bambu-search-all {
    display: block;
    margin-top: 8px;
    padding: 12px;
    border: 1px solid transparent;
    border-radius: 12px;
    background: #f8fafc;
    color: #0f172a;
    font-size: 14px;
    font-weight: 600;
    text-align: center;
    transition: background-color 160ms ease, border-color 160ms ease, color 160ms ease;
}

.bambu-search-all:hover,
.bambu-search-all.is-active {
    border-color: #a7f3d0;
    background: #ecfdf5;
    color: #047857;
}

.bambu-search-empty {
    margin: 0;
    padding: 32px 16px;
    color: #64748b;
    text-align: center;
}

.bambu-search-footer {
    display: flex;
    gap: 18px;
    padding: 10px 20px;
    border-top: 1px solid #e2e8f0;
    background: #f8fafc;
    color: #64748b;
    font-size: 12px;
}

@media (max-width: 767px) {
    .bambu-search {
        padding: 0;
    }

    .bambu-search-dialog {
        width: 100%;
        max-height: none;
        height: 100%;
        border-radius: 0;
    }

    .bambu-search-footer {
        display: none;
    }
}


/* Results page. */
.bambu-search-results-page {
    padding: 48px 0 80px;
    background: #eef2f8;
}

.bambu-search-page-container {
    width: calc(100% - 32px);
    max-width: 960px;
    margin-inline: auto;
}

.bambu-search-page-form {
    display: flex;
    gap: 12px;
    margin-bottom: 20px;
}

.bambu-search-page-form input {
    flex: 1;
    min-width: 0;
    padding: 14px 16px;
    border: 1px solid #cbd5e1;
    border-radius: 12px;
    background: #fff;
    font: inherit;
    font-size: 16px;
}

.bambu-search-page-form input:focus {
    border-color: #3ba295;
    outline: 3px solid #3ba2951f;
}

.bambu-search-page-form button {
    padding: 0 24px;
    border: 0;
    border-radius: 12px;
    background: linear-gradient(90deg, #43b263 0%, #3b7ab5 50%, #814272 100%);
    color: #fff;
    font: inherit;
    font-weight: 700;
    cursor: pointer;
}

.bambu-search-summary {
    margin: 0 0 16px;
    color: #475569;
}

.bambu-search-tabs {
    display: flex;
    gap: 8px;
    margin-bottom: 20px;
    overflow-x: auto;
}

.bambu-search-tabs {
    padding: 2px 2px 6px;
}

.bambu-search-tabs a {
    flex: none;
    padding: 8px 14px;
    border: 1px solid #dce5ee;
    border-radius: 9999px;
    background: #fff;
    color: #334155;
    font-size: 14px;
    font-weight: 600;
    text-decoration: none;
    transition: background-color 200ms ease, border-color 200ms ease, color 200ms ease, box-shadow 200ms ease, transform 200ms ease;
}

.bambu-search-tabs a:hover {
    border-color: #3ba295;
    color: #047857;
    box-shadow: 0 6px 16px -10px rgba(4, 120, 87, 0.6);
    transform: translateY(-1px);
}

.bambu-search-tabs a.is-current {
    border-color: #3ba295;
    background: #3ba295;
    color: #fff;
    box-shadow: 0 8px 18px -10px rgba(4, 120, 87, 0.8);
}

.bambu-search-tabs a.is-current small {
    color: #d1fae5;
}

.bambu-search-tabs small {
    transition: color 200ms ease;
}

/* In-place tab and page changes: fade the old results out and the new ones in. */
.bambu-search-page-body {
    transition: opacity 180ms ease, transform 240ms cubic-bezier(0.22, 1, 0.36, 1);
}

.bambu-search-page-body.is-loading .bambu-search-section,
.bambu-search-page-body.is-loading .bambu-search-summary {
    opacity: 0.35;
    transition: opacity 120ms ease;
    pointer-events: none;
}

.bambu-search-page-body.is-entering {
    opacity: 0;
    transform: translateY(8px);
    transition: none;
}

.bambu-search-section {
    animation: bambu-search-in 360ms cubic-bezier(0.22, 1, 0.36, 1) both;
}

.bambu-search-section:nth-of-type(2) { animation-delay: 50ms; }
.bambu-search-section:nth-of-type(3) { animation-delay: 100ms; }
.bambu-search-section:nth-of-type(4) { animation-delay: 150ms; }
.bambu-search-section:nth-of-type(5) { animation-delay: 200ms; }

.bambu-search-tabs small {
    margin-left: 6px;
    color: #64748b;
}

.bambu-search-section {
    margin-bottom: 20px;
    padding: 20px;
    border-radius: 16px;
    background: #fff;
    box-shadow: 0 4px 20px -2px rgba(15, 23, 42, 0.06);
}

.bambu-search-section h2 {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    margin: 0 0 8px;
    color: #0f172a;
    font-size: 18px;
}

.bambu-search-section h2 a {
    padding: 4px 10px;
    border-radius: 8px;
    color: #047857;
    font-size: 13px;
    text-decoration: none;
    transition: background-color 160ms ease;
}

.bambu-search-section h2 a:hover {
    background: #ecfdf5;
}

.bambu-search-row {
    display: flex;
    gap: 14px;
    margin: 0 -12px;
    padding: 14px 12px;
    border-top: 1px solid #f1f5f9;
    border-radius: 12px;
    color: inherit;
    text-decoration: none;
    transition: background-color 180ms ease, box-shadow 180ms ease;
}

.bambu-search-row:hover {
    background: linear-gradient(90deg, #ecfdf5 0%, #f8fafc 70%);
    box-shadow: inset 3px 0 0 #3ba295;
}

.bambu-search-row .bambu-search-thumb img {
    transition: transform 260ms ease;
}

.bambu-search-row:hover .bambu-search-thumb img {
    transform: scale(1.06);
}

.bambu-search-row strong {
    transition: color 180ms ease;
}

.bambu-search-row:first-of-type {
    border-top: 0;
}

.bambu-search-row .bambu-search-thumb {
    width: 64px;
    height: 64px;
}

.bambu-search-row strong {
    display: block;
    margin-bottom: 4px;
    color: #0f172a;
    font-size: 16px;
}

.bambu-search-row:hover strong {
    color: #047857;
}

.bambu-search-row p {
    margin: 6px 0 0;
    color: #475569;
    font-size: 14px;
    line-height: 1.55;
}

.bambu-search-pagination {
    display: flex;
    justify-content: center;
    gap: 8px;
    margin-top: 16px;
}

.bambu-search-pagination a,
.bambu-search-pagination span {
    padding: 8px 14px;
    border: 1px solid #dce5ee;
    border-radius: 10px;
    background: #fff;
    color: #334155;
    text-decoration: none;
    transition: border-color 160ms ease, color 160ms ease, transform 160ms ease;
}

.bambu-search-pagination a:hover {
    border-color: #3ba295;
    color: #047857;
    transform: translateY(-1px);
}

.bambu-search-pagination span[aria-current] {
    border-color: #3ba295;
    background: #3ba295;
    color: #fff;
}

.bambu-search-pagination .is-gap {
    border-color: transparent;
}

@media (prefers-reduced-motion: reduce) {
    .bambu-search-backdrop,
    .bambu-search-dialog,
    .bambu-search-item,
    .bambu-search-section,
    .bambu-search-page-body,
    .bambu-search-tabs a,
    .bambu-search-row {
        transition: none;
        animation: none;
        transform: none;
    }
}
