/* ============================================================
   Club SW VIP — Módulo 5: Galería
   Complementa main.css + perfil.css + feed.css
   ============================================================ */

/* ============================================================
   CABECERA DE GALERÍA
   ============================================================ */

.galeria-cabecera {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.galeria-titulo {
    font-family: var(--fuente-display);
    font-size: 1.6rem;
    color: var(--plata-claro);
    font-weight: 300;
    letter-spacing: 0.04em;
}

.galeria-info-auto {
    background: var(--negro-suave);
    border: 1px solid var(--gris-borde);
    border-left: 3px solid var(--oro-oscuro);
    border-radius: var(--radio);
    padding: 0.6rem 1rem;
    margin-bottom: 1.25rem;
}

/* ============================================================
   GRID DE ÁLBUMES
   ============================================================ */

.galeria-grid-albumes {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 1rem;
}

.album-card {
    text-decoration: none;
    border-radius: var(--radio-lg);
    overflow: hidden;
    background: var(--gris-oscuro);
    border: 1px solid var(--gris-borde);
    transition: var(--trans);
    display: block;
}

.album-card:hover {
    border-color: var(--oro-oscuro);
    transform: translateY(-2px);
    box-shadow: 0 8px 24px rgba(0,0,0,0.4);
}

.album-portada {
    position: relative;
    width: 100%;
    aspect-ratio: 1 / 1;
    background: var(--gris-medio);
    overflow: hidden;
}

.album-portada-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    transition: transform 0.3s ease;
}

.album-card:hover .album-portada-img {
    transform: scale(1.04);
}

.album-portada-vacio,
.album-portada-video {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2.5rem;
    opacity: 0.3;
}

.album-portada-play {
    font-size: 2.5rem;
    opacity: 0.7;
    color: var(--plata-claro);
}

.album-badge-pub {
    position: absolute;
    top: 0.5rem;
    right: 0.5rem;
    font-size: 0.85rem;
    background: rgba(7,7,9,0.7);
    border-radius: 50%;
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.album-info {
    padding: 0.75rem 0.9rem;
    display: flex;
    flex-direction: column;
    gap: 0.15rem;
}

.album-nombre {
    font-size: 0.85rem;
    color: var(--plata-claro);
    font-weight: 400;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.album-total {
    font-size: 0.7rem;
    color: var(--gris-texto);
}

/* ============================================================
   GRID DE MEDIOS (dentro de un álbum)
   ============================================================ */

.galeria-grid-medios {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    gap: 0.5rem;
}

.medio-thumb {
    position: relative;
    aspect-ratio: 1 / 1;
    background: var(--gris-medio);
    border-radius: var(--radio-md);
    overflow: hidden;
    cursor: pointer;
    border: 1px solid var(--gris-borde);
    transition: var(--trans);
}

.medio-thumb:hover { border-color: var(--oro-oscuro); }

.medio-thumb-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    transition: transform 0.3s ease;
}

.medio-thumb:hover .medio-thumb-img {
    transform: scale(1.04);
}

.medio-thumb-video {
    width: 100%;
    height: 100%;
    position: relative;
}

.medio-thumb-play {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%,-50%);
    font-size: 1.8rem;
    color: rgba(255,255,255,0.85);
    pointer-events: none;
    text-shadow: 0 2px 8px rgba(0,0,0,0.6);
}

.hls-placeholder {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, var(--gris-oscuro), var(--negro));
}

.hls-placeholder-icon {
    font-size: 2.5rem;
    opacity: 0.7;
}

.medio-thumb-overlay {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    background: linear-gradient(transparent, rgba(7,7,9,0.75));
    padding: 0.5rem 0.6rem 0.4rem;
    display: flex;
    gap: 0.75rem;
    font-size: 0.7rem;
    color: rgba(255,255,255,0.85);
    opacity: 0;
    transition: opacity 0.2s;
}

.medio-thumb:hover .medio-thumb-overlay { opacity: 1; }

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

.lightbox {
    position: fixed;
    inset: 0;
    background: rgba(5,5,7,0.97);
    z-index: 1000;
    display: flex;
    align-items: stretch;
}

.lb-cerrar {
    position: absolute;
    top: 1rem;
    right: 1rem;
    background: rgba(255,255,255,0.08);
    border: none;
    color: var(--plata-claro);
    font-size: 1.2rem;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    cursor: pointer;
    z-index: 10;
    transition: var(--trans);
    display: flex;
    align-items: center;
    justify-content: center;
}

.lb-cerrar:hover { background: rgba(255,255,255,0.15); }

.lb-prev,
.lb-next {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    background: rgba(255,255,255,0.08);
    border: none;
    color: var(--plata-claro);
    font-size: 1.8rem;
    width: 42px;
    height: 42px;
    border-radius: 50%;
    cursor: pointer;
    z-index: 10;
    transition: var(--trans);
    display: flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
}

.lb-prev { left: 1rem; }
.lb-next { right: 20rem; } /* deja espacio al panel */

.lb-prev:hover,
.lb-next:hover { background: rgba(255,255,255,0.15); }

.lb-contenido {
    display: flex;
    width: 100%;
    height: 100%;
}

/* Media */
.lb-media {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2rem;
    min-width: 0;
    position: relative;
}

/* El envoltorio tight dentro del lightbox se ajusta al tamano real del
   media, para que la marca de agua CSS quede sobre el contenido exacto
   y no sobre el padding del lightbox. */
.lb-media .wm-envoltorio {
    max-width:  100%;
    max-height: 90vh;
    border-radius: var(--radio-md);
}

.lb-img {
    max-width:  100%;
    max-height: 90vh;
    width:      auto;
    height:     auto;
    display:    block;
    border-radius: var(--radio-md);
}

.lb-video {
    max-width:  100%;
    max-height: 90vh;
    width:      auto;
    height:     auto;
    display:    block;
    border-radius: var(--radio-md);
    background: #000;
}

/* Panel lateral */
.lb-panel {
    width: 320px;
    min-width: 320px;
    background: var(--gris-oscuro);
    border-left: 1px solid var(--gris-borde);
    display: flex;
    flex-direction: column;
    overflow-y: auto;
    padding: 1.25rem;
    gap: 1rem;
}

.lb-autor {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding-top: 0.5rem;
}

.lb-reacciones {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    border-top: 1px solid var(--gris-borde);
    border-bottom: 1px solid var(--gris-borde);
    padding: 0.5rem 0;
}

.lb-reac-resumen {
    font-size: 0.82rem;
    color: var(--gris-claro);
}

.lb-desc {
    font-size: 0.85rem;
    color: var(--plata);
    line-height: 1.55;
    word-break: break-word;
}

.lb-acciones {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.lb-comentarios {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    min-height: 0;
}

.lb-comentarios .lista-comentarios {
    flex: 1;
    overflow-y: auto;
    max-height: 250px;
    padding-right: 0.25rem;
}

/* ============================================================
   MODAL (reutiliza estilos de feed.css)
   ============================================================ */

.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(7,7,9,0.85);
    z-index: 500;
    display: flex;
    align-items: center;
    justify-content: center;
    backdrop-filter: blur(4px);
}

.modal-caja {
    background: var(--gris-oscuro);
    border: 1px solid var(--gris-borde);
    border-radius: var(--radio-lg);
    padding: 1.75rem;
    max-width: 420px;
    width: 90%;
    position: relative;
    max-height: 88vh;
    overflow-y: auto;
}

.modal-titulo {
    font-family: var(--fuente-display);
    font-size: 1.2rem;
    color: var(--plata-claro);
    margin-bottom: 1.25rem;
    padding-right: 2rem;
}

.modal-cerrar {
    position: absolute;
    top: 1rem;
    right: 1rem;
    background: none;
    border: none;
    color: var(--gris-claro);
    font-size: 1.1rem;
    cursor: pointer;
    transition: var(--trans);
}

.modal-cerrar:hover { color: var(--plata-claro); }

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

@media (max-width: 700px) {
    .galeria-grid-albumes {
        grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    }
    .galeria-grid-medios {
        grid-template-columns: repeat(auto-fill, minmax(110px, 1fr));
        gap: 0.35rem;
    }

    /* Lightbox en columna: media arriba, panel abajo con scroll */
    .lightbox {
        align-items: flex-start;
        overflow-y: auto;
    }
    .lb-contenido {
        flex-direction: column;
        height: auto;
        min-height: 100%;
    }
    .lb-media {
        padding: 3rem 0.75rem 0.75rem;
        min-height: 50vw;
        max-height: 60vh;
    }
    .lb-img  { max-height: 58vh; }
    .lb-video { max-height: 58vh; }

    /* Panel visible debajo de la imagen */
    .lb-panel {
        display: flex;         /* sobreescribe el display:none anterior */
        width: 100%;
        min-width: 0;
        border-left: none;
        border-top: 1px solid var(--gris-borde);
        padding: 1rem;
        max-height: none;
        overflow-y: visible;
    }

    /* Acciones (eliminar, usar avatar) siempre visibles */
    .lb-acciones {
        padding-bottom: 1rem;
    }

    .lb-prev { left: 0.5rem; }
    .lb-next { right: 0.5rem; }
}
