/* CSS para la plantilla de catálogo (template-catalogo.php) */

.ps-catalogo-section {
    padding: 4rem 0;
}

/* Encapsulamiento del Catálogo */
.ps-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
}

/* Grilla Responsive (CSS Grid puro) */
.ps-products-wrapper {
    display: grid;
    grid-template-columns: repeat(1, 1fr);
    gap: 30px;
    list-style: none;
    padding: 0;
    margin: 0;
}

/* Tablets */
@media (min-width: 768px) {
    .ps-products-wrapper {
        grid-template-columns: repeat(2, 1fr);
    }
}

/* Desktop */
@media (min-width: 1024px) {
    .ps-products-wrapper {
        grid-template-columns: repeat(3, 1fr);
        /* 3 columnas o 4 ajustando a repeat(4, 1fr) */
    }
}

/* Limpieza de la etiqueta <li> nativa de WooCommerce */
.ps-product-item {
    margin: 0 !important;
    padding: 0 !important;
    list-style: none !important;
    display: block;
}

/* Base de la Card (Estética Apple Liquid Glass) */
.ps-product-card {
    display: flex;
    flex-direction: column;
    height: 100%;
    background: rgba(255, 255, 255, 0.6);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid rgba(255, 255, 255, 0.4);
    border-radius: 16px;
    box-shadow: 0 4px 24px rgba(0, 0, 0, 0.04);
    overflow: hidden;
    transition: transform 0.4s cubic-bezier(0.16, 1, 0.3, 1), box-shadow 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

.ps-product-card:hover {
    transform: translateY(-6px);
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.08);
}

/* Estricto Control de la Imagen */
.ps-product-card__image-wrapper {
    width: 100%;
    overflow: hidden;
    background-color: transparent;
}

.ps-product-card__image-wrapper img {
    display: block;
    width: 100% !important;
    height: auto !important;
    aspect-ratio: 1 / 1;
    object-fit: contain;
    background-color: transparent;
    transition: transform 0.5s ease;
}

.ps-product-card:hover .ps-product-card__image-wrapper img {
    transform: scale(1.05);
    /* Ligero zoom Apple-like */
}

/* Contenido de la Card */
.ps-product-card__content {
    padding: 24px 15px; /* Aumento de padding lateral para contención */
    display: flex;
    flex-direction: column;
    flex-grow: 1;
    align-items: center; /* Asegura todo centrado por defecto */
    text-align: center;
}

.ps-product-card__title {
    font-size: 1.15rem;
    font-weight: 600;
    margin: 0 0 8px 0;
    line-height: 1.4;
    letter-spacing: -0.01em;
}

.ps-product-card__title a {
    color: #1d1d1f;
    /* Color Apple */
    text-decoration: none;
}

/* ==========================================================================
   FIJACIÓN TIPOGRÁFICA RESPONSIVE (PC ONLY)
   Previene el desbordamiento provocado por el escalado masivo de Astra
   ========================================================================== */
@media (min-width: 769px) {
    /* Selectores de alta especificidad apuntando a los títulos nativos Woo/Astra y custom */
    body #content .products ul.products li.product .woocommerce-loop-product__title,
    body .woocommerce .products ul.products li.product .woocommerce-loop-product__title,
    body ul.products li.product .woocommerce-loop-product__title,
    body .ps-container .ps-product-card__title,
    body .ps-container .ps-product-card__title a {
        /* Sistema flexible: mínimo 1.1rem, ideal 1.2vw, tope 1.4rem */
        font-size: clamp(1.1rem, 1.2vw, 1.4rem) !important;
        white-space: normal !important;
        word-wrap: break-word !important; 
        overflow-wrap: break-word !important;
        line-height: 1.3 !important;
        overflow: hidden !important;
        text-overflow: ellipsis !important;
        display: -webkit-box !important;
        -webkit-line-clamp: 2 !important; /* Corta a 2 líneas */
        line-clamp: 2 !important;
        -webkit-box-orient: vertical !important;
        padding: 0 5px !important;
        margin-bottom: 12px !important;
        text-align: center !important;
        width: 100% !important;
    }
}

.ps-product-card__price {
    font-size: 1.25rem;
    font-weight: 700;
    color: #0071e3;
    /* Azul Apple */
    margin-bottom: 24px;
}

/* Normalización de Botones (Forzado absoluto) */
.ps-product-card__action {
    margin-top: auto;
    /* Empuja el botón al fondo */
    width: 100%;
}

.ps-product-card__action a.button,
.ps-product-card__action a.ps-btn {
    display: block !important;
    width: 100% !important;
    transform: none !important;
    writing-mode: horizontal-tb !important;
    text-align: center !important;
    background-color: #0071e3 !important;
    color: #ffffff !important;
    padding: 12px 20px !important;
    border-radius: 980px !important;
    /* Estilo píldora Apple */
    text-decoration: none !important;
    font-weight: 500 !important;
    font-size: 0.95rem !important;
    line-height: 1.5 !important;
    transition: background-color 0.2s ease, opacity 0.2s ease !important;
    border: none !important;
    box-sizing: border-box !important;
    margin: 0 !important;
}

.ps-product-card__action a.button:hover,
.ps-product-card__action a.ps-btn:hover {
    background-color: #0077ED !important;
    opacity: 0.9 !important;
}

/* Ocultar Elementos Nativos Huérfanos de WooCommerce */
.woocommerce-result-count,
.woocommerce-ordering,
.woocommerce-products-header,
.woocommerce-sidebar,
.storefront-sorting,
.widget-area {
    display: none !important;
}

/* =============================================================
   HERO CATÁLOGO: 1920x800 CON SOLAPAMIENTO (OVERLAP)
   ============================================================= */

.ps-hero-clean-catalogo {
    position: relative;
    width: 100%;
    /* Limitamos el alto máximo para mantener la proporción 1920x800 */
    height: 800px;
    max-width: 1920px;
    margin: 0 auto;
    overflow: hidden;
    background-color: #ffffff;
    display: flex;
    align-items: center;
    justify-content: center;
    padding-top: 150px;
}

/* Shader siempre al fondo */
.ps-shader-bg {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 1;
}

.ps-hero-viewport {
    position: relative;
    z-index: 10;
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.ps-hero-content {
    position: relative;
    width: 100%;
    max-width: 1400px;
    display: flex;
    flex-direction: column;
    align-items: center;
}

/* --- CAPA DE TEXTO (ATRÁS) --- */
.ps-hero-text-layer {
    position: relative;
    z-index: 5;
    /* Menor que la imagen */
    text-align: center;
}

.ps-title-massive {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    font-size: clamp(3rem, 7.5vw, 6.5rem);
    font-weight: 900 !important;
    /* Extra Bold */
    color: #003366;
    line-height: 0.85;
    letter-spacing: -0.05em;
    margin: 0;
    text-transform: uppercase;
}

.ps-title-massive span {
    color: #4CAF50;
}

/* --- CAPA DE IMAGEN (ADELANTE Y SOLAPADA) --- */
.ps-hero-image-layer {
    position: relative;
    z-index: 20;
    /* Mayor que el texto para pisarlo */
    width: 100%;
    max-width: 1100px;
    /* Tamaño controlado para que no tape todo */
    margin-top: -50px;
    /* EL TRUCO: Margen negativo para subir la imagen sobre el texto */
    filter: drop-shadow(0 40px 80px rgba(0, 51, 102, 0.25));
}

.ps-img-main-hero {
    width: 100%;
    height: auto;
    display: block;
    transform-origin: center bottom;
}

/* --- RESPONSIVE --- */

@media (max-width: 1400px) {
    .ps-hero-clean-catalogo {
        height: 600px;
        /* Ajuste proporcional para pantallas menores */
    }

    .ps-hero-image-layer {
        margin-top: -20px;
        max-width: 850px;
    }
}

@media (max-width: 768px) {
    .ps-hero-clean-catalogo {
        padding-top: 60px !important;
        height: auto !important;
        min-height: 550px;
        display: flex;
        align-items: center;
    }

    .ps-title-massive {
        font-size: 2.8rem;
    }

    .ps-hero-image-layer {
        margin-top: -20px;
        max-width: 90%;
    }
}

/* =============================================================
   DIVISOR: INFINITE MARQUEE (BANDA DE ANUNCIOS)
   ============================================================= */

.ps-marquee-divider {
    width: 100%;
    background-color: #003366;
    /* Azul corporativo Prevensalud */
    overflow: hidden;
    /* Oculta lo que sale de la pantalla */
    padding: 20px 0;
    display: flex;
    align-items: center;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    z-index: 30;
    position: relative;
}

.ps-marquee-track {
    display: flex;
    width: max-content;
    /* Permite que el contenido se extienda horizontalmente */
    animation: scroll-infinite 70s linear infinite;
    /* Movimiento constante lento */
}

.ps-marquee-content {
    display: flex;
    align-items: center;
    flex-shrink: 0;
    /* Evita que las palabras se compriman */
}

.ps-marquee-item {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    color: #ffffff;
    /* Letras blancas */
    font-size: 1.5rem;
    font-weight: 800;
    /* Extra Bold */
    text-transform: uppercase;
    letter-spacing: 0.15em;
    padding: 0 40px;
    /* Espaciado entre nombres */
    white-space: nowrap;
}

.ps-marquee-dot {
    color: #4CAF50;
    /* El punto en verde para resaltar */
    font-size: 1.5rem;
    font-weight: 900;
}

/* --- ANIMACIÓN DE DESPLAZAMIENTO --- */

@keyframes scroll-infinite {
    0% {
        transform: translateX(0);
    }

    100% {
        /* Desplaza exactamente la mitad (porque el contenido está duplicado) */
        transform: translateX(-50%);
    }
}

/* --- AJUSTES RESPONSIVE --- */

@media (max-width: 768px) {
    .ps-marquee-divider {
        padding: 15px 0;
    }

    .ps-marquee-item {
        font-size: 1.1rem;
        padding: 0 25px;
    }

    .ps-marquee-track {
        animation-duration: 45s;
        /* Ajustado para ser más tranquilo también en móvil */
    }
}

/* =============================================================
   SUPPORT & CONTACT CTA (GLASSMORPHISM)
   ============================================================= */

.ps-cta-glass-container {
    width: 100%;
    max-width: 1200px;
    margin: 80px auto 40px auto;
    padding: 0 20px;
    display: flex;
    justify-content: center;
}

.ps-cta-glass {
    background: rgba(255, 255, 255, 0.7);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid rgba(255, 255, 255, 0.4);
    border-radius: 30px;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.03);
    padding: 50px 40px;
    text-align: center;
    max-width: 800px;
    width: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 20px;
}

.ps-cta-glass h2 {
    color: #003366;
    font-weight: 900;
    font-size: 2.2rem;
    margin: 0;
    line-height: 1.2;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

.ps-cta-glass p {
    color: #555555;
    font-weight: 400;
    font-size: 1.1rem;
    margin: 0 0 10px 0;
    line-height: 1.6;
    max-width: 600px;
}

.ps-cta-whatsapp-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    background-color: #25D366;
    color: #ffffff !important;
    font-weight: 700;
    font-size: 1.1rem;
    text-decoration: none;
    padding: 15px 35px;
    border-radius: 50px;
    transition: all 0.3s ease;
    animation: ps-pulse-glow 2s infinite cubic-bezier(0.66, 0, 0, 1);
    box-shadow: 0 10px 20px rgba(37, 211, 102, 0.3);
}

.ps-cta-whatsapp-btn:hover {
    background-color: #1ebc5a;
    color: #ffffff !important;
    transform: translateY(-3px);
    box-shadow: 0 15px 25px rgba(37, 211, 102, 0.4);
}

.ps-cta-whatsapp-btn svg {
    flex-shrink: 0;
}

@keyframes ps-pulse-glow {
    0% {
        box-shadow: 0 0 0 0 rgba(37, 211, 102, 0.7);
    }
    70% {
        box-shadow: 0 0 0 15px rgba(37, 211, 102, 0);
    }
    100% {
        box-shadow: 0 0 0 0 rgba(37, 211, 102, 0);
    }
}

/* --- RESPONSIVE CTA --- */
@media (max-width: 768px) {
    .ps-cta-glass-container {
        margin-top: 60px;
    }
    
    .ps-cta-glass {
        padding: 40px 20px;
        border-radius: 24px;
        gap: 15px;
    }

    .ps-cta-glass h2 {
        font-size: 1.8rem;
    }

    .ps-cta-glass p {
        font-size: 1rem;
    }

    .ps-cta-whatsapp-btn {
        padding: 12px 25px;
        font-size: 1rem;
    }
}