/* ==============================> ESTILOS DE SECCION PERSONALIZADA */

/* -> CONTENEDOR COMUN */
.sc-cat-titulo-wrapper,
.sc-cat-texto-wrapper,
.sc-entry-link-wrapper {
    display: block;
    width: 100%;
    transform: translateZ(0);
    /* Aceleración GPU */
}

/* ==============================> TITULO */
.sc-cat-titulo-wrapper {
    opacity: 0;
    animation: fadeInUp 0.8s ease-out forwards;
}

.sc-cat-titulo {
    font-size: 32px;
    font-weight: 700;
    color: #fff;
    margin: 0;
    padding: 0;
    transition: color 0.3s ease, transform 0.3s ease;
    text-align: center;
}

.sc-cat-titulo:hover {
    transform: translateX(5px);
}

/* ==============================> TEXTO */
.sc-cat-texto-wrapper {
    opacity: 0;
    animation: fadeInUp 0.8s ease-out 0.2s forwards;
    /* Retraso de 0.2s */
}

.sc-cat-texto {
    font-size: 16px;
    line-height: 18px;
    text-align: center;
    color: #fff;
}

/* ==============================> BOTON ENLACE */
.sc-entry-link-wrapper {
    opacity: 0;
    animation: fadeInUp 0.8s ease-out 0.4s forwards;
    /* Retraso de 0.4s */
}

.sc-entry-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background-color: transparent;
    border: 2px solid #fff;
    color: #fff;
    padding: 8px 30px;
    font-size: 16px;
    font-weight: 600;
    text-decoration: none;
    border-radius: 25px;
    transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
    position: relative;
    overflow: hidden;
}

.sc-entry-btn:hover {
    background-color: var(--e-global-color-primary);
    border-color: var(--e-global-color-primary);
    color: #fff;
    padding-right: 45px;
    /* Espacio extra para la flecha al animar */
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
    transform: translateY(-2px);
}

.sc-arrow {
    display: inline-block;
    position: absolute;
    right: 15px;
    opacity: 0;
    transform: translateX(-10px);
    transition: all 0.3s ease;
}

.sc-entry-btn:hover .sc-arrow {
    opacity: 1;
    transform: translateX(0);
}

/* ==============================> ANIMACIONES */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ==============================> RESPONSIVE */
@media screen and (max-width: 768px) {

    /* Ajustes Titulo */
    .sc-cat-titulo {
        font-size: 24px;
        text-align: center;
    }

    .sc-cat-titulo:hover {
        transform: none;
    }

    /* Ajustes Texto */
    .sc-cat-texto {
        font-size: 15px;
        text-align: justify;
    }

    /* Ajustes Boton */
    .sc-entry-link-wrapper {
        text-align: center;
    }

    .sc-entry-btn {
        width: 100%;
        max-width: 320px;
        /* En móvil se muestra la flecha siempre */
        padding-right: 30px;
    }

    .sc-entry-btn:hover {
        transform: none;
    }

    .sc-entry-btn .sc-arrow {
        position: static;
        opacity: 1;
        transform: none;
        margin-left: 8px;
    }
}

/* ==============================> CARRUSEL DE PRODUCTOS CUSTOM */

/* -> Contenedor Principal */
.contenedor-carrusel-productos {
    position: relative;
    width: 100%;
    display: flex;
    align-items: center;
}

/* -> Pista de desplazamiento (Scroll Snap) */
.track-carrusel {
    display: flex;
    overflow-x: auto;
    gap: 20px;
    scroll-behavior: smooth;
    scroll-snap-type: x mandatory;
    scrollbar-width: none;
    /* Firefox */
    -ms-overflow-style: none;
    /* IE */
    width: 100%;
}

.track-carrusel::-webkit-scrollbar {
    display: none;
    /* Chrome/Safari */
}

/* -> Tarjeta Individual */
.tarjeta-producto {
    flex: 0 0 calc(20% - 16px);
    /* 5 columnas */
    scroll-snap-align: start;
    box-sizing: border-box;
    position: relative;
    background: #fff;
    border: 1px solid #f0f0f0;
    border-radius: 8px;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.tarjeta-producto:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 20px rgba(0, 0, 0, 0.1);
}

.tarjeta-interior {
    display: flex;
    flex-direction: column;
    height: 100%;
    position: relative;
}

/* -> Descuento Flotante */
.etiqueta-descuento {
    position: absolute;
    top: 10px;
    left: 10px;
    background-color: var(--e-global-color-primary);
    /* Color de fondo variable */
    color: #fff;
    padding: 4px 8px;
    font-size: 12px;
    font-weight: bold;
    border-radius: 4px;
    z-index: 2;
}

/* -> Imagen */
.imagen-wrapper {
    position: relative;
    overflow: hidden;
    border-radius: 8px 8px 0 0;
    aspect-ratio: 1 / 1;
}

.imagen-wrapper img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.5s ease;
}

.tarjeta-producto:hover .imagen-wrapper img {
    transform: scale(1.05);
}

/* -> Contenido Texto */
.contenido-producto {
    padding: 15px;
    display: flex;
    flex-direction: column;
    flex-grow: 1;
    justify-content: space-between;
}

/* -> Titulo */
.titulo-producto {
    font-size: 15px;
    font-weight: 600;
    line-height: 1.3;
    margin-bottom: 4px;
    min-height: 40px;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.titulo-producto a {
    text-decoration: none;
    color: inherit;
    transition: color 0.3s;
}

.titulo-producto a:hover {
    color: var(--e-global-color-primary);
}

/* -> Precios Flex Stretch */
.contenedor-precios {
    display: flex;
    margin-bottom: 15px;
    min-height: 45px;
    flex-direction: column;
    gap: 8px;
}

.precio-columna {
    display: flex;
    flex-direction: row;
    justify-content: space-between;
}

.precio-normal-label {
    font-size: 11px;
    color: #888;
    margin-bottom: 2px;
}

.precio-normal-valor {
    font-size: 13px;
    color: #999;
    text-decoration: line-through;
}

.precio-normal-valor span {
    color: #999 !important;
}

.precio-oferta-label {
    font-size: 11px;
    color: var(--e-global-color-primary);
    margin-bottom: 2px;
    font-weight: 600;
}

.precio-oferta-valor {
    font-size: 16px;
    font-weight: bold;
    color: #333;
}

/* -> Botones */
.contenedor-boton {
    margin-top: auto;
}

.btn-producto {
    display: block;
    width: 100%;
    text-align: center;
    background-color: var(--btn-accented-bgcolor, #333);
    /* Fallback si la var no existe */
    color: #fff;
    padding: 10px 0;
    text-decoration: none;
    font-size: 14px;
    font-weight: 600;
    border-radius: 4px;
    transition: background-color 0.3s ease;
}

.btn-producto:hover {
    background-color: var(--btn-accented-bgcolor-hover, #555);
    color: #fff;
}

/* -> Flechas de Navegación */
.flecha-carrusel {
    position: absolute;
    background: #fff;
    border: 1px solid #ddd;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    cursor: pointer;
    font-size: 18px;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10;
    transition: all 0.3s ease;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
    flex-shrink: 0;
    opacity: 0;
}

.flecha-carrusel:hover {
    background: var(--e-global-color-primary);
    color: #fff;
    border-color: var(--e-global-color-primary);
}

.contenedor-carrusel-productos:hover .flecha-carrusel {
    opacity: 1;
}

.flecha-carrusel.prev {
    left: -48px;
}

.flecha-carrusel.next {
    right: -48px;
}

/* -> Responsive Media Queries */
/* ==============================> RESPONSIVE: 2 COLUMNAS EN MÓVIL */

/* Tablet (aprox 768px a 1024px) - 3 columnas */
@media (max-width: 1024px) {
    .tarjeta-producto {
        flex: 0 0 calc(33.333% - 14px);
    }
}

/* Móvil (bajo 767px) - 2 columnas */
@media (max-width: 767px) {
    .tarjeta-producto {
        /* Ajuste para 2 columnas restando el gap (10px) */
        flex: 0 0 calc(50% - 5px);
    }

    .track-carrusel {
        gap: 10px;
        /* Espacio reducido entre tarjetas en móvil */
        padding: 10px 0;
    }

    .titulo-producto {
        font-size: 13px;
        /* Un poco más pequeño para que quepa bien */
        min-height: 35px;
    }

    /* Forzar visibilidad de flechas */
    .flecha-carrusel {
        opacity: 1;
        display: flex;
        width: 30px;
        height: 30px;
        background: rgba(255, 255, 255, 0.9);
        /* Un poco de transparencia */
    }

    /* Posicionamiento sobre el borde para maximizar espacio */
    .flecha-carrusel.prev {
        left: -10px;
    }

    .flecha-carrusel.next {
        right: -10px;
    }
}

/* Móvil Extra Pequeño (opcional) */
@media (max-width: 360px) {
    .tarjeta-producto {
        flex: 0 0 calc(50% - 5px);
    }

    .precio-oferta-valor {
        font-size: 14px;
    }
}

/* ==============================> ESTILOS FILTROS BLOG */

/* -> Contenedor Principal */
.filtros-blog-wrapper {
    position: relative;
    font-size: 16px;
    box-sizing: border-box;
}

.filtros-blog-wrapper * {
    box-sizing: border-box;
}

/* -> Trigger Móvil (Solo visible en < 768px) */
.filtros-mobile-trigger {
    display: none;
    background-color: var(--e-global-color-primary, #333);
    color: #fff;
    padding: 12px 20px;
    border-radius: 8px;
    cursor: pointer;
    text-align: center;
    font-weight: 600;
    transition: opacity 0.3s ease;
    margin-bottom: 20px;
}

.filtros-mobile-trigger:hover {
    opacity: 0.9;
}

/* -> Contenedor Sidebar (Canvas) */
.filtros-container {
    background: #fff;
    padding: 25px;
    border-radius: 12px;
    box-shadow: 0 5px 20px rgba(0, 0, 0, 0.05);
    border: 1px solid #f0f0f0;
    position: relative;
    transition: transform 0.4s cubic-bezier(0.25, 1, 0.5, 1);
    z-index: 1000;
}

/* -> Header Mobile del Canvas */
.filtros-header-mobile {
    display: none;
    /* Oculto en escritorio */
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    padding-bottom: 15px;
    border-bottom: 1px solid #eee;
}

.filtros-title {
    font-weight: 700;
    font-size: 18px;
}

.filtros-close {
    font-size: 24px;
    cursor: pointer;
    line-height: 1;
}

/* -> Sección de Buscador */
.filtros-search-box {
    position: relative;
    margin-bottom: 30px;
}

.search-input-group {
    position: relative;
    display: flex;
    align-items: center;
}

.filtros-search-box input {
    width: 100%;
    padding: 12px 40px 12px 15px;
    border: 1px solid #ddd;
    border-radius: 8px;
    font-size: 15px;
    outline: none;
    transition: border-color 0.3s ease, box-shadow 0.3s ease;
    background: #f9f9f9;
}

.filtros-search-box input:focus {
    border-color: var(--e-global-color-primary, #333);
    background: #fff;
    box-shadow: 0 0 0 2px rgba(0, 0, 0, 0.05);
}

.fb-clear-btn {
    position: absolute;
    right: 12px;
    top: 50%;
    transform: translateY(-50%);
    cursor: pointer;
    color: #999;
    font-size: 14px;
    padding: 4px;
    line-height: 1;
    transition: color 0.3s;
}

.fb-clear-btn:hover {
    color: #ff4d4d;
}

/* -> Resultados Live AJAX */
.fb-live-results {
    position: absolute;
    top: 100%;
    left: 0;
    width: 100%;
    background: #fff;
    border: 1px solid #eee;
    border-radius: 0 0 8px 8px;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.1);
    max-height: 350px;
    overflow-y: auto;
    z-index: 99;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-10px);
    transition: all 0.3s ease;
}

.fb-live-results.active {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.fb-group-title {
    padding: 8px 15px;
    background: #f4f4f4;
    font-size: 12px;
    font-weight: 700;
    text-transform: uppercase;
    color: #666;
    letter-spacing: 0.5px;
}

.fb-result-item {
    display: flex;
    align-items: center;
    padding: 10px 15px;
    text-decoration: none;
    color: #333;
    border-bottom: 1px solid #f9f9f9;
    transition: background 0.2s;
}

.fb-result-item:hover {
    background: #fbfbfb;
}

.fb-img-container {
    width: 40px;
    height: 40px;
    flex-shrink: 0;
    margin-right: 12px;
    border-radius: 4px;
    overflow: hidden;
}

.fb-thumb {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.fb-no-img {
    width: 100%;
    height: 100%;
    background: #eee;
}

.fb-post-title {
    font-size: 14px;
    font-weight: 500;
    line-height: 1.3;
}

.fb-loading,
.fb-no-results {
    padding: 15px;
    text-align: center;
    color: #888;
    font-size: 14px;
}

/* -> Secciones (Categorías y Posts) */
.filtros-section:not(:last-child) {
    margin-bottom: 30px;
}


.seccion-wsp {
    background: #fff;
    padding: 25px;
    border-radius: 12px;
    box-shadow: 0 5px 20px rgba(0, 0, 0, 0.05);
    border: 1px solid #f0f0f0;
    transition: transform 0.4s cubic-bezier(0.25, 1, 0.5, 1);
    margin-top: 20px;
}

@media (min-width: 1025px) {
    .seccion-wsp {
        position: -webkit-sticky;
        position: sticky;
        top: 20px;
        z-index: 100;
    }
}

@media (max-width: 1024px) {
    .seccion-wsp {
        position: relative;
        top: 0;
    }
}

.filtros-heading {
    font-size: 16px;
    font-weight: 700;
    margin-bottom: 15px;
    position: relative;
    padding-bottom: 8px;
    color: #222;
}

.filtros-heading::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    width: 30px;
    height: 2px;
    background: var(--e-global-color-primary, #333);
}

/* -> Lista Categorías */
.filtros-cat-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.filtros-cat-list li {
    margin-bottom: 8px;
}

.filtros-cat-list a {
    display: flex;
    justify-content: space-between;
    text-decoration: none;
    color: #555;
    font-size: 15px;
    padding: 6px 0;
    transition: color 0.3s, padding-left 0.3s;
}

.filtros-cat-list a:hover {
    color: var(--e-global-color-primary, #333);
    padding-left: 5px;
}

.filtros-cat-list .count {
    background: #eee;
    font-size: 11px;
    padding: 2px 8px;
    border-radius: 10px;
    color: #777;
}

/* -> Entradas Relacionadas */
.related-item {
    display: flex;
    align-items: flex-start;
    text-decoration: none;
    margin-bottom: 15px;
    group: relative;
}

.related-thumb {
    width: 60px;
    height: 60px;
    flex-shrink: 0;
    margin-right: 15px;
    border-radius: 6px;
    overflow: hidden;
}

.related-thumb img,
.related-thumb .no-thumb {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.3s ease;
    background: #f0f0f0;
}

.related-item:hover .related-thumb img {
    transform: scale(1.1);
}

.related-info {
    display: flex;
    flex-direction: column;
}

.related-title {
    font-size: 14px;
    font-weight: 600;
    color: #333;
    line-height: 1.4;
    margin-bottom: 5px;
    transition: color 0.3s;
}

.related-item:hover .related-title {
    color: var(--e-global-color-primary, #333);
}

.related-date {
    font-size: 12px;
    color: #999;
}

/* -> Responsive Styles (< 768px) */
@media screen and (max-width: 768px) {
    .filtros-mobile-trigger {
        display: block;
        /* Mostrar botón trigger */
    }

    .filtros-header-mobile {
        display: flex;
        /* Mostrar header del canvas */
    }

    .filtros-container {
        position: fixed;
        top: 0;
        left: 0;
        height: 100%;
        width: 300px;
        /* Ancho del drawer */
        max-width: 85%;
        border-radius: 0;
        transform: translate3d(-100%, 0, 0);
        /* Fuera de pantalla a la izquierda */
        overflow-y: auto;
        border-right: 1px solid #ddd;
        padding-top: 20px;
    }

    .filtros-container.is-open {
        transform: translate3d(0, 0, 0);
        /* Animación entrada */
    }

    /* Overlay oscuro */
    .filtros-overlay {
        position: fixed;
        top: 0;
        left: 0;
        width: 100%;
        height: 100%;
        background: rgba(0, 0, 0, 0.5);
        opacity: 0;
        visibility: hidden;
        transition: opacity 0.3s ease;
        z-index: 999;
        backdrop-filter: blur(2px);
    }

    .filtros-overlay.is-visible {
        opacity: 1;
        visibility: visible;
    }
}


/* ==============================> ESTILOS GRID BLOG MODERNOS */

/* -> Contenedor Principal */
.custom-blog-archive {
    width: 100%;
    margin: 0 auto;
}

.custom-blog-grid {
    display: -ms-grid;
    display: grid;
    grid-template-columns: repeat(var(--blog-columns, 4), minmax(0, 1fr));
    gap: 30px;
    row-gap: 30px;
    width: 100%;
}

/* -> Tarjeta Base */
.blog-card-item {
    position: relative;
    background-color: #fff;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.05);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    -webkit-font-smoothing: antialiased;
}

.blog-card-item:hover {
    transform: translateY(-5px);
    box-shadow: 0 15px 30px rgba(0, 0, 0, 0.1);
}

.blog-card-link {
    text-decoration: none;
    color: inherit;
    display: flex;
    flex-direction: column;
    height: 100%;
}

/* -> Imagen y Etiquetas */
.blog-card-image-wrapper {
    position: relative;
    width: 100%;
    height: 220px;
    overflow: hidden;
}

.blog-card-image-wrapper img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.5s ease;
}

.blog-card-item:hover .blog-card-image-wrapper img {
    transform: scale(1.05);
}

.blog-no-image {
    width: 100%;
    height: 100%;
    background-color: #f0f0f0;
}

.blog-card-category {
    position: relative;
    color: #333;
    padding: 6px 20px;
    border-radius: 4px;
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    text-align: end;
    bottom: -10px;
}

/* -> Contenido Texto */
.blog-card-content {
    padding: 16px 24px;
    display: flex;
    flex-direction: column;
    flex-grow: 1;
}

.blog-card-date {
    font-size: 13px;
    color: #888;
    margin-bottom: 10px;
    display: block;
}

.blog-card-title {
    font-size: 20px;
    line-height: 1.4;
    margin: 0 0 15px 0;
    font-weight: 700;
    color: #222;
    transition: color 0.3s ease;
}

.blog-card-item:hover .blog-card-title {
    color: var(--e-global-color-primary, #0073aa);
    /* Fallback si Elementor no está */
}

/* -> Footer y Botón */
.blog-card-footer {
    margin-top: auto;
    padding-top: 15px;
    border-top: 1px solid #eee;
    display: flex;
    justify-content: flex-end;
}

.blog-read-more {
    font-size: 14px;
    font-weight: 600;
    color: var(--e-global-color-primary, #0073aa);
    position: relative;
    padding-right: 20px;
    transition: padding 0.3s ease;
}

.blog-read-more::after {
    content: '→';
    position: absolute;
    right: 0;
    top: 50%;
    transform: translateY(-50%);
    opacity: 0;
    transition: opacity 0.3s ease, right 0.3s ease;
}

.blog-card-item:hover .blog-read-more {
    padding-right: 25px;
}

.blog-card-item:hover .blog-read-more::after {
    opacity: 1;
    right: 0;
}

/* -> Paginación */
.custom-blog-pagination {
    margin-top: 40px;
    text-align: center;
}

.custom-blog-pagination .page-numbers {
    display: inline-block;
    padding: 8px 16px;
    margin: 0 5px;
    background: #fff;
    border: 1px solid #ddd;
    border-radius: 4px;
    text-decoration: none;
    color: #333;
    font-size: 14px;
    transition: all 0.3s ease;
}

.custom-blog-pagination .page-numbers.current,
.custom-blog-pagination .page-numbers:hover {
    background-color: var(--e-global-color-primary, #0073aa);
    color: #fff;
    border-color: var(--e-global-color-primary, #0073aa);
}

/* -> Responsive Media Queries */
/* Forzamos el comportamiento responsive para evitar que 4 columnas 
   rompan el diseño en pantallas pequeñas */

@media (max-width: 1024px) {
    .custom-blog-grid {
        /* Cambiamos 45% por un cálculo más preciso para evitar desbordamientos por el gap */
        grid-template-columns: repeat(auto-fill, minmax(calc(50% - 20px), 1fr));
    }
}

@media (max-width: 768px) {
    .custom-blog-grid {
        /* Usamos minmax(0, 1fr) para evitar que el contenido ancho estire la columna en Safari */
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 20px;
    }

    .blog-card-title {
        font-size: 18px;
        line-height: 1.3;
        /* Mejor legibilidad en pantallas pequeñas */
    }
}

@media (max-width: 580px) {
    .custom-blog-grid {
        /* En lugar de 1fr solo, minmax asegura que el contenido no desborde horizontalmente */
        grid-template-columns: minmax(0, 1fr) !important;
        gap: 15px;
        /* Un gap ligeramente menor aprovecha mejor el espacio en iPhone SE */
    }
}