/* ===== ESTILOS PARA VIDEOS ===== */

/* Video Gallery */
.video-gallery {
    margin: 2rem 0;
    padding: 2rem;
    background: linear-gradient(135deg, #f8f9fa 0%, #ffffff 100%);
    border-radius: 12px;
    border: 1px solid var(--border-color);
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
    animation: fadeInUp 0.6s ease-out;
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.video-gallery-title {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin: 0 0 1.5rem 0;
    font-size: 1.3rem;
    font-weight: 700;
    color: var(--text-color);
    text-align: center;
    justify-content: center;
}

.video-gallery-title i {
    color: var(--primary-color);
    font-size: 1.4rem;
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.1); }
}

.video-grid {
    display: flex;
    gap: 1.5rem;
    justify-content: center;
    flex-wrap: wrap;
}

.video-item {
    cursor: pointer;
    border-radius: 12px;
    overflow: hidden;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    background: white;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
    width: 320px;
    max-width: 100%;
    position: relative;
}

.video-item:hover {
    transform: translateY(-8px) scale(1.02);
    box-shadow: 0 12px 30px rgba(0, 0, 0, 0.15);
}

.video-thumbnail {
    position: relative;
    width: 100%;
    height: 180px;
    overflow: hidden;
    background: linear-gradient(45deg, #f0f0f0, #e0e0e0);
}

.video-thumbnail img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: all 0.3s ease;
    border-radius: 0;
}

.video-item:hover .video-thumbnail img {
    transform: scale(1.08);
    filter: brightness(1.1);
}

.video-play-overlay {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 70px;
    height: 70px;
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.95), rgba(255, 255, 255, 0.85));
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--primary-color);
    font-size: 1.8rem;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    backdrop-filter: blur(5px);
    border: 3px solid rgba(255, 255, 255, 0.8);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.2);
}

.video-item:hover .video-play-overlay {
    background: linear-gradient(135deg, var(--primary-color), #ff6b6b);
    color: white;
    transform: translate(-50%, -50%) scale(1.2);
    box-shadow: 0 12px 35px rgba(0, 0, 0, 0.3);
    animation: playPulse 1.5s ease-in-out infinite;
}

.video-duration {
    position: absolute;
    top: 12px;
    right: 12px;
    background: linear-gradient(135deg, rgba(0, 0, 0, 0.8), rgba(0, 0, 0, 0.6));
    color: white;
    padding: 4px 8px;
    border-radius: 6px;
    font-size: 0.75rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 4px;
    backdrop-filter: blur(5px);
}

.video-label {
    padding: 1rem;
    text-align: center;
    font-weight: 600;
    color: var(--text-color);
    font-size: 1rem;
    background: linear-gradient(135deg, #f8f9fa, #ffffff);
    border-top: 1px solid var(--border-color);
}

/* Efecto de degradado en el borde inferior del video */
.video-thumbnail::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 60px;
    background: linear-gradient(transparent, rgba(0, 0, 0, 0.3));
    pointer-events: none;
}

/* Video thumbnails estilo historias/reels integrados en galería */
.video-thumbnail-item.video-story {
    position: relative;
    cursor: pointer;
    border-radius: 50%;
    overflow: hidden;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    border: 3px solid #fff;
    background: #fff;
    padding: 3px;
    flex-shrink: 0;
    width: 66px;
    height: 66px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.video-thumbnail-item.video-story:hover {
    transform: scale(1.1);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.2);
}

.video-preview {
    width: 60px;
    height: 60px;
    object-fit: cover;
    display: block;
    border-radius: 50%;
    transition: all 0.3s ease;
    border: 2px solid white;
    background: #000;
}

.video-story .video-thumb {
    width: 60px;
    height: 60px;
    object-fit: cover;
    display: block;
    border-radius: 50%;
    transition: all 0.3s ease;
    border: 2px solid white;
    background: #f0f0f0;
}

.video-story:hover .video-preview,
.video-story:hover .video-thumb {
    filter: brightness(1.1);
}

.video-play-overlay-mini {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 20px;
    height: 20px;
    background: linear-gradient(135deg, rgba(0, 0, 0, 0.8), rgba(0, 0, 0, 0.6));
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 0.6rem;
    font-weight: bold;
    backdrop-filter: blur(3px);
    border: 1px solid rgba(255, 255, 255, 0.3);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    opacity: 0.8;
}

.video-story:hover .video-play-overlay-mini {
    background: linear-gradient(135deg, #ff6b6b, #4ecdc4);
    transform: translate(-50%, -50%) scale(1.3);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
    opacity: 1;
}

.video-story-indicator {
    position: absolute;
    top: -3px;
    left: -3px;
    right: -3px;
    bottom: -3px;
    border-radius: 50%;
    pointer-events: none;
}

.story-ring {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    background: rgba(0, 0, 0, 0.1);
    border: 2px solid rgba(0, 0, 0, 0.1);
    animation: storyPulse 2s ease-in-out infinite;
}

@keyframes storyPulse {
    0%, 100% {
        opacity: 0.3;
        transform: scale(1);
    }
    50% {
        opacity: 0.6;
        transform: scale(1.02);
    }
}

/* Fallback para cuando el video no carga */
.video-fallback {
    display: none !important;
}

.video-story .video-preview:not([src]) + .video-fallback,
.video-story .video-preview[style*="display: none"] + .video-fallback {
    display: block !important;
}

/* Mejoras para autoplay */
.video-preview {
    pointer-events: none; /* Evitar controles mientras es preview */
}

.video-story:hover .video-preview {
    filter: brightness(1.1) contrast(1.1);
}

/* Indicador de que está reproduciéndose */
.video-story .video-preview:not([paused]) + .video-fallback + .video-play-overlay-mini {
    opacity: 0.6;
    transform: translate(-50%, -50%) scale(0.8);
}

/* Responsive para videos preview */
@media (max-width: 768px) {
    .video-thumbnail-item.video-story {
        width: 66px;
        height: 66px;
    }
    
    .video-preview,
    .video-story .video-thumb {
        width: 60px;
        height: 60px;
    }
}

/* Hacer que los videos se integren mejor con las imágenes normales */
.thumbnails {
    display: flex;
    gap: 0.5rem;
    overflow-x: auto;
    padding: 5px 0;
    align-items: center;
}

.thumbnail {
    width: 60px;
    height: 60px;
    object-fit: cover;
    border: 2px solid transparent;
    border-radius: var(--border-radius-small);
    cursor: pointer;
    transition: var(--transition);
    flex-shrink: 0;
}

.thumbnail.active,
.thumbnail:hover {
    border-color: var(--secondary-color);
    transform: scale(1.05);
}

/* Integración con videos en thumbnails */
.video-thumbnail-item {
    flex-shrink: 0;
}

/* ===== MODAL DE VIDEO ===== */
.video-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.95);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 10000;
    backdrop-filter: blur(10px);
    animation: modalFadeIn 0.3s ease-out;
}

@keyframes modalFadeIn {
    from {
        opacity: 0;
        backdrop-filter: blur(0px);
    }
    to {
        opacity: 1;
        backdrop-filter: blur(10px);
    }
}

.video-modal-content {
    position: relative;
    max-width: 95vw;
    max-height: 90vh;
    width: 900px;
    background: linear-gradient(135deg, #ffffff, #f8f9fa);
    border-radius: 16px;
    overflow: hidden;
    box-shadow: 0 25px 80px rgba(0, 0, 0, 0.4);
    animation: modalSlideIn 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

@keyframes modalSlideIn {
    from {
        transform: scale(0.8) translateY(50px);
        opacity: 0;
    }
    to {
        transform: scale(1) translateY(0);
        opacity: 1;
    }
}

.video-container {
    position: relative;
    width: 100%;
    background: #000;
}

.modal-video {
    width: 100%;
    height: auto;
    max-height: 65vh;
    display: block;
    background: #000;
    border-radius: 16px 16px 0 0;
}

.video-info {
    padding: 1.5rem;
    background: linear-gradient(135deg, #ffffff, #f8f9fa);
    border-top: 1px solid var(--border-color);
}

.video-info h4 {
    margin: 0 0 0.5rem 0;
    font-size: 1.3rem;
    font-weight: 700;
    color: var(--text-color);
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.video-info h4::before {
    content: '🎬';
    font-size: 1.2rem;
}

.video-info p {
    margin: 0;
    font-size: 1rem;
    color: var(--text-light);
    font-weight: 500;
}

/* Controles del modal */
.video-close {
    position: absolute;
    top: 20px;
    right: 20px;
    width: 45px;
    height: 45px;
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.9), rgba(255, 255, 255, 0.7));
    color: var(--text-color);
    border: none;
    border-radius: 50%;
    font-size: 1.5rem;
    cursor: pointer;
    z-index: 10001;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    backdrop-filter: blur(10px);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
}

.video-close:hover {
    background: linear-gradient(135deg, #ff6b6b, #ee5a52);
    color: white;
    transform: scale(1.15) rotate(90deg);
    box-shadow: 0 6px 20px rgba(255, 107, 107, 0.4);
}

.video-nav {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 55px;
    height: 55px;
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.9), rgba(255, 255, 255, 0.7));
    color: var(--text-color);
    border: none;
    border-radius: 50%;
    font-size: 2rem;
    cursor: pointer;
    z-index: 10001;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    backdrop-filter: blur(10px);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
}

.video-nav:hover {
    background: linear-gradient(135deg, var(--primary-color), #4dabf7);
    color: white;
    transform: translateY(-50%) scale(1.15);
    box-shadow: 0 6px 20px rgba(74, 144, 226, 0.4);
}

.video-prev {
    left: 20px;
}

.video-next {
    right: 20px;
}

.video-prev:hover {
    animation: slideLeft 0.6s ease-in-out;
}

.video-next:hover {
    animation: slideRight 0.6s ease-in-out;
}

@keyframes slideLeft {
    0%, 100% { transform: translateY(-50%) scale(1.15); }
    50% { transform: translateY(-50%) scale(1.15) translateX(-5px); }
}

@keyframes slideRight {
    0%, 100% { transform: translateY(-50%) scale(1.15); }
    50% { transform: translateY(-50%) scale(1.15) translateX(5px); }
}

/* ===== RESPONSIVE DESIGN ===== */
@media (max-width: 768px) {
    .video-gallery {
        margin: 1.5rem 0;
        padding: 1.5rem;
    }

    .video-grid {
        flex-direction: column;
        align-items: center;
        gap: 1.25rem;
    }

    .video-item {
        width: 100%;
        max-width: 350px;
    }

    .video-thumbnail {
        height: 200px;
    }

    .video-play-overlay {
        width: 60px;
        height: 60px;
        font-size: 1.6rem;
    }

    .video-modal-content {
        max-width: 95vw;
        max-height: 85vh;
        border-radius: 12px;
    }

    .modal-video {
        max-height: 50vh;
        border-radius: 12px 12px 0 0;
    }

    .video-nav {
        width: 45px;
        height: 45px;
        font-size: 1.5rem;
    }

    .video-close {
        width: 40px;
        height: 40px;
        font-size: 1.3rem;
        top: 15px;
        right: 15px;
    }

    .video-nav.video-prev {
        left: 15px;
    }

    .video-nav.video-next {
        right: 15px;
    }

    .video-info {
        padding: 1.25rem;
    }

    .video-info h4 {
        font-size: 1.2rem;
    }
}

@media (max-width: 480px) {
    .video-gallery {
        margin: 1rem 0;
        padding: 1rem;
    }

    .video-gallery-title {
        font-size: 1.2rem;
    }

    .video-item {
        width: 100%;
        max-width: 100%;
    }

    .video-thumbnail {
        height: 180px;
    }

    .video-modal-content {
        max-width: 98vw;
        border-radius: 8px;
    }

    .modal-video {
        max-height: 40vh;
        border-radius: 8px 8px 0 0;
    }

    .video-nav {
        width: 40px;
        height: 40px;
        font-size: 1.3rem;
    }

    .video-close {
        width: 35px;
        height: 35px;
        font-size: 1.1rem;
        top: 10px;
        right: 10px;
    }

    .video-nav.video-prev {
        left: 10px;
    }

    .video-nav.video-next {
        right: 10px;
    }

    .video-info {
        padding: 1rem;
    }

    .video-info h4 {
        font-size: 1.1rem;
    }

    .video-info p {
        font-size: 0.9rem;
    }
}

/* ===== ANIMACIONES ===== */
@keyframes playPulse {
    0% {
        transform: translate(-50%, -50%) scale(1.2);
        box-shadow: 0 12px 35px rgba(0, 0, 0, 0.3);
    }
    50% {
        transform: translate(-50%, -50%) scale(1.35);
        box-shadow: 0 15px 45px rgba(0, 0, 0, 0.4);
    }
    100% {
        transform: translate(-50%, -50%) scale(1.2);
        box-shadow: 0 12px 35px rgba(0, 0, 0, 0.3);
    }
}

/* Animación de aparición para videos */
@keyframes videoItemFadeIn {
    from {
        opacity: 0;
        transform: translateY(30px) scale(0.95);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.video-item {
    animation: videoItemFadeIn 0.6s ease-out;
}

.video-item:nth-child(1) {
    animation-delay: 0.1s;
}

.video-item:nth-child(2) {
    animation-delay: 0.2s;
}

/* Efecto de ondas en el botón de play */
@keyframes ripple {
    0% {
        transform: translate(-50%, -50%) scale(1);
        opacity: 1;
    }
    100% {
        transform: translate(-50%, -50%) scale(2);
        opacity: 0;
    }
}

.video-play-overlay::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 100%;
    height: 100%;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.3);
    transform: translate(-50%, -50%);
    animation: ripple 2s infinite;
}

/* Animación de loading para video */
@keyframes videoLoading {
    0% {
        background-position: -200px 0;
    }
    100% {
        background-position: calc(200px + 100%) 0;
    }
}

.video-loading {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 180px;
    background: linear-gradient(90deg, #f0f0f0 0px, #e0e0e0 40px, #f0f0f0 80px);
    background-size: 200px;
    animation: videoLoading 1.5s ease-in-out infinite;
    color: var(--text-light);
    font-size: 0.9rem;
}

.video-error {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 120px;
    background: #f8f9fa;
    color: #6c757d;
    text-align: center;
    padding: 1rem;
}

.video-error i {
    font-size: 2rem;
    margin-bottom: 0.5rem;
    color: #dc3545;
}

/* ===== ACCESIBILIDAD ===== */
.video-modal:focus-within .video-nav,
.video-modal:focus-within .video-close {
    outline: 2px solid var(--primary-color);
    outline-offset: 2px;
}

/* Reducir movimiento para usuarios con preferencias de accesibilidad */
@media (prefers-reduced-motion: reduce) {
    .video-item,
    .video-thumbnail-item,
    .video-nav,
    .video-close,
    .video-play-overlay {
        transition: none;
    }
    
    .video-item:hover,
    .video-thumbnail-item:hover {
        transform: none;
    }
    
    .video-modal-content {
        animation: none;
    }
}
