/**
 * Media Modal Block — Styles
 * Prefijo: mm- (evita colisiones con otros plugins)
 */

/* =========================================================
   BLOQUE PRINCIPAL
   ========================================================= */

.mm-block {
    position: relative;
    display: block;
    width: 100%;
}

.mm-block__wrapper {
    position: relative;
    display: block;
    line-height: 0; /* elimina espacio inferior de la imagen */
    border-radius: 25px;
    overflow: hidden;
}

.mm-block__image {
    display: block;
    width: 100%;
    height: auto;
    border-radius: 25px;
    object-fit: cover;
}

/* Overlay semitransparente encima de la imagen */
.mm-block__overlay {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* =========================================================
   BOTÓN
   ========================================================= */

.mm-block__btn {
    background-color: #E78C85;
    color: #ffffff;
    font-weight: 700;
    font-size: 18px;
    font-family: inherit; /* hereda la fuente de Gutenberg/tema */
    line-height: 1.2;
    padding: 12px 20px;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    transition: background-color 0.2s ease, transform 0.15s ease;
    white-space: nowrap;
}

.mm-block__btn:hover,
.mm-block__btn:focus-visible {
    background-color: #d4756e;
    outline: 3px solid rgba(231, 140, 133, 0.5);
    outline-offset: 2px;
}

.mm-block__btn:active {
    transform: scale(0.97);
}

.mm-block__btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* =========================================================
   MODAL / LIGHTBOX
   ========================================================= */

.mm-lightbox {
    position: fixed;
    inset: 0;
    z-index: 99999;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    box-sizing: border-box;
}

/* Estado oculto — usamos [hidden] + clase para animación */
.mm-lightbox[hidden] {
    display: none;
}

.mm-lightbox.mm-lightbox--visible {
    display: flex;
    animation: mmFadeIn 0.2s ease both;
}

@keyframes mmFadeIn {
    from { opacity: 0; }
    to   { opacity: 1; }
}

/* Overlay oscuro */
.mm-lightbox__overlay {
    position: absolute;
    inset: 0;
    background-color: rgba(0, 0, 0, 0.82);
    cursor: pointer;
}

/* Contenedor del contenido */
.mm-lightbox__container {
    position: relative;
    z-index: 1;
    max-width: 900px;
    width: 100%;
    background: #000;
    border-radius: 10px;
    overflow: hidden;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.6);
    animation: mmSlideUp 0.25s ease both;
}

@keyframes mmSlideUp {
    from { transform: translateY(20px); opacity: 0; }
    to   { transform: translateY(0);    opacity: 1; }
}

/* Botón cerrar */
.mm-lightbox__close {
    position: absolute;
    top: 10px;
    right: 10px;
    z-index: 2;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    background: rgba(0, 0, 0, 0.55);
    border: 1px solid rgba(255, 255, 255, 0.25);
    border-radius: 50%;
    color: #fff;
    cursor: pointer;
    transition: background 0.2s ease;
    padding: 0;
}

.mm-lightbox__close:hover,
.mm-lightbox__close:focus-visible {
    background: rgba(0, 0, 0, 0.85);
    outline: 2px solid #E78C85;
    outline-offset: 2px;
}

/* Contenido del modal */
.mm-lightbox__content {
    line-height: 0;
}

/* Wrapper de video responsivo (16:9) */
.mm-lightbox__video-wrapper {
    position: relative;
    padding-bottom: 56.25%; /* 16:9 */
    height: 0;
    overflow: hidden;
    background: #000;
}

.mm-lightbox__video-wrapper iframe {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    border: none;
}

/* Imagen en el modal */
.mm-lightbox__image {
    display: block;
    width: 100%;
    height: auto;
    max-height: 80vh;
    object-fit: contain;
}

/* =========================================================
   AVISO EN EDITOR (modo preview sin imagen)
   ========================================================= */

.mm-block__empty-notice {
    padding: 24px;
    background: #fff3cd;
    border-left: 4px solid #ffc107;
    border-radius: 4px;
    font-size: 14px;
    color: #856404;
}

.mm-block__empty-notice p {
    margin: 0;
}

/* =========================================================
   RESPONSIVE
   ========================================================= */

@media (max-width: 768px) {
    .mm-block__btn {
        font-size: 16px;
        padding: 10px 18px;
    }

    .mm-lightbox__container {
        max-width: 100%;
        border-radius: 8px;
    }

    .mm-lightbox {
        padding: 12px;
    }
}
