/**
 * Enhanced Search - rich search panel.
 *
 * Deliberately theme-neutral: colours come from currentColor and a handful of
 * variables, fonts are inherited, so the panel reads as part of whatever theme
 * it lands in. Override the variables in the theme's own stylesheet to restyle.
 */
/* Positioned from JS against the search box's rect — see panel.js. */
.se-panel-host {
    position: fixed;
    z-index: 99999;
    /* Transparent bridge to the search box above. See position() in panel.js:
       the host sits flush against the box so the pointer never crosses dead
       space on its way down, and this padding restores the visual gap. */
    padding-top: 6px;
}

/* The theme is running a full-screen search overlay: match it edge to edge
   instead of floating a rounded box under a full-bleed bar. Flush by design
   there, so the hover bridge above would only push it past the viewport. */
.se-panel-host-full {
    padding-top: 0;
}

.se-panel-host-full .se-panel {
    max-height: var(--se-max-height, calc(100vh - 90px));
    border-left: 0;
    border-right: 0;
    border-radius: 0;
    box-shadow: 0 16px 32px rgba(0, 0, 0, .10);
    padding: 24px max(24px, 4vw);
    gap: 4vw;
}

.se-panel-host-full .se-grid {
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
}

.se-panel {
    --se-gap: 18px;
    --se-muted: #6b7280;
    --se-line: rgba(0, 0, 0, .08);
    --se-highlight: #4f46e5;
    --se-surface: #fff;

    display: flex;
    gap: var(--se-gap);
    box-sizing: border-box;
    width: 100%;
    max-height: 78vh;
    overflow-y: auto;
    /* Keep the swipe inside the panel: no scroll chaining to the locked page
       behind it, and momentum scrolling on older iOS. */
    overscroll-behavior: contain;
    -webkit-overflow-scrolling: touch;
    touch-action: pan-y;
    padding: var(--se-gap);
    background: var(--se-surface);
    border: 1px solid var(--se-line);
    border-radius: 6px;
    box-shadow: 0 12px 32px rgba(0, 0, 0, .12);
    font-size: 14px;
    line-height: 1.35;
    text-align: left;
}

.se-col {
    min-width: 0;
}

.se-col-docs {
    flex: 1 1 58%;
}

.se-col-misc {
    flex: 1 1 42%;
    border-left: 1px solid var(--se-line);
    padding-left: var(--se-gap);
}

.se-panel-empty .se-col-misc {
    border-left: 0;
    padding-left: 0;
}

.se-title {
    margin: 0 0 10px;
    font-size: 13px;
    font-weight: 600;
    opacity: .75;
}

.se-section + .se-section {
    margin-top: var(--se-gap);
}

/* --- product rows --------------------------------------------------------- */
.se-result {
    display: flex;
    gap: 12px;
    align-items: flex-start;
    padding: 8px 4px;
    border-top: 1px solid var(--se-line);
    color: inherit;
    text-decoration: none;
}

.se-result:first-child {
    border-top: 0;
}

.se-result:hover,
.se-result:focus,
.se-hit:hover,
.se-hit:focus,
.se-suggestion:hover,
.se-suggestion:focus {
    background: rgba(0, 0, 0, .035);
    outline: none;
}

.se-result-image img {
    width: 56px;
    height: 56px;
    object-fit: contain;
}

.se-result-info {
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 0;
}

.se-result-title {
    font-weight: 500;
}

.se-result-brand,
.se-result-id {
    font-size: 12px;
    color: var(--se-muted);
    text-transform: uppercase;
    letter-spacing: .02em;
}

.se-result-id {
    text-transform: none;
}

.se-result-price {
    font-weight: 600;
}

.se-result-old {
    font-weight: 400;
    color: var(--se-muted);
}

/* "From" prefix, for shops that quote the lowest quantity-tier price. */
.se-price-from {
    margin-right: 3px;
    font-weight: 400;
    color: var(--se-muted);
}

.se-view-all {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    margin-top: 10px;
    padding: 10px;
    border-top: 1px solid var(--se-line);
    color: inherit;
    font-weight: 600;
    text-decoration: none;
}

.se-empty {
    margin: 0;
    padding: 12px 4px;
    color: var(--se-muted);
}

/* --- right column --------------------------------------------------------- */
.se-hit,
.se-suggestion {
    display: block;
    width: 100%;
    padding: 6px 4px;
    border: 0;
    background: none;
    color: inherit;
    font: inherit;
    text-align: left;
    text-decoration: none;
    cursor: pointer;
}

.se-hit-name {
    margin-right: 4px;
}

.se-count {
    color: var(--se-muted);
}

.se-legend {
    display: block;
    font-size: 11px;
    color: var(--se-muted);
}

.se-icon {
    display: inline-block;
    width: 1em;
    margin-right: 6px;
    color: var(--se-muted);
}

/* --- recent searches (this browser only) ---------------------------------- */
.se-recent-row {
    display: flex;
    align-items: center;
}

.se-recent-row .se-suggestion {
    flex: 1 1 auto;
}

.se-recent-remove {
    flex: 0 0 auto;
    padding: 2px 8px;
    border: 0;
    background: none;
    color: var(--se-muted);
    font: inherit;
    line-height: 1;
    cursor: pointer;
}

.se-recent-remove:hover,
.se-recent-remove:focus {
    color: inherit;
    outline: none;
}

.se-clear {
    float: right;
    padding: 0;
    border: 0;
    background: none;
    color: var(--se-muted);
    font: inherit;
    font-size: 12px;
    font-weight: 400;
    text-decoration: underline;
    cursor: pointer;
}

/* --- idle panel: top searches + a shelf of best sellers -------------------- */
.se-panel-idle {
    display: block;
}

.se-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 12px;
}

.se-card {
    display: flex;
    flex-direction: column;
    gap: 3px;
    padding: 8px;
    border: 1px solid var(--se-line);
    border-radius: 4px;
    color: inherit;
    text-decoration: none;
}

.se-card:hover,
.se-card:focus {
    background: rgba(0, 0, 0, .035);
    outline: none;
}

.se-card-image img {
    width: 100%;
    height: 110px;
    object-fit: contain;
}

.se-card-title {
    font-weight: 500;
}

/* Matched fragments, cross-script: "γατας" highlights the "Cat" in Catmania. */
.se-panel em {
    font-style: normal;
    font-weight: 600;
    color: var(--se-highlight);
}

@media (max-width: 767px) {
    .se-panel {
        display: block;
        max-height: 70vh;
        padding: 12px;
    }

    .se-col-misc {
        margin-top: 14px;
        padding-left: 0;
        padding-top: 14px;
        border-left: 0;
        border-top: 1px solid var(--se-line);
    }

    .se-result-image img {
        width: 44px;
        height: 44px;
    }

    .se-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .se-card-image img {
        height: 90px;
    }
}
