/**
 * EILP - Busca Rápida Customizada — quick-search.css
 * Versão: 2.0.0
 * Mobile: wrapper original fixado no topo, sem clone.
 */

/* ── WRAPPER ── */
.eilp-quick-search-wrapper {
    position: relative;
    width: 100%;
    font-family: inherit;
    isolation: isolate;
}

/* ── FORM ── */
.eilp-quick-search-form {
    display: flex;
    align-items: stretch;
    height: 44px;
    background: #ffffff;
    border: 1.5px solid #d0d5dd;
    border-radius: 6px;
    position: relative;
    transition: border-color 150ms ease, box-shadow 150ms ease;
}
.eilp-quick-search-form:focus-within {
    border-color: #1D56A7;
    box-shadow: 0 0 0 3px rgba(29,86,167,0.12);
}

/* ── ÍCONE LUPA ── */
.eilp-icon-left {
    position: absolute;
    left: 12px; top: 50%;
    transform: translateY(-50%);
    color: #C0272D;
    width: 18px; height: 18px;
    pointer-events: none;
    display: flex; align-items: center; justify-content: center;
    z-index: 1;
}
.eilp-icon-left svg { width: 18px; height: 18px; }

/* ── INPUT ── */
.eilp-quick-search-input {
    flex: 1;
    border: none !important;
    outline: none !important;
    background: transparent !important;
    padding: 0 12px 0 38px !important;
    font-size: 16px !important;
    color: #1a1a1a !important;
    height: 100%;
    min-width: 0;
    border-radius: 6px 0 0 6px;
}
.eilp-quick-search-input::placeholder { color: #a0a8b8; }
.eilp-quick-search-input:-webkit-autofill,
.eilp-quick-search-input:-webkit-autofill:hover,
.eilp-quick-search-input:-webkit-autofill:focus {
    -webkit-box-shadow: 0 0 0px 1000px #fff inset !important;
    transition: background-color 5000s ease-in-out 0s;
}

/* ── BOTÃO VERMELHO ── */
.eilp-quick-search-submit {
    flex-shrink: 0;
    display: flex; align-items: center; justify-content: center;
    width: 48px; height: 100%;
    background: #C0272D;
    border: none !important; outline: none !important;
    cursor: pointer; color: #fff;
    transition: background 130ms ease;
    border-radius: 0 6px 6px 0;
    min-width: 44px;
}
.eilp-quick-search-submit:hover  { background: #9e1f24; }
.eilp-quick-search-submit:active { background: #881a1f; }
.eilp-quick-search-submit svg { width: 18px; height: 18px; }

/* ── SPINNER ── */
.eilp-quick-search-form.is-loading .eilp-quick-search-submit { position: relative; pointer-events: none; }
.eilp-quick-search-form.is-loading .eilp-quick-search-submit::after {
    content: '';
    position: absolute; inset: 0; margin: auto;
    width: 18px; height: 18px;
    border: 2px solid rgba(255,255,255,0.35);
    border-top-color: #fff;
    border-radius: 50%;
    animation: eilp-spin 0.6s linear infinite;
}
.eilp-quick-search-form.is-loading .eilp-quick-search-submit svg { opacity: 0; }
@keyframes eilp-spin { to { transform: rotate(360deg); } }

/* ── DROPDOWN DESKTOP ── */
.eilp-search-results-dropdown {
    display: none;
    position: absolute;
    top: calc(100% + 3px);
    left: 0; right: 0;
    background: #fff;
    border: 1.5px solid #d0d5dd;
    border-radius: 6px;
    box-shadow: 0 8px 24px rgba(0,0,0,0.15);
    z-index: 999999;
    overflow: hidden;
    max-height: 82vh;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    transform: translateZ(0);
}
.eilp-search-results-dropdown::-webkit-scrollbar { width: 4px; }
.eilp-search-results-dropdown::-webkit-scrollbar-thumb { background: #d0d5dd; border-radius: 4px; }

/* ── OVERLAY MOBILE ── */
.eilp-search-overlay {
    display: none;
    position: fixed; inset: 0;
    background: rgba(0,0,0,0.40);
    z-index: 999997;
    -webkit-tap-highlight-color: transparent;
}
.eilp-search-overlay.is-visible { display: block; }

/* ── DROPDOWN MOBILE ── */
@media (max-width: 768px) {
    .eilp-search-results-dropdown {
        position: fixed;
        left: 0; right: 0;
        top: var(--eilp-dropdown-top, 116px);
        max-height: var(--eilp-dropdown-maxh, calc(100dvh - 116px - 8px));
        border-left: none; border-right: none; border-top: none;
        border-radius: 0 0 10px 10px;
        z-index: 999998;
        box-shadow: 0 10px 30px rgba(0,0,0,0.20);
        overscroll-behavior: contain;
        -webkit-overflow-scrolling: touch;
    }
    /* Card catálogo */
    .eilp-catalog-subtitle { display: none; }
    .eilp-catalog-card-icon { width: 40px; height: 40px; font-size: 18px; }
    .eilp-catalog-cta { padding: 7px 11px; font-size: 9.5px; }
    .eilp-catalog-title { font-size: 14px; }
    /* Itens */
    .eilp-suggestion-image { width: 46px; height: 46px; }
    .eilp-suggestion-title { font-size: 13px; }
    .eilp-suggestion-link { gap: 10px; padding: 10px 12px; }
    .eilp-suggestion-link:active { background: #f5f8ff; }
    .eilp-suggestion-price { font-size: 13px; }
    .eilp-suggestion-price del { font-size: 11px; }
    .eilp-suggestion-footer a { min-height: 48px; }
}

@media (max-width: 359px) {
    .eilp-catalog-cta { display: none; }
    .eilp-suggestion-meta { display: none; }
}

/* ── CARD CATÁLOGO ── */
.eilp-catalog-card {
    --card-accent: #C0272D;
    border-bottom: 2px solid #f0f0f0;
    background: linear-gradient(135deg, #fff 0%, #fff8f8 100%);
    position: relative; overflow: hidden;
}
.eilp-catalog-card::before {
    content: ''; position: absolute;
    right: -20px; top: -20px;
    width: 90px; height: 90px;
    background: radial-gradient(circle, rgba(192,39,45,0.08) 0%, transparent 70%);
    border-radius: 50%; pointer-events: none;
}
.eilp-catalog-card-link {
    display: flex; align-items: center; gap: 13px;
    padding: 14px 16px;
    text-decoration: none !important; color: inherit;
    border-left: 4px solid var(--card-accent);
    transition: background 130ms ease; position: relative;
}
.eilp-catalog-card-link:hover,
.eilp-catalog-card-link:active {
    background: linear-gradient(135deg, #fdf2f2 0%, #fce8e8 100%);
    text-decoration: none !important;
}
.eilp-catalog-card-icon {
    flex-shrink: 0; width: 46px; height: 46px;
    border-radius: 10px; background: var(--card-accent);
    display: flex; align-items: center; justify-content: center;
    font-size: 22px;
    box-shadow: 0 3px 10px rgba(192,39,45,0.30);
    transition: transform 130ms ease, box-shadow 130ms ease;
}
.eilp-catalog-card-link:hover .eilp-catalog-card-icon {
    transform: scale(1.07); box-shadow: 0 5px 14px rgba(192,39,45,0.38);
}
.eilp-catalog-card-body { flex: 1; display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.eilp-catalog-badge {
    display: inline-block; width: fit-content;
    font-size: 9.5px; font-weight: 800; letter-spacing: 1px; text-transform: uppercase;
    color: var(--card-accent);
    background: rgba(192,39,45,0.10); border: 1px solid rgba(192,39,45,0.18);
    border-radius: 4px; padding: 1px 6px; margin-bottom: 1px;
}
.eilp-catalog-title {
    font-size: 15px; font-weight: 700; color: #1a1a1a;
    line-height: 1.2; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.eilp-catalog-subtitle {
    font-size: 12px; color: #666; line-height: 1.3;
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.eilp-catalog-cta {
    flex-shrink: 0;
    display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px;
    background: var(--card-accent); color: #fff !important;
    border-radius: 7px; padding: 8px 13px;
    font-size: 10.5px; font-weight: 800; letter-spacing: 0.5px; text-transform: uppercase;
    text-decoration: none !important;
    box-shadow: 0 2px 8px rgba(192,39,45,0.25);
    transition: filter 130ms ease, box-shadow 130ms ease; white-space: nowrap;
}
.eilp-catalog-cta svg { width: 13px; height: 13px; stroke: #fff; stroke-width: 2.5; }
.eilp-catalog-card-link:hover .eilp-catalog-cta { filter: brightness(1.08); box-shadow: 0 4px 12px rgba(192,39,45,0.35); }

/* ── LISTA PRODUTOS ── */
.eilp-search-suggestions { list-style: none; padding: 0; margin: 0; }
.eilp-suggestion-item { border-bottom: 1px solid #f0f1f5; }
.eilp-suggestion-item:last-child { border-bottom: none; }
.eilp-suggestion-link {
    display: flex; align-items: center; gap: 12px;
    padding: 11px 14px; text-decoration: none; color: #1a1a1a;
    transition: background 100ms ease;
}
.eilp-suggestion-link:hover { background: #f5f8ff; }

/* Imagem */
.eilp-suggestion-image {
    flex-shrink: 0; width: 54px; height: 54px;
    border: 1px solid #e8eaf0; border-radius: 7px;
    padding: 3px; background: #fff;
    display: flex; align-items: center; justify-content: center;
}
.eilp-suggestion-image img { width: 100%; height: 100%; object-fit: contain; }

/* Coluna principal — ocupa todo o espaço */
.eilp-suggestion-content { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }

/* Nome */
.eilp-suggestion-title {
    font-size: 13.5px; font-weight: 500; color: #1a1a1a; line-height: 1.35;
    display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.eilp-suggestion-title strong {
    font-weight: 700; color: #C0272D;
    background: rgba(192,39,45,0.07); border-radius: 2px; padding: 0 2px;
}

/* Ref / SKU */
.eilp-suggestion-sku {
    font-size: 11px; color: #9ba3b2;
    font-family: 'Courier New', monospace; letter-spacing: 0.2px;
}

/* Linha de preço + estoque */
.eilp-suggestion-meta {
    display: flex; align-items: center; gap: 6px; margin-top: 3px; flex-wrap: wrap;
}
.eilp-suggestion-price { font-size: 13.5px; font-weight: 700; color: #C0272D; line-height: 1; }
.eilp-suggestion-price .amount { display: inline; }
.eilp-suggestion-price del { color: #bbb; font-size: 11px; font-weight: 400; margin-right: 3px; }
.eilp-suggestion-price ins { text-decoration: none; }
.eilp-suggestion-meta-sep { color: #d0d5dd; font-size: 12px; line-height: 1; }

/* Badges de estoque */
.eilp-stock {
    display: inline-flex; align-items: center; gap: 4px;
    font-size: 11px; font-weight: 600; letter-spacing: 0.1px;
    padding: 2px 7px 2px 5px; border-radius: 20px; line-height: 1.4;
}
.eilp-stock--in  { color: #1a7a3f; background: #e8f7ee; }
.eilp-stock--out { color: #8a1a1a; background: #fdeaea; }
.eilp-stock--back{ color: #7a5a00; background: #fff8e1; }

/* Wrapper de preço antigo (ocultar se existir) */
.eilp-suggestion-price-wrapper { display: none; }

/* ── FOOTER ── */
.eilp-suggestion-footer { border-top: 1.5px solid #eef0f5; background: #f8f9fc; }
.eilp-suggestion-footer a {
    display: flex; align-items: center; justify-content: center; gap: 8px;
    padding: 13px 14px; text-decoration: none;
    font-size: 13px; font-weight: 700; color: #1D56A7;
    text-transform: uppercase; letter-spacing: 0.4px;
    transition: background 120ms ease, color 120ms ease; min-height: 48px;
}
.eilp-suggestion-footer a:hover,
.eilp-suggestion-footer a:active { background: #eef3fb; color: #C0272D; }

/* ── SEM RESULTADOS ── */
.eilp-no-results {
    display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px;
    padding: 24px 16px; text-align: center; font-size: 14px; font-weight: 600; color: #333;
}

/* ── SOBRESCRIÇÃO ELEMENTOR ── */
.site-header .eilp-search-results-dropdown,
.elementor-sticky .eilp-search-results-dropdown,
header .eilp-search-results-dropdown { z-index: 999998 !important; }

/* ════════════════════════════════════════════════
   MODAL FULL-SCREEN — MOBILE
   Cobre 100% da tela ao focar na busca
════════════════════════════════════════════════ */
.eilp-modal {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 1000001;
    background: #f4f5f7;
    flex-direction: column;
    overflow: hidden;
}
.eilp-modal.is-open {
    display: flex;
}

/* Bloqueia scroll da página enquanto modal aberto */
body.eilp-modal-active {
    overflow: hidden;
}

/* ── HEADER DO MODAL ── */
.eilp-modal-header {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 12px;
    background: #fff;
    border-bottom: 1.5px solid #e0e3ea;
    flex-shrink: 0;
    box-shadow: 0 2px 8px rgba(0,0,0,0.07);
}

/* Botão voltar (seta) */
.eilp-modal-back {
    flex-shrink: 0;
    display: flex; align-items: center; justify-content: center;
    width: 40px; height: 40px;
    background: none; border: none; cursor: pointer;
    color: #1a1a1a; border-radius: 8px;
    transition: background 120ms ease;
    -webkit-tap-highlight-color: transparent;
}
.eilp-modal-back:active { background: #f0f0f0; }
.eilp-modal-back svg { width: 22px; height: 22px; }

/* Wrap do input */
.eilp-modal-input-wrap {
    flex: 1;
    position: relative;
    display: flex; align-items: center;
}

.eilp-modal-input-wrap .eilp-icon-left {
    position: absolute;
    left: 10px; top: 50%;
    transform: translateY(-50%);
    color: #C0272D;
    pointer-events: none;
    z-index: 1;
}

.eilp-modal-input {
    width: 100%;
    height: 44px;
    border: 1.5px solid #1D56A7 !important;
    border-radius: 8px !important;
    outline: none !important;
    background: #f8f9fc !important;
    padding: 0 40px 0 36px !important;
    font-size: 16px !important;
    color: #1a1a1a !important;
    box-shadow: 0 0 0 3px rgba(29,86,167,0.10);
    transition: border-color 150ms ease;
}
.eilp-modal-input::placeholder { color: #a0a8b8; }
.eilp-modal-input:-webkit-autofill,
.eilp-modal-input:-webkit-autofill:focus {
    -webkit-box-shadow: 0 0 0px 1000px #f8f9fc inset !important;
}

/* Botão limpar (X dentro do input) */
.eilp-modal-clear {
    position: absolute;
    right: 8px; top: 50%;
    transform: translateY(-50%);
    display: flex; align-items: center; justify-content: center;
    width: 28px; height: 28px;
    background: #e0e3ea; border: none; border-radius: 50%;
    cursor: pointer; color: #555;
    transition: background 120ms ease;
    -webkit-tap-highlight-color: transparent;
}
.eilp-modal-clear:active { background: #c8cdd8; }
.eilp-modal-clear svg { width: 14px; height: 14px; }

/* ── CORPO DO MODAL (resultados) ── */
.eilp-modal-body {
    flex: 1;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior: contain;
}

.eilp-modal-results {
    background: #fff;
}

/* Spinner no modal */
.eilp-modal.is-loading .eilp-modal-header::after {
    content: '';
    position: absolute;
    bottom: 0; left: 0; right: 0;
    height: 3px;
    background: linear-gradient(90deg, #C0272D 0%, #1D56A7 50%, #C0272D 100%);
    background-size: 200% 100%;
    animation: eilp-bar-spin 1s linear infinite;
}
.eilp-modal-header { position: relative; }
@keyframes eilp-bar-spin {
    0%   { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

/* Estado vazio (antes de digitar) */
.eilp-modal-results:empty::before {
    content: 'Digite para buscar produtos...';
    display: block;
    padding: 40px 20px;
    text-align: center;
    font-size: 14px;
    color: #aaa;
}
