/**
 * CSS para Galerías y Videos Embebidos
 * /assets/galeria-video.css
 */

/* ======================
   GALERÍA EMBEBIDA
   ====================== */

.galeria-embebida {
    margin: 40px 0;
    padding: 30px 0;
    border-top: 2px solid #e2e8f0;
    border-bottom: 2px solid #e2e8f0;
}

.galeria-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    grid-auto-rows: 20px;
    gap: 16px;
    margin: 32px 0;
}

.galeria-item {
    position: relative;
    overflow: hidden;
    border-radius: 12px;
    cursor: pointer;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    background: #f8f9fa;
}

.galeria-item:hover {
    transform: translateY(-4px);
    box-shadow: 0 12px 32px rgba(0,0,0,0.2);
}

.galeria-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

/* Aspectos específicos - Sistema masonry inteligente */
.galeria-item-horizontal {
    grid-row-end: span 12; /* ~240px height */
}

.galeria-item-vertical {
    grid-row-end: span 18; /* ~360px height */
}

.galeria-item-square {
    grid-row-end: span 15; /* ~300px height */
}

/* Efecto hover: overlay oscuro */
.galeria-item::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(to bottom, transparent 60%, rgba(0,0,0,0.4));
    opacity: 0;
    transition: opacity 0.3s ease;
}

.galeria-item:hover::after {
    opacity: 1;
}

/* Ícono de zoom en hover */
.galeria-item::before {
    content: '🔍';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) scale(0);
    font-size: 40px;
    z-index: 2;
    opacity: 0;
    transition: all 0.3s ease;
}

.galeria-item:hover::before {
    transform: translate(-50%, -50%) scale(1);
    opacity: 1;
}

/* Responsive */
@media (max-width: 768px) {
    .galeria-grid {
        grid-template-columns: repeat(2, 1fr);
        grid-auto-rows: 15px;
        gap: 12px;
    }
    
    .galeria-item-horizontal {
        grid-row-end: span 10;
    }
    
    .galeria-item-vertical {
        grid-row-end: span 15;
    }
    
    .galeria-item-square {
        grid-row-end: span 12;
    }
}

@media (max-width: 480px) {
    .galeria-grid {
        grid-template-columns: 1fr;
        grid-auto-rows: 12px;
        gap: 10px;
    }
    
    .galeria-item-horizontal {
        grid-row-end: span 15;
    }
    
    .galeria-item-vertical {
        grid-row-end: span 20;
    }
    
    .galeria-item-square {
        grid-row-end: span 18;
    }
}

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

.lightbox {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.95);
    z-index: 9999;
    align-items: center;
    justify-content: center;
}

.lightbox.active {
    display: flex;
}

.lightbox-content {
    position: relative;
    max-width: 90%;
    max-height: 90%;
}

.lightbox-image {
    max-width: 100%;
    max-height: 90vh;
    object-fit: contain;
}

.lightbox-close {
    position: absolute;
    top: 20px;
    right: 20px;
    width: 48px;
    height: 48px;
    background: rgba(255, 255, 255, 0.2);
    border: none;
    border-radius: 50%;
    color: white;
    font-size: 24px;
    cursor: pointer;
    backdrop-filter: blur(10px);
    transition: all 0.3s;
}

.lightbox-close:hover {
    background: rgba(255, 255, 255, 0.3);
    transform: scale(1.1);
}

.lightbox-nav {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 56px;
    height: 56px;
    background: rgba(255, 255, 255, 0.2);
    border: none;
    border-radius: 50%;
    color: white;
    font-size: 28px;
    cursor: pointer;
    backdrop-filter: blur(10px);
    transition: all 0.3s;
}

.lightbox-nav:hover {
    background: rgba(255, 255, 255, 0.3);
    transform: translateY(-50%) scale(1.1);
}

.lightbox-prev {
    left: 20px;
}

.lightbox-next {
    right: 20px;
}

.lightbox-counter {
    position: absolute;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(0, 0, 0, 0.6);
    color: white;
    padding: 8px 16px;
    border-radius: 20px;
    font-size: 14px;
    backdrop-filter: blur(10px);
}

/* ======================
   VIDEO EMBEBIDO
   ====================== */

.video-embebido {
    margin: 40px 0;
    border-radius: 12px;
    overflow: hidden;
    background: #000;
}

.video-embebido video {
    width: 100%;
    height: auto;
    display: block;
}

/* Video Horizontal (16:9) */
.video-horizontal {
    max-width: 100%;
    margin: 40px auto;
}

.video-horizontal video {
    aspect-ratio: 16/9;
}

/* Video Vertical (9:16) - Tipo Story */
.video-vertical {
    max-width: 400px;
    margin: 40px auto;
}

.video-vertical video {
    aspect-ratio: 9/16;
}

/* Responsive Videos */
@media (max-width: 768px) {
    .video-vertical {
        max-width: 320px;
    }
}

@media (max-width: 480px) {
    .video-vertical {
        max-width: 100%;
        max-width: min(100%, 360px);
    }
    
    .video-horizontal {
        margin: 30px 0;
    }
}

/* ======================
   VIDEO DESTACADO EN HOME/INDEX
   ====================== */

.hero-video-container,
.news-video-container {
    position: relative;
    width: 100%;
    overflow: hidden;
    background: #000;
    border-radius: 8px;
}

.hero-video,
.news-video {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* Video horizontal en hero */
.hero-video-container.horizontal {
    aspect-ratio: 16/9;
}

.hero-video-container.horizontal .hero-video {
    aspect-ratio: 16/9;
}

/* Video vertical en hero - adaptado */
.hero-video-container.vertical {
    aspect-ratio: 16/9;
    display: flex;
    align-items: center;
    justify-content: center;
}

.hero-video-container.vertical .hero-video {
    width: auto;
    height: 100%;
    max-width: 100%;
}

/* Controles de video */
.video-play-overlay {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 72px;
    height: 72px;
    background: rgba(255, 255, 255, 0.9);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s;
    pointer-events: none;
    opacity: 0;
}

.hero-video-container:hover .video-play-overlay,
.news-video-container:hover .video-play-overlay {
    opacity: 1;
}

.video-play-overlay::after {
    content: '▶';
    font-size: 28px;
    color: #0f172a;
    margin-left: 4px;
}

/* Indicador de video */
.video-badge {
    position: absolute;
    top: 12px;
    left: 12px;
    background: rgba(0, 0, 0, 0.8);
    color: white;
    padding: 6px 12px;
    border-radius: 6px;
    font-size: 12px;
    font-weight: 600;
    backdrop-filter: blur(10px);
    display: flex;
    align-items: center;
    gap: 6px;
}

.video-badge::before {
    content: '🎬';
}

/* ======================
   GRID DE NOTICIAS CON VIDEOS
   ====================== */

.news-card-video {
    position: relative;
}

.news-card-video .news-video-container {
    aspect-ratio: 16/9;
    margin-bottom: 16px;
}

.news-card-video .news-video-container.vertical {
    aspect-ratio: 9/16;
    max-width: 360px;
    margin: 0 auto 16px;
}

/* Últimas Noticias con videos */
.ultimas-item-video {
    position: relative;
}

.ultimas-item-video video {
    width: 80px;
    height: 80px;
    object-fit: cover;
    border-radius: 4px;
}

/* ======================
   ANIMACIONES
   ====================== */

@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

.lightbox.active {
    animation: fadeIn 0.3s ease;
}

@keyframes zoomIn {
    from {
        transform: scale(0.9);
        opacity: 0;
    }
    to {
        transform: scale(1);
        opacity: 1;
    }
}

.lightbox-content {
    animation: zoomIn 0.3s ease;
}
