/* ───────────────────────────────────────────────
   estilosdetalles.css
   ─────────────────────────────────────────────── */

/* Miniaturas a la izquierda */
.thumbnail-img {
    width: 80px;
    height: 80px;
    object-fit: cover;
    cursor: pointer;
    border: 2px solid transparent;
    transition: border 0.2s ease-in-out;
}

.thumbnail-img:hover,
.thumbnail-img.active {
    border: 2px solid #007bff;
}

/* Contenedor de la imagen principal */
.image-container {
    width: 100%;
    height: 600px;                 /* Altura fija para pantallas grandes */
    display: flex;
    align-items: center;
    justify-content: center;
    background: #f8f9fa;
    border-radius: 10px;
    padding: 10px;
}

.image-container img {
    width: auto;
    height: 100%;
    max-width: 100%;
    object-fit: contain;
    transition: opacity 0.3s ease-in-out;
}

/* Contenedor de la información */
.product-info {
    max-height: 600px;
    overflow-y: auto;
    padding: 20px;
    background: #ffffff;
    border-radius: 10px;
    box-shadow: 0px 4px 8px rgba(0, 0, 0, 0.1);
}

/* Galería - Cinta de imágenes grandes */
.gallery-container {
    margin-top: 50px;
    text-align: center;
}

.carousel-container {
    position: relative;
    width: 100%;
    max-width: 1100px;
    margin: 0 auto;
    overflow: hidden;
}

.carousel {
    display: flex;
    flex-wrap: nowrap;
    white-space: nowrap;
    overflow: hidden;
    scroll-behavior: smooth;
    -webkit-overflow-scrolling: touch;
    padding: 10px 0;
    cursor: grab;
}

.carousel:active {
    cursor: grabbing;
}

.carousel img {
    width: 250px;
    height: 250px;
    margin: 10px;
    object-fit: cover;
    cursor: pointer;
    border-radius: 10px;
    transition: transform 0.2s ease-in-out;
    flex-shrink: 0;
}

.carousel img:hover {
    transform: scale(1.05);
}

/* Botón de reproducción/pausa */
.play-pause-btn {
    margin-top: 10px;
    font-size: 20px;
    cursor: pointer;
    color: #007bff;
}

/* Botones de navegación */
.carousel-btn {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    background: rgba(0, 0, 0, 0.5);
    color: white;
    border: none;
    padding: 10px;
    cursor: pointer;
    font-size: 24px;
    border-radius: 50%;
    z-index: 100;
}
.carousel-btn.left  { left: 5px;  }
.carousel-btn.right { right: 5px; }
.carousel-btn:hover { background: rgba(0, 0, 0, 0.8); }

/* Ocultar botones de navegación para galería, video y productos relacionados */
.carousel-btn,
.carousel-control-prev,
.carousel-control-next {
    display: none !important;
}


/* Productos relacionados */
.related-products {
    margin-top: 50px;
    text-align: center;
    max-width: 1100px;
    margin: 0 auto;
}

.related-carousel {
    display: flex;
    flex-wrap: nowrap;
    overflow: hidden;
    scroll-behavior: smooth;
    -webkit-overflow-scrolling: touch;
    padding: 10px 0;
    white-space: nowrap;
    position: relative;
    cursor: grab;
}

.related-carousel:active {
    cursor: grabbing;
}

.related-item {
    flex: 0 0 200px;
    width: 200px;
    height: 280px;
    margin: 15px 20px;
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.related-img {
    width: 200px;
    height: 200px;
    object-fit: cover;
    border-radius: 10px;
    transition: transform 0.2s ease-in-out;
    flex-shrink: 0;
}

.related-img:hover { transform: scale(1.05); }

.related-title {
    font-size: 14px;
    margin-top: 10px;
    font-weight: bold;
    width: 200px;
    height: 50px;
    overflow: hidden;
    text-overflow: ellipsis;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    white-space: normal;
    line-height: 1.3;
}

/* Lightbox para imágenes */
.lightbox-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.9);
    z-index: 9999;
    justify-content: center;
    align-items: center;
    cursor: pointer;
}

.lightbox-overlay.active {
    display: flex;
}

.lightbox-overlay img {
    max-width: 90%;
    max-height: 90%;
    object-fit: contain;
    border-radius: 10px;
    box-shadow: 0 0 30px rgba(255,255,255,0.3);
}

.lightbox-close {
    position: absolute;
    top: 20px;
    right: 30px;
    font-size: 40px;
    color: white;
    cursor: pointer;
    z-index: 10000;
}

.lightbox-close:hover {
    color: #ff5555;
}

/* --- Espacio entre imágenes y descripción en móvil --- */
@media (max-width: 767.98px) {
    /* Separación entre la imagen principal/miniaturas y la sección de descripción */
    .image-container {
        margin-bottom: 1rem;
    }
    /* Si las miniaturas están en cuadrícula, darles algo de espacio */
    .thumbnail-grid-img, .thumbnail-img {
        margin-bottom: 0.5rem;
    }
    /* Asegurar distancia visual para la caja de información */
    .product-info {
        margin-top: 0.8rem;
    }
}

/* Contenedor de video individual (fuera del carrusel) */
.video-container {
    display: flex;
    justify-content: center;
    align-items: center;
    width: 100%;
    max-width: 800px;
    margin: 20px auto;
    padding: 10px;
    background: #f8f9fa;
    border-radius: 10px;
    box-shadow: 0px 4px 8px rgba(0, 0, 0, 0.1);
}

.video-container video {
    width: 100%;
    height: auto;
    border-radius: 10px;
}

/* Video dentro del carrusel (pantallas grandes) */
.carousel-item video {
    width: 100%;
    max-width: 800px;
    height: 450px;                 /* Altura fija para pantallas grandes */
    object-fit: cover;
    border-radius: 10px;
}

/* ───────────────────────────────────────────────
   Responsive Overrides para pantallas ≤ 767.98px
   ─────────────────────────────────────────────── */
@media (max-width: 767.98px) {

    /* Miniaturas un poco más pequeñas */
    .thumbnail-img {
        width: 70px;
        height: 70px;
    }

    /* Imagen principal: altura automática y bloque más bajo */
    .image-container {
        height: auto;            /* Quita la altura fija */
        min-height: 240px;       /* Altura mínima razonable */
    }
    .image-container img {
        width: 100%;
        height: auto;
        max-height: 60vh;        /* Nunca sobrepasa el 60 % del alto de la pantalla */
    }

    /* Video dentro y fuera del carrusel: ocupa el ancho y ajusta su altura */
    .carousel-item video,
    .video-container video {
        width: 100% !important;  /* Fuerza video a ocupar todo el ancho disponible */
        height: auto !important; /* Ajusta altura manteniendo proporción */
        max-height: 60vh;        /* Límite razonable en vertical */
    }
}

.card {
    height: 400px; /* o el alto que prefieras */
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    overflow: hidden;
}

.card-body {
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}
.card-title {
    font-size: 1rem;
    font-weight: bold;
    margin-bottom: 0.5rem;
    overflow: hidden;
    text-overflow: ellipsis;
    display: -webkit-box;
    -webkit-line-clamp: 2; /* Puedes cambiar el 2 por la cantidad de líneas que quieras */
    -webkit-box-orient: vertical;
}

.card-text {
    font-size: 0.875rem;
    overflow: hidden;
    text-overflow: ellipsis;
    display: -webkit-box;
    -webkit-line-clamp: 4; /* Cambia este valor para mostrar más o menos líneas */
    -webkit-box-orient: vertical;
}

/* Aplica a las imágenes de tarjetas (cards), al carrusel y relacionadas */
.card .card-img-top,
.related-carousel .related-img {
    width: 100%;
    aspect-ratio: 1 / 1;
    height: auto;
    object-fit: cover;
}

/* ───────────────────────────────────────────────
   MÓVIL - Galería y productos relacionados
   ─────────────────────────────────────────────── */
@media (max-width: 768px) {
    /* Galería de imágenes más grande en móvil */
    .carousel-container {
        padding: 0 45px;
    }
    
    .carousel img {
        width: 45vw;
        height: 45vw;
        min-width: 150px;
        min-height: 150px;
        margin: 8px;
    }
    
    .carousel-btn {
        width: 40px;
        height: 40px;
        padding: 0;
        font-size: 20px;
        display: flex;
        align-items: center;
        justify-content: center;
    }
    
    /* Productos relacionados más grandes */
    .related-item {
        flex: 0 0 45vw;
        width: 45vw;
        min-width: 150px;
        height: auto;
        margin: 10px 8px;
    }
    
    .related-img {
        width: 100%;
        height: auto;
        aspect-ratio: 1 / 1;
    }
    
    .related-title {
        font-size: 13px;
        width: 100%;
        height: auto;
        min-height: 40px;
    }
}