/* RPBuscar — Search Styles v2.2 (Mobile Optimized) */

/* Anula regras globais do tema no input da busca */
.fsl-wrap input[type=search],
.fsl-wrap input[type=text] {
    border: none !important;
    border-bottom: none !important;
    border-radius: 50px !important;
    box-shadow: none !important;
    background-clip: padding-box !important;
    transition: none !important;
    padding: 13px 48px 13px 44px !important;
    background: transparent !important;
    outline: none !important;
    width: 100% !important;
    font-size: 16px !important; /* Evita zoom automático no iOS */
    color: #333 !important;
    line-height: 1.4 !important;
}

.fsl-wrap {
    position: relative;
    width: 100%;
    max-width: 680px;
    font-family: inherit;
    margin: 0 auto;
}

/* Input wrapper */
.fsl-input-wrap {
    position: relative;
    display: flex;
    align-items: center;
    background: #f0f0f0;
    border-radius: 50px;
    border: 2px solid transparent;
    transition: background 0.2s, border-color 0.2s;
}

.fsl-input-wrap:focus-within {
    background: #fff;
    border-color: #222;
}

/* Lupa */
.fsl-icon-search {
    position: absolute;
    left: 14px;
    top: 50%;
    transform: translateY(-50%);
    width: 20px;
    height: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    pointer-events: none;
    color: #999;
}

.fsl-input-wrap:focus-within .fsl-icon-search { color: #333; }
.fsl-icon-search svg { width: 17px; height: 17px; }

/* Botão limpar */
.fsl-icon-clear {
    position: absolute;
    right: 14px;
    top: 50%;
    transform: translateY(-50%);
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    color: #fff;
    background: #bbb;
    border-radius: 50%;
    z-index: 2;
}

.fsl-icon-clear svg { width: 12px; height: 12px; }

/* Spinner */
.fsl-spinner {
    position: absolute;
    right: 14px;
    top: 50%;
    transform: translateY(-50%);
    width: 20px;
    height: 20px;
}

.fsl-spinner::after {
    content: \'\';
    display: block;
    width: 16px;
    height: 16px;
    border: 2px solid #ddd;
    border-top-color: #222;
    border-radius: 50%;
    animation: fsl-spin 0.7s linear infinite;
}

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

/* Dropdown Results */
.fsl-results {
    position: absolute;
    top: calc(100% + 8px);
    left: 0;
    right: 0;
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 10px 40px rgba(0,0,0,0.15);
    overflow: hidden;
    z-index: 1000;
    max-height: 400px;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    border: 1px solid rgba(0,0,0,0.05);
}

/* Item Result */
.fsl-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    cursor: pointer;
    text-decoration: none;
    color: inherit;
    border-bottom: 1px solid #f5f5f5;
    -webkit-tap-highlight-color: transparent;
}

.fsl-item:last-child { border-bottom: none; }
.fsl-item:hover, .fsl-item.fsl-active { background: #f8f8f8; }

.fsl-item-thumb {
    width: 52px;
    height: 52px;
    flex-shrink: 0;
    border-radius: 6px;
    overflow: hidden;
    background: #f0f0f0;
}

.fsl-item-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

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

.fsl-item-title {
    font-size: 14px;
    font-weight: 600;
    color: #222;
    margin-bottom: 2px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.fsl-item-title strong { color: var(--fsl-accent, #e91e8c); }

.fsl-item-meta {
    font-size: 12px;
    color: #888;
    display: flex;
    gap: 10px;
    align-items: center;
}

.fsl-item-price { color: var(--fsl-accent, #e91e8c); font-weight: 700; }
.fsl-item-sku { font-size: 11px; color: #bbb; }

.fsl-no-results { padding: 30px; text-align: center; color: #999; font-size: 14px; }

.fsl-see-all {
    display: block;
    padding: 14px;
    text-align: center;
    font-size: 13px;
    font-weight: 700;
    color: var(--fsl-accent, #e91e8c);
    text-decoration: none;
    background: #fcfcfc;
    border-top: 1px solid #eee;
}

/* Mobile Specific Fixes */
@media (max-width: 768px) {
    .fsl-results {
        position: absolute; /* Manter como absolute para seguir o input */
        top: calc(100% + 8px); /* Ajustar a distância do input */
        left: 0;
        right: 0;
        max-height: 60vh; /* Ajustar altura máxima para não cobrir a tela toda */
        border-radius: 12px;
        box-shadow: 0 5px 20px rgba(0,0,0,0.1);
    }
    
    /* Garantir que o wrap tenha position relative para o absolute funcionar */
    .fsl-wrap { position: relative; }
}

/* Linha de progresso no topo do campo */
.fsl-input-wrap::after {
    content: '';
    position: absolute;
    bottom: -2px;
    left: 10%;
    right: 10%;
    height: 2px;
    background: var(--fsl-accent, #e91e8c);
    border-radius: 2px;
    transform: scaleX(0);
    transition: transform 0s;
    opacity: 0;
}

.fsl-input-wrap.fsl-loading::after {
    opacity: 1;
    transform: scaleX(0.7);
    transition: transform 0.8s ease;
}

.fsl-input-wrap.fsl-done::after {
    transform: scaleX(1);
    opacity: 0;
    transition: transform 0.15s ease, opacity 0.25s ease 0.15s;
}

/* Preloader — barra abaixo do campo */
.fsl-preloader {
    height: 3px;
    border-radius: 0 0 4px 4px;
    overflow: hidden;
    background: transparent;
    margin: 0 8px;
}

.fsl-preloader-bar {
    height: 100%;
    width: 0%;
    background: var(--fsl-accent, #e91e8c);
    border-radius: 2px;
    transition: none;
    opacity: 0;
}

.fsl-loading .fsl-preloader-bar {
    opacity: 1;
    width: 75%;
    transition: width 0.8s ease;
}

.fsl-done .fsl-preloader-bar {
    width: 100%;
    opacity: 0;
    transition: width 0.15s ease, opacity 0.3s ease 0.1s;
}

