/* ============================================================
   v0.7.15 — BookList finder (v3: replaces header search entirely)
   Full replacement for assets/finder.css
   ============================================================ */

/* ---------- Hide the theme's own search ----------
   Unconditional, not applied by JS. A class added on document-ready would
   still let the original search form paint for one frame before being
   hidden, causing a visible flash on load. This rule is parsed by the
   browser before first paint, since stylesheets are render-blocking, so
   the WooCommerce form is never visible at all.
   Hidden, not removed — the original form is still in the DOM underneath.
   If product search returns later, delete this rule; the form reappears
   unmodified with no other change needed. */
.header-search-advanced {
    display: none !important;
}
/* ---------- Replacement bar ---------- */

.abs-finder-bar {
    display: flex;
    align-items: stretch;
    width: 100%;
    max-width: 640px;
    border: 1px solid #e2e2e2;
    border-radius: 30px;
    overflow: hidden;
    cursor: pointer;
    background: #fff;
}

.abs-finder-bar:hover {
    border-color: #c9c9c9;
}

.abs-finder-bar:focus-visible {
    outline: 2px solid #1a2b4c;
    outline-offset: 2px;
}

.abs-finder-bar-placeholder {
    flex: 1 1 auto;
    display: flex;
    align-items: center;
    padding: 0 20px;
    min-height: 36px;
    color: #8a8a8a;
    font-size: 15px;
    min-width: 280px;
}

.abs-finder-bar-button {
    flex: 0 0 auto;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 0 20px;
    background: var(--global-palette2);
    color: #fff;
    font-weight: 600;
    font-size: 14px;
    white-space: nowrap;
}

.abs-finder-bar:hover .abs-finder-bar-button {
    background: var(--global-palette1);
}

.abs-finder-icon {
    font-size: 16px;
    line-height: 1;
}

/* ---------- Modal ---------- */

.abs-finder-backdrop {
    position: fixed;
    inset: 0;
    z-index: 999999;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 20px;
    background: rgba(15, 23, 42, .55);
}

.abs-finder-backdrop.is-open {
    display: flex;
}

.abs-finder-panel {
    width: 100%;
    max-width: 460px;
    max-height: 90vh;
    overflow-y: auto;
    background: #fff;
    border-radius: 10px;
    box-shadow: 0 18px 50px rgba(0, 0, 0, .28);
}

.abs-finder-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px 22px 0;
}

.abs-finder-head h3 {
    margin: 0;
    font-size: 19px;
}

.abs-finder-close {
    background: none;
    border: none;
    font-size: 26px;
    line-height: 1;
    color: #6b7280;
    cursor: pointer;
    padding: 4px;
}

.abs-finder-body {
    padding: 18px 22px 4px;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.abs-finder-field {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.abs-finder-field span {
    font-weight: 600;
    font-size: 14px;
}

.abs-finder-field select {
    width: 100%;
    padding: 9px 10px;
}

.abs-finder-empty,
.abs-finder-error {
    margin: 0;
    padding: 11px 13px;
    border-radius: 4px;
    font-size: 13px;
}

.abs-finder-empty {
    background: #fffdf5;
    border-left: 3px solid #f0c674;
    color: #92400e;
}

.abs-finder-error {
    background: #fef2f2;
    border-left: 3px solid #b32d2e;
    color: #7f1d1d;
}

.abs-finder-actions {
    padding: 18px 22px 22px;
}

.abs-finder-actions .abs-finder-go {
    width: 100%;
    margin: 0;
}

.abs-finder-label {
    position: absolute;
    left: 50%;
    bottom: calc(100% + 8px);
    transform: translateX(-50%);
    padding: 6px 10px;
    background: #1a1a1a;
    color: #fff;
    font-size: 12px;
    font-weight: 600;
    white-space: nowrap;
    border-radius: 4px;
    opacity: 0;
    visibility: hidden;
    transition: opacity .15s ease;
    pointer-events: none;
}

.abs-finder-label::after {
    content: "";
    position: absolute;
    top: 100%;
    left: 50%;
    transform: translateX(-50%);
    border: 5px solid transparent;
    border-top-color: #1a1a1a;
}

.abs-finder-bar-button {
    position: relative;
}

.abs-finder-bar:hover .abs-finder-label,
.abs-finder-bar:focus-visible .abs-finder-label {
    opacity: 1;
    visibility: visible;
}

/* ---------- Mobile ---------- */

@media (max-width: 600px) {
    .abs-finder-bar-placeholder {
        font-size: 14px;
        padding: 0 14px;
    }

    .abs-finder-label {
        display: none;
    }

    .abs-finder-bar-button {
        padding: 0 16px;
    }

    body.abs-finder-open {
        overflow: hidden;
    }

    .abs-finder-backdrop {
        padding: 0;
        align-items: stretch;
    }

    .abs-finder-panel {
        max-width: none;
        max-height: none;
        width: 100%;
        border-radius: 0;
    }

    .abs-finder-head {
        padding-top: 24px;
    }
}
