/* tv.css */
body.tv-mode {
    margin: 0;
    padding: 0;
    background-color: #000;
    color: #fff;
    font-family: 'Inter', sans-serif;
    overflow: hidden;
    height: 100vh;
    height: 100dvh;
    width: 100vw;
    max-width: 100%;
    display: flex;
    flex-direction: column;
    position: fixed;
}

.tv-navbar {
    background: rgba(0, 0, 0, 0.8) !important;
    backdrop-filter: blur(10px);
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    position: relative;
    width: 100%;
    z-index: 100;
    transition: opacity 0.3s ease;
}

/* Hide navbar completely in fullscreen */
:fullscreen .tv-navbar,
:-webkit-full-screen .tv-navbar {
    display: none !important;
}

/* Hide navbar after a few seconds of inactivity, optional later */
.tv-mode:hover .tv-navbar {
    opacity: 1;
}

.tv-container {
    flex: 1;
    position: relative;
    width: 100%;
    height: 100%;
    display: flex;
    justify-content: center;
    align-items: center;
}

.tv-watermark-logo {
    display: block;
    position: absolute;
    bottom: 25px;
    right: 25px;
    width: 50px;
    height: 50px;
    border-radius: 50%;
    object-fit: cover;
    z-index: 50;
    opacity: 0.7;
    pointer-events: none;
    box-shadow: 0 2px 10px rgba(0,0,0,0.5);
    border: 2px solid rgba(255,255,255,0.2);
}

#player-container {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    overflow: hidden;
}

.tv-player {
    position: absolute;
    width: 100%;
    height: 100%;
    top: 0;
    left: 0;
    pointer-events: none;
    transition: opacity 0.5s ease;
}

.active-player {
    opacity: 1;
    z-index: 2;
}

.background-player {
    opacity: 0;
    z-index: 1;
}

.mouse-catcher {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 5; /* Above player, below overlay */
    pointer-events: auto; /* Catch mouse events */
}

/* Overlay Info */
.tv-overlay {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    padding: 20px 20px 10px;
    background: linear-gradient(to top, rgba(0,0,0,0.85) 0%, rgba(0,0,0,0) 100%);
    pointer-events: none;
    display: flex;
    flex-direction: column;
    gap: 6px;
    z-index: 10;
    transition: transform 0.3s ease, opacity 0.3s ease;
}

.tv-overlay.hidden {
    transform: translateY(100%);
    opacity: 0;
    pointer-events: none;
}

.tv-overlay-top {
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    gap: 20px;
    width: 100%;
    padding-right: 70px; /* Make space for watermark logo */
    box-sizing: border-box;
}

.tv-text-content {
    flex: 1;
    min-width: 0;
}

.tv-controls-bar {
    pointer-events: auto;
    display: flex;
    gap: 10px;
    flex-shrink: 0;
    transition: opacity 0.3s ease;
}

/* Hide controls when idle regardless of fullscreen */
body:not(.mouse-active) .tv-controls-bar {
    opacity: 0;
    pointer-events: none;
}

.tv-btn {
    background: rgba(255,255,255,0.15);
    backdrop-filter: blur(5px);
    border: 1px solid rgba(255,255,255,0.2);
    color: white;
    font-size: 0.85rem;
    padding: 6px 12px;
    border-radius: 15px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.tv-btn:hover {
    background: rgba(255,255,255,0.25);
    transform: scale(1.05);
}

.tv-btn-highlight {
    background: rgba(255, 59, 48, 0.2);
    border-color: rgba(255, 59, 48, 0.5);
    font-weight: 600;
}

.tv-btn-highlight:hover {
    background: rgba(255, 59, 48, 0.4);
}

.show-overlay-trigger {
    position: absolute;
    bottom: 20px;
    left: 20px;
    z-index: 15;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
}

body.mouse-active .show-overlay-trigger {
    opacity: 1;
    pointer-events: auto;
}

.tv-status {
    display: flex;
    align-items: center;
    gap: 8px;
}

.badge-live {
    background: #ff3b30;
    color: white;
    padding: 4px 10px;
    border-radius: 6px;
    font-weight: 700;
    font-size: 0.8rem;
    letter-spacing: 1px;
    animation: pulse-red 2s infinite;
}

.badge-vod {
    background: #007aff;
    color: white;
    padding: 4px 10px;
    border-radius: 6px;
    font-weight: 700;
    font-size: 0.8rem;
    letter-spacing: 1px;
}

#tv-channel {
    font-size: 0.95rem;
    font-weight: 600;
    color: rgba(255,255,255,0.9);
    text-shadow: 0 1px 3px rgba(0,0,0,0.6);
}

#tv-title {
    margin: 0;
    font-size: 1.4rem;
    font-family: 'Fredoka', sans-serif;
    font-weight: 600;
    text-shadow: 0 1px 5px rgba(0,0,0,0.8);
    display: -webkit-box;
    -webkit-line-clamp: 1;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.tv-next {
    font-size: 0.85rem;
    color: rgba(255,255,255,0.6);
    margin-top: 4px;
    margin-right: 70px; /* Avoid watermark */
    pointer-events: auto; /* Allow clicks since overlay is pointer-events: none */
}

#tv-next-title {
    color: rgba(255,255,255,0.9);
    font-weight: 500;
}

/* Progress Bar */
.tv-progress-container {
    width: auto;
    height: 4px;
    background: rgba(255,255,255,0.2);
    border-radius: 2px;
    margin-top: 15px;
    margin-right: 70px; /* Avoid watermark */
    overflow: hidden;
}

.tv-progress-bar {
    height: 100%;
    width: 0%;
    background: #ff3b30;
    transition: width 1s linear;
}

@keyframes pulse-red {
    0% { box-shadow: 0 0 0 0 rgba(255, 59, 48, 0.7); }
    70% { box-shadow: 0 0 0 10px rgba(255, 59, 48, 0); }
    100% { box-shadow: 0 0 0 0 rgba(255, 59, 48, 0); }
}

@media (max-width: 768px) {
    #tv-title { font-size: 1.2rem; }
    .tv-overlay { padding: 15px 15px 10px; }
}

/* Queue Overlay */
.queue-overlay {
    position: absolute;
    top: 0;
    right: 0;
    width: 350px;
    height: 100%;
    background: rgba(0, 0, 0, 0.95);
    backdrop-filter: blur(20px);
    border-left: 1px solid rgba(255, 255, 255, 0.1);
    z-index: 110;
    display: flex;
    flex-direction: column;
    transform: translateX(0);
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    pointer-events: auto;
}

.queue-overlay.hidden {
    transform: translateX(100%);
    opacity: 0;
    pointer-events: none;
}

.queue-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.queue-header h2 {
    margin: 0;
    font-family: 'Fredoka', sans-serif;
    font-size: 1.5rem;
}

.queue-list {
    flex: 1;
    overflow-y: auto;
    padding: 10px;
}

.queue-item {
    display: flex;
    flex-direction: column;
    padding: 12px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    gap: 4px;
}

.queue-item-channel {
    font-size: 0.8rem;
    color: rgba(255,255,255,0.6);
    font-weight: 600;
}

.queue-item-title {
    font-size: 0.95rem;
    font-weight: 500;
    line-height: 1.3;
}
