/* Search overlay. Every rule starts with #bps-root so the theme's own input and button styles cannot leak in. */

html.bps-lock, html.bps-lock body { overflow: hidden !important; }

#bps-root {
    --bps-accent: #829b11;
    --bps-accent-rgb: 130, 155, 17;
    --bps-accent-strong: #5d6f0c;
    --bps-ink: #1f2410;
    --bps-muted: #6c7260;
    --bps-line: #e5e8da;
    --bps-soft: #f5f7ec;

    position: fixed;
    top: 0; right: 0; bottom: 0; left: 0;
    z-index: 100000;
    display: none;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    font-size: 15px;
    line-height: 1.4;
    color: #1f2410;
    -webkit-font-smoothing: antialiased;
    text-align: left;
}
#bps-root.is-open { display: block; }
#bps-root, #bps-root * { box-sizing: border-box; }
#bps-root [hidden] { display: none !important; }
#bps-root a { text-decoration: none; color: inherit; }
/* themes often style every button (upper case, letter spacing, shadows): switch that off inside the overlay */
#bps-root button { font-family: inherit; text-transform: none; letter-spacing: normal; text-shadow: none; min-width: 0; margin: 0; }

/* ---------- backdrop and panel ---------- */
#bps-root .bps-backdrop {
    position: absolute; top: 0; right: 0; bottom: 0; left: 0;
    background: rgba(24, 29, 10, .58);
    -webkit-backdrop-filter: blur(5px);
    backdrop-filter: blur(5px);
    animation: bps-fade .18s ease-out both;
}

#bps-root .bps-panel {
    position: relative;
    display: flex;
    flex-direction: column;
    width: calc(100% - 48px);
    max-width: 1100px;
    height: calc(100% - 72px);
    max-height: 860px;
    margin: 36px auto 0;
    background: #fff;
    border-radius: 22px;
    overflow: hidden;
    box-shadow:
        0 36px 100px rgba(14, 18, 4, .46),
        0 12px 34px rgba(14, 18, 4, .22),
        0 0 0 1px rgba(255, 255, 255, .35) inset;
    animation: bps-pop .24s cubic-bezier(.2, .9, .25, 1) both;
}

@keyframes bps-fade { from { opacity: 0; } to { opacity: 1; } }
@keyframes bps-pop { from { opacity: 0; transform: translateY(18px) scale(.975); } to { opacity: 1; transform: none; } }

/* ---------- header ---------- */
#bps-root .bps-head {
    display: flex;
    align-items: center;
    gap: 18px;
    padding: 18px 22px 16px;
    background: linear-gradient(180deg, #fff 0%, #f8faef 100%);
    border-bottom: 1px solid var(--bps-line);
    flex: 0 0 auto;
}
#bps-root .bps-logo { display: block; flex: 0 0 auto; line-height: 0; }
#bps-root .bps-logo img { display: block; height: 48px; width: auto; max-width: 190px; }
#bps-root .bps-logo-text { font-size: 20px; font-weight: 800; color: var(--bps-ink); line-height: 1.2; }

#bps-root .bps-search { position: relative; flex: 1 1 auto; margin: 0; padding: 0; }
#bps-root .bps-icon { position: absolute; left: 18px; top: 50%; margin-top: -11px; color: var(--bps-accent-strong); pointer-events: none; }
#bps-root .bps-input {
    display: block;
    width: 100%;
    height: 54px;
    margin: 0;
    padding: 0 52px 0 52px;
    font-size: 18px;
    font-weight: 600;
    color: var(--bps-ink);
    background: #fff;
    border: 2px solid var(--bps-line);
    border-radius: 999px;
    outline: none;
    box-shadow: 0 2px 6px rgba(20, 28, 4, .06);
    transition: border-color .15s, box-shadow .15s;
    -webkit-appearance: none;
    appearance: none;
}
#bps-root .bps-input::placeholder { color: #9aa088; font-weight: 500; }
#bps-root .bps-input:focus {
    border-color: var(--bps-accent);
    box-shadow: 0 0 0 4px rgba(var(--bps-accent-rgb), .20), 0 8px 22px rgba(var(--bps-accent-rgb), .22);
}
#bps-root .bps-clear {
    position: absolute; right: 12px; top: 50%; margin-top: -15px;
    width: 30px; height: 30px; padding: 0;
    display: flex; align-items: center; justify-content: center;
    color: #6c7260; background: #edf0e1; border: 0; border-radius: 50%; cursor: pointer;
    transition: background .15s, color .15s;
}
#bps-root .bps-clear:hover { background: var(--bps-accent); color: #fff; }

#bps-root .bps-close {
    flex: 0 0 auto;
    width: 46px; height: 46px; padding: 0;
    display: flex; align-items: center; justify-content: center;
    color: var(--bps-ink); background: #fff;
    border: 1px solid var(--bps-line); border-radius: 50%; cursor: pointer;
    box-shadow: 0 2px 8px rgba(20, 28, 4, .10);
    transition: transform .15s, background .15s, color .15s, border-color .15s;
}
#bps-root .bps-close:hover { background: var(--bps-ink); color: #fff; border-color: var(--bps-ink); transform: rotate(90deg); }

/* ---------- body ---------- */
#bps-root .bps-body {
    flex: 1 1 auto;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior: contain;
    padding: 6px 22px 22px;
    outline: none;
    transition: opacity .15s;
}
#bps-root .bps-body.is-loading { opacity: .55; }

#bps-root .bps-group { margin-top: 20px; }
#bps-root .bps-title {
    margin: 0 0 10px;
    font-size: 12px;
    font-weight: 800;
    letter-spacing: .09em;
    text-transform: uppercase;
    color: var(--bps-muted);
}
#bps-root .bps-title em { font-style: normal; color: var(--bps-accent-strong); margin-left: 4px; }

/* ---------- chips ---------- */
#bps-root .bps-chips { display: flex; flex-wrap: wrap; gap: 8px; }
#bps-root .bps-chip {
    display: inline-flex; align-items: center; gap: 7px;
    padding: 8px 14px;
    font-size: 14px; font-weight: 600; line-height: 1.2;
    color: var(--bps-ink);
    background: #fff;
    border: 1px solid var(--bps-line);
    border-radius: 999px;
    cursor: pointer;
    box-shadow: 0 1px 2px rgba(20, 28, 4, .05);
    transition: transform .12s, box-shadow .15s, border-color .15s, background .15s, color .15s;
}
#bps-root .bps-chip span { font-size: 12px; font-weight: 700; color: var(--bps-muted); }
#bps-root .bps-chip:hover { border-color: var(--bps-accent); background: var(--bps-soft); transform: translateY(-1px); box-shadow: 0 6px 14px rgba(var(--bps-accent-rgb), .18); }
#bps-root .bps-chip.is-on { background: var(--bps-accent); border-color: var(--bps-accent); color: #fff; }
#bps-root .bps-chip.is-on span { color: rgba(255, 255, 255, .85); }
#bps-root .bps-chip i { font-style: normal; font-size: 16px; line-height: 1; margin-left: 2px; }

/* ---------- product cards ---------- */
#bps-root .bps-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
#bps-root .bps-grid--big { grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; }

#bps-root .bps-card {
    position: relative;
    display: flex;
    align-items: center;
    gap: 14px;
    min-width: 0;
    padding: 10px 12px 10px 10px;
    background: #fff;
    border: 1px solid var(--bps-line);
    border-radius: 16px;
    box-shadow: 0 1px 2px rgba(20, 28, 4, .05);
    transition: transform .15s ease, box-shadow .18s ease, border-color .15s ease, background .15s;
}
#bps-root .bps-card:hover, #bps-root .bps-card.is-selected {
    transform: translateY(-2px);
    border-color: rgba(var(--bps-accent-rgb), .75);
    background: #fcfdf7;
    box-shadow: 0 14px 30px rgba(34, 46, 6, .16), 0 3px 8px rgba(34, 46, 6, .08);
}
#bps-root .bps-card.is-selected { box-shadow: 0 0 0 3px rgba(var(--bps-accent-rgb), .35), 0 14px 30px rgba(34, 46, 6, .16); }

#bps-root .bps-thumb {
    flex: 0 0 auto;
    display: block;
    width: 74px; height: 74px;
    border-radius: 12px;
    background: #f3f5ea;
    overflow: hidden;
}
#bps-root .bps-thumb img { display: block; width: 100%; height: 100%; object-fit: contain; border: 0; margin: 0; padding: 0; max-width: none; }

#bps-root .bps-info { display: block; min-width: 0; flex: 1 1 auto; }
#bps-root .bps-name {
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    font-size: 15px; font-weight: 600; line-height: 1.3;
    color: var(--bps-ink);
}
#bps-root .bps-name mark { background: rgba(var(--bps-accent-rgb), .22); color: inherit; padding: 0 1px; margin: 0 -1px; border-radius: 3px; }
#bps-root .bps-meta { display: block; margin-top: 2px; font-size: 12.5px; color: var(--bps-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
#bps-root .bps-meta--why { color: var(--bps-accent-strong); font-weight: 600; }
#bps-root .bps-price { display: block; margin-top: 4px; font-size: 15px; color: var(--bps-ink); }
#bps-root .bps-price b { font-weight: 800; color: var(--bps-accent-strong); }
#bps-root .bps-price s { margin-right: 7px; font-size: 13px; color: #9aa088; }

/* the overview: larger cards with a square picture on top */
#bps-root .bps-card--big { flex-direction: column; align-items: stretch; gap: 10px; padding: 10px; }
#bps-root .bps-card--big .bps-thumb { width: 100%; height: auto; aspect-ratio: 1 / 1; border-radius: 12px; }
#bps-root .bps-card--big .bps-name { font-size: 14px; min-height: 36px; }
#bps-root .bps-card--big .bps-price { margin-top: 6px; }

/* placeholders while loading */
#bps-root .bps-card--ghost { pointer-events: none; }
#bps-root .bps-card--ghost .bps-thumb,
#bps-root .bps-line {
    background: linear-gradient(90deg, #eef1e2 25%, #f7f9ef 37%, #eef1e2 63%);
    background-size: 400% 100%;
    animation: bps-shimmer 1.3s ease infinite;
}
#bps-root .bps-line { display: block; height: 12px; margin: 8px 0; border-radius: 6px; }
#bps-root .bps-line--short { width: 55%; }
@keyframes bps-shimmer { 0% { background-position: 100% 50%; } 100% { background-position: 0 50%; } }

/* ---------- empty state and buttons ---------- */
#bps-root .bps-empty { text-align: center; padding: 34px 10px 6px; color: var(--bps-muted); }
#bps-root .bps-empty svg { color: var(--bps-accent); opacity: .8; }
#bps-root .bps-empty-title { margin: 12px 0 4px; font-size: 18px; color: var(--bps-ink); }
#bps-root .bps-empty-tip { margin: 0; font-size: 14px; }

#bps-root .bps-more { text-align: center; margin-top: 16px; }
#bps-root .bps-morebtn {
    padding: 11px 26px;
    font-size: 14px; font-weight: 700;
    color: var(--bps-accent-strong);
    background: #fff;
    border: 2px solid var(--bps-accent);
    border-radius: 999px;
    cursor: pointer;
    transition: background .15s, color .15s, box-shadow .15s;
}
#bps-root .bps-morebtn:hover { background: var(--bps-accent); color: #fff; box-shadow: 0 8px 18px rgba(var(--bps-accent-rgb), .3); }
#bps-root .bps-morebtn:disabled { opacity: .5; cursor: default; }

/* ---------- footer ---------- */
#bps-root .bps-foot {
    flex: 0 0 auto;
    display: flex; align-items: center; justify-content: space-between; gap: 12px;
    padding: 11px 22px;
    font-size: 12.5px; color: var(--bps-muted);
    background: #fafbf5;
    border-top: 1px solid var(--bps-line);
}
#bps-root .bps-keys kbd {
    display: inline-block; min-width: 22px; margin: 0 4px 0 12px; padding: 2px 6px;
    font: 700 11px/1.4 inherit; font-family: inherit; text-align: center;
    color: var(--bps-ink); background: #fff;
    border: 1px solid var(--bps-line); border-bottom-width: 2px; border-radius: 6px;
}
#bps-root .bps-keys kbd:first-child { margin-left: 0; }
#bps-root .bps-allpage { font-weight: 700; color: var(--bps-accent-strong); }
#bps-root .bps-allpage:hover { text-decoration: underline; }

#bps-root .bps-live { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ---------- tablets and phones ---------- */
@media (max-width: 1000px) {
    #bps-root .bps-grid--big { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}

@media (max-width: 760px) {
    #bps-root .bps-panel { width: 100%; max-width: none; height: 100%; max-height: none; margin: 0; border-radius: 0; animation-name: bps-slide; }
    @keyframes bps-slide { from { opacity: 0; transform: translateY(24px); } to { opacity: 1; transform: none; } }
    #bps-root .bps-head { flex-wrap: wrap; gap: 10px 12px; padding: 12px 14px 12px; }
    #bps-root .bps-logo img { height: 36px; max-width: 150px; }
    #bps-root .bps-close { width: 42px; height: 42px; margin-left: auto; }
    #bps-root .bps-search { flex: 1 0 100%; order: 3; }
    #bps-root .bps-input { height: 50px; font-size: 16px; }   /* 16px stops iOS from zooming in */
    #bps-root .bps-body { padding: 4px 14px 18px; }
    #bps-root .bps-grid { grid-template-columns: 1fr; gap: 10px; }
    #bps-root .bps-grid--big { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
    #bps-root .bps-foot { display: none; }
}

@media (prefers-reduced-motion: reduce) {
    #bps-root .bps-backdrop, #bps-root .bps-panel { animation: none; }
    #bps-root .bps-card, #bps-root .bps-chip, #bps-root .bps-close { transition: none; }
    #bps-root .bps-card--ghost .bps-thumb, #bps-root .bps-line { animation: none; }
}
