/* Estilos para o sistema de busca */

/* Container principal da busca */
.tf-form-search {
    position: relative;
    width: 100%;
    z-index: 2000; /* Aumentar z-index do container */
}

.tf-form-search .search-box {
    position: relative;
    width: 100%;
    z-index: 2001; /* Input também precisa estar na frente */
}

/* Resultados da busca principal */
.search-suggests-results {
    position: absolute !important;
    top: calc(100% + 2px) !important;
    left: 0 !important;
    right: 0 !important;
    background: #fff !important;
    border: 1px solid #e5e5e5 !important;
    border-radius: 8px !important;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1) !important;
    z-index: 9999 !important; /* Z-index muito alto para garantir que fique na frente */
    max-height: 400px !important;
    overflow-y: auto !important;
    display: none !important;
    visibility: hidden !important;
}

/* Quando os resultados devem ser mostrados - SEMPRE VISÍVEL */
.search-suggests-results.show {
    display: block !important;
    visibility: visible !important;
    opacity: 1 !important;
    pointer-events: auto !important; /* Garantir que os eventos de mouse funcionem */
}

/* Garantir que todos os elementos dentro dos resultados sejam clicáveis */
.search-suggests-results.show * {
    pointer-events: auto !important;
}

.search-suggests-results-inner {
    padding: 0;
    position: relative;
    z-index: 10001;
}

.search-suggests-results-inner ul {
    list-style: none;
    margin: 0;
    padding: 0;
    position: relative;
    z-index: 10002;
}

.search-suggests-results-inner li {
    border-bottom: 1px solid #f0f0f0;
    position: relative;
    z-index: 10003;
}

.search-suggests-results-inner li:last-child {
    border-bottom: none;
}

/* Item de resultado da busca */
.search-result-item {
    display: flex;
    align-items: center;
    padding: 12px 16px;
    text-decoration: none;
    color: #333;
    transition: background-color 0.2s ease;
    position: relative;
    z-index: 10000; /* Garantir que os links sejam clicáveis */
}

.search-result-item:hover {
    background-color: #f8f9fa;
    text-decoration: none;
    color: #333;
}

.search-result-item .img-box {
    width: 50px;
    height: 50px;
    margin-right: 12px;
    flex-shrink: 0;
    border-radius: 4px;
    overflow: hidden;
    background-color: #f8f9fa;
}

.search-result-item .img-box img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.search-result-item .box-content {
    flex: 1;
    min-width: 0;
}

.search-result-item .title {
    font-size: 14px;
    font-weight: 500;
    line-height: 1.4;
    margin: 0 0 4px 0;
    color: #333;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.search-result-item .price {
    font-size: 14px;
    font-weight: 600;
    color: #007bff;
    margin: 0;
}

/* Estados de loading e erro */
.searching-products,
.search-error,
.search-message {
    padding: 20px;
    text-align: center;
}

.searching-products .spinner-border {
    width: 2rem;
    height: 2rem;
}

.search-error {
    color: #dc3545;
}

.search-error i {
    font-size: 24px;
    margin-bottom: 8px;
    display: block;
}

.search-message {
    color: #6c757d;
}

/* Responsividade */
@media (max-width: 768px) {
    .search-suggests-results {
        left: -15px;
        right: -15px;
        margin-top: 8px;
        border-radius: 0;
        border-left: none;
        border-right: none;
    }
    
    .search-result-item {
        padding: 10px 15px;
    }
    
    .search-result-item .img-box {
        width: 40px;
        height: 40px;
        margin-right: 10px;
    }
    
    .search-result-item .title {
        font-size: 13px;
    }
    
    .search-result-item .price {
        font-size: 13px;
    }
}

/* Animações */
.search-suggests-results {
    animation: fadeInDown 0.3s ease;
}

@keyframes fadeInDown {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Scroll customizado para os resultados */
.search-suggests-results::-webkit-scrollbar {
    width: 6px;
}

.search-suggests-results::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 3px;
}

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

.search-suggests-results::-webkit-scrollbar-thumb:hover {
    background: #a8a8a8;
}

/* Destacar termo pesquisado (se implementado no futuro) */
.search-highlight {
    background-color: #fff3cd;
    font-weight: 600;
    padding: 1px 2px;
    border-radius: 2px;
}
