/* ============================================================
   DStv — minimal player UI
   ============================================================ */
:root {
    --accent: #e50914;
    --accent-glow: rgba(229, 9, 20, 0.45);
    --bg-player: #000;
    --text: #fff;
    --text-dim: #b8b8b8;
}

#player-view {
    display: none;
    position: fixed;
    inset: 0;
    background: var(--bg-player);
    z-index: 500;
}
#player-view.show { display: block; }

#video-wrapper {
    position: relative;
    width: 100%;
    height: 100%;
    background: var(--bg-player);
    overflow: hidden;
    user-select: none;
    -webkit-user-select: none;
}
#video-player {
    width: 100%;
    height: 100%;
    object-fit: contain;
    display: block;
    background: var(--bg-player);
}

/* Top overlay */
#player-overlay {
    position: absolute;
    top: 0; left: 0; right: 0;
    z-index: 20;
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 16px 20px;
    background: linear-gradient(180deg, rgba(0,0,0,0.75) 0%, transparent 100%);
    opacity: 0;
    transition: opacity 0.3s ease;
    pointer-events: none;
}
#player-overlay.visible { opacity: 1; pointer-events: auto; }
.btn-back {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: transparent;
    border: none;
    color: #fff;
    font-size: 18px;
    cursor: pointer;
    padding: 6px 8px;
    border-radius: 8px;
}
.btn-back:hover { background: rgba(255,255,255,0.12); }
.btn-back svg { width: 24px; height: 24px; }
.btn-back .btn-back-label { font-size: 14px; font-weight: 500; }
#player-info { display: flex; align-items: center; gap: 12px; min-width: 0; }
#player-info img { width: 44px; height: 44px; border-radius: 6px; object-fit: contain; background: rgba(255,255,255,0.05); }
#player-info .meta { min-width: 0; }
#player-info .title { font-size: 16px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
#player-info .sub { font-size: 13px; color: var(--text-dim); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* Loading / error */
#player-loading {
    position: absolute;
    inset: 0;
    z-index: 30;
    display: none;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 14px;
    color: #fff;
    background: rgba(0,0,0,0.55);
    font-size: 15px;
}
#player-loading.show { display: flex; }
#player-loading.error { color: #ff6b6b; }
#player-loading .spinner {
    width: 42px; height: 42px;
    border: 4px solid rgba(255,255,255,0.2);
    border-top-color: #fff;
    border-radius: 50%;
    animation: spin 0.9s linear infinite;
}
#player-loading .err-icon {
    width: 42px; height: 42px;
    border-radius: 50%;
    border: 3px solid #ff6b6b;
    color: #ff6b6b;
    display: flex; align-items: center; justify-content: center;
    font-size: 24px; font-weight: 700;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* Bottom controls */
#player-controls {
    position: absolute;
    left: 0; right: 0; bottom: 0;
    z-index: 20;
    padding: 0 16px 14px;
    background: linear-gradient(0deg, rgba(0,0,0,0.9) 0%, rgba(0,0,0,0.5) 60%, transparent 100%);
    opacity: 0;
    transform: translateY(12px);
    transition: opacity 0.3s ease, transform 0.3s ease;
    pointer-events: none;
}
#player-controls.visible { opacity: 1; transform: translateY(0); pointer-events: auto; }

#seek-wrap { width: 100%; padding: 16px 10px 6px; position: relative; }
#seek-bar {
    -webkit-appearance: none; appearance: none;
    width: 100%; height: 6px; margin: 0;
    background: rgba(255,255,255,0.22);
    border-radius: 3px; cursor: pointer; outline: none;
    background-image: linear-gradient(var(--accent), var(--accent));
    background-repeat: no-repeat; background-size: 0% 100%;
    transition: height 0.15s;
}
#seek-wrap:hover #seek-bar { height: 8px; }
#seek-bar::-webkit-slider-thumb {
    -webkit-appearance: none; appearance: none;
    width: 18px; height: 18px; border-radius: 50%;
    background: var(--accent); border: none;
    box-shadow: 0 0 8px var(--accent-glow); cursor: pointer;
}
#seek-bar::-moz-range-thumb {
    width: 18px; height: 18px; border-radius: 50%;
    background: var(--accent); border: none; cursor: pointer;
}
#seek-bar:disabled { opacity: 0.4; cursor: default; }

.seek-times {
    display: flex; justify-content: space-between;
    margin-top: 4px; padding: 0 2px;
    font-size: 12px; color: var(--text-dim);
    font-variant-numeric: tabular-nums;
}

#control-row {
    display: flex; align-items: center; gap: 8px;
    padding: 4px 8px 0;
}
.ctrl-btn {
    background: transparent; border: none; color: #fff;
    width: 42px; height: 42px; border-radius: 8px;
    cursor: pointer; display: inline-flex; align-items: center; justify-content: center;
    transition: background 0.15s;
    flex-shrink: 0;
}
.ctrl-btn:hover { background: rgba(255,255,255,0.12); }
.ctrl-btn svg { width: 24px; height: 24px; }

#volume-bar {
    -webkit-appearance: none; appearance: none;
    width: 90px; height: 4px; margin: 0 4px;
    background: rgba(255,255,255,0.25); border-radius: 3px;
    cursor: pointer; outline: none; overflow: hidden;
    background-image: linear-gradient(#fff, #fff);
    background-repeat: no-repeat; background-size: 100% 100%;
}
#volume-bar::-webkit-slider-thumb {
    -webkit-appearance: none; appearance: none;
    width: 12px; height: 12px; border-radius: 50%;
    background: #fff; cursor: pointer;
}
#volume-bar::-moz-range-thumb {
    width: 12px; height: 12px; border-radius: 50%;
    background: #fff; border: none; cursor: pointer;
}

#right-cluster { margin-left: auto; display: flex; align-items: center; gap: 8px; }
#behind-live {
    font-size: 13px; font-weight: 600; color: #fff;
    font-variant-numeric: tabular-nums; margin-right: 4px;
    white-space: nowrap; transition: opacity 0.2s;
}
#behind-live.hidden { opacity: 0; }
#btn-live {
    display: none;
    align-items: center; gap: 6px;
    background: rgba(229,9,20,0.15);
    border: 1px solid var(--accent);
    color: #fff; padding: 7px 12px; border-radius: 8px;
    font-size: 12.5px; font-weight: 600; cursor: pointer;
}
#btn-live.show { display: inline-flex; }
#btn-live .live-dot {
    width: 8px; height: 8px; border-radius: 50%;
    background: var(--accent); animation: pulse 1.6s infinite;
}
@keyframes pulse { 0%,100% { opacity: 1; } 50% { opacity: 0.4; } }

/* Responsive */
@media (max-width: 768px) {
    #player-overlay { padding: 12px 14px; gap: 10px; }
    .btn-back .btn-back-label { display: none; }
    #player-info .meta .title { font-size: 14px; }
    #player-info img { width: 36px; height: 36px; }
    #player-controls { padding: 0 8px 8px; }
    .ctrl-btn { width: 38px; height: 38px; }
    #volume-bar { width: 64px; }
    #behind-live { font-size: 12px; }
    #btn-live { padding: 6px 10px; font-size: 11.5px; }
    #seek-wrap { padding: 16px 8px 6px; }
    #seek-bar { height: 7px; }
    #seek-bar::-webkit-slider-thumb { width: 22px; height: 22px; }
    #seek-bar::-moz-range-thumb { width: 22px; height: 22px; }
}
@media (max-width: 540px) {
    #control-row { gap: 4px; }
    #volume-bar { width: 48px; }
}
