/* 
 * WEBIMPULSER INTELLIGENT SEARCH 
 * Premium Minimalist UI for WooCommerce
 */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&display=swap');

#wi-search-root {
    --wi-primary: #000000;
    --wi-text-main: #111111;
    --wi-text-dim: #71717a;
    --wi-bg: #ffffff;
    --wi-radius: 0px;
    --wi-border: #e4e4e7;

    position: fixed;
    inset: 0;
    z-index: 999999;
    display: none;
    background: rgba(255, 255, 255, 0.85);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    font-family: 'Inter', system-ui, -apple-system, sans-serif;
    justify-content: center;
    align-items: flex-start;
    padding: 20px;
    opacity: 0;
    transition: opacity 0.4s ease;
}

#wi-search-root.active {
    display: flex;
    opacity: 1;
}

.wi-search-modal {
    width: 100%;
    max-width: 700px;
    background: #ffffff;
    border-radius: 0;
    border: 1px solid var(--wi-border);
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.08);
    max-height: 90vh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    transform: translateY(10px);
    transition: all 0.5s cubic-bezier(0.16, 1, 0.3, 1);
}

#wi-search-root.active .wi-search-modal {
    transform: translateY(0);
}

/* HEADER */
.wi-search-header {
    padding: 30px 40px;
    border-bottom: 1px solid var(--wi-border);
    position: relative;
    background: #ffffff;
}

.wi-search-input-wrap {
    display: flex;
    align-items: center;
    background: transparent;
    border-radius: 0;
    padding: 0;
    height: 60px;
    border-bottom: 2px solid var(--wi-border);
    transition: all 0.3s ease;
}

.wi-search-input-wrap:focus-within {
    border-bottom-color: var(--wi-primary);
}

.wi-search-icon {
    color: var(--wi-primary);
    margin-right: 16px;
}

.wi-search-icon svg {
    width: 24px;
    height: 24px;
    stroke-width: 1.5;
}

#wi-search-input {
    flex: 1;
    background: transparent;
    border: none !important;
    outline: none !important;
    font-size: 1.5rem;
    font-weight: 500;
    color: var(--wi-text-main);
    padding: 0;
    height: 100%;
    box-shadow: none !important;
    letter-spacing: -0.02em;
}

#wi-search-input::placeholder {
    color: #a1a1aa;
    font-weight: 400;
}

.wi-search-close {
    position: absolute;
    top: 20px;
    right: 20px;
    width: 40px;
    height: 40px;
    background: transparent;
    border-radius: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    color: var(--wi-text-dim);
    z-index: 10;
    transition: color 0.2s;
}

.wi-search-close svg {
    width: 20px;
    height: 20px;
    stroke-width: 1.5;
}

.wi-search-close:hover {
    color: var(--wi-primary);
}

/* CONTENT */
.wi-search-body {
    flex: 1;
    overflow-y: auto;
    padding: 40px;
    scrollbar-width: thin;
    scrollbar-color: var(--wi-border) transparent;
}

.wi-search-body::-webkit-scrollbar {
    width: 6px;
}

.wi-search-body::-webkit-scrollbar-thumb {
    background-color: var(--wi-border);
}

/* INITIAL VIEW / HISTORY */
.wi-section-label {
    font-size: 0.65rem;
    font-weight: 700;
    color: var(--wi-text-dim);
    text-transform: uppercase;
    letter-spacing: 2px;
    margin-bottom: 20px;
    border-bottom: 1px solid var(--wi-border);
    padding-bottom: 8px;
}

.wi-history-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-bottom: 40px;
}

.wi-history-pill {
    background: transparent;
    padding: 10px 16px;
    border-radius: 0;
    border: 1px solid var(--wi-border);
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--wi-text-dim);
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
    transition: all 0.2s;
}

.wi-history-pill svg {
    width: 14px;
    height: 14px;
    stroke-width: 1.5;
}

.wi-history-pill:hover {
    border-color: var(--wi-primary);
    color: var(--wi-primary);
}

/* RESULTS GRID */
.wi-results-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 24px;
}

.wi-product-card {
    background: transparent;
    border-radius: 0;
    border: none;
    padding: 0;
    cursor: pointer;
    transition: all 0.3s ease;
    text-decoration: none !important;
    display: block;
}

.wi-product-img {
    width: 100%;
    aspect-ratio: 1/1;
    border-radius: 0;
    background-size: cover;
    background-position: center;
    background-color: #f4f4f5;
    margin-bottom: 16px;
    transition: filter 0.3s;
    border: 1px solid var(--wi-border);
}

.wi-product-card:hover .wi-product-img {
    filter: brightness(0.95);
}

.wi-product-info {
    padding: 0;
}

.wi-product-name {
    font-size: 1rem;
    font-weight: 600;
    color: var(--wi-text-main);
    margin-bottom: 8px;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    line-height: 1.4;
    letter-spacing: -0.01em;
}

.wi-sku-badge {
    display: inline-block;
    background: transparent;
    color: var(--wi-text-dim);
    font-size: 0.7rem;
    font-weight: 500;
    padding: 0;
    border-radius: 0;
    margin-bottom: 8px;
    letter-spacing: 0.5px;
}

.wi-product-price {
    font-size: 1.1rem;
    font-weight: 400;
    color: var(--wi-text-main);
}

/* OUT OF STOCK */
.wi-out-of-stock .wi-product-img {
    opacity: 0.5;
}

.wi-out-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: var(--wi-text-main);
    color: #fff;
    font-size: 0.7rem;
    font-weight: 600;
    padding: 6px 10px;
    border-radius: 0;
    letter-spacing: 1px;
    text-transform: uppercase;
    margin-top: 10px;
}

.wi-out-badge svg {
    display: none;
}

/* SALE BADGE */
.wi-sale-badge {
    position: absolute;
    top: 12px;
    left: 12px;
    background: var(--wi-text-main);
    color: #fff;
    font-size: 0.65rem;
    font-weight: 600;
    padding: 4px 8px;
    border-radius: 0;
    text-transform: uppercase;
    letter-spacing: 1px;
}

/* FUZZY WAND */
.wi-fuzzy-banner {
    background: #fafafa;
    padding: 16px 20px;
    border-radius: 0;
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 30px;
    cursor: pointer;
    border: 1px solid var(--wi-border);
    border-left: 4px solid var(--wi-primary);
    color: var(--wi-text-main);
    font-size: 0.85rem;
    animation: wiSlideIn 0.5s ease-out;
}

@keyframes wiSlideIn {
    from {
        opacity: 0;
        transform: translateY(-5px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.wi-fuzzy-banner b {
    font-weight: 600;
}

/* LOADERS */
.wi-spinner {
    width: 24px;
    height: 24px;
    border: 2px solid var(--wi-border);
    border-top-color: var(--wi-primary);
    border-radius: 50%;
    animation: wiSpin 0.8s linear infinite;
}

@keyframes wiSpin {
    to {
        transform: rotate(360deg);
    }
}

.wi-skeleton {
    background: #f4f4f5;
    animation: wiShimmer 2s infinite linear;
    background: linear-gradient(90deg, #f4f4f5 25%, #fafafa 50%, #f4f4f5 75%);
    background-size: 200% 100%;
}

@keyframes wiShimmer {
    from {
        background-position: 200% 0;
    }

    to {
        background-position: -200% 0;
    }
}

/* ── NO RESULTS STATE ───────────────────────────────────────────────────── */
.wi-no-results-wrap {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    padding: 60px 20px;
    animation: wiSlideIn 0.4s ease-out;
}

.wi-no-results-icon {
    width: 64px;
    height: 64px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 24px;
    color: var(--wi-text-main);
}

.wi-no-results-icon svg {
    width: 48px;
    height: 48px;
    stroke-width: 1;
}

.wi-no-results-title {
    margin: 0 0 12px;
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--wi-text-main);
}

.wi-no-results-sub {
    margin: 0;
    font-size: 0.95rem;
    color: var(--wi-text-dim);
}

/* ── RECOMMENDED PRODUCTS (no-results) ────────────────────────────────── */
.wi-no-results-rec-label {
    font-size: 0.65rem;
    font-weight: 700;
    color: var(--wi-text-dim);
    text-transform: uppercase;
    letter-spacing: 2px;
    margin: 40px 0 20px;
    text-align: left;
    border-bottom: 1px solid var(--wi-border);
    padding-bottom: 8px;
}

.wi-no-results-rec-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 16px;
}

.wi-rec-card {
    background: transparent;
    border-radius: 0;
    border: none;
    padding: 0;
    text-decoration: none !important;
    display: block;
    transition: all 0.3s ease;
    cursor: pointer;
}

.wi-rec-card:hover .wi-rec-img {
    filter: brightness(0.95);
}

.wi-rec-img {
    width: 100%;
    aspect-ratio: 1 / 1;
    border-radius: 0;
    background-size: cover;
    background-position: center;
    background-color: #f4f4f5;
    margin-bottom: 12px;
    position: relative;
    border: 1px solid var(--wi-border);
}

.wi-rec-info {
    padding: 0;
}

.wi-rec-name {
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--wi-text-main);
    margin-bottom: 4px;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    line-height: 1.4;
}

.wi-rec-price {
    font-size: 0.9rem;
    font-weight: 400;
    color: var(--wi-text-main);
}

/* ── RESPONSIVE ─────────────────────────────────────────────────────────── */
@media (max-width: 640px) {
    .wi-search-modal {
        max-height: 100vh;
        border-radius: 0;
        border: none;
        height: 100vh;
        max-width: 100%;
    }

    #wi-search-root {
        padding: 0;
        background: #ffffff;
    }

    .wi-search-header {
        padding: 20px 24px;
    }

    .wi-search-body {
        padding: 24px;
    }

    .wi-results-grid {
        gap: 16px;
    }
}

@media (max-width: 480px) {
    .wi-no-results-rec-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

/* BANNER */
.wi-search-banner {
    display: block;
    position: relative;
    width: 100%;
    margin-bottom: 40px;
    border-radius: 0;
    overflow: hidden;
    text-decoration: none;
    color: inherit;
    background: #000;
    border: 1px solid var(--wi-border);
    transition: opacity 0.3s ease;
}

.wi-search-banner:hover {
    opacity: 0.9;
}

.wi-banner-img {
    width: 100%;
    height: 160px;
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    position: relative;
}

.wi-banner-content {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    padding: 24px;
    z-index: 2;
}

.wi-banner-title {
    color: #ffffff;
    font-size: 1.5rem;
    font-weight: 600;
    margin-bottom: 8px;
    line-height: 1.2;
    letter-spacing: -0.02em;
}

.wi-banner-subtitle {
    color: rgba(255, 255, 255, 0.8);
    font-size: 0.95rem;
    font-weight: 400;
    line-height: 1.4;
}

/* BRANDING */
.wi-search-branding {
    text-align: center;
    padding: 16px;
    border-top: 1px solid var(--wi-border);
    background: #ffffff;
}

.wi-search-branding a {
    text-decoration: none;
    color: var(--wi-text-dim);
    font-size: 0.7rem;
    font-weight: 500;
    letter-spacing: 1px;
    text-transform: uppercase;
    transition: color 0.2s;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.wi-search-branding a:hover {
    color: var(--wi-primary);
}

.wi-search-branding svg {
    margin-left: 4px;
}

.wi-empty-msg {
    color: var(--wi-text-dim);
    font-size: 0.85rem;
}