/* CSS para Busca Avançada de Produtos */

/* Container do dropdown */
.search-dropdown {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: rgba(255, 255, 255, 0.98);
    backdrop-filter: blur(20px);
    border-radius: 16px;
    margin-top: 8px;
    max-height: 400px;
    overflow: hidden;
    z-index: 1000;
    opacity: 0;
    transform: translateY(-10px);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    pointer-events: none;
    box-shadow:
            0 20px 40px rgba(0, 0, 0, 0.1),
            0 4px 20px rgba(0, 0, 0, 0.08),
            inset 0 1px 0 rgba(255, 255, 255, 0.8);
    border: 1px solid rgba(0, 0, 0, 0.06);
}

.search-dropdown.show {
    opacity: 1;
    transform: translateY(0);
    pointer-events: all;
}

/* Loading state */
.search-loading {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    padding: 24px;
    color: #64748b;
    font-size: 14px;
}

.loading-spinner {
    width: 20px;
    height: 20px;
    border: 2px solid #e2e8f0;
    border-top: 2px solid #3b82f6;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Container dos resultados */
.search-results {
    max-height: 360px;
    overflow-y: auto;
    scrollbar-width: thin;
    scrollbar-color: #cbd5e1 transparent;
}

.search-results::-webkit-scrollbar {
    width: 6px;
}

.search-results::-webkit-scrollbar-track {
    background: transparent;
}

.search-results::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 3px;
}

.search-results::-webkit-scrollbar-thumb:hover {
    background: #94a3b8;
}

/* Item individual do resultado */
.search-result-item {
    transition: all 0.2s ease;
    border-bottom: 1px solid rgba(0, 0, 0, 0.04);
}

.search-result-item:last-child {
    border-bottom: none;
}

.search-result-item:hover,
.search-result-item.highlighted {
    background: linear-gradient(90deg,
    rgba(59, 130, 246, 0.05) 0%,
    rgba(59, 130, 246, 0.02) 100%);
    transform: translateX(4px);
}

.search-result-link {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 16px 20px;
    text-decoration: none;
    color: inherit;
    transition: all 0.2s ease;
    width: 100%;
}

.search-result-link:hover {
    color: inherit;
    text-decoration: none;
}

/* Imagem do produto */
.search-result-image {
    flex-shrink: 0;
    width: 60px;
    height: 60px;
    border-radius: 12px;
    overflow: hidden;
    background: #f1f5f9;
    display: flex;
    align-items: center;
    justify-content: center;
}

.search-result-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.3s ease;
}

.search-result-item:hover .search-result-image img {
    transform: scale(1.05);
}

/* Conteúdo do resultado */
.search-result-content {
    flex: 1;
    min-width: 0;
}

.search-result-title {
    font-weight: 600;
    font-size: 15px;
    color: #1e293b;
    line-height: 1.4;
    margin-bottom: 4px;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.search-result-title mark {
    background: linear-gradient(120deg, #fbbf24, #f59e0b);
    color: #78350f;
    padding: 2px 4px;
    border-radius: 4px;
    font-weight: 700;
}

.search-result-price {
    font-weight: 700;
    font-size: 16px;
    color: #059669;
    margin-bottom: 6px;
}

.search-result-categories {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
}

.category-tag {
    background: linear-gradient(135deg, #e0e7ff, #c7d2fe);
    color: #3730a3;
    padding: 3px 8px;
    border-radius: 12px;
    font-size: 11px;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.02em;
}

/* Seta indicativa */
.search-result-arrow {
    flex-shrink: 0;
    color: #94a3b8;
    opacity: 0;
    transform: translateX(-8px);
    transition: all 0.2s ease;
}

.search-result-item:hover .search-result-arrow,
.search-result-item.highlighted .search-result-arrow {
    opacity: 1;
    transform: translateX(0);
    color: #3b82f6;
}

/* Estado sem resultados */
.search-no-results {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 12px;
    padding: 40px 20px;
    color: #64748b;
    text-align: center;
}

.search-no-results svg {
    width: 32px;
    height: 32px;
    opacity: 0.5;
}

.search-no-results span {
    font-size: 14px;
    font-weight: 500;
}

/* Animações de entrada */
.search-result-item {
    animation: fadeInUp 0.3s ease forwards;
    opacity: 0;
    transform: translateY(10px);
}

.search-result-item:nth-child(1) { animation-delay: 0.05s; }
.search-result-item:nth-child(2) { animation-delay: 0.1s; }
.search-result-item:nth-child(3) { animation-delay: 0.15s; }
.search-result-item:nth-child(4) { animation-delay: 0.2s; }
.search-result-item:nth-child(5) { animation-delay: 0.25s; }
.search-result-item:nth-child(6) { animation-delay: 0.3s; }
.search-result-item:nth-child(7) { animation-delay: 0.35s; }
.search-result-item:nth-child(8) { animation-delay: 0.4s; }

@keyframes fadeInUp {
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Responsividade */
@media (max-width: 768px) {
    .search-dropdown {
        margin-top: 4px;
        border-radius: 12px;
        max-height: 300px;
    }

    .search-result-link {
        padding: 12px 16px;
        gap: 12px;
    }

    .search-result-image {
        width: 50px;
        height: 50px;
        border-radius: 10px;
    }

    .search-result-title {
        font-size: 14px;
    }

    .search-result-price {
        font-size: 15px;
    }

    .category-tag {
        font-size: 10px;
        padding: 2px 6px;
    }

    .search-no-results {
        padding: 30px 16px;
    }
}

@media (max-width: 480px) {
    .search-dropdown {
        left: -10px;
        right: -10px;
        margin-top: 2px;
    }

    .search-result-link {
        padding: 10px 12px;
        gap: 10px;
    }

    .search-result-image {
        width: 45px;
        height: 45px;
        border-radius: 8px;
    }

    .search-result-title {
        font-size: 13px;
        -webkit-line-clamp: 1;
    }

    .search-result-categories {
        gap: 4px;
    }

    .category-tag {
        font-size: 9px;
        padding: 2px 5px;
    }
}

/* Estados especiais */
.search-dropdown.loading .search-results {
    display: none;
}

.search-dropdown.no-results .search-results {
    display: none;
}

/* Melhorias de acessibilidade */
@media (prefers-reduced-motion: reduce) {
    .search-dropdown,
    .search-result-item,
    .search-result-image img,
    .search-result-arrow {
        transition: none;
        animation: none;
    }
}

/* Dark mode support (opcional) */
@media (prefers-color-scheme: dark) {
    .search-dropdown {
        background: rgba(30, 41, 59, 0.98);
        border-color: rgba(255, 255, 255, 0.1);
        box-shadow:
                0 20px 40px rgba(0, 0, 0, 0.4),
                0 4px 20px rgba(0, 0, 0, 0.3),
                inset 0 1px 0 rgba(255, 255, 255, 0.1);
    }

    .search-result-item:hover,
    .search-result-item.highlighted {
        background: linear-gradient(90deg,
        rgba(59, 130, 246, 0.15) 0%,
        rgba(59, 130, 246, 0.08) 100%);
    }

    .search-result-title {
        color: #e2e8f0;
    }

    .search-result-price {
        color: #10b981;
    }

    .category-tag {
        background: linear-gradient(135deg, #1e293b, #334155);
        color: #94a3b8;
    }

    .search-loading {
        color: #94a3b8;
    }

    .search-no-results {
        color: #94a3b8;
    }
}

/* Efeitos visuais avançados */
.search-dropdown::before {
    content: '';
    position: absolute;
    top: -1px;
    left: 20px;
    right: 20px;
    height: 1px;
    background: linear-gradient(90deg,
    transparent,
    rgba(59, 130, 246, 0.3),
    transparent);
    opacity: 0;
    transition: opacity 0.3s ease;
}

.search-dropdown.show::before {
    opacity: 1;
}

/* Indicador de mais resultados */
.search-dropdown::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 20px;
    background: linear-gradient(transparent, rgba(255, 255, 255, 0.9));
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.search-results:not(:hover)::after {
    opacity: 1;
}

/* Animação de digitação no placeholder */
@keyframes typing {
    0%, 20% { opacity: 1; }
    50% { opacity: 0.5; }
    80%, 100% { opacity: 1; }
}

.search-input:focus::placeholder {
    animation: typing 2s infinite;
}
