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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: #0d1117;
    color: #e6edf3;
    height: 100vh;
    overflow: hidden;
}

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

/* Login Panel */
.panel {
    max-width: 520px;
    margin: 80px auto;
    padding: 32px;
    background: #161b22;
    border: 1px solid #30363d;
    border-radius: 12px;
}

.panel h1 {
    margin-bottom: 24px;
    font-size: 22px;
    color: #58a6ff;
}

.form-group {
    margin-bottom: 16px;
}

.form-group label {
    display: block;
    margin-bottom: 6px;
    font-size: 14px;
    color: #8b949e;
}

.form-group input {
    width: 100%;
    padding: 10px 14px;
    background: #0d1117;
    border: 1px solid #30363d;
    border-radius: 6px;
    color: #e6edf3;
    font-size: 14px;
    transition: border-color 0.2s;
}

.form-group input:focus {
    outline: none;
    border-color: #58a6ff;
}

button {
    cursor: pointer;
    border: none;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 500;
    transition: background 0.2s;
}

#load-btn {
    width: 100%;
    padding: 12px;
    background: #238636;
    color: #fff;
    font-size: 16px;
    margin-top: 8px;
}

#load-btn:hover {
    background: #2ea043;
}

#loading {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-top: 16px;
    color: #8b949e;
}

.spinner {
    width: 20px;
    height: 20px;
    border: 2px solid #30363d;
    border-top-color: #58a6ff;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    display: inline-block;
}

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

#error {
    margin-top: 16px;
    padding: 12px;
    background: #3d1f28;
    border: 1px solid #f85149;
    border-radius: 6px;
    color: #f85149;
    font-size: 14px;
}

.hidden {
    display: none !important;
}

/* Player Panel */
#player-panel {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    height: 100vh;
}

#top-bar {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 8px 16px;
    background: #161b22;
    border-bottom: 1px solid #30363d;
    flex-shrink: 0;
}

#back-btn {
    padding: 6px 12px;
    background: #21262d;
    color: #c9d1d9;
    border: 1px solid #30363d;
    font-size: 16px;
}

#disconnect-btn {
    padding: 6px 14px;
    background: #da3633;
    color: #fff;
    border: 1px solid #da3633;
}

#back-btn:hover {
    background: #30363d;
}

#disconnect-btn:hover {
    background: #f85149;
}

#breadcrumb {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 13px;
    color: #8b949e;
    min-width: 0;
}

#breadcrumb .sep {
    color: #484f58;
}

#current-channel-name {
    flex: 1;
    font-weight: 600;
    font-size: 14px;
    color: #58a6ff;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    text-align: right;
}

#main-content {
    flex: 1;
    display: flex;
    overflow: hidden;
}

/* Sidebar */
#sidebar {
    width: 340px;
    min-width: 340px;
    background: #161b22;
    border-right: 1px solid #30363d;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

#search-box {
    padding: 10px;
    border-bottom: 1px solid #30363d;
}

#search {
    width: 100%;
    padding: 8px 12px;
    background: #0d1117;
    border: 1px solid #30363d;
    border-radius: 6px;
    color: #e6edf3;
    font-size: 14px;
}

#search:focus {
    outline: none;
    border-color: #58a6ff;
}

#channel-list {
    list-style: none;
    overflow-y: auto;
    flex: 1;
}

#channel-list li {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 14px;
    cursor: pointer;
    border-bottom: 1px solid #21262d;
    transition: background 0.15s;
}

#channel-list li:hover {
    background: #21262d;
}

#channel-list li.active {
    background: #1f3a5f;
    border-left: 3px solid #58a6ff;
}

/* Menu items */
.menu-item {
    padding: 16px 20px !important;
}

.menu-icon {
    font-size: 24px;
    flex-shrink: 0;
}

.menu-label {
    font-size: 16px;
    font-weight: 600;
}

/* Channel items */
#channel-list li img.channel-logo {
    width: 36px;
    height: 36px;
    border-radius: 4px;
    object-fit: contain;
    background: #0d1117;
    flex-shrink: 0;
}

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

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

#channel-list li .channel-group {
    font-size: 11px;
    color: #8b949e;
    margin-top: 2px;
}

/* Loading item */
.loading-item {
    justify-content: center;
    color: #8b949e;
    gap: 8px;
}

.error-item {
    color: #f85149;
    font-size: 13px;
}

/* Video */
#video-container {
    flex: 1;
    background: #000;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
}

#video-player {
    width: 100%;
    height: 100%;
    background: #000;
}

#video-placeholder {
    position: absolute;
    color: #484f58;
    font-size: 18px;
}

#player-status {
    position: absolute;
    bottom: 60px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(0, 0, 0, 0.85);
    color: #f85149;
    padding: 10px 24px;
    border-radius: 8px;
    font-size: 15px;
    font-weight: 500;
    z-index: 10;
}

/* Mobile */
@media (max-width: 768px) {
    #sidebar {
        position: fixed;
        top: 0;
        left: 0;
        bottom: 0;
        z-index: 100;
        transform: translateX(-100%);
        transition: transform 0.3s;
        width: 85vw;
        min-width: unset;
    }

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

/* Scrollbar */
::-webkit-scrollbar {
    width: 6px;
}

::-webkit-scrollbar-track {
    background: #0d1117;
}

::-webkit-scrollbar-thumb {
    background: #30363d;
    border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
    background: #484f58;
}
