/* ============================================================
   TikPlayer - Reproductor de vídeo de marca TikPanel
   Colores: primary #29D9D4 (teal) · accent #FF3E63 (rojo)
   ============================================================ */

.tikplayer {
    --tp-primary: var(--primary, #29D9D4);
    --tp-accent: var(--accent, #FF3E63);
    --tp-glow: var(--primary-glow, rgba(41, 217, 212, 0.35));
    --tp-bg: rgba(7, 9, 11, 0.92);
    --tp-track: rgba(255, 255, 255, 0.18);
    --tp-buffer: rgba(255, 255, 255, 0.32);
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    background: #000;
    overflow: hidden;
    font-family: inherit;
    user-select: none;
    -webkit-tap-highlight-color: transparent;
}

.tikplayer video {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: contain;
    background: #000;
    cursor: pointer;
}

/* ---------- Overlay central de play / spinner ---------- */
.tp-center {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 3;
    pointer-events: none;
}

.tp-bigplay {
    pointer-events: auto;
    width: 84px;
    height: 84px;
    border-radius: 50%;
    border: none;
    cursor: pointer;
    background: var(--tp-primary);
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 8px 32px var(--tp-glow);
    transition: transform 0.25s ease, box-shadow 0.25s ease, opacity 0.25s ease;
}

.tp-bigplay:hover {
    transform: scale(1.08);
    box-shadow: 0 12px 40px var(--tp-glow);
}

.tp-bigplay svg {
    width: 34px;
    height: 34px;
    fill: #07090b;
    margin-left: 4px;
}

.tikplayer.tp-playing .tp-bigplay {
    opacity: 0;
    transform: scale(0.6);
    pointer-events: none;
}

/* Spinner de carga */
.tp-spinner {
    position: absolute;
    width: 54px;
    height: 54px;
    border: 4px solid rgba(255, 255, 255, 0.15);
    border-top-color: var(--tp-primary);
    border-radius: 50%;
    animation: tp-spin 0.8s linear infinite;
    display: none;
}

.tikplayer.tp-loading .tp-spinner { display: block; }
.tikplayer.tp-loading .tp-bigplay { opacity: 0; }

@keyframes tp-spin { to { transform: rotate(360deg); } }

/* ---------- Barra de controles inferior ---------- */
.tp-controls {
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 4;
    padding: 2.4rem 0.9rem 0.7rem;
    background: linear-gradient(to top, var(--tp-bg) 0%, rgba(7, 9, 11, 0.55) 55%, transparent 100%);
    opacity: 1;
    transform: translateY(0);
    transition: opacity 0.3s ease, transform 0.3s ease;
}

.tikplayer.tp-hide-controls .tp-controls {
    opacity: 0;
    transform: translateY(6px);
    pointer-events: none;
}

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

.tp-progress-track {
    position: relative;
    width: 100%;
    height: 5px;
    background: var(--tp-track);
    border-radius: 99px;
    overflow: hidden;
    transition: height 0.15s ease;
}

.tp-progress:hover .tp-progress-track { height: 8px; }

.tp-progress-buffer {
    position: absolute;
    left: 0;
    top: 0;
    height: 100%;
    width: 0;
    background: var(--tp-buffer);
    border-radius: 99px;
}

.tp-progress-fill {
    position: absolute;
    left: 0;
    top: 0;
    height: 100%;
    width: 0;
    background: linear-gradient(90deg, var(--tp-primary), var(--tp-accent));
    border-radius: 99px;
}

.tp-progress-thumb {
    position: absolute;
    top: 50%;
    width: 14px;
    height: 14px;
    border-radius: 50%;
    background: #fff;
    box-shadow: 0 0 0 4px var(--tp-glow);
    transform: translate(-50%, -50%) scale(0);
    transition: transform 0.15s ease;
    pointer-events: none;
}

.tp-progress:hover .tp-progress-thumb { transform: translate(-50%, -50%) scale(1); }

/* Tooltip de tiempo al pasar el cursor */
.tp-progress-tooltip {
    position: absolute;
    bottom: 18px;
    transform: translateX(-50%);
    background: var(--tp-bg);
    color: #fff;
    font-size: 0.72rem;
    padding: 0.2rem 0.45rem;
    border-radius: 6px;
    border: 1px solid var(--tp-primary);
    white-space: nowrap;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.12s ease;
}

.tp-progress:hover .tp-progress-tooltip { opacity: 1; }

/* ---------- Fila de botones ---------- */
.tp-buttons {
    display: flex;
    align-items: center;
    gap: 0.35rem;
    color: #fff;
}

.tp-btn {
    background: none;
    border: none;
    color: #fff;
    cursor: pointer;
    padding: 0.4rem;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
    transition: color 0.2s ease, background 0.2s ease;
}

.tp-btn:hover { color: var(--tp-primary); background: rgba(255, 255, 255, 0.08); }
.tp-btn svg { width: 20px; height: 20px; }

.tp-spacer { flex: 1; }

.tp-time {
    font-size: 0.8rem;
    color: #fff;
    font-variant-numeric: tabular-nums;
    padding: 0 0.4rem;
    white-space: nowrap;
}

.tp-time .tp-sep { color: rgba(255, 255, 255, 0.5); margin: 0 0.15rem; }

/* ---------- Volumen ---------- */
.tp-volume {
    display: flex;
    align-items: center;
    gap: 0.2rem;
}

.tp-volume-slider {
    width: 0;
    opacity: 0;
    overflow: hidden;
    transition: width 0.25s ease, opacity 0.25s ease;
    display: flex;
    align-items: center;
}

.tp-volume:hover .tp-volume-slider,
.tp-volume:focus-within .tp-volume-slider {
    width: 72px;
    opacity: 1;
}

.tp-volume-range {
    -webkit-appearance: none;
    appearance: none;
    width: 68px;
    height: 5px;
    border-radius: 99px;
    background: var(--tp-track);
    outline: none;
    cursor: pointer;
}

.tp-volume-range::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 13px;
    height: 13px;
    border-radius: 50%;
    background: var(--tp-primary);
    box-shadow: 0 0 0 3px var(--tp-glow);
    cursor: pointer;
}

.tp-volume-range::-moz-range-thumb {
    width: 13px;
    height: 13px;
    border: none;
    border-radius: 50%;
    background: var(--tp-primary);
    box-shadow: 0 0 0 3px var(--tp-glow);
    cursor: pointer;
}

/* ---------- Menú de velocidad ---------- */
.tp-speed { position: relative; }

.tp-speed-toggle {
    font-size: 0.78rem;
    font-weight: 700;
    min-width: 42px;
}

.tp-speed-menu {
    position: absolute;
    bottom: calc(100% + 8px);
    right: 0;
    background: var(--tp-bg);
    border: 1px solid var(--border-mid, rgba(41, 217, 212, 0.2));
    border-radius: 10px;
    padding: 0.3rem;
    display: none;
    flex-direction: column;
    gap: 0.1rem;
    min-width: 92px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.5);
}

.tp-speed-menu.tp-open { display: flex; }

.tp-speed-option {
    background: none;
    border: none;
    color: #fff;
    font-size: 0.8rem;
    text-align: left;
    padding: 0.4rem 0.6rem;
    border-radius: 6px;
    cursor: pointer;
    transition: background 0.15s ease, color 0.15s ease;
}

.tp-speed-option:hover { background: rgba(255, 255, 255, 0.08); }
.tp-speed-option.tp-active { color: var(--tp-primary); font-weight: 700; }

/* ---------- Overlay de error ---------- */
.tp-error {
    position: absolute;
    inset: 0;
    display: none;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.6rem;
    color: var(--text2, #8da4b0);
    text-align: center;
    padding: 1rem;
    z-index: 5;
    background: #000;
}

.tikplayer.tp-error-state .tp-error { display: flex; }
.tp-error svg { width: 40px; height: 40px; color: var(--tp-accent); }

/* ---------- Responsive ---------- */
@media (max-width: 600px) {
    .tp-bigplay { width: 64px; height: 64px; }
    .tp-bigplay svg { width: 26px; height: 26px; }
    .tp-time { font-size: 0.72rem; }
    .tp-btn svg { width: 18px; height: 18px; }
    .tp-volume:hover .tp-volume-slider { width: 56px; }
}
