/* ================= BASE STYLES ================= */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body { 
    margin: 0; 
    background: #000; 
    display: flex; 
    height: 100vh; 
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    color: #fff;
    overflow: hidden;
}

/* ================= SIDEBAR STYLES ================= */
#sidebar {
    width: 350px;
    background: #111;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    border-right: 1px solid #222;
    box-shadow: 2px 0 10px rgba(0, 0, 0, 0.5);
}

#sidebar-header {
    padding: 20px;
    background: linear-gradient(135deg, #1a237e 0%, #0d47a1 100%);
    border-bottom: 2px solid #2196f3;
    position: sticky;
    top: 0;
    z-index: 10;
}

#sidebar-header h3 {
    margin: 0; 
    color: #fff; 
    font-size: 18px;
    font-weight: 600;
}

.subtitle {
    font-size: 12px; 
    color: #b3e5fc; 
    margin-top: 4px;
    opacity: 0.8;
}

/* Playlist Selector */
#playlist-selector {
    margin-top: 15px;
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.playlist-tab {
    padding: 8px 15px;
    background: rgba(255, 255, 255, 0.1);
    border: none;
    border-radius: 20px;
    color: #bbb;
    cursor: pointer;
    font-size: 12px;
    transition: all 0.3s ease;
    font-weight: 500;
}

.playlist-tab:hover:not(.active) {
    background: rgba(255, 255, 255, 0.15);
    transform: translateY(-1px);
}

.playlist-tab.active {
    background: linear-gradient(135deg, #2196f3 0%, #1976d2 100%);
    color: white;
    box-shadow: 0 2px 8px rgba(33, 150, 243, 0.3);
}

/* Search Box */
#search {
    width: 100%;
    padding: 12px;
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    color: white;
    margin-top: 15px;
    font-size: 14px;
    transition: all 0.3s;
}

#search:focus {
    outline: none;
    border-color: #2196f3;
    box-shadow: 0 0 0 2px rgba(33, 150, 243, 0.2);
}

#search::placeholder {
    color: rgba(255, 255, 255, 0.5);
}

/* ================= CHANNEL LIST STYLES ================= */
.channel-group {
    margin: 8px 0;
}

.group-header {
    padding: 12px 20px;
    background: linear-gradient(90deg, rgba(33, 150, 243, 0.1), transparent);
    color: #4fc3f7;
    font-size: 13px;
    font-weight: 600;
    display: flex;
    justify-content: space-between;
    align-items: center;
    cursor: pointer;
    border-left: 4px solid #2196f3;
    transition: all 0.3s;
}

.group-header:hover {
    background: linear-gradient(90deg, rgba(33, 150, 243, 0.2), transparent);
}

.group-channels {
    overflow: hidden;
    transition: max-height 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

.group-channels.collapsed {
    max-height: 0 !important;
}

/* Channel Items */
.channel {
    padding: 14px 20px 14px 30px;
    cursor: pointer;
    display: flex;
    align-items: center;
    transition: all 0.2s;
    border-left: 4px solid transparent;
    position: relative;
}

.channel:hover { 
    background: rgba(255, 255, 255, 0.05);
    padding-left: 32px;
}

.channel.active {
    background: linear-gradient(90deg, rgba(33, 150, 243, 0.15), transparent);
    border-left: 4px solid #2196f3;
}

.channel.active::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    height: 100%;
    width: 3px;
    background: #2196f3;
}

.channel img {
    width: 36px;
    height: 36px;
    border-radius: 6px;
    margin-right: 15px;
    object-fit: cover;
    background: #222;
    border: 1px solid #333;
}

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

.channel-number {
    background: rgba(255, 255, 255, 0.1);
    color: #aaa;
    padding: 4px 10px;
    border-radius: 12px;
    font-size: 11px;
    font-weight: 600;
    min-width: 40px;
    text-align: center;
}

/* Group Count */
.group-count {
    background: rgba(255, 255, 255, 0.1);
    color: #aaa;
    padding: 4px 10px;
    border-radius: 12px;
    font-size: 11px;
    font-weight: 600;
}

.collapse-icon {
    font-size: 12px;
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    opacity: 0.7;
}

.collapse-icon.collapsed {
    transform: rotate(-90deg);
}

/* ================= PLAYER STYLES ================= */
#player-container { 
    flex: 1; 
    position: relative;
    background: #000;
}

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

/* Now Playing Info */
#now-playing {
    position: absolute;
    top: 20px;
    left: 20px;
    background: rgba(0, 0, 0, 0.9);
    color: white;
    padding: 12px 20px;
    border-radius: 10px;
    font-size: 14px;
    z-index: 100;
    display: none;
    max-width: 400px;
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
    font-weight: 500;
}

/* Playlist Info */
#playlist-info {
    position: absolute;
    top: 20px;
    right: 20px;
    background: rgba(33, 150, 243, 0.9);
    color: white;
    padding: 10px 18px;
    border-radius: 10px;
    font-size: 12px;
    z-index: 100;
    display: none;
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.2);
    font-weight: 600;
    box-shadow: 0 4px 15px rgba(33, 150, 243, 0.3);
}

/* Quality Info */
#quality-info {
    position: absolute;
    top: 60px;
    right: 20px;
    background: rgba(0, 0, 0, 0.85);
    color: #4fc3f7;
    padding: 10px 18px;
    border-radius: 10px;
    font-size: 12px;
    z-index: 100;
    display: none;
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    cursor: pointer;
    transition: all 0.3s;
    font-weight: 600;
}

#quality-info:hover {
    background: rgba(0, 0, 0, 0.95);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4);
}

/* Resolution Menu */
#resolution-menu {
    position: absolute;
    bottom: 70px;
    right: 20px;
    background: rgba(0, 0, 0, 0.95);
    color: white;
    border-radius: 10px;
    padding: 12px;
    display: none;
    z-index: 1000;
    min-width: 200px;
    border: 1px solid rgba(255, 255, 255, 0.15);
    backdrop-filter: blur(20px);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
}

.resolution-item {
    padding: 10px 15px;
    cursor: pointer;
    border-radius: 6px;
    font-size: 13px;
    transition: all 0.2s;
    margin: 2px 0;
}

.resolution-item:hover {
    background: rgba(255, 255, 255, 0.1);
    padding-left: 20px;
}

.resolution-item.active {
    background: rgba(33, 150, 243, 0.3);
    color: #4fc3f7;
    font-weight: 600;
}

/* Stats Display */
#stats {
    position: absolute;
    bottom: 20px;
    left: 20px;
    background: rgba(0, 0, 0, 0.8);
    color: #aaa;
    padding: 10px 15px;
    border-radius: 8px;
    font-size: 11px;
    display: none;
    z-index: 100;
    font-family: 'Courier New', monospace;
    border: 1px solid rgba(255, 255, 255, 0.05);
}

/* ================= UPLOAD SECTION ================= */
#upload-playlist {
    margin-top: auto;
    padding: 20px;
    background: rgba(255, 255, 255, 0.03);
    border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.upload-title {
    font-size: 13px;
    color: #aaa;
    margin-bottom: 15px;
    text-align: center;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.upload-btn {
    width: 100%;
    background: rgba(255, 255, 255, 0.08);
    color: white;
    border: 1px solid rgba(255, 255, 255, 0.1);
    padding: 12px;
    border-radius: 8px;
    cursor: pointer;
    font-size: 13px;
    margin: 5px 0;
    transition: all 0.3s;
    font-weight: 500;
}

.upload-btn:hover {
    background: rgba(255, 255, 255, 0.12);
    transform: translateY(-1px);
    border-color: rgba(255, 255, 255, 0.2);
}

.upload-btn:nth-child(2) {
    background: rgba(76, 175, 80, 0.2);
    border-color: rgba(76, 175, 80, 0.3);
}

.upload-btn:nth-child(2):hover {
    background: rgba(76, 175, 80, 0.3);
}

.upload-btn:nth-child(3) {
    background: rgba(33, 150, 243, 0.2);
    border-color: rgba(33, 150, 243, 0.3);
}

.upload-btn:nth-child(3):hover {
    background: rgba(33, 150, 243, 0.3);
}

.upload-btn:nth-child(4) {
    background: rgba(244, 67, 54, 0.2);
    border-color: rgba(244, 67, 54, 0.3);
}

.upload-btn:nth-child(4):hover {
    background: rgba(244, 67, 54, 0.3);
}

/* ================= LOADING OVERLAY ================= */
#loading {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: rgba(0, 0, 0, 0.95);
    color: white;
    padding: 30px 40px;
    border-radius: 15px;
    display: none;
    z-index: 2000;
    text-align: center;
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.5);
}

.spinner {
    width: 40px;
    height: 40px;
    border: 4px solid rgba(255, 255, 255, 0.1);
    border-top: 4px solid #2196f3;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 0 auto 20px;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

#loading div:last-child {
    font-size: 16px;
    font-weight: 500;
    color: #b3e5fc;
}

/* ================= NO CHANNELS MESSAGE ================= */
#no-channels {
    padding: 40px 30px;
    text-align: center;
    color: #666;
    font-style: italic;
    font-size: 14px;
}

/* ================= RESPONSIVE DESIGN ================= */
@media (max-width: 1024px) {
    #sidebar {
        width: 320px;
    }
}

@media (max-width: 900px) {
    body { 
        flex-direction: column; 
    }
    
    #sidebar { 
        width: 100%; 
        height: 350px; 
        border-right: none;
        border-bottom: 1px solid #222;
    }
    
    #sidebar-header {
        padding: 15px;
    }
    
    #playlist-selector {
        overflow-x: auto;
        flex-wrap: nowrap;
        padding-bottom: 5px;
    }
    
    .playlist-tab {
        flex-shrink: 0;
    }
    
    #now-playing, #playlist-info, #quality-info {
        font-size: 11px;
        padding: 8px 12px;
    }
    
    #now-playing {
        max-width: 300px;
    }
}

@media (max-width: 480px) {
    #sidebar-header h3 {
        font-size: 16px;
    }
    
    .channel {
        padding: 12px 15px 12px 25px;
    }
    
    .channel img {
        width: 30px;
        height: 30px;
        margin-right: 10px;
    }
    
    .channel-name {
        font-size: 13px;
    }
    
    #upload-playlist {
        padding: 15px;
    }
    
    .upload-btn {
        padding: 10px;
        font-size: 12px;
    }
}

/* ================= SCROLLBAR STYLING ================= */
#sidebar::-webkit-scrollbar {
    width: 6px;
}

#sidebar::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.05);
}

#sidebar::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.2);
    border-radius: 3px;
}

#sidebar::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.3);
      }
