/* ========== Floating Button ========== */
#tvToggleBtn {
    position: fixed;
    bottom: 20px;
    right: 20px;
    z-index: 100000;
    background: #1e293b;
    color: #fff;
    border: none;
    border-radius: 30px;
    padding: 12px 20px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
    box-shadow: 0 6px 20px rgba(0,0,0,0.35);
    transition: 0.25s;
}
#tvToggleBtn.online { background: #16a34a; }
#tvToggleBtn .dot {
    width: 10px; height: 10px; border-radius: 50%;
    background: #94a3b8;
}
#tvToggleBtn.online .dot {
    background: #fff;
    animation: pulseDot 1.4s infinite;
}
@keyframes pulseDot {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.4; }
}

/* ========== Live TV ========== */
#liveTvWrapper {
    position: fixed;
    bottom: 80px;
    right: 20px;
    width: 340px;
    max-width: 94vw;
    z-index: 99999;
    font-family: system-ui, -apple-system, sans-serif;
    display: none;
}
#liveTvBox {
    background: #0f172a;
    border: 3px solid #ef4444;
    border-radius: 14px;
    overflow: hidden;
    box-shadow: 0 12px 35px rgba(0,0,0,0.5);
}
#liveTvHeader {
    background: #1e293b;
    color: #fff;
    padding: 8px 12px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 13px;
    font-weight: 600;
}
#liveBadge {
    background: #ef4444;
    color: white;
    padding: 2px 8px;
    border-radius: 20px;
    font-size: 11px;
    display: none;
    animation: livePulse 1.4s infinite;
}
@keyframes livePulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.55; }
}
.header-actions { display: flex; gap: 8px; align-items: center; }
#fullscreenBtn {
    background: transparent;
    border: none;
    color: #fff;
    font-size: 18px;
    cursor: pointer;
    padding: 2px 6px;
    line-height: 1;
    border-radius: 4px;
}
#fullscreenBtn:hover { background: rgba(255,255,255,0.15); }

#tvScreen {
    position: relative;
    width: 100%;
    background: #000;
    aspect-ratio: 16/9;
}
#remoteVideo, #offlineImg {
    width: 100%;
    height: 100%;
    object-fit: contain;
    background: #000;
}
#offlineImg { display: none; }
#tvStatus {
    position: absolute;
    bottom: 0; left: 0; right: 0;
    background: rgba(0,0,0,0.75);
    color: #94a3b8;
    font-size: 12px;
    text-align: center;
    padding: 6px;
    pointer-events: none;
}

/* Fullscreen */
#liveTvBox:fullscreen {
    width: 100vw;
    height: 100vh;
    border-radius: 0;
    border: none;
    display: flex;
    flex-direction: column;
}
#liveTvBox:fullscreen #tvScreen {
    flex: 1;
    aspect-ratio: auto;
}

/* Notification */
#liveNotification {
    position: fixed;
    bottom: 90px;
    right: 20px;
    z-index: 100001;
    background: #16a34a;
    color: white;
    padding: 12px 18px;
    border-radius: 10px;
    font-size: 14px;
    font-weight: 600;
    box-shadow: 0 6px 20px rgba(0,0,0,0.3);
    display: none;
    animation: slideIn 0.4s ease;
}
@keyframes slideIn {
    from { transform: translateX(100%); opacity: 0; }
    to   { transform: translateX(0); opacity: 1; }
}

@media (max-width: 480px) {
    #liveTvWrapper {
        width: 95vw;
        right: 2.5vw;
        bottom: 80px;
    }
    #tvToggleBtn {
        bottom: 15px;
        right: 15px;
        font-size: 13px;
        padding: 10px 16px;
    }
}