/* ============================================================
   WEW Ajax Search Widget — Frontend CSS
   ============================================================ */

/* ── Wrapper ─────────────────────────────────────────────── */
.wew-search-wrapper {
    position: relative;
    width: 100%;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}

/* ── Search bar row ─────────────────────────────────────── */
.wew-search-bar {
    display: flex;
    align-items: stretch;
    background: #fff;
    border: none;
    border-radius: 50px;
    overflow: hidden;
    /* Default shadow — overridden by Elementor box-shadow control */
    box-shadow: 0 2px 14px rgba(0, 0, 0, 0.10);
    transition: box-shadow 0.22s ease;
}

/* ── Category select ─────────────────────────────────────── */
.wew-search-category {
    /* Stretch to full bar height */
    align-self: stretch;
    border: none;
    border-right: 1.5px solid #ebebeb;
    background-color: #f7f7f7;
    padding: 0 28px 0 14px;
    font-size: 13px;
    color: #555;
    cursor: pointer;
    outline: none;
    appearance: none;
    -webkit-appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6' viewBox='0 0 10 6'%3E%3Cpath fill='%23999' d='M0 0l5 6 5-6z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 10px center;
    /* No fixed min-width: let the browser size it to its content */
    min-width: 0;
    max-width: 160px;
    width: auto;
    /* Shrink before the input does */
    flex-shrink: 1;
    font-family: inherit;
    transition: background-color 0.2s;
    /* Round only the left corners (matches pill bar) */
    border-radius: 50px 0 0 50px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.wew-search-category:focus,
.wew-search-category:hover {
    background-color: #f0effa;
}

/* ── Input wrap ──────────────────────────────────────────── */
.wew-search-input-wrap {
    display: flex;
    align-items: center;
    flex: 1;
    padding: 0 18px;
    gap: 9px;
    /* Guarantee the input always has at least 80px — never collapses */
    min-width: 80px;
    /* Override theme styles */
    border: none !important;
    outline: none !important;
    box-shadow: none !important;
    background: transparent !important;
}

.wew-search-input {
    flex: 1;
    border: none !important;
    outline: none !important;
    box-shadow: none !important;
    background: transparent !important;
    font-size: 14px;
    color: #1a1a1a;
    padding: 14px 0;
    font-family: inherit;
    min-width: 0;
}

.wew-search-input:focus {
    border: none !important;
    outline: none !important;
    box-shadow: none !important;
}

.wew-search-input::placeholder {
    color: #c0c0c0;
}

/* ── Spinner ─────────────────────────────────────────────── */
.wew-search-spinner {
    width: 15px;
    height: 15px;
    border: 2px solid #ececec;
    border-top-color: #9b8ecf;
    border-radius: 50%;
    animation: wew-search-spin 0.65s linear infinite;
    flex-shrink: 0;
}

@keyframes wew-search-spin {
    to {
        transform: rotate(360deg);
    }
}

/* ── Button ──────────────────────────────────────────────── */
.wew-search-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 7px;
    padding: 11px 24px;
    /* Elementor primary color as default; overridable from Elementor controls */
    background: var(--e-global-color-primary, #4385d8);
    color: #fff;
    border: none;
    cursor: pointer;
    font-size: 14px;
    font-weight: 600;
    font-family: inherit;
    border-radius: 0 50px 50px 0;
    white-space: nowrap;
    flex-shrink: 0;
    transition: background 0.2s ease, transform 0.1s ease;
    letter-spacing: 0.2px;
}

.wew-search-btn:hover {
    filter: brightness(1.10);
}

.wew-search-btn:active {
    transform: scale(0.97);
}

.wew-btn-icon {
    width: 15px;
    height: 15px;
}

/* ── Dropdown ────────────────────────────────────────────── */
.wew-search-dropdown {
    position: absolute;
    top: calc(100% + 8px);
    left: 0;
    right: 0;
    background: #fff;
    border-radius: 16px;
    box-shadow: 0 16px 48px rgba(0, 0, 0, 0.14), 0 3px 10px rgba(0, 0, 0, 0.06);
    z-index: 99999;
    max-height: 420px;
    overflow-y: auto;
    overflow-x: hidden;
    animation: wew-dropdown-appear 0.18s cubic-bezier(0.22, 0.61, 0.36, 1);
    scroll-behavior: smooth;
}

@keyframes wew-dropdown-appear {
    from {
        opacity: 0;
        transform: translateY(-6px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Custom scrollbar */
.wew-search-dropdown::-webkit-scrollbar {
    width: 4px;
}

.wew-search-dropdown::-webkit-scrollbar-track {
    background: transparent;
}

.wew-search-dropdown::-webkit-scrollbar-thumb {
    background: #e0e0e0;
    border-radius: 4px;
}

.wew-search-dropdown::-webkit-scrollbar-thumb:hover {
    background: #c0c0c0;
}

/* ── Result item ─────────────────────────────────────────── */
.wew-search-result-item {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 11px 16px;
    text-decoration: none !important;
    color: inherit;
    border-bottom: 1px solid #f5f5f5;
    transition: background 0.12s ease;
    outline: none;
}

.wew-search-result-item:last-child {
    border-bottom: none;
}

.wew-search-result-item:hover,
.wew-search-result-item.wew-result--focused {
    background: #f9f8ff;
}

.wew-search-result-item:first-child {
    border-radius: 16px 16px 0 0;
}

.wew-search-result-item:last-child {
    border-radius: 0 0 16px 16px;
}

.wew-search-result-item:only-child {
    border-radius: 16px;
}

/* Thumbnail */
.wew-search-result-thumb {
    width: 46px;
    height: 46px;
    min-width: 46px;
    object-fit: cover;
    border-radius: 8px;
    background: #f5f5f5;
    flex-shrink: 0;
}

/* Title */
.wew-search-result-title {
    flex: 1;
    font-size: 14px;
    font-weight: 600;
    color: #1a1a1a;
    line-height: 1.35;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    min-width: 0;
}

/* Price */
.wew-search-result-price {
    font-size: 14px;
    font-weight: 700;
    color: #e05a5a;
    white-space: nowrap;
    flex-shrink: 0;
    margin-left: auto;
    padding-left: 8px;
}

.wew-search-result-price *,
.wew-search-result-price span,
.wew-search-result-price bdi {
    font-size: inherit !important;
    font-weight: inherit !important;
    color: inherit !important;
}

/* ── No Results ──────────────────────────────────────────── */
.wew-search-no-results {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 20px 16px;
    color: #aaa;
    font-size: 14px;
}

.wew-search-no-results svg {
    width: 18px;
    height: 18px;
    flex-shrink: 0;
    color: #ccc;
}

.wew-search-no-results strong {
    color: #555;
    font-weight: 600;
}

/* ── Responsive ──────────────────────────────────────────── */

/* ── Medium screens (≤ 1280px): icon-only button ─────────── *
 * Keep the category visible, but save space by removing btn text
 * ─────────────────────────────────────────────────────────── */
@media (max-width: 1280px) {

    /* Button: icon only — hide text label */
    .wew-search-btn .wew-btn-text {
        display: none;
    }

    /* Tighten button padding */
    .wew-search-btn {
        padding: 11px 20px;
        gap: 0;
    }

    .wew-btn-icon {
        width: 17px;
        height: 17px;
    }
}

/* ── Tablet & below (≤ 1024px): also hide category ──────── *
 * Input + icon-button take all the space
 * ─────────────────────────────────────────────────────────── */
@media (max-width: 1024px) {

    /* Hide the category dropdown entirely */
    .wew-search-category {
        display: none !important;
    }

    /* Remove the left-rounded corner now that category is gone */
    .wew-search-input-wrap {
        border-radius: 50px 0 0 50px;
        padding: 0 12px; /* tighter horizontal padding */
    }

    /* Reduce input vertical padding for a slimmer bar */
    .wew-search-input {
        padding: 10px 0;
    }
}

/* ── Mobile (≤ 600px) ────────────────────────────────────── *
 * Category already hidden; further reduce button padding
 * ─────────────────────────────────────────────────────────── */
@media (max-width: 600px) {

    .wew-search-btn {
        padding: 11px 16px;
    }

    .wew-btn-icon {
        width: 18px;
        height: 18px;
    }

    .wew-search-input {
        font-size: 13px;
    }

    .wew-search-result-title {
        font-size: 13px;
    }

    .wew-search-result-price {
        font-size: 13px;
    }
}