/* Mejoras para el carrusel de productos y responsive design */

/* Contenedor principal del carrusel */
.product-carousel {
    padding-top: 20px;
    position: relative;
}

/* Mejoras para single-product */
.single-product {
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.08);
    margin-bottom: 20px;
    overflow: hidden;
    position: relative;
    transition: all 0.3s ease;
    border: 1px solid #f0f0f0;
}

.single-product:hover {
    transform: translateY(-8px);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.15);
    border-color: #5a88ca;
}

/* Imagen del producto mejorada */
.single-product .product-image {
    width: 100%;
    height: 220px;
    object-fit: cover;
    object-position: center;
    transition: transform 0.3s ease;
    display: block;
    border-bottom: 1px solid #f0f0f0;
    background: #f8f9fa;
}

.single-product:hover .product-image {
    transform: scale(1.05);
}

/* Contenedor de imagen para mejor control */
.single-product .product-image-container {
    position: relative;
    overflow: hidden;
    background: #f8f9fa;
    height: 220px;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Placeholder mientras carga la imagen */
.single-product .product-image[src=""] {
    background: #f8f9fa url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="%23ccc"><path d="M21 19V5c0-1.1-.9-2-2-2H5c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h14c1.1 0 2-.9 2-2zM8.5 13.5l2.5 3.01L14.5 12l4.5 6H5l3.5-4.5z"/></svg>') center/60px no-repeat;
}

/* Error state para imágenes que no cargan */
.single-product .product-image[alt]:after {
    content: attr(alt);
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    color: #999;
    font-size: 12px;
    text-align: center;
    display: none;
}

.single-product .product-image[src=""],
.single-product .product-image[src*="placeholder"] {
    background: #f8f9fa;
    border: 2px dashed #ddd;
}

.single-product .product-image[src=""]:after,
.single-product .product-image[src*="placeholder"]:after {
    display: block;
}

/* Contenido del producto */
.single-product h2 {
    font-size: 16px;
    line-height: 1.4;
    margin: 15px 15px 10px;
    font-weight: 600;
    color: #333;
    height: 44px;
    overflow: hidden;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    line-clamp: 2;
}

.single-product h2 a {
    color: inherit;
    text-decoration: none;
    transition: color 0.3s ease;
}

.single-product h2 a:hover {
    color: #5a88ca;
}

/* Precios mejorados */
.product-carousel-price {
    padding: 0 15px 15px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.product-carousel-price ins {
    color: #5a88ca;
    font-weight: 700;
    font-size: 18px;
    text-decoration: none;
}

.product-carousel-price del {
    color: #999;
    font-size: 14px;
    text-decoration: line-through;
}

/* Overlay de acciones mejorado */
.product-hover {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(90, 136, 202, 0.9);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    gap: 15px;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
}

.single-product:hover .product-hover {
    opacity: 1;
    visibility: visible;
}

.product-hover a {
    background: #fff;
    color: #5a88ca;
    padding: 12px 20px;
    border-radius: 25px;
    text-decoration: none;
    font-weight: 600;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 8px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
}

.product-hover a:hover {
    background: #5a88ca;
    color: #fff;
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.2);
}

/* Navegación del carrusel mejorada */
.latest-product .owl-nav {
    position: absolute;
    right: 0;
    top: -60px;
    display: flex;
    gap: 10px;
}

.latest-product .owl-nav div,
.related-products-wrapper .owl-nav div {
    background: #5a88ca;
    color: #fff;
    border: none;
    border-radius: 50%;
    width: 45px;
    height: 45px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 16px;
    box-shadow: 0 4px 15px rgba(90, 136, 202, 0.3);
    text-align: center;
    line-height: 1;
}

.latest-product .owl-nav div:hover,
.related-products-wrapper .owl-nav div:hover {
    background: #4a78ba;
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(90, 136, 202, 0.4);
}

/* Asegurar que los iconos se vean correctamente */
.latest-product .owl-nav div i {
    font-size: 18px;
    line-height: 1;
}

.latest-product .owl-nav .owl-prev,
.latest-product .owl-nav .owl-next {
    outline: none;
    border: none;
}

.latest-product .owl-nav .owl-prev:focus,
.latest-product .owl-nav .owl-next:focus {
    outline: 2px solid #fff;
    outline-offset: 2px;
}

/* Personalización de textos de navegación - Simplificado */
.latest-product .owl-nav .owl-prev,
.latest-product .owl-nav .owl-next {
    font-size: 0 !important;
}

/* Ocultar cualquier texto predeterminado */
.latest-product .owl-nav div * {
    display: block;
}

.latest-product .owl-nav .owl-prev .sr-only,
.latest-product .owl-nav .owl-next .sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

/* Puntos de navegación */
.latest-product .owl-dots {
    text-align: center;
    margin-top: 30px;
}

.latest-product .owl-dots .owl-dot {
    display: inline-block;
    margin: 0 5px;
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: #ddd;
    cursor: pointer;
    transition: all 0.3s ease;
}

.latest-product .owl-dots .owl-dot.active,
.latest-product .owl-dots .owl-dot:hover {
    background: #5a88ca;
    transform: scale(1.2);
}

/* Responsive Design */
@media (max-width: 768px) {
    .single-product h2 {
        font-size: 14px;
        margin: 12px 12px 8px;
        height: 38px;
    }
    
    .single-product .product-imagr {
        height: 160px;
    }
    
    .product-carousel-price {
        padding: 0 12px 12px;
    }
    
    .product-carousel-price ins {
        font-size: 16px;
    }
    
    .product-hover a {
        padding: 10px 16px;
        font-size: 14px;
    }
    
    .latest-product .owl-nav {
        position: static;
        text-align: center;
        margin-top: 20px;
        justify-content: center;
    }
    
    .latest-product .owl-nav div {
        width: 40px;
        height: 40px;
        font-size: 14px;
    }
}

@media (max-width: 480px) {
    .single-product {
        margin-bottom: 15px;
    }
    
    .single-product .product-imagr {
        height: 140px;
    }
    
    .single-product h2 {
        font-size: 13px;
        margin: 10px 10px 6px;
        height: 34px;
    }
    
    .product-carousel-price {
        padding: 0 10px 10px;
        flex-direction: column;
        align-items: flex-start;
        gap: 4px;
    }
    
    .product-carousel-price ins {
        font-size: 15px;
    }
    
    .product-carousel-price del {
        font-size: 13px;
    }
    
    .product-hover {
        gap: 10px;
    }
    
    .product-hover a {
        padding: 8px 14px;
        font-size: 13px;
    }
}

/* Mejoras adicionales para la sección de productos */
.latest-product {
    position: relative;
}

.latest-product .section-title {
    margin-bottom: 30px;
    font-size: 28px;
    font-weight: 600;
    color: #333;
    text-align: center;
    position: relative;
}

.latest-product .section-title::after {
    content: '';
    position: absolute;
    bottom: -10px;
    left: 50%;
    transform: translateX(-50%);
    width: 60px;
    height: 3px;
    background: linear-gradient(90deg, #5a88ca, #4a78ba);
    border-radius: 2px;
}

/* Animaciones suaves */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.single-product {
    animation: fadeInUp 0.6s ease forwards;
}

/* Estados de carga */
.single-product.loading {
    background: #f8f9fa;
    pointer-events: none;
}

.single-product.loading::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 30px;
    height: 30px;
    border: 3px solid #f3f3f3;
    border-top: 3px solid #5a88ca;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: translate(-50%, -50%) rotate(0deg); }
    100% { transform: translate(-50%, -50%) rotate(360deg); }
}

/* Mejoras específicas para imágenes en móviles */
@media (max-width: 767.98px) {
    .single-product .product-image {
        height: 180px;
    }
    
    .single-product .product-image-container {
        height: 180px;
    }
    
    .single-product {
        margin-bottom: 15px;
    }
    
    .single-product h2 {
        font-size: 14px;
        margin: 10px 10px 8px;
        height: 36px;
    }
    
    .product-carousel-price {
        padding: 0 10px 12px;
    }
    
    .product-carousel-price ins {
        font-size: 16px;
    }
    
    .product-carousel-price del {
        font-size: 13px;
    }
}

/* Mejoras para tablets */
@media (min-width: 768px) and (max-width: 991.98px) {
    .single-product .product-image {
        height: 200px;
    }
    
    .single-product .product-image-container {
        height: 200px;
    }
}

/* Asegurar que las imágenes mantengan su aspecto */
.product-image {
    max-width: 100%;
    height: auto;
    vertical-align: middle;
}

/* Fallback para navegadores que no soportan object-fit */
@supports not (object-fit: cover) {
    .single-product .product-image {
        width: 100%;
        height: auto;
        min-height: 180px;
    }
}
