/*
 * Estilos para el Floating Video Player
 * Franja debajo del header que se activa como reproductor flotante
 */

/* Franja principal debajo del header */
.floating-video-strip {
    position: fixed;
    top: 60px; /* Debajo del header (60px) */
    left: 0;
    right: 0;
    /* Forzar ancho completo de la ventana, evitando límites del tema */
    width: 100vw;
    max-width: 100vw;
    margin: 0; /* evitar centrados del tema */
    box-sizing: border-box;
    height: 120px; /* Aumentado para acomodar miniatura de ~200px */
    background: linear-gradient(90deg, #1a2a6c 0%, #2a5298 100%);
    color: white;
    /* Subimos el z-index para que no quede detrás del header en mobile */
    z-index: 9999; /* Por encima de la mayoría de headers; el modal usa 10000 */
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 20px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.3);
    transition: transform 0.3s ease, opacity 0.3s ease, visibility 0.3s ease;
    border-bottom: 1px solid #ff4444;
    transform: translateY(0); /* Visible desde el inicio */
    opacity: 1; /* Inicialmente visible */
    visibility: visible; /* Inicialmente visible */
    font-family: 'Segoe UI', Arial, sans-serif;
}

/* Estado activo de la franja */
.floating-video-strip.active {
    transform: translateY(0);
    opacity: 1;
    visibility: visible;
}

/* Ajuste cuando hay admin bar de WordPress */
body.admin-bar .floating-video-strip {
    top: 32px; /* Solo el admin bar */
}

@media screen and (max-width: 782px) {
    body.admin-bar .floating-video-strip {
        top: 46px; /* Solo el admin bar en móvil */
    }
}

/* Ajustes responsivos */
@media screen and (max-width: 600px) {
    .floating-video-strip {
        height: 50px;
        padding: 0 10px;
    }
    
    .strip-video-thumbnail {
        width: 60px;
        height: 34px;
    }
    
    .video-title {
        font-size: 12px;
        max-width: 120px;
    }
    
    .play-pause-btn {
        width: 28px;
        height: 28px;
    }
    
    .expand-btn {
        padding: 4px 8px;
        font-size: 10px;
    }
}

/* Contenedor del video en la franja */
.floating-video-container {
    display: flex;
    align-items: center;
    gap: 10px;
    flex: 1;
    height: 100%;
}

/* Video miniatura */
.strip-video-thumbnail {
    width: 200px;
    height: 112.5px; /* 16:9 */
    background: #000;
    border-radius: 6px;
    position: relative;
    overflow: hidden;
    border: 1px solid rgba(255, 255, 255, 0.25);
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.35);
    margin-right: 16px;
}

.strip-video-thumbnail video {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* Overlay de play en la miniatura */
.strip-video-thumbnail::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 0;
    height: 0;
    border-left: 12px solid rgba(255, 255, 255, 0.9);
    border-top: 8px solid transparent;
    border-bottom: 8px solid transparent;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.strip-video-thumbnail:hover::after {
    opacity: 1;
}

/* Cuando el video está pausado */
.strip-video-thumbnail.paused::after {
    opacity: 1;
}

/* Indicador de transmisión en vivo */
.live-indicator {
    display: flex;
    align-items: center;
    gap: 6px;
    background-color: rgba(255, 68, 68, 0.8);
    padding: 4px 10px;
    border-radius: 12px;
    margin-bottom: 6px;
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 0.6px;
    text-transform: uppercase;
}

/* Punto rojo parpadeante */
.live-dot {
    width: 6px;
    height: 6px;
    background-color: white;
    border-radius: 50%;
    animation: pulse 1.5s infinite;
    box-shadow: 0 0 3px rgba(255, 255, 255, 0.6);
}

@keyframes pulse {
    0% {
        opacity: 1;
        transform: scale(1);
    }
    50% {
        opacity: 0.7;
        transform: scale(1.2);
    }
    100% {
        opacity: 1;
        transform: scale(1);
    }
}

/* Información del video */
.strip-info {
    display: flex;
    flex-direction: column;
    justify-content: center;
    padding-left: 5px;
}

/* Título del video */
.video-title {
    font-size: 18px;
    font-weight: 600;
    margin: 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 360px;
    text-shadow: 0 1px 1px rgba(0, 0, 0, 0.3);
    letter-spacing: 0.2px;
}

/* Controles de la franja */
.strip-controls {
    display: flex;
    align-items: center;
    gap: 8px;
    height: 100%;
}

/* Botón de reproducir/pausar */
.play-pause-btn {
    background-color: rgba(255, 255, 255, 0.18);
    border: none;
    border-radius: 50%;
    width: 40px;
    height: 40px;
    color: #fff;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.25);
    margin-right: 8px;
}

/* Asegura que el ícono sea visible y más grande */
.play-pause-btn svg {
    width: 22px;
    height: 22px;
    fill: currentColor;
    display: block;
}

/* Botón de expandir */
.expand-btn {
    background-color: rgba(255, 255, 255, 0.15);
    border: none;
    border-radius: 4px;
    padding: 8px 14px;
    color: white;
    cursor: pointer;
    font-size: 14px;
    font-weight: 600;
    transition: all 0.2s ease;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.25);
    text-transform: uppercase;
    letter-spacing: 0.6px;
}

.expand-btn:hover {
    background-color: rgba(255, 255, 255, 0.3);
    transform: scale(1.05);
}

/* Botón de cerrar */
.close-btn {
    background: none;
    border: none;
    color: white;
    font-size: 22px;
    cursor: pointer;
    opacity: 0.7;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 30px;
    height: 30px;
}

.close-btn:hover {
    opacity: 1;
    transform: scale(1.08);
}

/* Modal del reproductor expandido */
.video-modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.9);
    z-index: 10000;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.video-modal.active {
    display: flex;
}

.video-modal-content {
    position: relative;
    max-width: 90vw;
    max-height: 90vh;
    background: #000;
    border-radius: 8px;
    overflow: hidden;
}

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

.modal-close {
    position: absolute;
    top: 10px;
    right: 10px;
    background: rgba(0, 0, 0, 0.7);
    border: none;
    color: #fff;
    font-size: 24px;
    padding: 10px;
    cursor: pointer;
    border-radius: 50%;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2; /* sobre el video */
    pointer-events: auto;
}

/* Responsive */
@media (max-width: 768px) {
    .strip-video-thumbnail {
        width: 72px;
        height: 40px;
    }
    
    .video-title {
        font-size: 13px;
        max-width: 180px;
    }
    
    .play-pause-btn {
        width: 35px;
        height: 35px;
    }
    
    .expand-btn {
        padding: 4px 8px;
        font-size: 10px;
    }
    
    .floating-video-container {
        gap: 10px;
    }
    
    .strip-controls {
        gap: 8px;
    }
}

@media (max-width: 480px) {
    .floating-video-strip {
        height: 50px;
        padding: 4px 10px;
    }
    
    .video-title {
        font-size: 12px;
        max-width: 140px;
    }
    
    .live-indicator {
        font-size: 12px;
    }
    
    .floating-video-container {
        gap: 10px;
    }
}

@media screen and (max-width: 782px) {
    body.admin-bar .floating-video-strip {
        top: 32px; /* alinear con admin bar móvil, evitar doble margen visual */
    }
}

/* Animaciones adicionales */
.floating-video-strip {
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
}

/* Estados de carga */
.loading .play-pause-btn {
    animation: spin 1s linear infinite;
}

@keyframes spin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

/* Ajuste del contenido principal cuando la franja está activa */
body.floating-strip-active {
    padding-top: 200px; /* Ajustado para altura real del strip (header 60px + strip ~140px) */
}

body.floating-strip-active.admin-bar {
    padding-top: 232px; /* + Admin bar 32px */
}

@media screen and (max-width: 782px) {
    body.floating-strip-active.admin-bar {
        padding-top: 110px;
    }
}

@media (max-width: 768px) {
    body.floating-strip-active {
        padding-top: 70px; /* strip más compacto en mobile */
    }
    
    body.floating-strip-active.admin-bar {
        padding-top: 120px;
    }
}

@media (max-width: 480px) {
    body.floating-strip-active {
        padding-top: 60px;
    }
    
    body.floating-strip-active.admin-bar {
        padding-top: 110px;
    }
}

/* --- Modo inline: cuando el contenedor tiene .fvp-inline o data-display="inline" --- */
.floating-video-strip.fvp-inline,
.floating-video-strip[data-display="inline"] {
  position: static;          /* no fixed */
  top: auto;
  left: auto;
  right: auto;
  width: 100%;
  transform: none;
  opacity: 1;
  visibility: visible;
  margin: 10px 0;            /* separarla del header */
  z-index: auto;
}

/* En modo inline no forzamos altura fija; dejamos que el contenido fluya */
.floating-video-strip.fvp-inline,
.floating-video-strip[data-display="inline"] {
  height: auto;
  padding: 10px 16px;
}

/* Sólo aplicar margen-top global cuando el body indique franja fija activa */
body.floating-strip-active {
  /* nada aquí por defecto; el JS ya no mueve el contenido para inline */
}