/* ============================================================
   WooCommerce AJAX Search Filter — woo-ajax-search.css
   ============================================================ */

/* Reset scoped to our widget */
.was-wrapper *,
.was-wrapper *::before,
.was-wrapper *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

/* ── Container ────────────────────────────────────────────── */
.was-wrapper {
    position: relative;
    width: 100%;
    max-width: 760px;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    font-size: 15px;
    line-height: 1.4;
    color: #1a1a1a;
}

/* ── Search bar ───────────────────────────────────────────── */
.was-search-bar {
    display: flex;
    align-items: stretch;
    border: 1.5px solid #d0d0d0;
    border-radius: 6px;
    background: #fff;
    overflow: hidden;
    transition: border-color 0.18s, box-shadow 0.18s;
}

.was-search-bar:focus-within {
    border-color: #2d5a27;
    box-shadow: 0 0 0 3px rgba(45, 90, 39, 0.12);
}

.was-input {
    flex: 1;
    padding: 12px 16px;
    border: none;
    outline: none;
    font-size: 15px;
    color: #1a1a1a;
    background: transparent;
}

.was-input::placeholder {
    color: #9a9a9a;
}

.was-btn {
    display: flex;
    align-items: center;
    gap: 7px;
    padding: 12px 22px;
    background: #2d5a27;
    border: none;
    cursor: pointer;
    color: #fff;
    font-size: 15px;
    font-weight: 600;
    letter-spacing: 0.01em;
    transition: background 0.18s;
    white-space: nowrap;
}

.was-btn:hover { background: #234820; }
.was-btn:active { background: #1b3819; }

/* Spinner inside button */
.was-spinner {
    display: none;
    width: 16px;
    height: 16px;
    animation: was-spin 0.75s linear infinite;
    flex-shrink: 0;
}

.was-wrapper.is-loading .was-spinner { display: block; }
.was-wrapper.is-loading .was-btn-label { display: none; }

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

/* ── Dropdown ─────────────────────────────────────────────── */
.was-dropdown {
    position: absolute;
    top: calc(100% + 4px);
    left: 0;
    right: 0;
    background: #fff;
    border: 1.5px solid #d8d8d8;
    border-radius: 6px;
    box-shadow: 0 8px 28px rgba(0, 0, 0, 0.12);
    z-index: 9999;
    overflow: hidden;
}

.was-dropdown[hidden] { display: none; }

/* Meta line: "3 results found" */
.was-meta {
    padding: 10px 16px 8px;
    font-size: 13px;
    font-weight: 700;
    color: #1a1a1a;
    border-bottom: 1px solid #f0f0f0;
    background: #fafafa;
}

/* ── Results list ─────────────────────────────────────────── */
.was-results {
    list-style: none;
    max-height: 380px;
    overflow-y: auto;
    overscroll-behavior: contain;
}

.was-results::-webkit-scrollbar { width: 5px; }
.was-results::-webkit-scrollbar-thumb { background: #d0d0d0; border-radius: 4px; }

/* Single result item */
.was-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 16px;
    cursor: pointer;
    transition: background 0.12s;
    text-decoration: none;
    color: inherit;
}

.was-item:hover,
.was-item:focus,
.was-item.is-active {
    background: #f2f7f1;
    outline: none;
}

/* Thumbnail */
.was-item-img {
    width: 44px;
    height: 44px;
    border-radius: 4px;
    object-fit: cover;
    flex-shrink: 0;
    border: 1px solid #ebebeb;
    background: #f5f5f5;
}

.was-item-body {
    flex: 1;
    min-width: 0;
}

.was-item-title {
    font-size: 14px;
    color: #1a1a1a;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Bold the matched keyword */
.was-item-title mark {
    background: none;
    font-weight: 700;
    color: inherit;
}

.was-item-price {
    font-size: 13px;
    color: #555;
    margin-top: 2px;
}

.was-item-price ins { text-decoration: none; }

/* Out-of-stock badge */
.was-badge-oos {
    font-size: 11px;
    font-weight: 600;
    background: #ffe8e8;
    color: #c0392b;
    padding: 1px 6px;
    border-radius: 3px;
    margin-left: auto;
    flex-shrink: 0;
}

/* No results */
.was-no-results {
    padding: 18px 16px;
    font-size: 14px;
    color: #777;
    text-align: center;
}

/* Footer — "View all results" */
.was-footer {
    border-top: 1px solid #f0f0f0;
    padding: 10px 16px;
    background: #fafafa;
}

.was-footer[hidden] { display: none; }

.was-view-all {
    font-size: 13px;
    font-weight: 600;
    color: #2d5a27;
    text-decoration: none;
}

.was-view-all:hover { text-decoration: underline; }

/* ── Responsive ───────────────────────────────────────────── */
@media (max-width: 480px) {
    .was-btn-label { display: none; }
    .was-btn {
        padding: 12px 14px;
    }
    .was-btn::after {
        content: "";
        display: block;
        width: 18px;
        height: 18px;
        background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23fff' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='11' cy='11' r='8'/%3E%3Cline x1='21' y1='21' x2='16.65' y2='16.65'/%3E%3C/svg%3E");
        background-size: contain;
    }
}
