/* TV WavePlay - Professional Player Styles */

/* ── Container ───────────────────────────────────────── */
.tv-player {
    position: relative;
    width: 100%;
    height: 100%;
    background: #000;
    overflow: hidden;
    user-select: none;
    -webkit-user-select: none;
    font-family: 'Inter', system-ui, sans-serif;
}

.tv-player video {
    position: absolute;
    top: 0; left: 0;
    width: 100%; height: 100%;
    object-fit: contain;
    outline: none;
}

/* Remove native controls when custom are active */
.tv-player video.tv-has-custom::-webkit-media-controls {
    display: none !important;
}
.tv-player video.tv-has-custom::-webkit-media-controls-enclosure {
    display: none !important;
}

/* ── Controls Overlay ────────────────────────────────── */
.tv-controls {
    position: absolute;
    bottom: 0; left: 0; right: 0;
    top: 0;
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
    z-index: 5;
    opacity: 0;
    transition: opacity 0.25s ease;
    pointer-events: none;
}

.tv-player.tv-show-controls .tv-controls,
.tv-player.tv-controls-pinned .tv-controls {
    opacity: 1;
    pointer-events: auto;
}

.tv-player.tv-controls-pinned .tv-controls {
    pointer-events: auto;
}

/* ── Top Bar ─────────────────────────────────────────── */
.tv-top-bar {
    position: absolute;
    top: 0; left: 0; right: 0;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
    z-index: 10;
}

.tv-live-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 10px;
    background: #ef4444;
    border-radius: 4px;
    font-size: 11px;
    font-weight: 700;
    color: #fff;
    letter-spacing: 0.5px;
    text-transform: uppercase;
}

.tv-live-badge .tv-live-dot {
    width: 6px; height: 6px;
    background: #fff;
    border-radius: 50%;
    animation: tv-pulse 1.5s ease-in-out infinite;
}

@keyframes tv-pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.3; }
}

.tv-source-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 10px;
    background: rgba(0,0,0,0.6);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    border: 1px solid rgba(255,255,255,0.1);
    border-radius: 6px;
    font-size: 12px;
    font-weight: 500;
    color: #fff;
}

.tv-source-badge .tv-dot-online {
    width: 6px; height: 6px;
    background: #22c55e;
    border-radius: 50%;
}

.tv-source-badge .tv-dot-offline {
    width: 6px; height: 6px;
    background: #ef4444;
    border-radius: 50%;
}

/* ── Center Play Button ──────────────────────────────── */
.tv-center-play {
    position: absolute;
    top: 50%; left: 50%;
    transform: translate(-50%, -50%);
    z-index: 8;
    opacity: 0;
    transition: opacity 0.2s ease, transform 0.2s ease;
    pointer-events: none;
}

.tv-player.tv-paused .tv-center-play {
    opacity: 1;
    pointer-events: auto;
}

.tv-center-play-btn {
    width: 72px; height: 72px;
    border-radius: 50%;
    background: rgba(0,0,0,0.55);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 2px solid rgba(255,255,255,0.2);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s ease;
    outline: none;
}

.tv-center-play-btn:hover {
    background: rgba(59,130,246,0.6);
    border-color: rgba(59,130,246,0.8);
    transform: scale(1.08);
}

.tv-center-play-btn svg {
    width: 32px; height: 32px;
    color: #fff;
    margin-left: 3px;
}

/* ── Loading Spinner ─────────────────────────────────── */
.tv-loading {
    position: absolute;
    top: 0; left: 0; right: 0; bottom: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background: rgba(0,0,0,0.75);
    z-index: 7;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
}

.tv-player.tv-loading .tv-loading {
    opacity: 1;
    pointer-events: auto;
}

.tv-spinner {
    width: 56px; height: 56px;
    border: 4px solid rgba(255,255,255,0.12);
    border-top-color: #3b82f6;
    border-right-color: #3b82f6;
    border-radius: 50%;
    animation: tv-spin 0.7s linear infinite;
    margin-bottom: 16px;
    filter: drop-shadow(0 0 12px rgba(59,130,246,0.4));
}

.tv-loading-text {
    color: rgba(255,255,255,0.85);
    font-size: 14px;
    font-weight: 500;
    letter-spacing: 0.3px;
    text-shadow: 0 1px 4px rgba(0,0,0,0.5);
}

.tv-loading-sub {
    color: rgba(255,255,255,0.45);
    font-size: 12px;
    margin-top: 6px;
}

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

/* ── Bottom Controls Bar ─────────────────────────────── */
.tv-bottom-bar {
    position: relative;
    padding: 0 12px 10px;
    z-index: 10;
}

/* ── Seek Bar ────────────────────────────────────────── */
.tv-seek-container {
    position: relative;
    width: 100%;
    height: 20px;
    display: flex;
    align-items: center;
    cursor: pointer;
    margin-bottom: 2px;
}

.tv-seek-bar {
    position: relative;
    width: 100%;
    height: 3px;
    background: rgba(255,255,255,0.2);
    border-radius: 2px;
    overflow: visible;
    transition: height 0.15s ease;
}

.tv-seek-container:hover .tv-seek-bar {
    height: 5px;
}

.tv-seek-buffered {
    position: absolute;
    top: 0; left: 0;
    height: 100%;
    background: rgba(255,255,255,0.3);
    border-radius: 2px;
}

.tv-seek-progress {
    position: absolute;
    top: 0; left: 0;
    height: 100%;
    background: #3b82f6;
    border-radius: 2px;
}

.tv-seek-handle {
    position: absolute;
    top: 50%;
    transform: translate(-50%, -50%) scale(0);
    width: 14px; height: 14px;
    background: #3b82f6;
    border: 2px solid #fff;
    border-radius: 50%;
    box-shadow: 0 0 6px rgba(0,0,0,0.4);
    transition: transform 0.15s ease;
    z-index: 2;
}

.tv-seek-container:hover .tv-seek-handle {
    transform: translate(-50%, -50%) scale(1);
}

.tv-seek-tooltip {
    position: absolute;
    bottom: 100%;
    transform: translateX(-50%);
    padding: 4px 8px;
    background: rgba(0,0,0,0.85);
    color: #fff;
    font-size: 12px;
    font-weight: 500;
    border-radius: 4px;
    white-space: nowrap;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.15s ease;
    margin-bottom: 8px;
}

.tv-seek-container:hover .tv-seek-tooltip {
    opacity: 1;
}

/* ── Live indicator on seek bar ──────────────────────── */
.tv-live-edge {
    position: absolute;
    right: 0; top: -4px;
    width: 8px; height: 8px;
    background: #ef4444;
    border-radius: 50%;
    box-shadow: 0 0 8px rgba(239,68,68,0.6);
}

/* ── Controls Row ────────────────────────────────────── */
.tv-controls-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 4px;
}

.tv-controls-left,
.tv-controls-right {
    display: flex;
    align-items: center;
    gap: 2px;
}

/* ── Control Buttons ─────────────────────────────────── */
.tv-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 36px; height: 36px;
    border: none;
    background: transparent;
    color: #fff;
    border-radius: 6px;
    cursor: pointer;
    transition: background 0.15s ease;
    outline: none;
    flex-shrink: 0;
}

.tv-btn:hover {
    background: rgba(255,255,255,0.12);
}

.tv-btn svg {
    width: 20px; height: 20px;
}

.tv-btn-sm svg {
    width: 18px; height: 18px;
}

.tv-btn-label {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    height: 36px;
    padding: 0 10px;
    border: none;
    background: transparent;
    color: #fff;
    border-radius: 6px;
    cursor: pointer;
    font-size: 12px;
    font-weight: 500;
    font-family: inherit;
    transition: background 0.15s ease;
    outline: none;
    white-space: nowrap;
}

.tv-btn-label:hover {
    background: rgba(255,255,255,0.12);
}

.tv-btn-label.tv-active {
    color: #3b82f6;
}

/* ── Time Display ────────────────────────────────────── */
.tv-time {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 0 8px;
    font-size: 12px;
    font-weight: 500;
    color: rgba(255,255,255,0.85);
    white-space: nowrap;
    font-variant-numeric: tabular-nums;
}

.tv-time-separator {
    color: rgba(255,255,255,0.4);
}

/* ── Volume Control ──────────────────────────────────── */
.tv-volume-group {
    display: flex;
    align-items: center;
    gap: 0;
}

.tv-volume-slider-wrap {
    width: 0;
    overflow: hidden;
    transition: width 0.2s ease;
}

.tv-volume-group:hover .tv-volume-slider-wrap {
    width: 70px;
}

.tv-volume-slider {
    -webkit-appearance: none;
    appearance: none;
    width: 60px;
    height: 4px;
    background: rgba(255,255,255,0.25);
    border-radius: 2px;
    outline: none;
    margin: 0 4px 0 0;
    cursor: pointer;
}

.tv-volume-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 12px; height: 12px;
    background: #fff;
    border-radius: 50%;
    cursor: pointer;
}

.tv-volume-slider::-moz-range-thumb {
    width: 12px; height: 12px;
    background: #fff;
    border-radius: 50%;
    cursor: pointer;
    border: none;
}

/* ── Dropdown Menus ──────────────────────────────────── */
.tv-dropdown {
    position: absolute;
    bottom: 100%;
    right: 0;
    margin-bottom: 8px;
    min-width: 140px;
    background: rgba(15,23,42,0.95);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid rgba(255,255,255,0.1);
    border-radius: 10px;
    padding: 6px;
    opacity: 0;
    transform: translateY(8px);
    pointer-events: none;
    transition: opacity 0.15s ease, transform 0.15s ease;
    z-index: 20;
    box-shadow: 0 8px 32px rgba(0,0,0,0.5);
}

.tv-dropdown.tv-open {
    opacity: 1;
    transform: translateY(0);
    pointer-events: auto;
}

.tv-dropdown-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    padding: 8px 12px;
    border: none;
    background: transparent;
    color: rgba(255,255,255,0.75);
    font-size: 13px;
    font-family: inherit;
    border-radius: 6px;
    cursor: pointer;
    transition: background 0.1s ease, color 0.1s ease;
    text-align: left;
    outline: none;
    white-space: nowrap;
}

.tv-dropdown-item:hover {
    background: rgba(255,255,255,0.08);
    color: #fff;
}

.tv-dropdown-item.tv-selected {
    color: #3b82f6;
    font-weight: 600;
}

.tv-dropdown-item .tv-check {
    width: 16px; height: 16px;
    opacity: 0;
}

.tv-dropdown-item.tv-selected .tv-check {
    opacity: 1;
}

.tv-dropdown-label {
    padding: 6px 12px 4px;
    font-size: 11px;
    font-weight: 600;
    color: rgba(255,255,255,0.35);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.tv-dropdown-divider {
    height: 1px;
    background: rgba(255,255,255,0.08);
    margin: 4px 0;
}

/* ── Error Overlay ───────────────────────────────────── */
.tv-error-overlay {
    position: absolute;
    top: 0; left: 0; right: 0; bottom: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0,0,0,0.82);
    z-index: 15;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.25s ease;
}

.tv-player.tv-error .tv-error-overlay {
    opacity: 1;
    pointer-events: auto;
}

.tv-error-box {
    text-align: center;
    padding: 32px;
    max-width: 360px;
}

.tv-error-icon {
    width: 56px; height: 56px;
    margin: 0 auto 16px;
    background: rgba(239,68,68,0.15);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.tv-error-icon svg {
    width: 28px; height: 28px;
    color: #ef4444;
}

.tv-error-msg {
    font-size: 15px;
    font-weight: 600;
    color: #fff;
    margin-bottom: 4px;
}

.tv-error-sub {
    font-size: 13px;
    color: rgba(255,255,255,0.5);
    margin-bottom: 20px;
}

.tv-error-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 24px;
    background: #3b82f6;
    color: #fff;
    border: none;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    font-family: inherit;
    cursor: pointer;
    transition: background 0.15s ease;
    outline: none;
}

.tv-error-btn:hover {
    background: #2563eb;
}

.tv-error-btn svg {
    width: 16px; height: 16px;
}

/* ── Source Switch Toast ─────────────────────────────── */
.tv-source-toast {
    position: absolute;
    top: 50%; left: 50%;
    transform: translate(-50%, -50%);
    padding: 10px 20px;
    background: rgba(0,0,0,0.7);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    border: 1px solid rgba(255,255,255,0.1);
    border-radius: 8px;
    color: #fff;
    font-size: 14px;
    font-weight: 500;
    z-index: 12;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
    display: flex;
    align-items: center;
    gap: 10px;
    white-space: nowrap;
}

.tv-source-toast.tv-visible {
    opacity: 1;
}

.tv-source-toast .tv-toast-dot {
    width: 8px; height: 8px;
    background: #22c55e;
    border-radius: 50%;
    animation: tv-pulse 1.2s ease-in-out infinite;
}

.tv-source-toast .tv-toast-quality {
    color: #3b82f6;
    font-weight: 600;
}

/* ── Buffering indicator ─────────────────────────────── */
.tv-buffering-overlay {
    position: absolute;
    top: 0; left: 0; right: 0; bottom: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background: rgba(0,0,0,0.45);
    z-index: 6;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
}

.tv-player.tv-buffering .tv-buffering-overlay {
    opacity: 1;
}

.tv-buffering-spinner {
    width: 44px; height: 44px;
    border: 3px solid rgba(255,255,255,0.12);
    border-top-color: rgba(255,255,255,0.85);
    border-radius: 50%;
    animation: tv-spin 0.7s linear infinite;
    filter: drop-shadow(0 0 8px rgba(255,255,255,0.2));
}

/* ── Fullscreen adjustments ──────────────────────────── */
.tv-player:-webkit-full-screen { width: 100vw; height: 100vh; }
.tv-player:fullscreen { width: 100vw; height: 100vh; }

/* ── Responsive ──────────────────────────────────────── */
@media (max-width: 640px) {
    .tv-center-play-btn {
        width: 56px; height: 56px;
    }
    .tv-center-play-btn svg {
        width: 24px; height: 24px;
    }
    .tv-bottom-bar {
        padding: 0 8px 6px;
    }
    .tv-btn {
        width: 32px; height: 32px;
    }
    .tv-btn svg {
        width: 18px; height: 18px;
    }
    .tv-time {
        font-size: 11px;
        padding: 0 4px;
    }
    .tv-btn-label {
        font-size: 11px;
        padding: 0 6px;
        height: 32px;
    }
    .tv-volume-group:hover .tv-volume-slider-wrap {
        width: 50px;
    }
    .tv-dropdown {
        min-width: 120px;
    }
    .tv-top-bar {
        padding: 8px 10px;
    }
    .tv-live-badge,
    .tv-source-badge {
        font-size: 10px;
        padding: 3px 8px;
    }
}

/* ── Utility Classes ─────────────────────────────────── */
@keyframes fadeIn { from { opacity:0; } to { opacity:1; } }
@keyframes slideUp { from { opacity:0; transform:translateY(20px); } to { opacity:1; transform:translateY(0); } }
