/* ============================================
   CATÁLOGO - ESTILOS PRINCIPALES Y COMPLEMENTARIOS
   Rastro Ripollet - v3.0 (Refactorizado)
   ============================================ */

/* ========== 1. BARRA DE FILTROS (STICKY & GLASS) ========== */
.filters-sticky-bar {
    position: sticky;
    top: 10px;
    /* Ajustado para ser más compacto al inicio de la pantalla */
    z-index: 100;
    background: rgb(255 255 255 / 88%);
    backdrop-filter: blur(15px);
    -webkit-backdrop-filter: blur(15px);
    padding: 12px 30px;
    margin: 0 auto 25px auto;
    width: 94%;
    max-width: 1600px;
    border: 1px solid rgba(255, 255, 255, 0.5);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.04);
    border-radius: 20px;
    overflow: hidden;
    transition: max-height 0.5s cubic-bezier(0.16, 1, 0.3, 1),
        opacity 0.4s ease,
        padding 0.4s ease,
        margin 0.4s ease,
        transform 0.4s ease;
}

/* Estado oculto en escritorio */
@media (min-width: 769px) {
    .filters-sticky-bar.desktop-hidden {
        max-height: 0 !important;
        opacity: 0 !important;
        margin-bottom: 0 !important;
        padding-top: 0 !important;
        padding-bottom: 0 !important;
        pointer-events: none !important;
        border-color: transparent !important;
        box-shadow: none !important;
    }
}

/* Título del drawer móvil */
.mobile-drawer-title {
    display: none;
}

/* Botón de cierre drawer móvil */
.mobile-filter-close {
    display: none;
    position: absolute;
    top: 15px;
    right: 15px;
    background: transparent;
    border: none;
    color: var(--text-main);
    cursor: pointer;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: none;
    /* Se activa por media query */
    align-items: center;
    justify-content: center;
    z-index: 20;
    transition: all 0.2s ease;
}

.mobile-filter-close:active {
    transform: scale(0.9);
    background-color: transparent;
}

.mobile-filter-close svg {
    width: 22px;
    height: 22px;
    stroke-width: 2.5px;
}

.filters-container {
    display: flex;
    gap: 12px;
    overflow-x: auto;
    padding: 5px 20px;
    scrollbar-width: none;
    align-items: center;
}

.filters-container::-webkit-scrollbar {
    display: none;
}

.filter-select {
    -webkit-appearance: none !important;
    appearance: none !important;
    background-color: #ffffff !important;
    border: 1px solid #e5e5e5 !important;
    border-radius: 12px !important;
    padding: 10px 32px 10px 14px !important;
    font-family: var(--font) !important;
    font-size: 13px !important;
    font-weight: 500 !important;
    color: var(--text-main) !important;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' viewBox='0 0 24 24' fill='none' stroke='%23202322' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E") !important;
    background-repeat: no-repeat !important;
    background-position: right 12px center !important;
    background-size: 14px !important;
    cursor: pointer !important;
    transition: all 0.3s ease !important;
}

.filter-select:hover {
    background-color: #f8f8f8 !important;
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.05);
}

/* Botón Limpiar (Papelera) */
.btn-icon-only {
    display: none;
    width: 42px;
    height: 42px;
    border-radius: 12px;
    border: none;
    background: #fff5f5;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    flex-shrink: 0;
    color: #ff4757;
    transition: all 0.2s ease;
}

.btn-icon-only.active {
    display: flex;
    background-color: #ff4757;
    /* Fondo rojo destacado */
    color: #fff;
    /* Icono blanco */
    transform: scale(1);
    box-shadow: 0 4px 12px rgba(255, 71, 87, 0.2);
    animation: fadeIn 0.3s ease forwards;
}

.sticky-search-wrapper {
    display: flex;
    align-items: center;
    background: #f1f3f4;
    border-radius: 12px;
    height: 42px;

    /* Ocultación total del flujo pero animable */
    flex: 0;
    min-width: 0;
    max-width: 0;
    margin-right: 0;
    padding: 0;
    opacity: 0;
    overflow: hidden;

    transform: translateX(-10px);
    pointer-events: none;
    transition: all 0.45s cubic-bezier(0.16, 1, 0.3, 1);
}

/* Botón de Toggle Filtros (Solo Buscador Principal) */
.search-filter-btn {
    background: transparent;
    border: none;
    color: #5f6368;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 10px;
    border-radius: 50%;
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    margin-right: 0;
    /* Espaciado fijo y seguro */
    flex-shrink: 0;
}

.search-filter-btn:hover {
    background: rgba(0, 0, 0, 0.05);
    /* Sutil fondo en hover */
    color: #1a1a1a;
}

.search-filter-btn.active {
    background: #202322;
    color: #ffffff;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.15);
}

.search-filter-btn svg {
    stroke-width: 2.5px;
}

.filters-sticky-bar.search-active .sticky-search-wrapper {
    flex: 1;
    min-width: 150px;
    max-width: 600px;
    padding: 0 15px;
    margin-right: 12px;
    opacity: 1;
    transform: translateX(0);
    pointer-events: auto;
}

/* Ocultar badge cuando el modo sticky está activo (preferencia usuario) */
body.search-sticky-mode .search-active-badge {
    opacity: 0;
    pointer-events: none;
}

.sticky-search-icon {
    color: #5f6368;
    margin-right: 10px;
    flex-shrink: 0;
}

.sticky-search-input {
    border: none;
    background: transparent;
    width: 100%;
    height: 100%;
    font-size: 13.5px;
    font-family: inherit;
    color: var(--text-main);
    outline: none;
}

.sticky-search-input::placeholder {
    color: #80868b;
}

/* ========== FILTROS MÓVIL Y SELECTOR COLOR ========== */
.mobile-filter-toggle {
    display: none;
    position: fixed;
    bottom: 90px;
    right: 25px;
    width: 60px;
    height: 60px;
    background: #202322;
    color: #fff;
    border: none !important;
    border-radius: 50%;
    z-index: 10001;
    /* By above the navbar */
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3);
    cursor: pointer;
    align-items: center;
    justify-content: center;
    transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    -webkit-tap-highlight-color: transparent;
}

.mobile-filter-toggle:hover {
    transform: scale(1.1);
    background: #000;
}

.mobile-filter-toggle.scroll-hidden {
    transform: scale(0) rotate(180deg);
    opacity: 0;
    pointer-events: none;
}

.mobile-filter-toggle span:first-child {
    font-size: 0;
    /* Hide "Filtros" text */
    display: flex;
    align-items: center;
    justify-content: center;
}

.mobile-filter-toggle span svg {
    margin-right: 0 !important;
    width: 24px;
    height: 24px;
}

.mobile-filter-toggle .filter-count {
    position: absolute;
    top: -5px;
    right: -5px;
    background: #ff4757;
    color: #fff;
    font-size: 11px;
    font-weight: 700;
    min-width: 20px;
    height: 20px;
    padding: 0 6px;
    border-radius: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 8px rgba(255, 71, 87, 0.3);
    /* Añadido un ligero resplandor en su lugar */
}

.color-filter-wrapper {
    position: relative;
}

.color-filter-btn {
    display: flex !important;
    align-items: center;
    gap: 8px;
    padding-right: 15px !important;
    background-image: none !important;
}

.color-preview {
    display: none;
    /* Oculto por defecto */
    width: 16px;
    height: 16px;
    border-radius: 50%;
    border: 1px solid rgba(0, 0, 0, 0.1);
    box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.1);
}

.color-preview.active {
    display: block;
    /* Visible cuando hay un color seleccionado */
}

.color-dropdown {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: #fff;
    border-radius: 16px;
    padding: 20px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.1);
    border: 1px solid rgba(0, 0, 0, 0.05);
    z-index: 10020;
    /* Elevado para estar por encima del drawer móvil (10010) */
    width: 320px;
    max-width: 90vw;
    display: none;
    flex-direction: column;
}

.color-dropdown.active {
    display: flex;
    animation: fadeInScale 0.2s ease-out;
}

@keyframes fadeInScale {
    from {
        opacity: 0;
        transform: translate(-50%, -50%) scale(0.95);
    }

    to {
        opacity: 1;
        transform: translate(-50%, -50%) scale(1);
    }
}

.color-picker-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.4);
    backdrop-filter: blur(2px);
    z-index: 10015;
    /* Justo debajo del modal pero encima del drawer */
    display: none;
}

.color-picker-overlay.active {
    display: block;
}

.color-dropdown-title {
    font-size: 14px;
    font-weight: 700;
    margin: 0 0 15px 0;
}

.color-grid {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 15px;
    justify-items: center;
}

.color-option {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    border: 1px solid rgba(0, 0, 0, 0.1);
    cursor: pointer;
    transition: transform 0.2s;
    box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.1);
}

.color-option:hover {
    transform: scale(1.1);
}

.color-option.selected {
    box-shadow: 0 0 0 2px #fff, 0 0 0 4px var(--text-main);
}

/* Marcas / Tags (Versión Escritorio Fila Única) */
.brands-filter-container {
    width: 100%;
    margin-top: 10px;
    padding-top: 10px;
    border-top: 1px solid rgba(0, 0, 0, 0.04);
    position: relative;
    mask-image: linear-gradient(to right, transparent, black 4%, black 96%, transparent);
    -webkit-mask-image: linear-gradient(to right, transparent, black 4%, black 96%, transparent);
}

.brands-tags {
    display: flex;
    flex-wrap: nowrap;
    gap: 8px;
    margin-top: 5px;
    padding: 0 40px 8px 40px;
    margin-left: -30px;
    margin-right: -30px;
    width: calc(100% + 60px);
    overflow-x: auto;
    scrollbar-width: none;
    scroll-behavior: smooth;
    -webkit-overflow-scrolling: touch;
}

/* Ocultar scrollbar en Chrome/Safari */
.brands-tags::-webkit-scrollbar {
    display: none;
}

.brand-tag {
    display: inline-flex;
    align-items: center;
    background: #f8f9fa;
    color: #555;
    padding: 10px 18px;
    border-radius: 12px;
    font-size: 13.5px;
    font-family: 'Poppins', sans-serif;
    font-weight: 500;
    cursor: pointer;
    border: 1px solid transparent;
    transition: all 0.2s ease;
    white-space: nowrap;
    margin: 4px 0;
    flex-shrink: 0;
}

.brand-tag .tag-count {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: #e5e7eb;
    color: #666;
    font-size: 11px;
    font-weight: 600;
    min-width: 20px;
    height: 20px;
    border-radius: 10px;
    margin-left: 8px;
    padding: 0 4px;
    transition: all 0.2s;
}

@media (hover: hover) {
    .brand-tag:hover {
        background: #e5e7eb;
        transform: translateY(-1px);
    }
}

.brand-tag.selected {
    background: #1a1a1a;
    color: #fff;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.brand-tag.selected .tag-count {
    background: #ff4757;
    color: #fff;
}

/* ========== 2. GRID ESTÁTICO PROFESIONAL ========== */
.masonry-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 15px;
    width: 94%;
    max-width: 1600px;
    margin: 0 auto;
    padding: 0;
    min-height: 200px;
    /* Removed touch-action: pan-y to allow zooming for accessibility */
}

@media (min-width: 600px) {
    .masonry-grid {
        padding: 0;
    }
}

@media (min-width: 768px) {
    .masonry-grid {
        grid-template-columns: repeat(3, 1fr);
        gap: 18px;
        padding: 0;
    }
}

@media (min-width: 1024px) {
    .masonry-grid {
        grid-template-columns: repeat(4, 1fr);
    }
}

@media (min-width: 1440px) {
    .masonry-grid {
        grid-template-columns: repeat(5, 1fr);
    }
}

@media (min-width: 1920px) {
    .masonry-grid {
        grid-template-columns: repeat(6, 1fr);
    }
}

/* ========== 3. TARJETA DE PRODUCTO ========== */
.product-card {
    break-inside: avoid;
    margin-bottom: 25px;
    position: relative;
    border-radius: 16px;
    overflow: hidden;
    background: #fff;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.03);
    transition: transform 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);

    /* Optimización de rendimiento */
    content-visibility: auto;
    contain-intrinsic-size: 300px 400px;
    /* Tamaño aproximado para evitar saltos de scroll */
}

@media (hover: hover) {
    .product-card:hover {
        transform: translateY(-5px);
        box-shadow: 0 15px 30px rgba(0, 0, 0, 0.1);
    }
}

.product-img-wrapper {
    position: relative;
    overflow: hidden;
    border-radius: 16px 16px 0 0;
    aspect-ratio: 3 / 4;
    /* Espacio reservado para evitar saltos */
    background-color: #f4f4f4;
    /* Skeleton base */
}

.product-img {
    width: 100%;
    height: 100%;
    display: block;
    object-fit: cover;
    /* Garantiza que la imagen no se deforme al fijar aspecto */
    transition: transform 0.5s ease;
}

@media (hover: hover) {
    .product-card:hover .product-img {
        transform: scale(1.05);
    }
}

.card-info {
    padding: 12px 15px;
    background: #fff;
}

.card-title {
    color: var(--text-main);
    font-size: 13px;
    font-weight: 600;
    margin: 0;
    line-height: 1.4;
    display: -webkit-box;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    overflow: hidden;
    text-transform: uppercase;
}

/* Elementos sobre la imagen */
.fav-btn {
    position: absolute;
    top: 10px;
    left: 10px;
    width: 38px;
    height: 38px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: transparent;
    border: none;
    cursor: pointer;
    z-index: 20;
    transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    color: #fff;
    filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.4));
}

.fav-btn svg {
    width: 24px;
    height: 24px;
    fill: transparent;
    stroke: currentColor;
    stroke-width: 2px;
    transition: all 0.25s ease;
    pointer-events: none;
}

@media (hover: hover) {
    .fav-btn:hover {
        transform: scale(1.2);
        color: #ff4d4d;
    }

    .fav-btn:hover svg {
        fill: #ff4d4d;
        stroke: #ff4d4d;
    }
}

.fav-btn.active {
    color: #ff4d4d;
    animation: heartPop 0.45s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.fav-btn.active svg {
    fill: #ff4d4d;
    stroke: #ff4d4d;
}

/* Efecto PRO de Corazones (Partículas) */
.heart-particle {
    position: fixed; /* Cambiado a fixed para ignorar recortes de contenedores */
    pointer-events: none;
    color: #ff4d4d;
    z-index: 99999; /* Sobre todo, incluyendo navbar y modales */
    animation: heartBurst 0.8s ease-out forwards;
}

@keyframes heartPop {
    0% {
        transform: scale(1);
    }

    50% {
        transform: scale(1.4);
    }

    100% {
        transform: scale(1);
    }
}

/* Animación de Corazón Roto (PRO) */
.fav-btn.broken {
    pointer-events: none;
}

.fav-btn.broken svg {
    visibility: hidden;
}

.fav-btn.broken::before,
.fav-btn.broken::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 24px;
    height: 24px;
    margin-top: -12px;
    margin-left: -12px;
    background-color: #ff4d4d;
    /* Usamos el mismo path del SVG */
    -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M12 21.35l-1.45-1.32C5.4 15.36 2 12.28 2 8.5 2 5.42 4.42 3 7.5 3c1.74 0 3.41.81 4.5 2.09C13.09 3.81 14.76 3 16.5 3 19.58 3 22 5.42 22 8.5c0 3.78-3.4 6.86-8.55 11.54L12 21.35z'/%3E%3C/svg%3E") no-repeat center;
    mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M12 21.35l-1.45-1.32C5.4 15.36 2 12.28 2 8.5 2 5.42 4.42 3 7.5 3c1.74 0 3.41.81 4.5 2.09C13.09 3.81 14.76 3 16.5 3 19.58 3 22 5.42 22 8.5c0 3.78-3.4 6.86-8.55 11.54L12 21.35z'/%3E%3C/svg%3E") no-repeat center;
    -webkit-mask-size: contain;
    mask-size: contain;
    z-index: 2;
}

.fav-btn.broken::before {
    -webkit-clip-path: polygon(0 0, 50% 0, 50% 100%, 0 100%);
    clip-path: polygon(0 0, 50% 0, 50% 100%, 0 100%);
    animation: heartBreakLeft 0.8s cubic-bezier(0.2, 0, 0.2, 1) forwards;
}

.fav-btn.broken::after {
    -webkit-clip-path: polygon(50% 0, 100% 0, 100% 100%, 50% 100%);
    clip-path: polygon(50% 0, 100% 0, 100% 100%, 50% 100%);
    animation: heartBreakRight 0.8s cubic-bezier(0.2, 0, 0.2, 1) forwards;
}

@keyframes heartBreakLeft {
    0% {
        transform: translate(0, 0) rotate(0deg);
        opacity: 1;
    }
    20% {
        transform: translate(-2px, 0) rotate(-5deg);
    }
    100% {
        transform: translate(-20px, 40px) rotate(-45deg);
        opacity: 0;
    }
}

@keyframes heartBreakRight {
    0% {
        transform: translate(0, 0) rotate(0deg);
        opacity: 1;
    }
    20% {
        transform: translate(2px, 0) rotate(5deg);
    }
    100% {
        transform: translate(20px, 40px) rotate(45deg);
        opacity: 0;
    }
}

@keyframes heartBurst {
    0% {
        transform: translate(0, 0) scale(0);
        opacity: 0;
    }

    15% {
        opacity: 1;
        transform: translate(0, 0) scale(1.2);
    }

    100% {
        transform: translate(var(--tx), var(--ty)) scale(0.5);
        opacity: 0;
    }
}

.wa-btn {
    position: absolute;
    top: 10px;
    right: 10px;
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: transparent;
    /* Fondo transparente */
    color: #25D366;
    /* Verde característico */
    z-index: 20;
    transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.35));
    /* Sombra para visibilidad */
}

.wa-btn svg {
    width: 26px;
    height: 26px;
}

@media (hover: hover) {
    .wa-btn:hover {
        transform: scale(1.2);
        color: #128C7E;
        /* Verde más oscuro al pasar el ratón */
    }
}

.badge-sold {
    position: absolute;
    top: 0;
    left: 0;
    background: #ef4444cf;
    color: #fff;
    font-size: 11px;
    font-weight: 700;
    padding: 4px 10px;
    border-radius: 0 0 10px 0;
    text-transform: uppercase;
    z-index: 20;
}


.product_title {
    font-family: var(--font) !important;
    font-weight: 700 !important;
    font-size: clamp(1.8rem, 3vw, 2.5rem) !important;
    color: var(--text-main) !important;
    margin-bottom: 15px !important;
    text-transform: uppercase !important;
}

.catalog-search-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    margin: 5px 0 35px 0;
    width: 100%;
    position: relative;
    /* Ya no es sticky */
    z-index: 110;
    pointer-events: none;
}

/* Caja de Búsqueda Catálogo */
.catalog-search-box {
    position: relative;
    background: rgba(255, 255, 255, 0.9);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-radius: 28px;
    border: 1px solid rgba(0, 0, 0, 0.08);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.08);
    display: flex;
    align-items: center;
    padding: 6px 12px 6px 6px;
    /* Más espacio a la derecha para los botones */
    width: 100%;
    max-width: 550px;
    transition: all 0.3s ease;
    pointer-events: auto;
    /* Reactivar clics para la caja en sí */
}

.catalog-search-box:focus-within {
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.12);
    border-color: transparent;
    transform: translateY(-1px);
}

.catalog-search-box:focus-within .catalog-search-icon {
    transform: scale(1.1) rotate(12deg);
}

.catalog-search-box:focus-within .catalog-search-input::placeholder {
    color: var(--text-main);
    opacity: 0.7;
}

.catalog-search-icon {
    width: 48px;
    height: 48px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-muted);
    flex-shrink: 0;
    transition: transform 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.catalog-search-icon svg {
    width: 20px;
    height: 20px;
    stroke-width: 2.5px;
}

.catalog-search-input {
    flex: 1;
    border: none !important;
    outline: none !important;
    background: transparent !important;
    box-shadow: none !important;
    font-size: 16px !important; /* Bloqueo de zoom en iOS/Android */
    font-family: var(--font) !important;
    color: var(--text-main);
    padding: 12px 0 !important;
    touch-action: manipulation;
}

.catalog-search-input::placeholder {
    color: #bbb;
}

.catalog-search-clear {
    background: none;
    border: none;
    padding: 10px;
    cursor: pointer;
    color: #ccc;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-right: 5px;
    /* Espacio con el botón de filtros */
    transition: all 0.2s;
    opacity: 0;
    pointer-events: none;
}

.catalog-search-clear.visible {
    opacity: 1;
    pointer-events: auto;
}

.catalog-search-clear:hover {
    color: #333;
}

/* Badge de búsqueda activa */
.search-active-badge {
    display: inline-flex;
    align-items: center;
    background: #f8f8f8;
    padding: 6px 14px;
    border-radius: 12px;
    font-size: 11.5px;
    gap: 8px;
    margin-bottom: 8px;
    /* Espacio con el buscador de abajo */
    color: rgba(32, 35, 34, 0.85);
    font-weight: 500;
    transition: none;
}

.search-active-badge strong {
    color: var(--text-main);
    font-weight: 700;
}

.search-active-badge button {
    background: rgba(0, 0, 0, 0.05);
    border: none;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 13px;
    cursor: pointer;
    transition: all 0.2s ease;
    color: var(--text-main);
}

.search-active-badge button:hover {
    background: rgba(0, 0, 0, 0.1);
    transform: scale(1.1);
}

/* ========== 6. RESPONSIVE MÓVIL ========== */
@media (max-width: 768px) {
    body {
        touch-action: pan-y; /* Bloqueo global de zoom de dos dedos */
    }

    .mobile-filter-toggle {
        display: flex;
    }

    .catalog-search-container {
        margin-top: 15px;
        padding: 0 15px;
        position: relative;
        /* Quitar sticky en móvil */
        top: 0;
    }

    .search-filter-btn {
        display: none !important;
    }

    /* Transformar en Bottom Sheet (Cajón Inferior del 45%) */
    .filters-sticky-bar {
        position: fixed !important;
        top: auto !important;
        bottom: 0 !important;
        left: 0 !important;
        right: 0 !important;
        width: 100% !important;
        height: 60dvh !important;
        background: #fff;
        border-radius: 24px 24px 0 0 !important;
        margin: 0 !important;
        padding: 40px 20px 20px !important;
        box-shadow: 0 -10px 40px rgba(0, 0, 0, 0.15);
        z-index: 10010 !important;
        transform: translateY(105%);
        transition: transform 0.4s cubic-bezier(0.16, 1, 0.3, 1);
        will-change: transform;
        overflow-y: auto;
        overflow-x: hidden; /* Evitar cualquier movimiento lateral */
        display: flex !important;
        flex-direction: column;
        visibility: hidden;
        touch-action: pan-y; /* Bloquea zoom de pellizco, solo permite scroll vertical */
        user-select: none; /* Evita selección accidental que dispare UI del sistema */
    }

    /* Grab handle (UX móvil) */
    .filters-sticky-bar::before {
        content: '';
        position: absolute;
        top: 12px;
        left: 50%;
        transform: translateX(-50%);
        width: 40px;
        height: 4px;
        background: #e5e7eb;
        border-radius: 10px;
    }

    .filters-sticky-bar.mobile-visible {
        visibility: visible;
        transform: translateY(0);
    }

    /* Estilos para el nuevo overlay */
    .filters-overlay {
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        background: rgba(0, 0, 0, 0.4);
        backdrop-filter: blur(3px);
        -webkit-backdrop-filter: blur(3px);
        z-index: 10005;
        /* Justo debajo del drawer */
        opacity: 0;
        visibility: hidden;
        transition: opacity 0.22s cubic-bezier(0.33, 1, 0.68, 1), visibility 0.22s;
    }

    .filters-overlay.active {
        opacity: 1;
        visibility: visible;
    }

    .mobile-drawer-title {
        display: block;
        position: sticky;
        /* Mantener fijo al hacer scroll */
        top: 0;
        margin-bottom: 20px;
        font-family: 'Poppins', sans-serif;
        font-size: 20px;
        font-weight: 700;
        color: var(--text-main);
        background: #fff;
        z-index: 5;
    }

    /* Asegurar que el buscador interno sea siempre visible en el Bottom Sheet móvil */
    .sticky-search-wrapper {
        grid-column: span 2 !important;
        width: 100% !important;
        max-width: none !important;
        opacity: 1 !important;
        padding: 0 15px !important;
        margin-bottom: 20px !important;
        pointer-events: auto !important;
        transform: none !important;
        visibility: visible !important;
        height: 48px !important;
        background: #f1f3f4 !important;
        display: flex !important;
    }

    .sticky-search-input {
        font-size: 16px !important; /* Prevents auto-zoom on iOS */
    }

    .mobile-filter-close {
        display: flex;
    }

    .filters-container {
        display: grid;
        grid-template-columns: 1fr 1fr;
        gap: 15px;
        padding: 0;
        align-items: stretch;
    }

    .filter-select {
    width: 100% !important;
    height: 48px;
    font-size: 16px !important; /* Bloqueo estricto de auto-zoom */
    padding: 8px 35px 8px 15px !important;
    grid-column: span 2;
    touch-action: manipulation;
}

    #f-talla,
    .color-filter-wrapper {
        grid-column: span 1;
    }

    /* Sobrescribir ancho excesivo del botón de color en móvil */
    .color-filter-btn {
        width: 100% !important;
        justify-content: space-between;
        padding: 0 15px !important;
        height: 48px !important;
        /* Consistente con selects */
        text-transform: none !important;
    }

    .btn-icon-only {
        width: 100% !important;
        height: 48px;
        border-radius: 12px;
        margin-top: 5px;
        grid-column: span 2;
        display: none;
        /* Oculto por defecto el reset móvil */
        background: #ffeded;
        font-weight: 600;
    }

    .btn-icon-only.active {
        display: flex;
    }

    /* Ajuste para el color picker dentro del drawer */
    .color-filter-wrapper {
        width: 100%;
    }
}

/* ========== 7. ESTADOS (CARGANDO, VACÍO, ERROR) ========== */
.catalog-state {
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 100px 20px;
    text-align: center;
    width: 100%;
}

.catalog-state.hidden {
    display: none !important;
}

.state-content {
    max-width: 360px;
}

.catalog-state .icon-circle {
    width: 70px;
    height: 70px;
    background: #f5f5f5;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 25px;
    color: var(--text-muted);
}

.catalog-state .icon-circle.error {
    background: #fff5f5;
    color: #ff4757;
}

.catalog-state h3 {
    font-size: 1.4rem;
    font-weight: 700;
    margin: 0 0 12px;
    color: var(--text-main);
}

.catalog-state p {
    font-size: 14.5px;
    color: var(--text-muted);
    margin: 0 0 25px;
    line-height: 1.6;
}

.catalog-state .animate-spin {
    width: 40px;
    height: 40px;
    margin-bottom: 20px;
    color: var(--accent-solid);
}

@media (max-width: 768px) {
    .catalog-state {
        padding: 60px 15px;
    }
}