/* =========================================================
   InitMU - News Responsive + Lightbox Safe Layer v1.0.0
   Scope: front/public news cards only (.panel-news)
   Notes:
   - Hace responsive las imagenes dentro de noticias.
   - NO rompe imagenes con link: los <a href> siguen redirigiendo normal.
   - El lightbox lo controla el JS y solo aplica a imagenes sin enlace.
   ========================================================= */

.panel-news,
.panel-news * {
    box-sizing: border-box;
}

.panel-news .panel-body {
    overflow: hidden !important;
}

/* Imagenes de noticias: base64 o URL externa */
.panel-news .panel-body img,
.panel-news .panel-body a img {
    display: block !important;
    width: 100% !important;
    max-width: 100% !important;
    height: auto !important;
    margin: 12px auto !important;
    border-radius: 6px;
    object-fit: contain;
    image-rendering: auto;
}

/* Links que contienen imagen: mantener comportamiento de redireccion */
.panel-news .panel-body a:has(img) {
    display: block;
    max-width: 100%;
    text-decoration: none !important;
}

/* Clase opcional para imagenes pequenas que NO deban estirarse */
.panel-news .panel-body img.initmu-news-no-stretch {
    width: auto !important;
    max-width: 100% !important;
}

/* Clase agregada por JS solo a imagenes sin <a href> */
.panel-news .panel-body img.initmu-lightbox-ready {
    cursor: zoom-in;
    transition: transform 180ms ease, filter 180ms ease, box-shadow 180ms ease;
}

.panel-news .panel-body img.initmu-lightbox-ready:hover {
    filter: brightness(1.06) saturate(1.08);
    box-shadow: 0 0 18px rgba(80, 190, 255, 0.24);
}

/* Modal seguro */
.initmu-news-lightbox-modal {
    position: fixed;
    inset: 0;
    z-index: 999999;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 18px;
    background: rgba(0, 6, 18, 0.88);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
}

.initmu-news-lightbox-modal.is-open {
    display: flex;
}

.initmu-news-lightbox-inner {
    position: relative;
    width: min(96vw, 1180px);
    max-height: 92vh;
    padding: 12px;
    border: 1px solid rgba(91, 197, 255, 0.55);
    border-radius: 10px;
    background: linear-gradient(180deg, rgba(5, 22, 48, 0.94), rgba(0, 8, 22, 0.96));
    box-shadow:
        0 0 0 1px rgba(191, 137, 62, 0.22),
        0 0 34px rgba(0, 145, 255, 0.28),
        0 24px 70px rgba(0, 0, 0, 0.65);
}

.initmu-news-lightbox-img {
    display: block;
    width: auto;
    max-width: 100%;
    max-height: calc(92vh - 72px);
    height: auto;
    margin: 0 auto;
    border-radius: 7px;
    object-fit: contain;
    box-shadow: 0 0 22px rgba(0, 0, 0, 0.45);
}

.initmu-news-lightbox-close {
    position: absolute;
    top: -14px;
    right: -14px;
    width: 38px;
    height: 38px;
    border: 1px solid rgba(137, 220, 255, 0.65);
    border-radius: 50%;
    background: radial-gradient(circle, rgba(22, 88, 150, 0.98), rgba(4, 18, 43, 0.98));
    color: #dff7ff;
    font-size: 24px;
    line-height: 34px;
    text-align: center;
    cursor: pointer;
    box-shadow: 0 0 18px rgba(0, 170, 255, 0.28);
}

.initmu-news-lightbox-close:hover,
.initmu-news-lightbox-close:focus {
    color: #ffffff;
    outline: none;
    box-shadow: 0 0 22px rgba(0, 200, 255, 0.42);
}

body.initmu-news-lightbox-open {
    overflow: hidden !important;
}

@media (max-width: 767px) {
    .panel-news .panel-heading {
        padding: 14px 12px !important;
    }

    .panel-news .panel-title {
        font-size: 15px !important;
        line-height: 1.25 !important;
    }

    .panel-news .panel-body {
        padding: 12px !important;
    }

    .panel-news .panel-footer {
        min-height: 34px !important;
        height: auto !important;
        padding: 9px 12px !important;
        line-height: 1.2 !important;
    }

    .panel-news .panel-body img,
    .panel-news .panel-body a img {
        margin: 8px auto 10px !important;
        border-radius: 5px;
    }

    .initmu-news-lightbox-modal {
        padding: 10px;
    }

    .initmu-news-lightbox-inner {
        width: 96vw;
        padding: 8px;
    }

    .initmu-news-lightbox-close {
        top: -10px;
        right: -10px;
        width: 34px;
        height: 34px;
        font-size: 22px;
        line-height: 30px;
    }
}
