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

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: #0a0a0a;
    color: #e0e0e0;
    height: 100vh;
    overflow: hidden;
}

#app {
    display: flex;
    height: 100vh;
}

.toggle-btn {
    display: none;
    position: absolute;
    top: 10px;
    left: 10px;
    z-index: 100;
    background: rgba(0, 0, 0, 0.7);
    border: none;
    color: white;
    font-size: 24px;
    padding: 8px 12px;
    border-radius: 6px;
    cursor: pointer;
}

/* Sidebar */
.sidebar {
    width: 320px;
    min-width: 320px;
    background: #141414;
    display: flex;
    flex-direction: column;
    border-right: 1px solid #2a2a2a;
    transition: transform 0.3s ease;
}

.sidebar-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px;
    border-bottom: 1px solid #2a2a2a;
}

.logo {
    font-size: 1.5rem;
    font-weight: 700;
    color: #3b82f6;
}

.icon-btn {
    background: none;
    border: none;
    color: #aaa;
    font-size: 22px;
    cursor: pointer;
    padding: 6px;
    border-radius: 6px;
    transition: color 0.2s, background 0.2s;
    line-height: 1;
}
.icon-btn:hover {
    color: #fff;
    background: rgba(255, 255, 255, 0.1);
}

.search-container {
    padding: 12px 16px;
}

#searchInput {
    width: 100%;
    padding: 10px 12px;
    border-radius: 8px;
    border: 1px solid #333;
    background: #1e1e1e;
    color: #e0e0e0;
    font-size: 14px;
    outline: none;
    transition: border-color 0.2s;
}
#searchInput:focus {
    border-color: #3b82f6;
}

.filter-container {
    padding: 0 16px 12px;
}

#groupFilter {
    width: 100%;
    padding: 10px 12px;
    border-radius: 8px;
    border: 1px solid #333;
    background: #1e1e1e;
    color: #e0e0e0;
    font-size: 14px;
    cursor: pointer;
    outline: none;
}

.channel-list {
    flex: 1;
    overflow-y: auto;
    padding: 8px 0;
}

.channel-list::-webkit-scrollbar {
    width: 6px;
}
.channel-list::-webkit-scrollbar-track {
    background: #1e1e1e;
}
.channel-list::-webkit-scrollbar-thumb {
    background: #555;
    border-radius: 3px;
}

.channel-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 16px;
    cursor: pointer;
    transition: background 0.15s, border-color 0.15s;
    border-left: 3px solid transparent;
}
.channel-item:hover {
    background: #1e1e1e;
}
.channel-item.active {
    background: #1a2a3a;
    border-left-color: #3b82f6;
}

.channel-logo {
    width: 40px;
    height: 40px;
    border-radius: 6px;
    object-fit: contain;
    background: #252525;
    flex-shrink: 0;
}

.channel-info {
    overflow: hidden;
    min-width: 0;
}
.channel-name {
    font-size: 14px;
    font-weight: 500;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.channel-group {
    font-size: 12px;
    color: #888;
    margin-top: 2px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.sidebar-footer {
    padding: 10px 16px;
    border-top: 1px solid #2a2a2a;
    font-size: 12px;
    color: #777;
}

/* Main player */
.main-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    background: #000;
}

.player-container {
    flex: 1;
    position: relative;
    background: black;
    display: flex;
    align-items: center;
    justify-content: center;
}

.video-player {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.loading-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, 0.5);
    pointer-events: none;
}

.spinner {
    border: 4px solid rgba(255, 255, 255, 0.2);
    border-top: 4px solid #3b82f6;
    border-radius: 50%;
    width: 44px;
    height: 44px;
    animation: spin 0.8s linear infinite;
}

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

.error-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, 0.8);
    color: #fff;
    font-size: 18px;
    text-align: center;
    padding: 20px;
    z-index: 5;
}

.controls-bar {
    display: flex;
    align-items: center;
    padding: 10px 16px;
    background: #1a1a1a;
    gap: 10px;
    min-height: 56px;
}

.control-btn {
    background: none;
    border: none;
    color: #ccc;
    font-size: 22px;
    cursor: pointer;
    padding: 8px 10px;
    border-radius: 6px;
    transition: color 0.2s, background 0.2s;
    line-height: 1;
}
.control-btn:hover {
    color: #fff;
    background: rgba(255, 255, 255, 0.1);
}

.volume-container {
    display: flex;
    align-items: center;
    gap: 6px;
}

.volume-icon {
    font-size: 18px;
}

.volume-slider {
    width: 80px;
    cursor: pointer;
    accent-color: #3b82f6;
}

.spacer {
    flex: 1;
}

/* Responsive */
@media (max-width: 768px) {
    #app {
        flex-direction: column;
    }

    .toggle-btn {
        display: block;
    }

    .sidebar {
        position: fixed;
        top: 0;
        left: 0;
        height: 100%;
        z-index: 50;
        transform: translateX(-100%);
        width: 280px;
        min-width: 280px;
    }

    .sidebar.open {
        transform: translateX(0);
    }

    .main-content {
        height: 100%;
    }

    .controls-bar {
        flex-wrap: wrap;
        gap: 8px;
    }

    .volume-slider {
        width: 60px;
    }
}