/**
 * Estilos específicos para a página de Busca - Tailwind Style
 */

/* ===== SEÇÃO DE BUSCA ===== */
.search-section {
    margin-bottom: 2rem;
}

.search-form {
    margin-bottom: 0;
}

.search-input-group {
    display: flex;
    gap: 0.75rem;
    margin-bottom: 1.5rem;
}

.search-input {
    flex: 1;
    padding: 0.75rem 1rem;
    border: 1px solid #d1d5db;
    border-radius: 0.5rem;
    background: #ffffff;
    color: #111827;
    font-size: 0.875rem;
    transition: all 0.2s ease;
}

.search-input:focus {
    outline: none;
    border-color: #111827;
    background: #ffffff;
    box-shadow: 0 0 0 3px rgb(0 0 0 / 0.1);
}

.search-input::placeholder {
    color: #9ca3af;
}

/* ===== FILTROS DE BUSCA ===== */
.search-filters {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem;
    padding: 1.5rem;
    background: #f9fafb;
    border-radius: 0.75rem;
    border: 1px solid #e5e7eb;
}

.filter-group {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.filter-group label {
    font-size: 0.875rem;
    color: #6b7280;
    font-weight: 500;
}

.filter-group select,
.filter-group input {
    padding: 0.5rem 0.75rem;
    border: 1px solid #d1d5db;
    border-radius: 0.375rem;
    background: #ffffff;
    color: #111827;
    font-size: 0.875rem;
    transition: all 0.2s ease;
}

.filter-group select:focus,
.filter-group input:focus {
    outline: none;
    border-color: #111827;
    background: #ffffff;
    box-shadow: 0 0 0 2px rgb(0 0 0 / 0.05);
}

.filter-group select option {
    background: #ffffff;
    color: #111827;
}

/* ===== RESULTADOS ===== */
.results-section {
    margin-bottom: 2rem;
}

.results-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
}

.results-count {
    color: #6b7280;
    font-size: 0.875rem;
}

.sort-options {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.sort-options label {
    color: #6b7280;
    font-size: 0.875rem;
}

.sort-options select {
    padding: 0.375rem 0.625rem;
    border: 1px solid #d1d5db;
    border-radius: 0.375rem;
    background: #ffffff;
    color: #111827;
    font-size: 0.875rem;
}

/* ===== GRID DE PRODUTOS ===== */
.products-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.product-card {
    background: #ffffff;
    border: 1px solid #e5e7eb;
    border-radius: 1rem;
    overflow: hidden;
    transition: all 0.2s ease;
    position: relative;
    animation: fadeInUp 0.4s ease-out;
    box-shadow: 0 1px 3px 0 rgb(0 0 0 / 0.1), 0 1px 2px -1px rgb(0 0 0 / 0.1);
}

.product-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);
    border-color: #d1d5db;
}

/* ===== IMAGEM DO PRODUTO ===== */
.product-image {
    position: relative;
    overflow: hidden;
    background: #f3f4f6;
}

.product-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.2s ease;
}

.product-card:hover .product-image img {
    transform: scale(1.02);
}

/* ===== BADGES ===== */
.product-badge {
    position: absolute;
    top: 0.75rem;
    left: 0.75rem;
    padding: 0.25rem 0.5rem;
    border-radius: 0.375rem;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.025em;
    z-index: 2;
    color: #ffffff;
    width: 20%;
}

.badge-novo {
    background: #10b981;
}

.badge-seminovo {
    background: #6b7280;
}

.badge-usado {
    background: #9ca3af;
}

.product-status {
    position: absolute;
    top: 0.75rem;
    right: 0.75rem;
    padding: 0.25rem 0.5rem;
    border-radius: 0.375rem;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    z-index: 2;
}

.status-vendido {
    background: #ef4444;
    color: #ffffff;
}

/* ===== INFORMAÇÕES DO PRODUTO ===== */
.product-info {
    padding: 1.5rem;
}

.product-name {
    margin: 0 0 0.5rem 0;
    font-size: 1rem;
    font-weight: 600;
    color: #111827;
    line-height: 1.4;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.product-category {
    margin: 0 0 0.75rem 0;
    color: #6b7280;
    font-size: 0.875rem;
    text-transform: uppercase;
    letter-spacing: 0.025em;
}

.product-price {
    margin-bottom: 0.75rem;
}

.price-current {
    font-size: 1.25rem;
    font-weight: 700;
    color: #111827;
}

.price-original {
    margin-left: 0.5rem;
    font-size: 1rem;
    color: #9ca3af;
    text-decoration: line-through;
    opacity: 0.7;
}

.product-seller {
    display: flex;
    align-items: center;
    gap: 0.375rem;
    color: #6b7280;
    font-size: 0.875rem;
    margin-bottom: 1rem;
}

.product-seller svg {
    flex-shrink: 0;
}

/* ===== AÇÕES DO PRODUTO ===== */
.product-actions {
    display: flex;
    gap: 0.5rem;
}

.product-actions .btn {
    flex: 1;
    justify-content: center;
    font-size: 0.875rem;
    padding: 0.625rem 1rem;
}

.btn-buy {
    background: #10b981;
    color: #ffffff;
    border: 1px solid #10b981;
}

.btn-buy:hover:not(:disabled) {
    background: #059669;
    border-color: #059669;
    transform: translateY(-1px);
    box-shadow: 0 4px 6px -1px rgb(16 185 129 / 0.3);
}

/* ===== PAGINAÇÃO ===== */
.pagination-section {
    margin-top: 3rem;
}

.pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 1.5rem;
}

.pagination-info {
    color: #6b7280;
    font-size: 0.875rem;
    padding: 0 1rem;
}

.pagination .btn {
    min-width: 6rem;
}

/* ===== ESTADO VAZIO ===== */
.no-results {
    margin-top: 3rem;
}

.no-results .card-body {
    padding: 3rem;
    text-align: center;
}

.no-results svg {
    opacity: 0.3;
    margin-bottom: 1.5rem;
}

.no-results h2 {
    margin-bottom: 1rem;
    color: #111827;
}

.no-results p {
    color: #6b7280;
    margin-bottom: 2rem;
    font-size: 1.125rem;
    line-height: 1.6;
}

/* ===== LOADING STATES ===== */
.search-loading {
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 3rem;
    color: #6b7280;
    gap: 1rem;
}

.product-card.loading {
    opacity: 0.6;
    pointer-events: none;
}

.product-card.loading::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 30px;
    height: 30px;
    margin: -15px 0 0 -15px;
    border: 3px solid #e5e7eb;
    border-radius: 50%;
    border-top-color: #111827;
    animation: spin 1s ease-in-out infinite;
    z-index: 10;
}

/* ===== ANIMAÇÕES ===== */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(1rem);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

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

.product-card:nth-child(1) { animation-delay: 0.1s; }
.product-card:nth-child(2) { animation-delay: 0.2s; }
.product-card:nth-child(3) { animation-delay: 0.3s; }
.product-card:nth-child(4) { animation-delay: 0.4s; }
.product-card:nth-child(5) { animation-delay: 0.5s; }
.product-card:nth-child(6) { animation-delay: 0.6s; }

/* ===== RESPONSIVIDADE ===== */
@media (max-width: 768px) {
    .search-input-group {
        flex-direction: column;
    }
    
    .search-filters {
        grid-template-columns: 1fr;
        gap: 1rem;
    }
    
    .results-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.75rem;
    }
    
    .sort-options {
        width: 100%;
        justify-content: space-between;
    }
    
    .products-grid {
        grid-template-columns: 1fr;
        gap: 1rem;
    }
    
    .product-actions {
        flex-direction: column;
    }
    
    .pagination {
        flex-direction: column;
        gap: 1rem;
    }
}

@media (max-width: 480px) {
    .search-input {
        font-size: 16px; /* Evita zoom no iOS */
    }
    
    .product-info {
        padding: 1rem;
    }
    
    .product-name {
        font-size: 0.875rem;
    }
    
    .price-current {
        font-size: 1.125rem;
    }
    
    .no-results .card-body {
        padding: 2rem;
    }
}

/* ===== FILTROS AVANÇADOS (MOBILE) ===== */
@media (max-width: 768px) {
    .filters-toggle {
        display: block;
        width: 100%;
        margin-bottom: 1rem;
        background: #f9fafb;
        color: #111827;
        border: 1px solid #e5e7eb;
        padding: 0.75rem;
        border-radius: 0.5rem;
        cursor: pointer;
        transition: all 0.2s ease;
    }
    
    .filters-toggle:hover {
        background: #f3f4f6;
        border-color: #d1d5db;
    }
    
    .search-filters.collapsed {
        display: none;
    }
    
    .search-filters.expanded {
        display: grid;
        animation: slideDown 0.3s ease-out;
    }
}

@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-1rem);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ===== ACESSIBILIDADE ===== */
.product-card:focus-within {
    outline: 2px solid #111827;
    outline-offset: 2px;
}

.btn:focus-visible {
    outline: 2px solid #111827;
    outline-offset: 2px;
}

/* ===== ESTADOS HOVER MELHORADOS ===== */
.search-input:hover {
    border-color: #9ca3af;
}

.filter-group select:hover,
.filter-group input:hover {
    border-color: #9ca3af;
}

.sort-options select:hover {
    border-color: #9ca3af;
}

/* ===== MELHORIAS DE UX ===== */
.search-input:focus {
    transform: translateY(-1px);
}

.filter-group select:focus,
.filter-group input:focus {
    transform: translateY(-1px);
}

.product-card:hover .product-name {
    color: #000000;
}

.product-card:hover .product-category {
    color: #4b5563;
}
