/**
 * HMVIP Player Gallery — Grid responsivo para múltiplas mídias
 *
 * @version 2.5.0
 * @since 2026-04-21
 */

/* ============================================
   GALLERY CONTAINER
   ============================================ */
.hmvip-media-gallery {
    display: grid;
    gap: 4px;
    border-radius: 12px;
    overflow: hidden;
    margin-top: 12px;
    width: 100%;
}

/* ============================================
   GRID LAYOUTS
   ============================================ */

/* 1 mídia: full width */
.hmvip-grid-1 {
    grid-template-columns: 1fr;
}

/* 2 mídias: side by side */
.hmvip-grid-2 {
    grid-template-columns: 1fr 1fr;
}

/* 3 mídias: 1 grande em cima, 2 embaixo */
.hmvip-grid-3 {
    grid-template-columns: 1fr 1fr;
}
.hmvip-grid-3 .hmvip-media-item:first-child {
    grid-column: 1 / -1;
}

/* 4+ mídias: grid 2x2 */
.hmvip-grid-4,
.hmvip-grid-more {
    grid-template-columns: 1fr 1fr;
}

/* Esconde mídias além da 4ª */
.hmvip-grid-more .hmvip-media-item:nth-child(n+5) {
    display: none;
}

/* ============================================
   MEDIA ITEMS
   ============================================ */
.hmvip-media-item {
    position: relative;
    overflow: hidden;
    border-radius: 8px;
    background: #111;
    cursor: pointer;
    transition: transform 0.15s ease, opacity 0.15s ease;
}

.hmvip-media-item:hover {
    transform: scale(1.01);
    opacity: 0.95;
}

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

.hmvip-media-item:hover img {
    transform: scale(1.05);
}

/* ============================================
   VIDEO ITEMS (containers pré-hidratação)
   ============================================ */
.hmvip-media-item.hmvip-video-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

.hmvip-media-item.hmvip-video-item.hmvip-player-loading {
    background: #111;
}

/* ============================================
   IMAGE MORE OVERLAY
   ============================================ */
.hmvip-image-more-overlay {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, 0.6);
    color: #fff;
    font-size: 28px;
    font-weight: 700;
    border-radius: 8px;
    pointer-events: none;
    z-index: 2;
}

/* ============================================
   INDICATORS (dots)
   ============================================ */
.hmvip-gallery-indicators {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 6px;
    margin-top: 8px;
    padding: 4px 0;
}

.hmvip-indicator {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.25);
    transition: background 0.2s ease, transform 0.2s ease;
    cursor: pointer;
}

.hmvip-indicator.active {
    background: #E91E63;
    transform: scale(1.3);
}

.hmvip-indicator:hover {
    background: rgba(255, 255, 255, 0.5);
}

/* ============================================
   MOBILE RESPONSIVE
   ============================================ */
@media (max-width: 768px) {
    .hmvip-media-gallery:has(.hmvip-video-item) {
        grid-template-columns: 1fr !important;
    }
    
    .hmvip-grid-2,
    .hmvip-grid-3,
    .hmvip-grid-4,
    .hmvip-grid-more {
        grid-template-columns: 1fr 1fr;
    }
    
    .hmvip-grid-3 .hmvip-media-item:first-child {
        grid-column: 1 / -1;
    }
    
    .hmvip-media-item {
        min-height: 160px;
    }
    
    .hmvip-gallery-indicators {
        margin-top: 6px;
    }
}

@media (max-width: 480px) {
    .hmvip-media-gallery {
        gap: 2px;
        border-radius: 8px;
    }
    
    .hmvip-media-item {
        border-radius: 6px;
        min-height: 140px;
    }
    
    .hmvip-image-more-overlay,
    .hmvip-grid-more .hmvip-media-item:nth-child(4)::after {
        font-size: 22px;
    }
}

/* ============================================
   DARK THEME COMPATIBILITY
   ============================================ */
body.buddyboss-theme .hmvip-media-gallery,
body.dark-theme .hmvip-media-gallery {
    background: transparent;
}

/* ============================================
   ANIMATIONS
   ============================================ */
@keyframes hmvip-gallery-fade-in {
    from {
        opacity: 0;
        transform: translateY(8px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.hmvip-media-gallery {
    animation: hmvip-gallery-fade-in 0.3s ease-out;
}

/* ============================================
   ACCESSIBILITY
   ============================================ */
@media (prefers-reduced-motion: reduce) {
    .hmvip-media-gallery,
    .hmvip-media-item,
    .hmvip-media-item img,
    .hmvip-indicator {
        animation: none !important;
        transition: none !important;
    }
}
