/* --- 1. BOTÓN DISPARADOR (INYECTADO POR EL PLUGIN) --- */
.vp-trigger-container {
    margin: 20px 0;
    display: flex;
    width: 100%;
    /* Por defecto en PC: Alineado a la derecha */
    justify-content: flex-end; 
}

.vp-btn-trigger {
    background-color: #5A196E !important; /* Morado VP Principal */
    color: #ffffff !important;
    border: 2px solid transparent !important; /* Preparado para el borde dorado */
    padding: 12px 25px !important; /* Más aire a los lados para que luzca redondo */
    border-radius: 50px !important; /* CAMBIO A CÁPSULA (REDONDO) */
    font-weight: 700 !important;
    text-transform: uppercase;
    letter-spacing: 1px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 10px;
    transition: all 0.3s ease !important;
    box-shadow: 0 4px 6px rgba(0,0,0,0.1);
}

.vp-btn-trigger:hover {
    background-color: #7B2B94 !important; /* Morado claro (como en Terapia/Tienda) */
    border-color: #D4AF37 !important; /* EL TOQUE DORADO DE ÉNFASIS */
    color: #ffffff !important;
    transform: translateY(-2px);
    box-shadow: 0 6px 15px rgba(90, 25, 110, 0.2);
}

/* Si el icono SVG del filtro debe cambiar de color al hover */
.vp-btn-trigger:hover svg {
    fill: #ffffff;
    stroke: #ffffff;
}

.vp-btn-trigger span {
    font-size: 1.2rem;
}

/* --- 2. ESTRUCTURA DEL PANEL LATERAL (DRAWER) --- */
.vp-filter-canvas {
    position: fixed;
    top: 0;
    right: -450px; /* Escondido totalmente */
    width: 380px;
    max-width: 100%; 
    
    /* FIX MÓVIL: Altura dinámica para evitar barras de navegación */
    height: 100vh;
    height: 100dvh; 
    
    background: #ffffff;
    z-index: 999999 !important;
    display: flex !important;
    flex-direction: column !important; /* Estructura Header > Cuerpo > Footer */
    box-shadow: -5px 0 25px rgba(0,0,0,0.15);
    transition: right 0.4s cubic-bezier(0.25, 0.46, 0.45, 0.94);
    overflow: hidden !important; /* El panel no scrollea, solo su contenido */
}

.vp-filter-canvas.is-open {
    right: 0 !important;
}

/* --- 3. EL OVERLAY (FONDO OSCURO) --- */
.vp-filter-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(2px);
    z-index: 999998;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
    max-width: 100vw !important;
}

.vp-filter-overlay.is-visible {
    opacity: 1;
    visibility: visible;
}

/* --- 4. HEADER DEL FILTRO --- */
.vp-filter-header {
    padding: 20px;
    background: #5A196E;
    color: #ffffff;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-shrink: 0; /* No se achica */
}

.vp-filter-header h3 {
    margin: 0 !important;
    color: #ffffff !important;
    font-size: 1.1rem;
    font-weight: 700;
    text-transform: uppercase;
}

#vp-close-filter {
    background: none;
    border: none;
    color: #ffffff;
    font-size: 28px;
    line-height: 1;
    cursor: pointer;
    padding: 0;
}

/* --- 5. CUERPO DE FILTROS (CON SCROLL INTERNO) --- */
.vp-custom-filters {
    padding: 25px 20px;
    flex: 1 1 auto !important; /* Ocupa el espacio central disponible */
    overflow-y: auto !important; /* El scroll ocurre aquí */
    scrollbar-width: thin;
    scrollbar-color: #00C4CC #f1f1f1;
    -webkit-overflow-scrolling: touch;
}

/* Scrollbar Chrome/Safari */
.vp-custom-filters::-webkit-scrollbar { width: 6px; }
.vp-custom-filters::-webkit-scrollbar-track { background: #f1f1f1; }
.vp-custom-filters::-webkit-scrollbar-thumb { background: #00C4CC; border-radius: 10px; }

.filter-section {
    margin-bottom: 30px;
}

.filter-section h4 {
    color: #5A196E;
    font-size: 15px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1px;
    border-bottom: 2px solid #00C4CC;
    padding-bottom: 8px;
    margin-bottom: 15px;
}

.filter-section label {
    display: flex;
    align-items: center;
    margin-bottom: 12px;
    cursor: pointer;
    font-size: 14px;
    color: #333;
}

.filter-section input[type="checkbox"] {
    margin-right: 12px;
    accent-color: #00C4CC;
    width: 18px;
    height: 18px;
    cursor: pointer;
}

/* --- 6. RANGO DE PRECIO --- */
.price-input-wrapper {
    padding: 10px 5px;
}

#vp-price-max {
    width: 100%;
    accent-color: #5A196E;
    margin-bottom: 10px;
}

#price-output {
    display: block;
    text-align: center;
    font-weight: bold;
    color: #5A196E;
    font-size: 1.1rem;
}

/* --- 7. FOOTER DE BOTONES (SIEMPRE VISIBLE ABAJO) --- */
.vp-filtros-footer {
    flex-shrink: 0 !important; /* PROHIBE que se encoja o desaparezca */
    padding: 15px 20px;
    background: #f9f9f9;
    border-top: 1px solid #eee;
    display: flex;
    gap: 12px;
    /* Ajuste para barras de navegación móviles y muescas */
    padding-bottom: calc(max(15px, env(safe-area-inset-bottom, 15px))) !important;
}

#vp-aplicar-filtros {
    flex: 2;
    background: #5A196E;
    color: #ffffff;
    border: none;
    padding: 14px;
    border-radius: 5px;
    font-weight: bold;
    text-transform: uppercase;
    cursor: pointer;
    min-height: 48px;
}

#vp-limpiar-filtros {
    flex: 1;
    background: #ffffff;
    color: #666;
    border: 1px solid #ccc;
    padding: 14px;
    border-radius: 5px;
    font-weight: bold;
    cursor: pointer;
    min-height: 48px;
}

/* Bloqueo de scroll de fondo */
.vp-lock-scroll {
    overflow: hidden !important;
    height: 100% !important;
    position: fixed !important;
    width: 100% !important;
}

/* --- INDICADOR DE CARGA (SPINNER) --- */
.vp-loader {
    width: 18px;
    height: 18px;
    border: 2px solid rgba(255, 255, 255, 0.3); /* Círculo de fondo tenue */
    border-bottom-color: #ffffff; /* La parte que brilla y gira */
    border-radius: 50%;
    display: inline-block;
    vertical-align: middle;
    margin-right: 10px;
    box-sizing: border-box;
    animation: rotation 0.8s linear infinite; /* Un poco más rápido para dar sensación de agilidad */
}

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

/* Estilo para el botón cuando está cargando */
#vp-aplicar-filtros:disabled {
    background-color: #00C4CC !important; /* Turquesa VP */
    color: #ffffff !important;
    cursor: wait; /* Cambia el cursor a reloj de arena */
    opacity: 1; /* Quitamos la opacidad 0.8 para que el color turquesa sea vibrante */
    border: none !important;
}
/* --- 4. EFECTO HOVER EN BLOQUES DE PRODUCTO --- */

/* Contenedor de la imagen: ocultamos el desborde para que el zoom se vea dentro */
.wc-block-components-product-image {
    overflow: hidden !important;
    border-radius: 8px; /* Opcional: bordes suaves */
}

/* La imagen dentro del bloque */
.wc-block-components-product-image img {
    transition: transform 0.6s cubic-bezier(0.25, 0.46, 0.45, 0.94) !important;
}

/* El efecto al pasar el mouse por el LI completo o la imagen */
.wc-block-product:hover .wc-block-components-product-image img {
    transform: scale(1.1) !important; /* Zoom del 10% */
}

/* Opcional: Sombra al bloque completo para que resalte */
.wc-block-product {
    transition: all 0.3s ease;
    padding: 15px;
}

.wc-block-product:hover {
    box-shadow: 0 10px 30px rgba(90, 25, 110, 0.08); /* Sombra morada VP muy suave */
}
/* --- 5. BADGE DE OFERTA ESTILO HOMEPAGE --- */
.wc-block-product .wc-block-components-product-sale-badge,
.wc-block-grid__product-image .wc-block-components-product-sale-badge {
    background-color: var(--vp-turquesa-secundario) !important;
    color: white !important;
    border-radius: 50% !important;
    width: 55px !important;
    height: 55px !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    font-size: 0.7rem !important;
    font-weight: 800 !important;
    top: 10px !important;
    right: 10px !important;
    position: absolute !important;
    border: 2px solid #fff !important;
    box-shadow: 0 4px 10px rgba(0,0,0,0.1) !important;
    z-index: 10;
    padding: 0 !important; /* Asegura que el círculo no se deforme */
    margin: 0 !important;
}

/* Forzar que el texto interno no herede márgenes raros */
.wc-block-components-product-sale-badge span {
    background: transparent !important;
    padding: 0 !important;
    margin: 0 !important;
    display: block !important;
    line-height: 1 !important;
}

/* Asegurar que el contenedor de la imagen permita el posicionamiento absoluto del badge */
.wc-block-components-product-image {
    position: relative !important;
}

/* --- 8. AJUSTE PARA MÓVILES --- */
@media (max-width: 480px) {
    /* 1. La Franja: Sólida de lado a lado */
    .vp-trigger-container {
        position: fixed !important;
        bottom: 0 !important;
        left: 0 !important;
        width: 100% !important;
        background: #ffffff !important; /* Fondo blanco sólido */
        margin: 0 !important;
        padding: 10px 0 !important; /* Padding arriba/abajo, 0 a los lados */
        z-index: 998;
        display: flex !important;
        justify-content: center !important; /* Centra el botón horizontalmente */
        border-top: 1px solid #eeeeee;
        box-shadow: 0 -3px 10px rgba(0,0,0,0.05);

        /* Espacio de seguridad inferior para móviles modernos */
        padding-bottom: calc(10px + env(safe-area-inset-bottom, 10px)) !important;
    }

    /* 2. El Botón: 90% del ancho y centrado */
    .vp-btn-trigger {
        width: 90% !important; /* Aquí está el truco: no toca los bordes */
        max-width: 400px;
        justify-content: center;
        height: 48px;
        font-size: 14px;
        border-radius: 8px !important;
        margin: 0 auto !important; /* Asegura el centrado */
        display: flex !important;
    }

    /* 3. El Panel (Drawer) */
    .vp-filter-canvas {
        width: 100% !important;
        max-width: 100% !important;
        right: -100% !important;
    }

    /* 4. Evitar que la franja tape el contenido al final */
    body.archive.post-type-archive-product, 
    body.tax-product_cat {
        padding-bottom: 85px !important; 
    }
}