/* =================================== */
/* ==== ESTILOS ORIGINALES (BASE) ==== */
/* =================================== */

.titulo-relacionados {
    font-size: 2rem;
    margin-top: 50px;
    margin-bottom: 25px;
    color: #1a1a2e;
    text-align: center;
}

.carrusel-container {
    position: relative;
    max-width: 1200px;
    margin: 0 auto 30px auto;
    display: flex;
    align-items: center;
}

.carrusel {
    display: flex;
    gap: 20px;
    overflow-x: auto;
    scroll-snap-type: x mandatory;
    -ms-overflow-style: none;
    scrollbar-width: none;
    padding: 15px 5px;
}

.carrusel::-webkit-scrollbar {
    display: none;
}

/* --- TARJETA DE PRODUCTO RELACIONADO --- */
.producto {
    flex: 0 0 220px; /* Ancho fijo para cada tarjeta */
    border-radius: 12px;
    background: #ffffff;
    box-shadow: 0 4px 10px rgba(0,0,0,0.1);
    scroll-snap-align: start;
    overflow: hidden;
    display: flex;
    flex-direction: column; 
}

.producto .img-container {
    width: 100%;
    height: 210px;
    overflow: hidden;
}

.producto img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    transition: transform 0.3s ease;
}

.producto:hover img {
    transform: scale(1.1);
}

.producto-info-relacionado {
    padding: 15px;
    text-align: center;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    flex-grow: 1; /* Ocupa el espacio sobrante para igualar alturas */
}

.producto h4 {
    font-size: 1rem;
    color: #333;
    margin: 0 0 10px 0;
    /* Limita el texto a 2 líneas para evitar desbordamiento */
    display: -webkit-box;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    text-overflow: ellipsis;
    min-height: 40px; /* Espacio reservado para 2 líneas de texto */
}
.producto p {
    font-size: 1.1rem;
    font-weight: bold;
    color: #7C170D;
    margin-top: auto; /* Empuja el precio hacia abajo */
}

/* Botones del Carrusel */
.carrusel-container button {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    background-color: rgba(26,26,46,0.8);
    color: #fff;
    border: none;
    padding: 10px 15px;
    cursor: pointer;
    border-radius: 50%;
    font-size: 1.5rem;
    z-index: 2;
    transition: background 0.3s ease;
}

.carrusel-container button:hover {
    background-color: #7C170D;
}

.prev { left: -15px; }
.next { right: -15px; }

/* --- TARJETA DE PRODUCTO PRINCIPAL --- */
.producto-card {
    display: flex;
    align-items: center;
    background: #fff;
    border-radius: 20px;
    box-shadow: 0 8px 20px rgba(0,0,0,0.15);
    overflow: hidden;
    max-width: 1000px;
    margin: 30px auto;
}

.producto-imagen {
    position: relative;
    flex: 1.2;
}

.producto-imagen img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.favorito {
    position: absolute;
    top: 15px;
    left: 15px;
    background: #fff;
    border-radius: 50%;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: 0 3px 8px rgba(0,0,0,0.2);
    transition: all 0.3s;
}

.favorito:hover {
    background: #ff4d6d;
    transform: scale(1.1);
}
.favorito ion-icon {
    font-size: 24px;
    color: #555;
}
.favorito:hover ion-icon {
    color: #fff;
}


.producto-info {
    flex: 1.8;
    padding: 30px;
}

.producto-info h2 {
    font-size: 2rem;
    margin-bottom: 15px;
}

.producto-info p {
    font-size: 1rem;
    color: #444;
    margin-bottom: 15px;
    line-height: 1.6;
}

.precio {
    font-size: 1.5rem;
    font-weight: bold;
    color: #7C170D;
    margin-bottom: 25px;
}

.marca {
    font-size: 1rem;
    font-weight: bold;
    color: #555;
    margin-bottom: 10px;
}

.acciones {
    display: flex;
    gap: 15px;
    align-items: center;
    margin-top: 20px;
}

.btn-agregar {
    padding: 12px 25px;
    font-size: 1rem;
    font-weight: bold;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    transition: transform 0.2s ease, background 0.3s;
    background: #141A45;
    color: #fff;
}

.btn-agregar:hover {
    transform: scale(1.05);
    background: #2c3e50;
}


/* ============================================ */
/* ==== 📱 MEDIA QUERIES RESPONSIVAS 📱 ==== */
/* ============================================ */

@media (max-width: 992px) {
    .producto-card {
        flex-direction: column;
        margin: 30px auto;
        width: 90%;
        max-width: 600px;
    }

    .producto-info {
        border-radius: 0 0 20px 20px;
    }
}

@media (max-width: 768px) {
    .titulo-relacionados {
        font-size: 1.6rem;
    }

    .producto {
        flex: 0 0 180px;
    }

    .producto .img-container {
        height: 170px;
    }

    .carrusel-container {
        padding: 0 15px;
    }
    
    .carrusel-container button {
        display: none;
    }

    .producto-info {
        padding: 20px;
    }

    .producto-info h2 {
        font-size: 1.5rem;
    }

    .acciones button {
        width: 100%;
    }
}