/* Fondo oscuro */
#modal-comentarios-bg {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.75);
    backdrop-filter: blur(4px);
    z-index: 9998;
    overflow: hidden !important; /* ← evita cualquier scroll del fondo */
}

/* Modal contenedor */
#modal-comentarios {
    background: #1b1b1b;
    width: 90%;
    max-width: 700px;
    height: 90vh;

    margin: 40px auto;
    padding: 20px;
    border-radius: 12px;

    display: flex;
    flex-direction: column;

    overflow: hidden !important; /* ← NO scroll del modal */
    position: relative;
    z-index: 9999;
    color: #fff;
}

/* Área de contenido (donde va el iframe) */
#modal-contenido {
    flex: 1;
    overflow: hidden !important;

    /* CENTRADO REAL */
    display: flex;
    justify-content: center;
    align-items: stretch;

    margin: 0;
    padding: 0;

    width: 100%;
}
/* El iframe manejará TODO el scroll */
#modal-contenido iframe {
    width: 100% !important;  /* ocupa todo el ancho */
    max-width: 100% !important;
    height: 100% !important;
     display: block;

    margin: 0 auto;          /* centra perfectamente */
    display: block;

    border: none;
    background: #111;

    overflow-y: auto;
    border-radius: 10px;      /* opcional */
}

/* Scrollbar elegante solo dentro del iframe (si lo usas) */
#modal-contenido iframe::-webkit-scrollbar {
    width: 8px;
}
#modal-contenido iframe::-webkit-scrollbar-thumb {
    background: #444;
    border-radius: 4px;
}

/* Botón cerrar */
#cerrar-modal {
    position: absolute;
    top: 12px;
    right: 12px;

    background: #000;
    color: #FFE300;
    border: none;

    font-size: 20px;
    font-weight: 800;

    border-radius: 50%;
    width: 45px;
    height: 45px;

    cursor: pointer;
    opacity: 0.9;

    display: flex;
    align-items: center;
    justify-content: center;

    box-shadow: 0 0 8px rgba(0,0,0,0.4);
    transition: 0.2s ease;

    z-index: 20000 !important; /* ← SIEMPRE encima del iframe */
}
#cerrar-modal:hover {
    background: #1a1a1a;
    transform: scale(1.12);
}

/* Botón abrir */
.btn-comentarios {
    background: #1e1e1e;
    color: #EBEBEB;
    border: 2px solid #9C069C;
    padding: 10px 18px;
    font-size: 16px;
    border-radius: 8px;
    cursor: pointer;

    transition: 0.3s ease;
    display: inline-flex;
    align-items: center;
    gap: 8px;

    margin-bottom: 30px;
}
.btn-comentarios:hover {
    background: #860D91;
    color: #fff;
    transform: translateY(-2px);
}
.btn-comentarios:active {
    transform: scale(0.97);
}

/* Animaciones */
@keyframes fadeIn {
    from { opacity: 0; }
    to   { opacity: 1; }
}
@keyframes modalIn {
    from { transform: translateY(-20px) scale(0.95); opacity: 0; }
    to   { transform: translateY(0) scale(1); opacity: 1; }
}

/* Móvil */

@media screen and (max-width: 600px) {
    #modal-comentarios {
        width: 100%;
        height: 100%;
        margin: 0;
        border-radius: 0;
        padding: 16px;
    }
    #cerrar-modal {
        top: 18px;
        right: 18px;
    }
    #modal-contenido iframe {
        border-radius: 0;
    }
 /* 🔥 Ajustar ancho real del contenido interior del modal */
    #modal-contenido {
        width: 100% !important;
        max-width: 100% !important;
        padding: 10px !important;
        box-sizing: border-box;
    }

    /* 🔥 Contenedor del formulario + comentarios */
    #contenedor-comentarios {
        width: 100% !important;
        max-width: 100% !important;
    }

    /* 🔥 Caja de texto "Escribe tu comentario" más estrecha */
    #comentario {
        width: 100% !important;
        max-width: 100% !important;
        margin-right: 0 !important;
    }

    /* 🔥 Lista de comentarios a todo el ancho */
    .comentarios-lista {
        width: 100% !important;
        max-width: 100% !important;
        padding-right: 4px; /* evita que toque el scroll */
        box-sizing: border-box;
    }

    .comentario-item {
        width: 100% !important;
        max-width: 100% !important;
    }
}
