/* public/assets/css/video/web-iptv.css */

.tv-wrapper { padding: 32px; border-radius: var(--radius-lg); position: relative; }
.tv-header { text-align: center; margin-bottom: 24px; }
.tv-title { font-size: 2rem; font-weight: 800; color: var(--text-main); margin-bottom: 12px; letter-spacing: -0.5px; }
.tv-subtitle { font-size: 1.05rem; color: var(--text-muted); max-width: 700px; margin: 0 auto; line-height: 1.6; }

/* 响应式核心布局 */
.tv-workspace { display: flex; flex-direction: row-reverse; width: 100%; max-width: 1400px; margin: 0 auto; height: 75vh; min-height: 600px; background: #000; border-radius: 16px; overflow: hidden; box-shadow: 0 20px 50px rgba(0,0,0,0.3); border: 1px solid rgba(255,255,255,0.1); }

/* 主播放器占据剩余空间 */
.tv-main-player { flex: 1; min-width: 0; display: flex; flex-direction: column; background: #0f172a; position: relative; }

/* 侧边栏 */
.tv-sidebar { width: 360px; background: rgba(15, 23, 42, 0.95); backdrop-filter: blur(10px); border-right: 1px solid rgba(255,255,255,0.1); display: flex; flex-direction: column; transition: width 0.3s cubic-bezier(0.4, 0, 0.2, 1); overflow: hidden; flex-shrink: 0; }
.tv-sidebar.is-closed { width: 0; border-right: none; }

/* 顶层：头部操作栏 */
.tv-player-header { padding: 16px 20px; background: linear-gradient(rgba(0,0,0,0.8), transparent); display: flex; align-items: center; gap: 16px; z-index: 15; position: absolute; top: 0; left: 0; right: 0; pointer-events: auto; }

.tv-menu-btn { background: rgba(255,255,255,0.1); border: 1px solid rgba(255,255,255,0.2); color: #fff; width: 40px; height: 40px; border-radius: 8px; cursor: pointer; display: flex; justify-content: center; align-items: center; backdrop-filter: blur(8px); transition: 0.2s; flex-shrink: 0; }
.tv-menu-btn:hover { background: rgba(255,255,255,0.2); transform: scale(1.05); }

.tv-now-playing { background: #ef4444; color: #fff; font-size: 0.7rem; font-weight: 800; padding: 4px 8px; border-radius: 4px; letter-spacing: 0.5px; flex-shrink: 0; animation: pulse 2s infinite; }
@keyframes pulse { 0% { opacity: 1; } 50% { opacity: 0.7; } 100% { opacity: 1; } }

.tv-current-name { margin: 0; font-size: 1.25rem; font-weight: 800; color: #f8fafc; flex: 1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; letter-spacing: -0.5px; text-shadow: 0 2px 4px rgba(0,0,0,0.5); }
.tv-header-actions { display: flex; align-items: center; gap: 12px; flex-shrink: 0; }

.tv-status-badge { font-size: 0.8rem; color: #e2e8f0; font-weight: 600; background: rgba(0,0,0,0.5); border: 1px solid rgba(255,255,255,0.1); backdrop-filter: blur(4px); padding: 4px 10px; border-radius: 20px; white-space: nowrap; }
.tv-status-badge.error { background: rgba(239, 68, 68, 0.8); color: #fff; border-color: rgba(239, 68, 68, 1); }

.tv-top-fav-btn { background: rgba(0,0,0,0.5); border: 1px solid rgba(255,255,255,0.1); backdrop-filter: blur(4px); color: #94a3b8; cursor: pointer; width: 36px; height: 36px; border-radius: 50%; transition: 0.2s; display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.tv-top-fav-btn:hover { background: rgba(255,255,255,0.2); color: #f8fafc; }
.tv-top-fav-btn.active { color: #f59e0b; border-color: rgba(245, 158, 11, 0.4); background: rgba(245, 158, 11, 0.2); }

/* 视频容器 */
.tv-video-wrapper { flex: 1; position: relative; display: flex; justify-content: center; align-items: center; background: #000; overflow: hidden; }
.tv-video { width: 100%; height: 100%; outline: none; background: #000; transition: object-fit 0.3s ease; }
.tv-fit-contain { object-fit: contain; }
.tv-fit-cover { object-fit: cover; }
.tv-fit-fill { object-fit: fill; }

/* 影院级双语悬浮字幕层 */
.tv-subtitle-overlay { position: absolute; bottom: 85px; left: 50%; transform: translateX(-50%); text-align: center; pointer-events: none; z-index: 18; max-width: 90%; display: flex; flex-direction: column; align-items: center; gap: 4px; }
.tv-sub-orig { font-size: 1.05rem; color: #f8fafc; text-shadow: 0 2px 4px rgba(0,0,0,0.9), 0 0 2px #000; background: rgba(0,0,0,0.65); padding: 4px 12px; border-radius: 6px; display: inline-block; line-height: 1.4; }
.tv-sub-trans { font-size: 1.2rem; font-weight: bold; color: #fde047; text-shadow: 0 2px 4px rgba(0,0,0,0.9), 0 0 2px #000; background: rgba(0,0,0,0.8); padding: 4px 14px; border-radius: 6px; display: inline-block; line-height: 1.4; }

/* 侧边栏内容 */
.tv-tabs { display: flex; border-bottom: 1px solid rgba(255,255,255,0.1); background: rgba(0,0,0,0.2); width: 360px; }
.tv-tab { flex: 1; padding: 16px 0; border: none; background: transparent; font-size: 0.95rem; font-weight: 700; color: #94a3b8; cursor: pointer; transition: 0.2s; border-bottom: 3px solid transparent; }
.tv-tab:hover { color: #e2e8f0; background: rgba(255,255,255,0.05); }
.tv-tab.active { color: #60a5fa; border-bottom-color: #60a5fa; background: rgba(59, 130, 246, 0.1); }

.tv-tab-content { display: none; flex-direction: column; flex: 1; overflow: hidden; animation: tvFadeIn 0.3s ease; width: 360px; }
.tv-tab-content.active { display: flex; }

.tv-sidebar-search { padding: 14px 16px 10px 16px; }
.tv-search-input { width: 100%; padding: 10px 14px; border: 1px solid rgba(255,255,255,0.1); border-radius: 10px; font-size: 0.9rem; background: rgba(0,0,0,0.3); color: #f8fafc; outline: none; transition: 0.2s; box-sizing: border-box; }
.tv-search-input:focus { border-color: #3b82f6; }

/* 🌟 网格排版的快速加载按钮 */
.tv-ext-source-grid { padding: 0 16px 12px 16px; display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.tv-btn-ext { background: rgba(59, 130, 246, 0.08); border: 1px solid rgba(59, 130, 246, 0.25); color: #93c5fd; padding: 8px 10px; border-radius: 8px; font-size: 0.8rem; font-weight: 600; cursor: pointer; transition: 0.2s; text-align: center; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tv-btn-ext:hover { background: #3b82f6; color: #fff; border-color: #3b82f6; }

/* 🌟 核心修复：分类胶囊自动多行折行 */
.tv-category-pills { 
    display: flex; 
    flex-wrap: wrap; /* 允许折行 */
    gap: 8px; 
    padding: 0 16px 12px 16px; 
    border-bottom: 1px solid rgba(255,255,255,0.1); 
}
.tv-pill { 
    padding: 5px 12px; 
    border-radius: 16px; 
    border: 1px solid rgba(255,255,255,0.15); 
    background: rgba(0,0,0,0.2); 
    color: #cbd5e1; 
    font-size: 0.8rem; 
    font-weight: 600; 
    cursor: pointer; 
    transition: 0.2s; 
}
.tv-pill:hover { border-color: #3b82f6; color: #60a5fa; }
.tv-pill.active { background: #3b82f6; border-color: #3b82f6; color: #fff; }

.tv-channel-list { flex: 1; overflow-y: auto; padding-bottom: 20px; }
.tv-channel-list::-webkit-scrollbar { width: 6px; }
.tv-channel-list::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.2); border-radius: 4px; }

.tv-item { display: flex; align-items: center; gap: 12px; padding: 12px 16px; border-bottom: 1px solid rgba(255,255,255,0.05); cursor: pointer; transition: 0.2s; position: relative; }
.tv-item:hover { background: rgba(255,255,255,0.05); }
.tv-item.active { background: rgba(59, 130, 246, 0.15); border-left: 4px solid #3b82f6; padding-left: 12px; }
.tv-item-logo { width: 42px; height: 42px; object-fit: contain; border-radius: 8px; background: #fff; padding: 2px; border: 1px solid rgba(0,0,0,0.2); flex-shrink: 0; }
.tv-item-info { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 4px; padding-right: 8px; }
.tv-item-name { font-size: 0.95rem; font-weight: 700; color: #f8fafc; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tv-item-cat { font-size: 0.75rem; color: #94a3b8; }
.tv-empty-state { text-align: center; padding: 40px 20px; color: #94a3b8; font-size: 0.9rem; }

.tv-item-fav-btn { background: none; border: none; padding: 6px; cursor: pointer; color: #475569; flex-shrink: 0; display: flex; align-items: center; justify-content: center; border-radius: 50%; transition: 0.2s; z-index: 2; }
.tv-item-fav-btn:hover { background: rgba(255,255,255,0.1); color: #f59e0b; }
.tv-item-fav-btn.active { color: #f59e0b; }

.tv-custom-form { padding: 16px; background: rgba(0,0,0,0.2); border-bottom: 1px dashed rgba(255,255,255,0.1); width: 360px; box-sizing: border-box;}
.tv-custom-desc { font-size: 0.85rem; color: #94a3b8; margin: 0 0 12px 0; }
.tv-input, .tv-textarea { width: 100%; padding: 10px 12px; border: 1px solid rgba(255,255,255,0.1); border-radius: 8px; font-size: 0.9rem; background: rgba(0,0,0,0.4); color: #f8fafc; outline: none; margin-bottom: 10px; box-sizing: border-box; }
.tv-textarea { min-height: 80px; resize: vertical; font-family: monospace; }
.tv-input:focus, .tv-textarea:focus { border-color: #3b82f6; }
.tv-btn-row { display: flex; gap: 10px; }
.tv-btn-primary { flex: 1; background: #3b82f6; color: #fff; border: none; border-radius: 8px; font-weight: 600; cursor: pointer; transition: 0.2s; padding: 10px; }
.tv-btn-primary:hover { filter: brightness(1.1); }
.tv-btn-outline { width: 40px; background: rgba(239, 68, 68, 0.1); color: #ef4444; border: 1px solid rgba(239, 68, 68, 0.3); border-radius: 8px; cursor: pointer; transition: 0.2s; }
.tv-btn-outline:hover { background: #ef4444; color: #fff; }

/* 提示与浮层 */
.tv-toast { position: absolute; top: 80px; left: 50%; transform: translateX(-50%); background: rgba(0,0,0,0.8); color: #fff; padding: 10px 20px; border-radius: 30px; font-size: 0.95rem; font-weight: 600; z-index: 50; backdrop-filter: blur(8px); pointer-events: none; animation: toastIn 0.3s ease; border: 1px solid rgba(255,255,255,0.1); box-shadow: 0 10px 30px rgba(0,0,0,0.3); }
@keyframes toastIn { from { opacity: 0; transform: translate(-50%, -20px); } to { opacity: 1; transform: translate(-50%, 0); } }

.tv-loading-overlay { position: absolute; inset: 0; background: rgba(0,0,0,0.8); display: none; justify-content: center; align-items: center; z-index: 10; backdrop-filter: blur(4px); }
.tv-spinner { width: 56px; height: 56px; border: 4px solid rgba(255,255,255,0.1); border-top-color: #3b82f6; border-radius: 50%; animation: tvSpin 1s linear infinite; }

/* CC 字幕菜单面板 */
.tv-cc-menu { position: absolute; bottom: 80px; right: 20px; background: rgba(15, 23, 42, 0.95); border: 1px solid rgba(255,255,255,0.15); border-radius: 14px; width: 280px; z-index: 30; backdrop-filter: blur(12px); color: #f8fafc; overflow: hidden; box-shadow: 0 10px 30px rgba(0,0,0,0.6); }
.tv-cc-title { padding: 12px 16px; font-weight: 700; font-size: 0.95rem; border-bottom: 1px solid rgba(255,255,255,0.1); background: rgba(255,255,255,0.05); }
.tv-cc-section { padding: 12px 16px; }
.tv-cc-row { display: flex; justify-content: space-between; align-items: center; font-size: 0.9rem; font-weight: 600; cursor: pointer; }
.tv-cc-sublabel { font-size: 0.8rem; color: #94a3b8; margin-bottom: 6px; display: block; }

.tv-cc-lang-box { margin-top: 10px; display: none; }
.tv-cc-lang-box.is-active { display: block; }
.tv-cc-select { width: 100%; padding: 8px 10px; border-radius: 8px; border: 1px solid rgba(255,255,255,0.2); background: #1e293b; color: #f8fafc; font-size: 0.85rem; outline: none; cursor: pointer; }
.tv-cc-select:focus { border-color: #3b82f6; }

.tv-toggle-switch { width: 36px; height: 20px; background: rgba(255,255,255,0.2); border-radius: 12px; position: relative; transition: 0.3s; }
.tv-toggle-knob { width: 16px; height: 16px; background: #fff; border-radius: 50%; position: absolute; top: 2px; left: 2px; transition: 0.3s; }
.tv-toggle-switch.on { background: #10b981; }
.tv-toggle-switch.on .tv-toggle-knob { transform: translateX(16px); }

.tv-cc-list { max-height: 140px; overflow-y: auto; }
.tv-cc-item { padding: 8px 16px; font-size: 0.85rem; cursor: pointer; transition: 0.2s; display: flex; justify-content: space-between; align-items: center; }
.tv-cc-item:hover { background: rgba(255,255,255,0.1); }
.tv-cc-item.active { color: #3b82f6; font-weight: bold; }
.tv-cc-item.active::after { content: '✓'; }
.tv-cc-divider { height: 1px; background: rgba(255,255,255,0.1); margin: 4px 0; }

/* 底部控制条 */
.tv-custom-controls { position: absolute; bottom: 0; left: 0; right: 0; background: linear-gradient(transparent, rgba(0,0,0,0.9)); padding: 40px 20px 16px 20px; z-index: 20; opacity: 0; transition: opacity 0.3s ease; display: flex; flex-direction: column; gap: 10px; pointer-events: none; }
.tv-workspace:hover .tv-custom-controls, .tv-custom-controls:hover { opacity: 1; pointer-events: auto; }

.tv-ctrl-progress { width: 100%; height: 4px; background: rgba(255,255,255,0.2); border-radius: 2px; overflow: hidden; }
.tv-ctrl-progress-fill { height: 100%; background: #ef4444; transition: width 0.1s; }

.tv-ctrl-row { display: flex; justify-content: space-between; align-items: center; }
.tv-ctrl-left, .tv-ctrl-right { display: flex; align-items: center; gap: 16px; }
.tv-ctrl-btn { background: none; border: none; color: #fff; cursor: pointer; padding: 0; display: flex; justify-content: center; align-items: center; opacity: 0.8; transition: 0.2s; position: relative; }
.tv-ctrl-btn:hover { opacity: 1; transform: scale(1.1); color: #3b82f6; }
.tv-ctrl-btn.active { color: #3b82f6; opacity: 1; }

.tv-ctrl-vol { display: flex; align-items: center; gap: 8px; width: 0; overflow: hidden; transition: width 0.3s ease; opacity: 0; }
.tv-ctrl-left:hover .tv-ctrl-vol { width: 80px; opacity: 1; }
.tv-vol-slider { -webkit-appearance: none; width: 100%; height: 4px; background: rgba(255,255,255,0.3); border-radius: 2px; outline: none; cursor: pointer; }
.tv-vol-slider::-webkit-slider-thumb { -webkit-appearance: none; width: 12px; height: 12px; border-radius: 50%; background: #fff; }

.tv-ctrl-live-badge { border: 1px solid #ef4444; color: #ef4444; font-size: 0.7rem; font-weight: bold; padding: 2px 6px; border-radius: 4px; letter-spacing: 0.5px; margin-left: 8px; }

/* 移动端响应 */
@media (max-width: 900px) {
    .tv-workspace { display: flex; flex-direction: column; height: auto; min-height: 100vh; border-radius: 0; border: none; }
    .tv-main-player { position: sticky; top: 0; z-index: 100; width: 100%; height: 35vh; min-height: 250px; flex: none; box-shadow: 0 4px 20px rgba(0,0,0,0.5); }
    .tv-video-wrapper { height: 100%; }
    .tv-player-header { padding: 12px; background: linear-gradient(rgba(0,0,0,0.8), transparent); }
    .tv-menu-btn { display: none; }
    .tv-current-name { font-size: 1.1rem; }
    .tv-sidebar { position: relative; width: 100%; flex: 1; transform: none !important; border-right: none; height: auto; display: flex; flex-direction: column; z-index: 10; }
    .tv-tab-content, .tv-tabs, .tv-custom-form { width: 100%; }
    .tv-channel-list { max-height: none; overflow: visible; padding-bottom: 50px; }
    .tv-custom-controls { opacity: 1; pointer-events: auto; padding: 20px 10px 10px 10px; } 
    .tv-ctrl-vol { display: none; }
    .tv-cc-menu { bottom: 60px; right: 10px; width: 260px; }
    .tv-subtitle-overlay { bottom: 60px; }
}

.tv-workspace:-webkit-full-screen { width: 100%; height: 100%; border-radius: 0; border: none; }
.tv-workspace:fullscreen { width: 100%; height: 100%; border-radius: 0; border: none; }