/* ===================================================================
   REPRODUCTOR ABTV - controles propios
   Sustituye los controles nativos del navegador para que se vea igual
   en Chrome, Firefox y Safari, con la identidad del sitio.
   Marcado esperado: .reproductor-abtv > video + .rep-controles
   =================================================================== */

.reproductor-abtv {
    position: relative;
    width: 100%;
    background: #000;
    overflow: hidden;
    border-radius: 0 0 1rem 1rem;
    line-height: 0;
    user-select: none;
}

.reproductor-abtv video {
    width: 100%;
    height: auto;
    display: block;
    background: #000;
    outline: none;
}

/* Oculta los controles nativos por si algun navegador insiste */
.reproductor-abtv video::-webkit-media-controls {
    display: none !important;
}

/* --- Botón grande de reproducir (cuando está en pausa) --- */
.rep-play-grande {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, 0.3);
    border: none;
    cursor: pointer;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.25s ease, visibility 0.25s ease;
    z-index: 3;
    padding: 0;
}

.reproductor-abtv.en-pausa .rep-play-grande {
    opacity: 1;
    visibility: visible;
}

.rep-play-grande span {
    width: 78px;
    height: 78px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    background: linear-gradient(135deg, #fc018b 0%, #5225ba 100%);
    box-shadow: 0 10px 34px rgba(252, 1, 139, 0.45);
    transition: transform 0.2s ease;
}

.rep-play-grande:hover span {
    transform: scale(1.08);
}

.rep-play-grande svg {
    width: 32px;
    height: 32px;
    fill: #fff;
    margin-left: 4px;
}

/* --- Indicador de carga --- */
.rep-cargando {
    position: absolute;
    top: 50%;
    left: 50%;
    width: 48px;
    height: 48px;
    margin: -24px 0 0 -24px;
    border: 3px solid rgba(255, 255, 255, 0.18);
    border-top-color: #fc018b;
    border-radius: 50%;
    animation: repGirar 0.8s linear infinite;
    display: none;
    z-index: 4;
}

.reproductor-abtv.cargando .rep-cargando {
    display: block;
}

@keyframes repGirar {
    to { transform: rotate(360deg); }
}

/* --- Aviso de salto (+10 / -10) --- */
.rep-aviso {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    padding: 0.7rem 1.3rem;
    background: rgba(0, 0, 0, 0.72);
    backdrop-filter: blur(10px);
    border-radius: 10px;
    color: #fff;
    font-size: 1rem;
    font-weight: 600;
    line-height: 1;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.25s ease;
    z-index: 5;
}

.rep-aviso.visible {
    opacity: 1;
}

/* --- Barra de controles --- */
.rep-controles {
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    padding: 2.5rem 1rem 0.85rem;
    background: linear-gradient(to top,
        rgba(0, 0, 0, 0.88) 0%,
        rgba(0, 0, 0, 0.55) 55%,
        transparent 100%);
    opacity: 1;
    transition: opacity 0.3s ease;
    z-index: 6;
    line-height: normal;
}

.reproductor-abtv.ocultar-controles .rep-controles {
    opacity: 0;
    pointer-events: none;
}

.reproductor-abtv.ocultar-controles {
    cursor: none;
}

/* --- Barra de progreso --- */
.rep-barra {
    position: relative;
    height: 18px;
    display: flex;
    align-items: center;
    cursor: pointer;
    margin-bottom: 0.35rem;
}

.rep-pista {
    position: relative;
    width: 100%;
    height: 4px;
    border-radius: 2px;
    background: rgba(255, 255, 255, 0.25);
    transition: height 0.15s ease;
}

.rep-barra:hover .rep-pista {
    height: 6px;
}

.rep-buffer {
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 0;
    border-radius: 2px;
    background: rgba(255, 255, 255, 0.32);
}

.rep-progreso {
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 0;
    border-radius: 2px;
    background: linear-gradient(90deg, #fc018b 0%, #c01a9f 100%);
}

.rep-punto {
    position: absolute;
    top: 50%;
    left: 0;
    width: 13px;
    height: 13px;
    margin: -6.5px 0 0 -6.5px;
    border-radius: 50%;
    background: #fc018b;
    box-shadow: 0 0 0 4px rgba(252, 1, 139, 0.25);
    opacity: 0;
    transition: opacity 0.15s ease;
}

.rep-barra:hover .rep-punto,
.reproductor-abtv.arrastrando .rep-punto {
    opacity: 1;
}

/* Tiempo al pasar el mouse por la barra */
.rep-tooltip {
    position: absolute;
    bottom: 22px;
    transform: translateX(-50%);
    padding: 3px 8px;
    background: rgba(0, 0, 0, 0.85);
    border-radius: 5px;
    color: #fff;
    font-size: 0.73rem;
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.15s ease;
}

.rep-barra:hover .rep-tooltip {
    opacity: 1;
}

/* --- Fila de botones --- */
.rep-fila {
    display: flex;
    align-items: center;
    gap: 0.35rem;
}

.rep-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 38px;
    height: 38px;
    padding: 0;
    background: none;
    border: none;
    border-radius: 8px;
    color: rgba(255, 255, 255, 0.88);
    cursor: pointer;
    transition: background 0.18s ease, color 0.18s ease;
}

.rep-btn:hover {
    background: rgba(255, 255, 255, 0.14);
    color: #fff;
}

.rep-btn svg {
    width: 20px;
    height: 20px;
    fill: currentColor;
    pointer-events: none;
}

.rep-btn-ancho {
    width: auto;
    padding: 0 0.6rem;
    font-size: 0.8rem;
    font-weight: 600;
    font-variant-numeric: tabular-nums;
}

.rep-tiempo {
    margin-left: 0.4rem;
    font-size: 0.82rem;
    color: rgba(255, 255, 255, 0.82);
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
}

.rep-espacio {
    flex: 1;
}

/* --- Volumen --- */
.rep-volumen {
    display: flex;
    align-items: center;
}

.rep-vol-pista {
    width: 0;
    opacity: 0;
    overflow: hidden;
    transition: width 0.22s ease, opacity 0.22s ease;
}

.rep-volumen:hover .rep-vol-pista,
.rep-volumen:focus-within .rep-vol-pista {
    width: 78px;
    opacity: 1;
}

.rep-vol-pista input {
    width: 72px;
    margin: 0 0 0 6px;
    accent-color: #fc018b;
    cursor: pointer;
    vertical-align: middle;
}

/* Alternar iconos segun estado */
.rep-icono-pausa,
.reproductor-abtv.reproduciendo .rep-icono-play { display: none; }
.reproductor-abtv.reproduciendo .rep-icono-pausa { display: block; }

.rep-icono-mudo,
.reproductor-abtv.silenciado .rep-icono-sonido { display: none; }
.reproductor-abtv.silenciado .rep-icono-mudo { display: block; }

.rep-icono-salir,
.reproductor-abtv.pantalla-completa .rep-icono-entrar { display: none; }
.reproductor-abtv.pantalla-completa .rep-icono-salir { display: block; }

/* --- Pantalla completa --- */
.reproductor-abtv:fullscreen {
    border-radius: 0;
    display: flex;
    align-items: center;
}

.reproductor-abtv:fullscreen video {
    max-height: 100vh;
}

/* --- Responsive --- */
@media (max-width: 600px) {
    .rep-controles {
        padding: 2rem 0.5rem 0.6rem;
    }

    .rep-btn {
        width: 34px;
        height: 34px;
    }

    .rep-btn svg {
        width: 18px;
        height: 18px;
    }

    .rep-tiempo {
        font-size: 0.72rem;
    }

    /* En movil el volumen lo maneja el sistema */
    .rep-volumen,
    .rep-velocidad {
        display: none;
    }

    .rep-play-grande span {
        width: 62px;
        height: 62px;
    }
}

@media (prefers-reduced-motion: reduce) {
    .rep-cargando { animation-duration: 2s; }
    .rep-play-grande span { transition: none; }
}


/* ===================================================================
   MODO CINE
   Al reproducir, el reproductor toma toda la ventana del navegador
   (como Prime Video). No es la pantalla completa del sistema: eso
   sigue estando en su propio boton.
   =================================================================== */

body.cine-activo {
    overflow: hidden;
}

.reproductor-abtv.modo-cine {
    position: fixed;
    inset: 0;
    z-index: 9998;
    border-radius: 0;
    background: #000;
    display: flex;
    align-items: center;
    justify-content: center;
    animation: cineEntra 0.3s ease;
}

@keyframes cineEntra {
    from { opacity: 0; transform: scale(0.98); }
    to   { opacity: 1; transform: scale(1); }
}

.reproductor-abtv.modo-cine video {
    width: 100%;
    height: 100%;
    max-height: 100vh;
    object-fit: contain;
}

/* --- Barra superior (solo en modo cine) --- */
.rep-cabecera {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    display: none;
    align-items: center;
    gap: 1rem;
    padding: 1.1rem 1.25rem;
    background: linear-gradient(to bottom,
        rgba(0, 0, 0, 0.85) 0%,
        rgba(0, 0, 0, 0.45) 60%,
        transparent 100%);
    z-index: 7;
    transition: opacity 0.3s ease;
}

.reproductor-abtv.modo-cine .rep-cabecera {
    display: flex;
}

.reproductor-abtv.ocultar-controles .rep-cabecera {
    opacity: 0;
    pointer-events: none;
}

.rep-cabecera-titulo {
    flex: 1;
    min-width: 0;
    font-size: 1rem;
    font-weight: 600;
    color: #fff;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    line-height: 1.3;
}

.rep-cerrar-cine {
    display: flex;
    align-items: center;
    gap: 7px;
    padding: 0.5rem 0.9rem;
    background: rgba(255, 255, 255, 0.12);
    border: 1px solid rgba(255, 255, 255, 0.16);
    border-radius: 8px;
    color: #fff;
    font-size: 0.82rem;
    font-weight: 500;
    font-family: inherit;
    cursor: pointer;
    transition: background 0.2s ease;
    flex-shrink: 0;
}

.rep-cerrar-cine:hover {
    background: rgba(255, 255, 255, 0.22);
}

.rep-cerrar-cine svg {
    width: 15px;
    height: 15px;
    fill: currentColor;
}

/* Icono del boton de modo cine en la barra inferior */
.rep-icono-cine-salir,
.reproductor-abtv.modo-cine .rep-icono-cine-entrar { display: none; }
.reproductor-abtv.modo-cine .rep-icono-cine-salir { display: block; }

@media (max-width: 600px) {
    .rep-cabecera { padding: 0.8rem 0.9rem; }
    .rep-cabecera-titulo { font-size: 0.88rem; }
    .rep-cerrar-cine span { display: none; }
    .rep-cerrar-cine { padding: 0.5rem; }
}

@media (prefers-reduced-motion: reduce) {
    .reproductor-abtv.modo-cine { animation: none; }
}
