/* ==========================================
   BUSCADOR Y FILTROS
========================================== */

.search-filter-container {
    margin-bottom: 1.5rem;
    padding: 1.25rem 1rem;
    background: linear-gradient(135deg, #ffffff 0%, #f8fafc 100%);
    border-radius: 1rem;
    box-shadow: 0 4px 16px rgba(220, 38, 38, 0.06);
    border: 1px solid rgba(220, 38, 38, 0.05);
    backdrop-filter: blur(10px);
}

/* Buscador */
.search-box-wrapper {
    margin-bottom: 1rem;
}

.search-input-container {
    position: relative;
    max-width: 700px;
    margin: 0 auto;
}

.search-icon {
    position: absolute;
    left: 1.5rem;
    top: 50%;
    transform: translateY(-50%);
    color: #D1D5DB;
    font-size: 1.2rem;
    pointer-events: none;
    transition: color 0.3s ease;
}

.search-input:focus ~ .search-icon {
    color: var(--secondary);
}

.search-input {
    width: 100%;
    padding: 0.75rem 2.5rem 0.75rem 2.5rem;
    border: 2px solid #E5E7EB;
    border-radius: 10px;
    font-size: 0.95rem;
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    background: white;
    font-weight: 500;
    letter-spacing: 0.3px;
}

.search-input::placeholder {
    color: #9CA3AF;
    font-weight: 500;
}

.search-input:focus {
    outline: none;
    border-color: var(--secondary);
    box-shadow: 0 0 0 4px rgba(220, 38, 38, 0.12);
    background: #fafafa;
}

.clear-search {
    position: absolute;
    right: 1.25rem;
    top: 50%;
    transform: translateY(-50%);
    background: rgba(239, 68, 68, 0.9);
    color: white;
    border: none;
    width: 2.25rem;
    height: 2.25rem;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    font-size: 1.1rem;
    box-shadow: 0 2px 8px rgba(239, 68, 68, 0.2);
}

.clear-search:hover {
    background: #DC2626;
    transform: translateY(-50%) scale(1.12);
    box-shadow: 0 4px 12px rgba(220, 38, 38, 0.25);
}

.clear-search:active {
    transform: translateY(-50%) scale(0.95);
}

/* Botones de Filtro */
.filter-buttons-container {
    display: flex;
    flex-wrap: wrap;
    gap: 0.35rem;
    justify-content: center;
    margin-bottom: 0.5rem;
}

.filter-btn {
    padding: 0.35rem 0.75rem;
    border: 1.5px solid #E5E7EB;
    background: white;
    color: #6B7280;
    border-radius: 6px;
    font-weight: 500;
    font-size: 0.8rem;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex;
    align-items: center;
    gap: 0.3rem;
    letter-spacing: 0.2px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
    position: relative;
    overflow: hidden;
}

.filter-btn i {
    font-size: 0.9rem;
    transition: all 0.3s ease;
}

.filter-btn::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: rgba(220, 38, 38, 0.05);
    transition: left 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    z-index: -1;
}

.filter-btn:hover {
    border-color: var(--secondary);
    color: var(--secondary);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(220, 38, 38, 0.12);
}

.filter-btn:hover::before {
    left: 0;
}

.filter-btn:hover i {
    transform: scale(1.15);
}

.filter-btn.active {
    background: linear-gradient(135deg, var(--secondary) 0%, var(--primary-dark) 100%);
    color: white;
    border-color: var(--secondary);
    box-shadow: 0 4px 12px rgba(220, 38, 38, 0.25);
    transform: translateY(-2px);
}

.filter-btn.active i {
    transform: scale(1.2);
}

/* Info de Resultados */
.results-info {
    text-align: center;
    padding: 0.6rem 1rem;
    background: linear-gradient(135deg, #F3F4F6 0%, #F9FAFB 100%);
    border-radius: 8px;
    margin-top: 0.75rem;
    border: 1px solid rgba(220, 38, 38, 0.05);
}

#resultsCount {
    color: #374151;
    font-weight: 600;
    font-size: 0.9rem;
    letter-spacing: 0.3px;
}

/* Animación de aparición de tarjetas */
.product-card {
    animation: fadeIn 0.4s ease;
}

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

/* ==========================================
   RESPONSIVE - TABLET
========================================== */
@media (max-width: 768px) {
    .search-filter-container {
        padding: 0.875rem;
        border-radius: 0.75rem;
        margin-bottom: 1rem;
    }

    .search-box-wrapper {
        margin-bottom: 0.75rem;
    }

    .search-input {
        padding: 0.6rem 2rem 0.6rem 2.25rem;
        font-size: 0.9rem;
    }

    .search-icon {
        left: 0.75rem;
        font-size: 1rem;
    }

    .filter-buttons-container {
        gap: 0.25rem;
    }

    .filter-btn {
        padding: 0.3rem 0.5rem;
        font-size: 0.7rem;
        border-radius: 5px;
        flex: 1 1 auto;
        min-width: calc(25% - 0.2rem);
        justify-content: center;
        gap: 0.2rem;
    }

    .filter-btn i {
        font-size: 0.75rem;
    }

    .results-info {
        padding: 0.5rem 0.75rem;
        margin-top: 0.5rem;
    }

    #resultsCount {
        font-size: 0.8rem;
    }
}

/* ==========================================
   RESPONSIVE - MÓVIL
========================================== */
@media (max-width: 480px) {
    .search-filter-container {
        padding: 0.5rem;
        border-radius: 0.5rem;
        margin-bottom: 0.75rem;
    }

    .search-box-wrapper {
        margin-bottom: 0.5rem;
    }

    .search-input-container {
        max-width: 100%;
    }

    .search-input {
        padding: 0.5rem 2rem 0.5rem 2rem;
        font-size: 0.85rem;
    }

    .search-icon {
        left: 0.75rem;
        font-size: 0.9rem;
    }

    .clear-search {
        right: 0.5rem;
        width: 1.5rem;
        height: 1.5rem;
        font-size: 0.75rem;
    }

    .filter-buttons-container {
        gap: 0.25rem;
        display: grid;
        grid-template-columns: repeat(4, 1fr);
    }

    .filter-btn {
        padding: 0.25rem 0.15rem;
        font-size: 0.6rem;
        border-radius: 4px;
        flex: none;
        min-width: auto;
        justify-content: center;
        gap: 0.1rem;
        white-space: nowrap;
    }

    .filter-btn i {
        font-size: 0.65rem;
        display: none;
    }

    .results-info {
        padding: 0.4rem 0.5rem;
        margin-top: 0.5rem;
    }

    #resultsCount {
        font-size: 0.75rem;
    }
}

@media (max-width: 360px) {
    .filter-buttons-container {
        grid-template-columns: repeat(3, 1fr);
        gap: 0.25rem;
    }

    .filter-btn {
        padding: 0.3rem 0.15rem;
        font-size: 0.6rem;
    }
}

/* ==========================================
   AJUSTES HERO PRODUCTOS RESPONSIVE
========================================== */
@media (max-width: 640px) {
    /* Hero más compacto en móvil pequeño */
    body > section:first-of-type:not(#header-container) {
        min-height: auto;
    }
}

/* ==========================================
   SCROLL SUAVE EN MÓVIL
========================================== */
@media (max-width: 768px) {
    html {
        scroll-behavior: smooth;
    }
    
    /* Ajuste para scroll-margin en móvil */
    [id] {
        scroll-margin-top: 80px;
    }
}

/* ==========================================
   TOUCH FRIENDLY PARA BOTONES
========================================== */
@media (hover: none) and (pointer: coarse) {
    .filter-btn {
        min-height: 44px;
    }
    
    .search-input {
        font-size: 16px; /* Prevenir zoom en iOS */
    }
}