:root {
    --bg-deep: #000000;
    --bg-elevated: #09090b;
    --bg-hover: #18181b;
    --border: #27272a;
    --border-hover: #3f3f46;
    --text-primary: #f4f4f5;
    --text-secondary: #a1a1aa;
    --accent: #ffffff;
    --accent-glow: rgba(255, 255, 255, 0.1);
    --playing: #ffffff; /* Sleek white to match the brand vibe */
    --easing: cubic-bezier(0.16, 1, 0.3, 1);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    -webkit-font-smoothing: antialiased;
}

body {
    background-color: var(--bg-deep);
    color: var(--text-primary);
    line-height: 1.5;
    min-height: 100vh;
    overflow-x: hidden;
    position: relative;
    background-image: radial-gradient(circle at 50% -20%, rgba(255,255,255,0.03) 0%, transparent 50%);
}

/* Navbar */
.navbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 24px;
    height: 48px;
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 0;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    z-index: 100;
}

.brand {
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 16px;
    font-weight: 600;
    letter-spacing: 2px;
    color: var(--text-primary);
    text-transform: uppercase;
}

.brand-dot {
    width: 6px;
    height: 6px;
    background-color: var(--text-primary);
    border-radius: 50%;
}

.categories {
    display: flex;
    gap: 6px;
}

.nav-btn {
    background: transparent;
    border: 1px solid transparent;
    color: var(--text-secondary);
    font-size: 12px;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    padding: 6px 14px;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.3s var(--easing);
}

.nav-btn:hover {
    color: var(--text-primary);
    background: var(--bg-hover);
}

.nav-btn.active {
    color: #000;
    background-color: var(--text-primary);
}

.search-box {
    position: relative;
    display: flex;
    align-items: center;
    width: 200px;
}

.search-box i {
    position: absolute;
    left: 12px;
    color: var(--text-secondary);
    font-size: 14px;
}

.search-box input {
    width: 100%;
    background: transparent;
    border: 1px solid var(--border);
    color: var(--text-primary);
    padding: 8px 12px 8px 34px;
    border-radius: 6px;
    font-size: 12px;
    outline: none;
    transition: all 0.3s var(--easing);
}

.search-box input:focus {
    border-color: var(--text-primary);
}

/* Main Container */
.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 40px 20px;
}

/* Player Section */
.player-wrapper {
    margin-bottom: 60px;
    position: relative;
    border-radius: 12px;
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    padding: 4px;
}

#videoPlayer {
    width: 100%;
    aspect-ratio: 16 / 9;
    background-color: #000;
    border-radius: 8px;
    object-fit: contain;
}

/* Overlays */
.player-overlay, .error-overlay {
    position: absolute;
    top: 4px; left: 4px; right: 4px; bottom: 4px;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(10px);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
    transition: opacity 0.4s var(--easing);
    z-index: 10;
}

.player-overlay.hidden, .error-overlay.hidden {
    opacity: 0;
    pointer-events: none;
}

.player-overlay i {
    font-size: 48px;
    color: var(--text-secondary);
}

.error-overlay i {
    font-size: 40px;
    color: var(--text-secondary);
    margin-bottom: 12px;
}

.error-overlay h3 {
    font-size: 16px;
    font-weight: 500;
    margin-bottom: 4px;
    letter-spacing: 0.5px;
}

.error-overlay p {
    color: var(--text-secondary);
    font-size: 13px;
    margin-bottom: 24px;
}

.cors-btn {
    background: var(--bg-hover);
    color: var(--text-primary);
    text-decoration: none;
    padding: 8px 16px;
    border-radius: 6px;
    font-size: 12px;
    display: flex;
    align-items: center;
    gap: 8px;
    border: 1px solid var(--border);
    transition: all 0.2s;
    cursor: pointer;
}

.cors-btn:hover {
    border-color: var(--text-primary);
    background: transparent;
}

/* Player Info */
.player-info {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    margin-top: 10px;
    padding: 0 8px;
}

.now-playing-label {
    font-size: 10px;
    font-weight: 600;
    letter-spacing: 2px;
    color: var(--text-secondary);
    margin-bottom: 8px;
    display: block;
    text-transform: uppercase;
}

#nowPlayingTitle {
    font-size: 28px;
    font-weight: 300;
    letter-spacing: -0.5px;
    color: var(--text-primary);
}

.btn-icon {
    background: transparent;
    border: 1px solid var(--border);
    width: 32px;
    height: 32px;
    border-radius: 6px;
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.3s var(--easing);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
}

.btn-icon:hover {
    border-color: var(--text-primary);
    color: var(--text-primary);
}

.btn-icon.active {
    color: #fff;
    border-color: #fff;
}

.btn-icon.active i::before {
    content: "\eb77"; /* ri-heart-fill */
}

/* Channels Section */
.channels-section {
    margin-top: 40px;
    width: 100%;
    border-top: 1px solid var(--border);
    padding-top: 24px;
    display: flex;
    flex-direction: column;
}

.section-header {
    display: flex;
    align-items: baseline;
    gap: 16px;
    margin-bottom: 20px;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--border);
}

#sectionTitle {
    font-size: 16px;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.count-badge {
    font-size: 11px;
    color: var(--text-secondary);
}

.channels-grid {
    display: flex;
    flex-wrap: nowrap;
    overflow-x: auto;
    gap: 16px;
    padding-bottom: 16px;
    scroll-behavior: smooth;
    -webkit-overflow-scrolling: touch;
    transition: opacity 0.2s cubic-bezier(0.16, 1, 0.3, 1), transform 0.2s cubic-bezier(0.16, 1, 0.3, 1);
    opacity: 1;
    transform: translateY(0);
}

.channels-grid.animating {
    opacity: 0;
    transform: translateY(12px);
}

/* Custom Scrollbars for the horizontal list */
.channels-grid::-webkit-scrollbar {
    height: 6px;
}
.channels-grid::-webkit-scrollbar-track {
    background: transparent;
}
.channels-grid::-webkit-scrollbar-thumb {
    background: var(--border);
    border-radius: 3px;
}
.channels-grid::-webkit-scrollbar-thumb:hover {
    background: var(--border-hover);
}

.channel-card {
    flex: 0 0 260px;
    padding: 16px;
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s var(--easing);
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.channel-card:hover {
    border-color: var(--border-hover);
    background: var(--bg-hover);
}

.channel-card.playing {
    border-left: 3px solid var(--playing);
    background: var(--bg-hover);
    padding-left: 13px; /* Adjust padding to compensate for border width */
}

.card-top {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.channel-cat {
    font-size: 10px;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    gap: 6px;
}

/* Indicator dot for playing state */
.playing-indicator {
    width: 6px;
    height: 6px;
    background-color: var(--playing);
    border-radius: 50%;
    box-shadow: 0 0 8px rgba(255, 255, 255, 0.4);
}

.quality-badge {
    font-size: 9px;
    font-weight: 600;
    letter-spacing: 0.5px;
    padding: 2px 4px;
    border-radius: 4px;
    border: 1px solid var(--border);
    color: var(--text-secondary);
}

.quality-badge.high {
    color: var(--text-primary);
    border-color: rgba(255,255,255,0.3);
}

.channel-name {
    font-size: 14px;
    font-weight: 400;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Toast Notifications */
.toast-container {
    position: fixed;
    top: 24px;
    right: 24px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    z-index: 1000;
    pointer-events: none;
}

.toast {
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    color: var(--text-primary);
    padding: 12px 16px;
    border-radius: 6px;
    font-size: 12px;
    display: flex;
    align-items: center;
    gap: 10px;
    box-shadow: 0 8px 24px rgba(0,0,0,0.5);
    transform: translateX(120%);
    opacity: 0;
    transition: transform 0.4s var(--easing), opacity 0.4s var(--easing);
}

.toast.show {
    transform: translateX(0);
    opacity: 1;
}

.toast i {
    font-size: 16px;
    color: var(--text-secondary);
}

.toast.success i { color: #10b981; }
.toast.info i { color: #3b82f6; }
.toast.warning i { color: #f59e0b; }
.toast.error i { color: #ef4444; }

/* Settings Modal */
.modal-backdrop {
    position: fixed;
    top: 0; left: 0; width: 100vw; height: 100vh;
    background: rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(5px);
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 1;
    transition: opacity 0.3s var(--easing);
}
.modal-backdrop.hidden { opacity: 0; pointer-events: none; }
.settings-modal {
    width: 100%;
    max-width: 480px;
    background: var(--bg-deep);
    border: 1px solid var(--border);
    border-radius: 12px;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}
.modal-header {
    display: flex;
    justify-content: space-between;
    padding: 16px 20px;
    border-bottom: 1px solid var(--border);
}
.modal-header h3 { font-size: 14px; font-weight: 500; }
.close-btn { background: none; border: none; color: var(--text-secondary); font-size: 20px; cursor: pointer; }
.close-btn:hover { color: var(--text-primary); }
.modal-body { padding: 20px; overflow-y: auto; display: flex; flex-direction: column; gap: 24px; }
.settings-section h4 { font-size: 11px; text-transform: uppercase; letter-spacing: 1px; color: var(--text-secondary); margin-bottom: 8px; }
.section-desc { font-size: 12px; color: var(--text-secondary); line-height: 1.5; margin-bottom: 12px; }
.upload-dropzone { border: 1px dashed var(--border); padding: 24px; border-radius: 8px; text-align: center; cursor: pointer; }
.upload-dropzone:hover { border-color: var(--text-secondary); background: var(--bg-hover); }
.upload-status { margin-top: 8px; font-size: 11px; padding: 6px; border-radius: 4px; text-align: center; }
.upload-status.success { color: #10b981; }
.upload-status.error { color: #ef4444; }
.danger-btn { background: rgba(239, 68, 68, 0.1); border: 1px solid rgba(239, 68, 68, 0.2); color: #ef4444; padding: 6px 12px; border-radius: 4px; cursor: pointer; font-size: 11px; }
.danger-btn:hover { background: rgba(239, 68, 68, 0.2); }
.primary-btn { background: var(--text-primary); color: #000; font-weight: 500; text-align: center; justify-content: center; width: 100%; border: none; }
.primary-btn:hover { background: #fff; }

@media (max-width: 768px) {
    .navbar { flex-direction: column; height: auto; padding: 16px; gap: 16px; }
    .categories { overflow-x: auto; width: 100%; padding-bottom: 8px; }
    .search-box { width: 100%; }
    .container { padding: 20px; }
    #videoPlayer { aspect-ratio: 16 / 9; }
}

@media (min-width: 1024px) {
    body {
        overflow: hidden;
    }
    .container {
        display: grid;
        grid-template-columns: minmax(0, calc((100vh - 135px) * 16 / 9)) 1fr;
        gap: 24px;
        max-width: 100%;
        height: calc(100vh - 48px);
        padding: 8px 24px 8px 12px;
        margin: 0 auto;
        align-items: center;
        overflow: hidden;
    }
    .player-wrapper {
        height: 100%;
        display: flex;
        flex-direction: column;
        justify-content: center;
        margin-bottom: 0;
        background: transparent;
        border: none;
        padding: 0;
    }
    #videoPlayer, #youtubePlayer {
        width: 100%;
        aspect-ratio: 16 / 9;
        max-height: calc(100vh - 135px);
        object-fit: contain;
    }
    .player-overlay, .error-overlay {
        top: 0; left: 0; right: 0; bottom: auto;
        aspect-ratio: 16 / 9;
        border-radius: 8px;
    }
    #nowPlayingTitle {
        font-size: 22px;
    }
    .section-header {
        margin-bottom: 12px;
        padding-bottom: 8px;
    }
    #sectionTitle {
        font-size: 14px;
    }
    .channels-section {
        height: 100%;
        display: flex;
        flex-direction: column;
        overflow: hidden;
        margin-top: 0;
        border-top: none;
        padding-top: 0;
    }
    .channels-grid {
        display: grid;
        grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
        gap: 12px;
        overflow-y: auto;
        flex-grow: 1;
        padding-right: 8px;
        padding-bottom: 0;
    }
    .channels-grid::-webkit-scrollbar {
        width: 4px;
        height: 0;
    }
    .channels-grid::-webkit-scrollbar-track {
        background: transparent;
    }
    .channels-grid::-webkit-scrollbar-thumb {
        background: var(--border);
        border-radius: 2px;
    }
    .channels-grid::-webkit-scrollbar-thumb:hover {
        background: var(--border-hover);
    }
    .channel-card {
        flex: 1 1 auto;
        padding: 10px 12px;
        gap: 6px;
        border-radius: 6px;
    }
    .channel-name {
        font-size: 13px;
    }
    .channel-cat {
        font-size: 9px;
    }
    .quality-badge {
        font-size: 8px;
        padding: 1px 3px;
    }
}

.ambient-bg {
    display: none !important;
}
