/**
 * SALA DE GUERRA - MEDIOS
 * Frontend Styles
 * Encapsulated under .sdgm-* classes.
 */

/* ── Single Media ────────────────────────────────────────── */
.sdgm-single,
.sdgm-video-single {
    margin: 1em 0;
}

.sdgm-figure {
    margin: 0;
    padding: 0;
    line-height: 0;
}

.sdgm-img {
    max-width: 100%;
    height: auto;
    display: block;
    border-radius: 4px;
}

/* Size variants */
.sdgm-size-thumbnail .sdgm-img {
    max-width: 150px;
}

.sdgm-size-medium .sdgm-img {
    max-width: 600px;
}

.sdgm-size-large .sdgm-img {
    max-width: 900px;
}

.sdgm-size-full .sdgm-img {
    max-width: 100%;
}

/* ── Video ───────────────────────────────────────────────── */
.sdgm-video-wrap {
    position: relative;
    width: 100%;
    max-width: 900px;
    margin: 1em 0;
}

.sdgm-video-wrap iframe {
    width: 100%;
    aspect-ratio: 16 / 9;
    border: none;
    border-radius: 4px;
    display: block;
}

.sdgm-video {
    width: 100%;
    max-width: 100%;
    border-radius: 4px;
    display: block;
}

/* ── Gallery ─────────────────────────────────────────────── */
.sdgm-gallery {
    display: grid;
    gap: 12px;
    margin: 1em 0;
}

.sdgm-gallery.sdgm-cols-2 { grid-template-columns: repeat(2, 1fr); }
.sdgm-gallery.sdgm-cols-3 { grid-template-columns: repeat(3, 1fr); }
.sdgm-gallery.sdgm-cols-4 { grid-template-columns: repeat(4, 1fr); }
.sdgm-gallery.sdgm-cols-5 { grid-template-columns: repeat(5, 1fr); }
.sdgm-gallery.sdgm-cols-6 { grid-template-columns: repeat(6, 1fr); }

.sdgm-gallery-item {
    overflow: hidden;
    border-radius: 4px;
    line-height: 0;
}

.sdgm-gallery-item .sdgm-figure {
    width: 100%;
}

.sdgm-gallery-item .sdgm-img {
    width: 100%;
    height: auto;
    object-fit: cover;
    aspect-ratio: 1 / 1;
    border-radius: 0;
}

/* ── Grid ────────────────────────────────────────────────── */
.sdgm-grid {
    display: grid;
    gap: 16px;
    margin: 1em 0;
}

.sdgm-grid.sdgm-cols-2 { grid-template-columns: repeat(2, 1fr); }
.sdgm-grid.sdgm-cols-3 { grid-template-columns: repeat(3, 1fr); }
.sdgm-grid.sdgm-cols-4 { grid-template-columns: repeat(4, 1fr); }
.sdgm-grid.sdgm-cols-5 { grid-template-columns: repeat(5, 1fr); }
.sdgm-grid.sdgm-cols-6 { grid-template-columns: repeat(6, 1fr); }

.sdgm-grid-item {
    overflow: hidden;
    border-radius: 4px;
}

.sdgm-grid-item .sdgm-img {
    width: 100%;
    height: auto;
}

.sdgm-grid-item .sdgm-video-wrap {
    margin: 0;
    max-width: 100%;
}

.sdgm-grid-caption {
    margin: 6px 0 0;
    font-size: 0.85em;
    color: #555;
    line-height: 1.3;
}

/* ── File Link ───────────────────────────────────────────── */
.sdgm-file-link {
    display: inline-block;
    padding: 8px 14px;
    background: #f5f5f5;
    border-radius: 4px;
    color: #333;
    text-decoration: none;
    font-size: 0.9em;
    transition: background 0.2s;
}

.sdgm-file-link:hover {
    background: #e8e8e8;
    color: #111;
}

/* ── Bunny Stream Embed ───────────────────────────────────── */
.sdgm-stream-wrap {
    position: relative;
    width: 100%;
    max-width: 900px;
    margin: 1em 0;
}

.sdgm-stream-iframe {
    width: 100%;
    aspect-ratio: 16 / 9;
    border: none;
    border-radius: 4px;
    display: block;
}

/* Stream pending / encoding state */
.sdgm-stream-pending {
    position: relative;
    max-width: 900px;
    margin: 1em 0;
    background: #1a1a2e;
    border-radius: 4px;
    overflow: hidden;
}

.sdgm-stream-pending-thumb {
    width: 100%;
    aspect-ratio: 16 / 9;
    object-fit: cover;
    display: block;
    opacity: 0.5;
}

.sdgm-stream-pending-info {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    padding: 16px 20px;
    background: linear-gradient(transparent, rgba(0, 0, 0, 0.8));
    color: #fff;
}

.sdgm-stream-pending-status {
    margin: 0 0 8px;
    font-size: 0.85em;
    font-weight: 500;
}

.sdgm-stream-progress {
    width: 100%;
    height: 6px;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 3px;
    overflow: hidden;
}

.sdgm-stream-progress-bar {
    height: 100%;
    background: #2860F5;
    border-radius: 3px;
    transition: width 0.5s ease;
}

/* ── Responsive ──────────────────────────────────────────── */
@media (max-width: 768px) {
    .sdgm-gallery.sdgm-cols-4,
    .sdgm-gallery.sdgm-cols-5,
    .sdgm-gallery.sdgm-cols-6,
    .sdgm-grid.sdgm-cols-4,
    .sdgm-grid.sdgm-cols-5,
    .sdgm-grid.sdgm-cols-6 {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 480px) {
    .sdgm-gallery,
    .sdgm-grid {
        grid-template-columns: 1fr !important;
    }

    .sdgm-gallery-item .sdgm-img {
        aspect-ratio: 4 / 3;
    }
}

/* ══════════════════════════════════════════════════════════
 *  LIGHTBOX
 * ══════════════════════════════════════════════════════════ */

.sdgm-lb {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 999999;
    align-items: center;
    justify-content: center;
}

.sdgm-lb.active {
    display: flex;
}

.sdgm-lb-overlay {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, .92);
    cursor: pointer;
}

.sdgm-lb-content {
    position: relative;
    z-index: 2;
    max-width: 90vw;
    max-height: 85vh;
    display: flex;
    align-items: center;
    justify-content: center;
}

.sdgm-lb-img {
    max-width: 90vw;
    max-height: 85vh;
    object-fit: contain;
    border-radius: 4px;
    display: block;
}

.sdgm-lb-video {
    width: 80vw;
    max-width: 1100px;
}

.sdgm-lb-video iframe {
    width: 100%;
    aspect-ratio: 16 / 9;
    border: none;
    border-radius: 4px;
}

.sdgm-lb-close {
    position: absolute;
    top: 16px;
    right: 20px;
    z-index: 3;
    background: none;
    border: none;
    color: #fff;
    font-size: 36px;
    cursor: pointer;
    opacity: .7;
    transition: opacity .2s;
    line-height: 1;
}

.sdgm-lb-close:hover { opacity: 1; }

.sdgm-lb-prev,
.sdgm-lb-next {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    z-index: 3;
    background: rgba(255,255,255,.12);
    border: none;
    color: #fff;
    font-size: 28px;
    width: 48px;
    height: 48px;
    border-radius: 50%;
    cursor: pointer;
    opacity: .7;
    transition: opacity .2s, background .2s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.sdgm-lb-prev { left: 16px; }
.sdgm-lb-next { right: 16px; }

.sdgm-lb-prev:hover,
.sdgm-lb-next:hover {
    opacity: 1;
    background: rgba(255,255,255,.22);
}

.sdgm-lb-caption {
    position: absolute;
    bottom: 16px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 3;
    color: #fff;
    font-size: 14px;
    text-align: center;
    max-width: 70vw;
    padding: 6px 16px;
    background: rgba(0,0,0,.5);
    border-radius: 20px;
}

/* ══════════════════════════════════════════════════════════
 *  SLIDER (Swiper overrides)
 * ══════════════════════════════════════════════════════════ */

.sdgm-slider-wrap {
    margin: 1em 0;
    position: relative;
}

.sdgm-slider-wrap .swiper-slide {
    height: auto;
}

.sdgm-slider-wrap .swiper-slide .sdgm-img {
    width: 100%;
    height: auto;
    object-fit: cover;
    aspect-ratio: 4 / 3;
    border-radius: 4px;
}

.sdgm-slider-wrap .swiper-button-prev,
.sdgm-slider-wrap .swiper-button-next {
    color: #fff;
    background: rgba(0,0,0,.35);
    width: 40px;
    height: 40px;
    border-radius: 50%;
}

.sdgm-slider-wrap .swiper-button-prev:after,
.sdgm-slider-wrap .swiper-button-next:after {
    font-size: 16px;
}

.sdgm-slider-wrap .swiper-pagination-bullet-active {
    background: #2860F5;
}

/* ══════════════════════════════════════════════════════════
 *  STREAM VIDEO THUMBNAILS (for galleries/grids)
 * ══════════════════════════════════════════════════════════ */

.sdgm-stream-thumb-wrap {
    position: relative;
    overflow: hidden;
    border-radius: 4px;
    line-height: 0;
}

.sdgm-stream-thumb-wrap a {
    display: block;
    position: relative;
}

.sdgm-stream-thumb-img {
    width: 100%;
    aspect-ratio: 16 / 9;
    object-fit: cover;
}

.sdgm-stream-thumb-placeholder {
    width: 100%;
    aspect-ratio: 16 / 9;
    background: #1a1a2e;
    display: flex;
    align-items: center;
    justify-content: center;
}

.sdgm-play-overlay {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0,0,0,.25);
    transition: background .2s;
    pointer-events: none;
}

.sdgm-stream-thumb-wrap a:hover .sdgm-play-overlay {
    background: rgba(0,0,0,.45);
}

.sdgm-play-icon {
    width: 52px;
    height: 52px;
    background: rgba(255,255,255,.9);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 22px;
    color: #1a1a2e;
    padding-left: 4px;
    box-shadow: 0 2px 8px rgba(0,0,0,.2);
}

/* Lightbox trigger cursor on images */
[data-sdgm-lb] {
    cursor: pointer;
}

[data-sdgm-lb] img {
    transition: transform .2s, filter .2s;
}

[data-sdgm-lb]:hover img {
    transform: scale(1.02);
    filter: brightness(.95);
}
