/*!
 * Sport&Fun — Estilos compartidos de los mensajes de chat (web + admin):
 * enlaces clicables y visor de imágenes integrado (lightbox).
 * Requiere assets/js/chat-media.js
 */

/* ─── Enlaces dentro de un mensaje (chatLinkify) ─────────────────────────── */
.chat-bubble a.chat-link,
.chat-msg-content a.chat-link {
    color: inherit;
    text-decoration: underline;
    text-underline-offset: 2px;
    word-break: break-word;
    overflow-wrap: anywhere;
}

.chat-bubble a.chat-link:hover,
.chat-msg-content a.chat-link:hover,
.chat-bubble a.chat-link:focus-visible,
.chat-msg-content a.chat-link:focus-visible {
    opacity: 0.85;
}

/* ─── Miniaturas: indican que se abren en el visor ───────────────────────── */
.chat-image a.chat-media-link {
    display: inline-block;
    -webkit-tap-highlight-color: transparent;
}

.chat-image img {
    cursor: zoom-in;
}

/* ─── Visor integrado ────────────────────────────────────────────────────── */
.chat-lightbox {
    display: none;
}

.chat-lightbox.is-open {
    display: flex;
    position: fixed;
    top: 0;
    right: 0;
    bottom: 0;
    left: 0;
    z-index: 100000;
    align-items: center;
    justify-content: center;
    padding: 20px;
    background: rgba(0, 0, 0, 0.88);
    -webkit-backdrop-filter: blur(2px);
    backdrop-filter: blur(2px);
}

.chat-lightbox-img {
    max-width: 100%;
    max-height: 100%;
    width: auto;
    height: auto;
    border-radius: 8px;
    background: #101010;
    box-shadow: 0 12px 48px rgba(0, 0, 0, 0.6);
    cursor: default;
}

.chat-lightbox-close {
    position: absolute;
    top: 12px;
    right: 14px;
    width: 42px;
    height: 42px;
    padding: 0;
    border: 0;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(255, 255, 255, 0.16);
    /* <button> no hereda color ni tipografía: se fijan explícitamente */
    color: #ffffff;
    font-family: inherit;
    font-size: 26px;
    font-weight: 400;
    line-height: 1;
    cursor: pointer;
    transition: background 0.15s ease;
}

.chat-lightbox-close:hover,
.chat-lightbox-close:focus-visible {
    background: rgba(255, 255, 255, 0.32);
    color: #ffffff;
}

/* Mientras el visor está abierto, la página de fondo no hace scroll */
html.chat-lightbox-lock {
    overflow: hidden;
}

@media (max-width: 768px) {
    .chat-lightbox.is-open {
        padding: 10px;
    }

    .chat-lightbox-close {
        top: 8px;
        right: 8px;
        width: 38px;
        height: 38px;
        font-size: 22px;
    }
}

@media print {
    .chat-lightbox {
        display: none !important;
    }
}
