:root {
    --bg: #090d16;
    --panel: #111827;
    --panel-alt: #1f2937;
    --border: #1f2937;
    --text: #f3f4f6;
    --muted: #9ca3af;
    --accent: #3b82f6;
    --accent-hover: #2563eb;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html, body {
    height: 100%;
    background: var(--bg);
    color: var(--text);
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "PingFang SC", "Microsoft YaHei", sans-serif;
}

.app-shell {
    display: flex;
    flex-direction: column;
    height: 100vh;
}

.topbar {
    height: 58px;
    background: var(--panel);
    border-bottom: 1px solid var(--border);
    padding: 0 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    flex-shrink: 0;
}

.brand {
    display: flex;
    align-items: center;
    gap: 10px;
    font-weight: 700;
    font-size: 17px;
    white-space: nowrap;
}

.brand-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border-radius: 8px;
    background: linear-gradient(135deg, #3b82f6, #8b5cf6);
    color: #fff;
    font-size: 13px;
}

.topbar-controls {
    display: flex;
    align-items: center;
    gap: 10px;
    flex: 1;
    justify-content: flex-end;
    max-width: 720px;
}

.control-select,
.control-search {
    background: var(--bg);
    border: 1px solid #374151;
    color: var(--text);
    border-radius: 8px;
    padding: 7px 12px;
    font-size: 13px;
    outline: none;
}

.control-select {
    max-width: 190px;
}

.control-search {
    width: 220px;
}

.control-select:focus,
.control-search:focus {
    border-color: var(--accent);
}

.btn-admin {
    background: var(--panel-alt);
    color: var(--text);
    text-decoration: none;
    padding: 7px 14px;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 500;
    white-space: nowrap;
    border: 1px solid #374151;
    transition: background 0.15s;
}

.btn-admin:hover {
    background: #374151;
}

.main-content {
    flex: 1;
    display: flex;
    min-height: 0;
}

.player-section {
    flex: 1;
    display: flex;
    flex-direction: column;
    background: #000;
    min-width: 0;
}

.video-container {
    position: relative;
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #000;
    min-height: 0;
}

.video-container video {
    width: 100%;
    height: 100%;
    max-height: 100%;
    outline: none;
}

.player-overlay {
    position: absolute;
    inset: 0;
    background: rgba(9, 13, 22, 0.85);
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 24px;
    z-index: 2;
}

.player-overlay.hidden {
    display: none;
}

.overlay-title {
    font-size: 18px;
    font-weight: 600;
    margin-bottom: 6px;
}

.overlay-sub {
    font-size: 13px;
    color: var(--muted);
    margin-bottom: 14px;
}

.btn-retry {
    background: var(--accent);
    color: #fff;
    border: none;
    padding: 8px 18px;
    border-radius: 8px;
    cursor: pointer;
    font-size: 13px;
}

.now-playing {
    height: 48px;
    background: var(--panel);
    border-top: 1px solid var(--border);
    padding: 0 18px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    flex-shrink: 0;
}

.np-left {
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 0;
}

.status-dot {
    width: 9px;
    height: 9px;
    border-radius: 50%;
    background: #6b7280;
    flex-shrink: 0;
}

.status-dot.live {
    background: #10b981;
    box-shadow: 0 0 8px #10b981;
}

.status-dot.error {
    background: #ef4444;
}

.np-title {
    font-size: 14px;
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.np-badge {
    font-size: 11px;
    background: rgba(59, 130, 246, 0.2);
    color: #60a5fa;
    padding: 2px 8px;
    border-radius: 999px;
    white-space: nowrap;
}

.np-source {
    font-size: 12px;
    color: var(--muted);
    white-space: nowrap;
}

.stats-text {
    font-size: 12px;
    color: var(--muted);
    white-space: nowrap;
}

.sidebar {
    width: 340px;
    background: var(--panel);
    border-left: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    min-height: 0;
    flex-shrink: 0;
}

.group-tabs {
    display: flex;
    gap: 6px;
    padding: 10px 12px;
    border-bottom: 1px solid var(--border);
    overflow-x: auto;
    flex-shrink: 0;
}

.group-tab {
    background: var(--panel-alt);
    color: var(--muted);
    border: none;
    border-radius: 999px;
    padding: 5px 12px;
    font-size: 12px;
    cursor: pointer;
    white-space: nowrap;
    transition: all 0.15s;
}

.group-tab:hover {
    color: var(--text);
}

.group-tab.active {
    background: var(--accent);
    color: #fff;
}

.channel-list {
    flex: 1;
    overflow-y: auto;
    padding: 8px;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.channel-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 9px 10px;
    border-radius: 8px;
    cursor: pointer;
    transition: background 0.12s;
    border: 1px solid transparent;
}

.channel-item:hover {
    background: var(--panel-alt);
}

.channel-item.active {
    background: rgba(59, 130, 246, 0.16);
    border-color: rgba(59, 130, 246, 0.4);
}

.channel-logo {
    width: 36px;
    height: 36px;
    border-radius: 6px;
    background: #1f2937;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    font-weight: 600;
    color: var(--muted);
    overflow: hidden;
    flex-shrink: 0;
}

.channel-logo img {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.channel-info {
    min-width: 0;
    flex: 1;
}

.channel-name {
    font-size: 14px;
    font-weight: 500;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.channel-meta {
    font-size: 11px;
    color: var(--muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.empty-state {
    text-align: center;
    color: var(--muted);
    font-size: 13px;
    padding: 32px 16px;
    line-height: 1.7;
}

@media (max-width: 900px) {
    .app-shell {
        height: auto;
        min-height: 100vh;
    }
    .main-content {
        flex-direction: column;
    }
    .video-container {
        aspect-ratio: 16 / 9;
    }
    .sidebar {
        width: 100%;
        border-left: none;
        border-top: 1px solid var(--border);
        height: 460px;
    }
    .control-search {
        width: 130px;
    }
}
