/* Featured Products Carousel - Modern Responsive Grid */

/* Wrapper externo para contener flechas + carrusel */
.featured-carousel-wrapper {
    position: relative;
    display: -webkit-box;
    display: -webkit-flex;
    display: flex;
    -webkit-box-align: center;
    -webkit-align-items: center;
    align-items: center;
    gap: 1rem;
    width: 100%;
    margin: 0 auto 2rem;
    padding-left: clamp(0.5rem, 2vw, 1rem);
    padding-right: clamp(0.5rem, 2vw, 1rem);
}

.featured-products-carousel,
.swiper-container {
    position: relative;
    width: 100%;
    -webkit-box-flex: 1;
    -webkit-flex: 1;
    flex: 1;
    overflow: hidden;
    padding: 0;
}

/* When not using Swiper */
.featured-products-carousel:not(.swiper) {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(clamp(125px, 100%, 175px), 1fr));
    gap: clamp(0.5rem, 2vw, 1rem);
    justify-content: center;
}

.featured-product-item,
.swiper-slide.featured-product-item {
    width: 100%;
    aspect-ratio: 3 / 5;
    min-height: 300px;
    max-height: 450px;
    height: 400px; /* Fallback para Safari */
    box-sizing: border-box;
    display: -webkit-box !important;
    display: -webkit-flex !important;
    display: flex !important;
    -webkit-box-orient: vertical;
    -webkit-box-direction: normal;
    -webkit-flex-direction: column;
    flex-direction: column;
    border-radius: clamp(0.25rem, 1vw, 0.375rem);
    overflow: hidden;
    background-color: #2d2d2d;
    -webkit-transition: transform 0.2s ease, filter 0.2s ease, box-shadow 0.3s ease;
    transition: transform 0.2s ease, filter 0.2s ease, box-shadow 0.3s ease;
    visibility: visible !important;
    opacity: 1 !important;
}

@media (min-width: 768px) {
    .featured-products-carousel:not(.swiper) {
        grid-template-columns: repeat(auto-fit, minmax(clamp(140px, 45%, 175px), 1fr));
    }
}

@media (min-width: 1024px) {
    .featured-products-carousel:not(.swiper) {
        grid-template-columns: repeat(auto-fit, minmax(clamp(150px, 30%, 200px), 1fr));
        max-width: 1400px;
        margin-inline: auto;
    }
}

.featured-product-item a.featured-product-link {
    position: relative;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    width: 100%;
    height: 100%;
    color: inherit;
    text-decoration: none;
}

/* Sección de la imagen */
.featured-product-image {
    flex: 1 0 auto;
    text-align: center;
    background-color: white;
    display: flex;
    align-items: center;
    justify-content: center;
}

.featured-product-image img {
    max-width: clamp(50%, 60%, 80%);
    max-height: 200px;
    height: auto;
    display: inline-block;
    border-radius: clamp(0.25rem, 1vw, 0.375rem);
    object-fit: contain;
}

/* Sección de la información */
.featured-product-info {
    display: flex;
    flex-direction: column;
    background-color: #1f1f1f;
    padding: clamp(0.625rem, 2vw, 0.875rem);
    box-sizing: border-box;
    text-align: left;
    min-height: 40%;
    gap: clamp(0.25rem, 0.8vw, 0.375rem);
}

/* Título del producto */
.featured-product-title {
    font-size: clamp(0.75rem, 1.8vw, 0.95rem);
    color: #fff;
    line-height: 1.3;
    font-weight: 500;
    overflow: hidden;
    text-overflow: ellipsis;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
}

/* Precio del producto */
.featured-product-price {
    font-size: clamp(0.875rem, 2.2vw, 1rem);
    font-weight: 600;
    margin-top: clamp(0.25rem, 1vw, 0.375rem);
    color: #FFD700;
}

/* Estilo para Visitas */
.featured-product-views {
    font-size: clamp(0.625rem, 1.5vw, 0.75rem);
    color: #ccc;
    margin-top: auto;
}

/* Hover en toda la tarjeta */
.featured-product-item:hover {
    -webkit-filter: brightness(1.15);
    filter: brightness(1.15);
    cursor: pointer;
    -webkit-transform: translateY(-4px);
    transform: translateY(-4px);
    box-shadow: 0 8px 16px rgba(0, 0, 0, 0.3);
}

/* Estilo del ripple - Responsive */
.ripple-effect {
    position: absolute;
    width: clamp(1rem, 4vw, 1.5rem);
    height: clamp(1rem, 4vw, 1.5rem);
    background-color: rgba(255, 255, 255, 0.4);
    border-radius: 50%;
    -webkit-transform: scale(0);
    transform: scale(0);
    -webkit-animation: rippleAnimation 0.6s ease-out forwards;
    animation: rippleAnimation 0.6s ease-out forwards;
    pointer-events: none;
    z-index: 999;
}

@-webkit-keyframes rippleAnimation {
    to {
        -webkit-transform: scale(100);
        transform: scale(100);
        opacity: 0;
    }
}

@keyframes rippleAnimation {
    to {
        -webkit-transform: scale(100);
        transform: scale(100);
        opacity: 0;
    }
}

/* Swiper Configuration - Responsive */
.featured-products-carousel.swiper,
.swiper-container,
.featured-products-carousel.swiper-container {
    --swiper-navigation-size: clamp(1.5rem, 4vw, 2rem);
    --swiper-navigation-color: gray;
    --swiper-navigation-sides-offset: 0;
    --swiper-navigation-top-offset: 50%;
}

/* Ajustes de las flechas - Responsive */
.featured-carousel-wrapper .swiper-button-next,
.featured-carousel-wrapper .swiper-button-prev {
	z-index: 1;
    position: static;
    width: var(--swiper-navigation-size, clamp(1.5rem, 4vw, 2rem));
    height: var(--swiper-navigation-size, clamp(1.5rem, 4vw, 2rem));
    min-width: var(--swiper-navigation-size, clamp(1.5rem, 4vw, 2rem));
    min-height: var(--swiper-navigation-size, clamp(1.5rem, 4vw, 2rem));
    color: var(--swiper-navigation-color, gray);
    opacity: 0.8;
    -webkit-transition: opacity 0.3s ease, -webkit-transform 0.2s ease;
    transition: opacity 0.3s ease, -webkit-transform 0.2s ease;
    transition: opacity 0.3s ease, transform 0.2s ease;
    transition: opacity 0.3s ease, transform 0.2s ease, -webkit-transform 0.2s ease;
    background: rgba(255, 255, 255, 0.8);
    border-radius: 50%;
    padding: clamp(0.5rem, 2vw, 0.75rem);
    display: -webkit-box !important;
    display: -webkit-flex !important;
    display: flex !important;
    -webkit-box-align: center;
    -webkit-align-items: center;
    align-items: center;
    -webkit-box-pack: center;
    -webkit-justify-content: center;
    justify-content: center;
    cursor: pointer;
    -webkit-flex-shrink: 0;
    flex-shrink: 0;
    margin: 0;
}

/* Efecto hover para las flechas */
.featured-carousel-wrapper .swiper-button-next:hover,
.featured-carousel-wrapper .swiper-button-prev:hover {
    opacity: 1;
    -webkit-transform: scale(1.15);
    transform: scale(1.15);
    background: rgba(255, 255, 255, 0.95);
}

/* Swiper Wrapper - propiedades adicionales */
.featured-products-carousel .swiper-wrapper,
.swiper-container .swiper-wrapper {
    display: -webkit-box !important;
    display: -webkit-flex !important;
    display: flex !important;
    -webkit-box-align: stretch;
    -webkit-align-items: stretch;
    align-items: stretch;
    height: auto;
    min-height: 300px;
    -webkit-transition: -webkit-transform 0.3s ease;
    transition: -webkit-transform 0.3s ease;
    transition: transform 0.3s ease;
    transition: transform 0.3s ease, -webkit-transform 0.3s ease;
    padding: 0;
    margin: 0;
}

.featured-products-carousel .swiper-slide,
.swiper-container .swiper-slide {
    -webkit-flex-shrink: 0;
    flex-shrink: 0;
    width: auto !important;
    min-width: 280px;
    max-width: 350px;
    height: auto;
    display: -webkit-box !important;
    display: -webkit-flex !important;
    display: flex !important;
}

.swiper-slide.featured-product-item {
    visibility: visible !important;
    pointer-events: auto !important;
}

/* Mobile Swiper adjustments */
@media (max-width: 768px) {
    .featured-products-carousel.swiper {
        --swiper-navigation-size: clamp(1.25rem, 5vw, 1.75rem);
    }
    
    /* Ocultar flechas en móvil */
    .featured-carousel-wrapper .swiper-button-next,
    .featured-carousel-wrapper .swiper-button-prev {
        display: none !important;
    }
    
    /* Aumentar padding del wrapper cuando no hay flechas */
    .featured-carousel-wrapper {
        padding-left: clamp(1rem, 3vw, 1.5rem);
        padding-right: clamp(1rem, 3vw, 1.5rem);
    }
    
    /* Ajustar ancho de slides en móvil */
    .featured-products-carousel .swiper-slide,
    .swiper-container .swiper-slide {
        min-width: calc(85vw - 2rem);
        max-width: calc(85vw - 2rem);
    }
}

@media (min-width: 769px) and (max-width: 1024px) {
    /* Tablet */
    .featured-products-carousel .swiper-slide,
    .swiper-container .swiper-slide {
        min-width: 320px;
        max-width: 380px;
    }
}

@media (min-width: 1025px) {
    /* Desktop */
    .featured-products-carousel .swiper-slide,
    .swiper-container .swiper-slide {
        min-width: 300px;
        max-width: 400px;
    }
}