/* ===== Custom Player UI (accent: #0072c6) ===== */

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

#video-wrapper {
    position: relative;
    width: 100%;
    height: 100%;
    background: #000;
    cursor: default;
}
#video-wrapper.hide-cursor { cursor: none; }
#video-player {
    width: 100%;
    height: 100%;
    object-fit: contain;
    display: block;
    background: #000;
}

/* ===== Top overlay ===== */
#player-overlay {
    position: absolute;
    top: 0; left: 0; right: 0;
    padding: 16px 28px;
    z-index: 20;
    background: linear-gradient(180deg, rgba(0,0,0,0.85) 0%, rgba(0,0,0,0.35) 70%, transparent 100%);
    display: flex;
    align-items: center;
    gap: 16px;
    opacity: 0;
    transform: translateY(-8px);
    transition: opacity 0.25s ease, transform 0.25s ease;
    pointer-events: none;
}
#player-overlay.visible {
    opacity: 1;
    transform: translateY(0);
    pointer-events: auto;
}

.btn-back {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: rgba(255,255,255,0.12);
    border: none;
    color: #fff;
    padding: 9px 16px;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.15s;
    backdrop-filter: blur(6px);
}
.btn-back:hover { background: rgba(255,255,255,0.22); }
.btn-back svg { width: 18px; height: 18px; }

#player-info {
    display: flex;
    align-items: center;
    gap: 12px;
    min-width: 0;
    flex: 1;
}
#player-info img {
    width: 42px;
    height: 42px;
    border-radius: 6px;
    object-fit: contain;
    background: #1a1c24;
    flex-shrink: 0;
}
#player-info .meta { min-width: 0; }
#player-info .meta .title {
    font-size: 16px;
    font-weight: 700;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
#player-info .meta .sub {
    font-size: 12.5px;
    color: #b8c0cc;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
#player-info .meta .sub .live-tag {
    color: #0072c6;
    font-weight: 700;
}

#overlay-right {
    margin-left: auto;
    display: flex;
    align-items: center;
    gap: 12px;
}
#btn-channels {
    background: #0072c6;
    border: none;
    color: #fff;
    padding: 9px 18px;
    border-radius: 8px;
    font-size: 13.5px;
    font-weight: 700;
    cursor: pointer;
    transition: background 0.15s;
    display: inline-flex;
    align-items: center;
    gap: 7px;
}
#btn-channels:hover { background: #0084e0; }
#btn-channels svg { width: 16px; height: 16px; }

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

/* Seek bar — full width above the buttons */
#seek-wrap {
    width: 100%;
    padding: 10px 12px 6px;
    position: relative;
}
#seek-bar {
    -webkit-appearance: none;
    appearance: none;
    width: 100%;
    height: 5px;
    margin: 0;
    background: rgba(255,255,255,0.22);
    border-radius: 3px;
    cursor: pointer;
    outline: none;
    background-image: linear-gradient(#0072c6, #0072c6);
    background-repeat: no-repeat;
    background-size: 0% 100%;
}
#seek-bar::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 14px;
    height: 14px;
    border-radius: 50%;
    background: #fff;
    border: none;
    box-shadow: 0 0 4px rgba(0,0,0,0.5);
    cursor: pointer;
    transition: transform 0.1s;
}
#seek-bar:hover::-webkit-slider-thumb { transform: scale(1.25); }
#seek-bar::-moz-range-thumb {
    width: 14px;
    height: 14px;
    border-radius: 50%;
    background: #fff;
    border: none;
    cursor: pointer;
}
#seek-bar:disabled {
    opacity: 0.5;
    cursor: default;
}

/* Button row */
#control-row {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 4px 8px 0;
    height: 44px;
}
.ctrl-btn {
    background: transparent;
    border: none;
    color: #fff;
    width: 40px;
    height: 40px;
    border-radius: 8px;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: background 0.15s, color 0.15s, transform 0.1s;
    flex-shrink: 0;
}
.ctrl-btn:hover { background: rgba(255,255,255,0.15); }
.ctrl-btn:active { transform: scale(0.92); }
.ctrl-btn.active { color: #0072c6; }
.ctrl-btn svg { width: 22px; height: 22px; }

/* Volume group */
.volume-group {
    display: inline-flex;
    align-items: center;
    margin-right: 6px;
}
.volume-group .ctrl-btn { width: 36px; height: 36px; }
.volume-group .ctrl-btn svg { width: 20px; height: 20px; }
#volume-bar {
    -webkit-appearance: none;
    appearance: none;
    width: 0;
    height: 4px;
    background: rgba(255,255,255,0.25);
    border-radius: 3px;
    cursor: pointer;
    outline: none;
    overflow: hidden;
    transition: width 0.2s ease, opacity 0.2s ease;
    background-image: linear-gradient(#fff, #fff);
    background-repeat: no-repeat;
}
.volume-group:hover #volume-bar { width: 80px; }
#volume-bar::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: #fff;
    cursor: pointer;
    box-shadow: -80px 0 0 76px rgba(0,0,0,0); /* keep thumb visible */
}
#volume-bar::-moz-range-thumb {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: #fff;
    border: none;
    cursor: pointer;
}

/* Right cluster */
#right-cluster {
    margin-left: auto;
    display: flex;
    align-items: center;
    gap: 6px;
}

/* Time / behind-live display */
#behind-live {
    font-size: 13px;
    font-weight: 600;
    color: #e6edf3;
    font-variant-numeric: tabular-nums;
    margin-right: 4px;
    min-width: 0;
    transition: opacity 0.2s;
    white-space: nowrap;
}
#behind-live.hidden { opacity: 0; pointer-events: none; width: 0; margin: 0; overflow: hidden; }

/* Back to LIVE pill */
#btn-live {
    display: none;
    align-items: center;
    gap: 6px;
    background: rgba(255,255,255,0.12);
    border: none;
    color: #fff;
    padding: 7px 14px;
    border-radius: 6px;
    font-size: 12.5px;
    font-weight: 700;
    letter-spacing: 0.3px;
    cursor: pointer;
    transition: background 0.15s, color 0.15s;
    margin-right: 6px;
}
#btn-live.show { display: inline-flex; }
#btn-live:hover { background: rgba(255,255,255,0.22); }
#btn-live .live-dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: #e50914;
    animation: livepulse 1.6s infinite;
}
@keyframes livepulse { 0%,100% { opacity: 1; } 50% { opacity: 0.35; } }

/* Center play overlay (big, on pause / click) */
#center-play {
    position: absolute;
    top: 50%; left: 50%;
    transform: translate(-50%, -50%);
    width: 84px; height: 84px;
    border-radius: 50%;
    background: rgba(0,0,0,0.55);
    border: 2px solid rgba(255,255,255,0.25);
    display: none;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    z-index: 15;
    backdrop-filter: blur(4px);
    transition: opacity 0.2s;
}
#center-play.show { display: flex; }
#center-play svg { width: 40px; height: 40px; color: #fff; }

/* Loading spinner */
#player-loading {
    position: absolute;
    top: 50%; left: 50%;
    transform: translate(-50%, -50%);
    z-index: 10;
    text-align: center;
    color: #b8c0cc;
    font-size: 14px;
    display: none;
    max-width: 80vw;
    line-height: 1.5;
}
#player-loading.show { display: block; }
#player-loading span { display: block; }
#player-loading.error { color: #ffb4b4; font-size: 14px; }
#player-loading.error .spinner { display: none; }
.spinner {
    width: 52px;
    height: 52px;
    border: 4px solid rgba(255,255,255,0.15);
    border-top-color: #0072c6;
    border-radius: 50%;
    animation: spin 0.9s linear infinite;
    margin: 0 auto 14px;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ===== Popup menus (settings / subtitles) ===== */
.menu-popup {
    position: absolute;
    bottom: 64px;
    right: 16px;
    min-width: 200px;
    background: rgba(20,22,28,0.97);
    border: 1px solid rgba(255,255,255,0.1);
    border-radius: 10px;
    padding: 6px;
    z-index: 30;
    backdrop-filter: blur(10px);
    box-shadow: 0 12px 40px rgba(0,0,0,0.6);
    display: none;
}
.menu-popup.show { display: block; }
.menu-popup .menu-title {
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.6px;
    color: #8b949e;
    padding: 8px 12px 6px;
}
.menu-popup .menu-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 9px 12px;
    border-radius: 6px;
    font-size: 13.5px;
    color: #e6edf3;
    cursor: pointer;
    transition: background 0.12s;
}
.menu-popup .menu-item:hover { background: rgba(255,255,255,0.08); }
.menu-popup .menu-item.selected { color: #0072c6; font-weight: 600; }
.menu-popup .menu-item .check {
    width: 16px; height: 16px;
    opacity: 0;
}
.menu-popup .menu-item.selected .check { opacity: 1; }

/* ===== Channel switcher panel ===== */
#channel-panel {
    position: absolute;
    top: 0; right: 0; bottom: 0;
    width: 340px;
    max-width: 85vw;
    background: rgba(15,16,21,0.98);
    border-left: 1px solid rgba(255,255,255,0.08);
    z-index: 40;
    transform: translateX(100%);
    transition: transform 0.28s ease;
    display: flex;
    flex-direction: column;
    backdrop-filter: blur(8px);
}
#channel-panel.show { transform: translateX(0); }
#channel-panel .panel-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 18px 18px 12px;
    border-bottom: 1px solid rgba(255,255,255,0.06);
}
#channel-panel .panel-header h3 {
    font-size: 16px;
    font-weight: 700;
}
#channel-panel .panel-close {
    background: transparent;
    border: none;
    color: #b8c0cc;
    font-size: 22px;
    cursor: pointer;
    width: 32px; height: 32px;
    border-radius: 6px;
    line-height: 1;
}
#channel-panel .panel-close:hover { background: rgba(255,255,255,0.1); color: #fff; }
#channel-panel .panel-search {
    margin: 10px 14px;
    padding: 9px 12px;
    background: #1a1c24;
    border: 1px solid #2a2d36;
    border-radius: 8px;
    color: #e6edf3;
    font-size: 13px;
    outline: none;
}
#channel-panel .panel-search:focus { border-color: #0072c6; }
#channel-list {
    flex: 1;
    overflow-y: auto;
    padding: 4px 8px 14px;
}
.ch-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 8px 10px;
    border-radius: 8px;
    cursor: pointer;
    transition: background 0.12s;
}
.ch-item:hover { background: rgba(255,255,255,0.06); }
.ch-item.active { background: rgba(0,114,198,0.18); }
.ch-item img {
    width: 44px; height: 44px;
    border-radius: 6px;
    object-fit: contain;
    background: #1a1c24;
    flex-shrink: 0;
}
.ch-item .ch-meta { min-width: 0; flex: 1; }
.ch-item .ch-name {
    font-size: 13.5px;
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.ch-item .ch-num { font-size: 11px; color: #6b7280; }
.ch-item .ch-now {
    font-size: 11.5px;
    color: #b8c0cc;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* ===== VOD cards (poster-style, 2:3 aspect) ===== */
.card.vod-card { width: 170px; }
.card.vod-card .vod-poster {
    position: relative;
    width: 100%;
    aspect-ratio: 2 / 3;
    background: #0f1015;
    overflow: hidden;
}
.card.vod-card .vod-poster img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}
.card.vod-card .vod-poster .rating-badge {
    position: absolute;
    top: 8px; right: 8px;
    background: rgba(0,0,0,0.75);
    color: #fff;
    font-size: 10px;
    font-weight: 700;
    padding: 2px 7px;
    border-radius: 4px;
    letter-spacing: 0.3px;
    backdrop-filter: blur(4px);
}
.card.vod-card .card-body { padding: 10px 12px 13px; }
.card.vod-card .card-name {
    font-size: 13.5px;
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    margin-bottom: 3px;
}
.card.vod-card .card-meta {
    font-size: 11.5px;
    color: #6b7280;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.card.vod-card .card-meta .dot { margin: 0 5px; opacity: 0.6; }

/* VOD rows section divider */
.row.vod-row .row-title { color: #e6edf3; }

/* ===== Genre filter chips ===== */
.genre-chips {
    display: flex; gap: 8px; padding: 0 48px 20px;
    overflow-x: auto; scrollbar-width: none; flex-wrap: wrap;
}
.genre-chips::-webkit-scrollbar { display: none; }
.genre-chip {
    padding: 7px 16px; border-radius: 20px;
    background: #1a1c24; border: 1px solid #2a2d36;
    color: #b8c0cc; font-size: 13px; font-weight: 500;
    cursor: pointer; transition: all 0.15s; white-space: nowrap;
}
.genre-chip:hover { background: #23262f; color: #e6edf3; }
.genre-chip.active { background: #0072c6; border-color: #0072c6; color: #fff; }

/* ===== Series Detail ===== */
.series-detail { padding: 0 48px 60px; }
.series-back {
    display: inline-flex; align-items: center; gap: 8px;
    background: none; border: none; color: #b8c0cc;
    font-size: 14px; font-weight: 600; cursor: pointer;
    padding: 18px 0 12px; transition: color 0.15s;
}
.series-back:hover { color: #fff; }
.series-back svg { width: 18px; height: 18px; }
.series-hero {
    display: flex; gap: 36px; margin-bottom: 36px; align-items: flex-start;
}
.series-poster {
    width: 220px; flex-shrink: 0; border-radius: 10px; overflow: hidden;
    background: #1a1c24; aspect-ratio: 2/3;
}
.series-poster img { width: 100%; height: 100%; object-fit: cover; display: block; }
.series-info { flex: 1; min-width: 0; padding-top: 8px; }
.series-info .sd-title { font-size: 30px; font-weight: 800; line-height: 1.15; margin-bottom: 10px; }
.series-info .sd-meta { font-size: 14px; color: #b8c0cc; margin-bottom: 14px; }
.series-info .sd-meta .dot { margin: 0 6px; opacity: 0.5; }
.series-info .sd-synopsis { font-size: 14px; color: #8b949e; line-height: 1.6; max-height: 120px; overflow: hidden; }

.season-tabs {
    display: flex; gap: 8px; margin-bottom: 20px;
    overflow-x: auto; scrollbar-width: none; padding-bottom: 4px;
}
.season-tabs::-webkit-scrollbar { display: none; }
.season-tab {
    flex-shrink: 0; padding: 9px 20px; border-radius: 8px;
    background: #1a1c24; border: 1px solid #2a2d36;
    color: #b8c0cc; font-size: 14px; font-weight: 600;
    cursor: pointer; transition: all 0.15s; white-space: nowrap;
}
.season-tab:hover { background: #23262f; color: #e6edf3; }
.season-tab.active { background: #0072c6; border-color: #0072c6; color: #fff; }

.episode-list { display: flex; flex-direction: column; gap: 6px; }
.episode-card {
    display: flex; align-items: center; gap: 16px;
    padding: 14px 18px; background: #1a1c24; border-radius: 10px;
    cursor: pointer; transition: background 0.12s;
}
.episode-card:hover { background: #23262f; }
.episode-num {
    font-size: 16px; font-weight: 700; color: #6b7280;
    width: 36px; text-align: center; flex-shrink: 0;
    font-variant-numeric: tabular-nums;
}
.episode-body { flex: 1; min-width: 0; }
.episode-title { font-size: 15px; font-weight: 600; margin-bottom: 3px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.episode-synopsis { font-size: 12.5px; color: #8b949e; line-height: 1.45; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.episode-right { flex-shrink: 0; display: flex; align-items: center; gap: 12px; }
.episode-duration { font-size: 12px; color: #6b7280; font-variant-numeric: tabular-nums; }
.episode-play {
    width: 40px; height: 40px; border-radius: 50%;
    background: #0072c6; border: none; color: #fff;
    display: flex; align-items: center; justify-content: center;
    cursor: pointer; transition: background 0.15s, transform 0.1s; flex-shrink: 0;
}
.episode-play:hover { background: #0084e0; transform: scale(1.08); }
.episode-play svg { width: 18px; height: 18px; margin-left: 2px; }
.episode-card.unavailable { opacity: 0.45; cursor: default; }
.episode-card.unavailable .episode-play { background: #3a3d45; cursor: not-allowed; }

.series-empty { color: #6b7280; font-size: 15px; padding: 40px 0; text-align: center; }

/* ===== Responsive ===== */
@media (max-width: 768px) {
    #player-overlay { padding: 12px 14px; gap: 10px; }
    #player-info .meta .title { font-size: 14px; }
    #player-info img { width: 34px; height: 34px; }
    #btn-channels span { display: none; }
    #btn-channels { padding: 9px 12px; }
    #player-controls { padding: 0 8px 8px; }
    .ctrl-btn { width: 36px; height: 36px; }
    .ctrl-btn svg { width: 20px; height: 20px; }
    #behind-live { font-size: 12px; }
    #btn-live { padding: 6px 10px; font-size: 11.5px; }
    .volume-group:hover #volume-bar { width: 60px; }
    .card.vod-card { width: 130px; }
    .series-detail { padding: 0 20px 40px; }
    .series-hero { flex-direction: column; gap: 20px; }
    .series-poster { width: 160px; }
    .series-info .sd-title { font-size: 22px; }
    .episode-card { padding: 12px 14px; gap: 12px; }
    .episode-num { font-size: 14px; width: 28px; }
    .episode-title { font-size: 13.5px; }
}
