/* --- RESET & FONTS --- */
:root {
    --bg-color: #050505;
    --text-main: #e0e0e0;
    --neon-green: #39ff14;
    --neon-pink: #ff00ff;
    --neon-cyan: #00ffff;
    --neon-yellow: #ffff00;
    --scan-line-color: rgba(18, 16, 16, 0.3);
    --border-thick: 2px solid var(--text-main);
    --font-mono: 'Courier New', Courier, monospace; /* Fallback for pixel feel */
    --font-display: 'Impact', 'Arial Black', sans-serif;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    scrollbar-width: thin;
    scrollbar-color: var(--neon-green) var(--bg-color);
}

body {
    background-color: var(--bg-color);
    color: var(--text-main);
    font-family: var(--font-mono);
    height: 100vh;
    overflow: hidden; /* App-like feel */
    display: flex;
    flex-direction: column;
}

/* --- CRT & GLITCH OVERLAYS --- */
.crt-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 10;
    background:
        linear-gradient(rgba(18, 16, 16, 0) 50%, rgba(0, 0, 0, 0.25) 50%),
        linear-gradient(90deg, rgba(255, 0, 0, 0.06), rgba(0, 255, 0, 0.02), rgba(0, 0, 255, 0.06));
    background-size: 100% 4px, 6px 100%;
    animation: flicker 0.15s infinite;
}

/* Scanline animation */
.crt-overlay::before {
    content: " ";
    display: block;
    position: absolute;
    top: 0;
    left: 0;
    bottom: 0;
    right: 0;
    background: rgba(18, 16, 16, 0.1);
    opacity: 0;
    z-index: 2;
    animation: scanline 8s linear infinite;
}

@keyframes flicker {
    0% { opacity: 0.9; }
    50% { opacity: 0.95; }
    100% { opacity: 0.9; }
}

@keyframes scanline {
    0% { transform: translateY(-100%); opacity: 0.1; }
    100% { transform: translateY(100%); opacity: 0.1; }
}

/* --- LAYOUT --- */
.header {
    height: 60px;
    border-bottom: var(--border-thick);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 20px;
    background: #000;
}

.brand {
    font-family: var(--font-display);
    font-size: 2rem;
    letter-spacing: -1px;
    color: var(--neon-cyan);
    text-shadow: 2px 2px var(--neon-pink);
    text-transform: uppercase;
}

.logo-img {
    height: 40px;
    width: auto;
    vertical-align: middle;
    margin-right: 5px;
}

.user-controls button {
    background: transparent;
    border: 1px solid var(--text-main);
    color: var(--text-main);
    padding: 5px 15px;
    font-family: var(--font-mono);
    cursor: pointer;
    text-transform: uppercase;
    font-weight: bold;
}

.user-controls button:hover {
    background: var(--text-main);
    color: var(--bg-color);
}

.main-grid {
    display: flex;
    flex: 1;
    overflow: hidden;
    height: calc(100vh - 60px);
}

/* --- LEFT COLUMN: STAGE --- */
.stage-col {
    width: 75%;
    border-right: var(--border-thick);
    display: flex;
    flex-direction: column;
    background: #080808;
}

.video-container {
    flex: 1;
    position: relative;
    background: #111;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

/* Glitchy Background for Video */
.video-placeholder {
    width: 100%;
    height: 100%;
    object-fit: cover;
    opacity: 1;
    filter: contrast(1.2) saturate(1.5);
    z-index: 1;
    position: relative;
}

#main-feed-video {
    width: 100%;
    height: 100%;
    z-index: 25;
    position: relative;
}

.glitch-noise {
    position: absolute;
    top: 0; left: 0; right: 0; bottom: 0;
    background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 200 200' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noiseFilter'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.65' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noiseFilter)' opacity='0.4'/%3E%3C/svg%3E");
    mix-blend-mode: overlay;
    opacity: 0.3;
}

/* Overlays */
.overlay-top-left {
    position: absolute;
    top: 20px;
    left: 20px;
    display: flex;
    align-items: center;
    gap: 10px;
    z-index: 30;
}

.live-badge {
    background: var(--neon-pink);
    color: #000;
    padding: 5px 10px;
    font-weight: 900;
    font-size: 1.2rem;
    font-family: var(--font-display);
}

.viewer-count {
    background: rgba(0,0,0,0.8);
    border: 1px solid var(--neon-green);
    color: var(--neon-green);
    padding: 5px 10px;
    font-size: 0.9rem;
    letter-spacing: 1px;
}

@keyframes blink {
    to { visibility: hidden; }
}

/* Channel Switcher */
.channel-bar {
    height: 140px;
    background: #000;
    border-top: var(--border-thick);
    display: flex;
    padding: 10px;
    gap: 10px;
    overflow-x: auto;
}

.channel-btn {
    flex: 1;
    min-width: 120px;
    background: #111;
    border: 1px solid #333;
    position: relative;
    cursor: pointer;
    transition: all 0.1s;
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
    padding: 10px;
    overflow: hidden;
}

.channel-btn:hover {
    border-color: var(--text-main);
}

/* Active Channel State */
.channel-btn.active {
    border: 2px solid var(--neon-green);
    box-shadow: 0 0 15px var(--neon-green), inset 0 0 10px var(--neon-green);
    background: #0a0f0a;
    transform: scale(1.02);
    z-index: 2;
}

.channel-btn.active .ch-name {
    color: var(--neon-green);
    text-shadow: 2px 0 var(--neon-pink);
}

.ch-preview {
    position: absolute;
    top: 0; left: 0; width: 100%; height: 100%;
    background-size: cover;
    background-position: center;
    opacity: 0.3;
    transition: opacity 0.2s;
    filter: grayscale(100%);
    z-index: 0;
}

.channel-btn:hover .ch-preview {
    opacity: 0.5;
}

.channel-btn.active .ch-preview {
    opacity: 0.2;
    filter: grayscale(0%) sepia(100%) hue-rotate(90deg);
}

.ch-info {
    position: relative;
    z-index: 1;
    background: rgba(0,0,0,0.8);
    padding: 5px;
    backdrop-filter: blur(2px);
}

.ch-num {
    font-size: 0.7rem;
    color: #666;
    margin-bottom: 2px;
}

.ch-name {
    font-family: var(--font-display);
    font-size: 1.2rem;
    color: #fff;
    text-transform: uppercase;
}

/* --- RIGHT COLUMN: SIDEBAR --- */
.sidebar-col {
    width: 25%;
    display: flex;
    flex-direction: column;
    background: #0a0a0a;
    position: relative;
}

/* Now Playing Modal */
.now-playing-modal {
    background: #000;
    border-bottom: var(--border-thick);
    padding: 15px;
    position: relative;
    overflow: hidden;
}

.now-playing-modal::before {
    content: "";
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 200 200' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noiseFilter'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noiseFilter)' opacity='0.08'/%3E%3C/svg%3E");
    pointer-events: none;
    z-index: 0;
}

.now-playing-header {
    font-family: var(--font-display);
    font-size: 0.9rem;
    color: var(--neon-cyan);
    letter-spacing: 2px;
    margin-bottom: 10px;
    text-shadow: 0 0 10px var(--neon-cyan);
    position: relative;
    z-index: 1;
}

.now-playing-content {
    position: relative;
    z-index: 1;
}

.np-channel {
    font-family: var(--font-mono);
    font-size: 0.85rem;
    color: #888;
    margin-bottom: 5px;
    letter-spacing: 1px;
}

.np-program {
    font-family: var(--font-display);
    font-size: 1.3rem;
    color: var(--neon-green);
    text-transform: uppercase;
    line-height: 1.2;
    margin-bottom: 8px;
    text-shadow: 2px 0 var(--neon-pink);
}

.np-status {
    display: flex;
    align-items: center;
    gap: 8px;
}

.np-live-indicator {
    width: 10px;
    height: 10px;
    background: var(--neon-pink);
    border-radius: 50%;
    animation: pulse 1.5s ease-in-out infinite;
    box-shadow: 0 0 10px var(--neon-pink);
}

@keyframes pulse {
    0%, 100% { opacity: 1; transform: scale(1); }
    50% { opacity: 0.5; transform: scale(0.9); }
}

.np-live-text {
    font-family: var(--font-mono);
    font-size: 0.75rem;
    color: var(--neon-pink);
    font-weight: bold;
    letter-spacing: 2px;
}

/* Tabs */
.sidebar-tabs {
    display: flex;
    border-bottom: var(--border-thick);
}

.tab-btn {
    flex: 1;
    padding: 15px;
    background: #000;
    border: none;
    color: #666;
    font-family: var(--font-display);
    font-size: 1.2rem;
    cursor: pointer;
    text-transform: uppercase;
    border-right: 1px solid #333;
}

.tab-btn.active {
    background: var(--neon-pink);
    color: #000;
    font-weight: 900;
}

.tab-btn:hover:not(.active) {
    background: #111;
    color: #fff;
}

/* Chat Area */
.sidebar-content {
    flex: 1;
    overflow-y: auto;
    position: relative;
}

/* Noise texture for chat bg */
.sidebar-content::before {
    content: "";
    position: absolute;
    top:0; left:0; right:0; bottom:0;
    background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 200 200' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noiseFilter'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.8' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noiseFilter)' opacity='0.05'/%3E%3C/svg%3E");
    pointer-events: none;
    z-index: 0;
}

#chat-stream {
    padding: 15px;
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
    min-height: 100%;
    gap: 8px;
    z-index: 1;
    position: relative;
}

.chat-msg {
    font-size: 0.85rem;
    line-height: 1.4;
    word-break: break-word;
    padding: 4px 0;
    border-bottom: 1px solid rgba(255,255,255,0.05);
    animation: slideIn 0.1s ease-out;
}

@keyframes slideIn {
    from { transform: translateX(10px); opacity: 0; }
    to { transform: translateX(0); opacity: 1; }
}

.user-name {
    font-weight: bold;
    margin-right: 8px;
}

.sys-msg {
    color: var(--neon-yellow);
    font-style: italic;
    border: 1px dashed var(--neon-yellow);
    padding: 5px;
    margin: 5px 0;
    text-align: center;
}

/* Schedule Area (Hidden by default) */
#schedule-view {
    display: none;
    padding: 20px;
    z-index: 1;
    position: relative;
}

.schedule-item {
    margin-bottom: 25px;
    border-left: 4px solid #333;
    padding-left: 15px;
    transition: 0.2s;
}

.schedule-item:hover {
    border-left-color: var(--neon-cyan);
}

.time {
    font-size: 1.4rem;
    font-family: var(--font-display);
    color: var(--neon-cyan);
    display: block;
    margin-bottom: 5px;
}

.show-title {
    font-size: 1rem;
    font-weight: bold;
    text-transform: uppercase;
    color: #fff;
    margin-bottom: 5px;
    display: block;
}

.show-desc {
    font-size: 0.8rem;
    color: #888;
}

/* Input Area */
.chat-input-area {
    border-top: var(--border-thick);
    padding: 15px;
    background: #000;
    display: flex;
    gap: 10px;
}

.chat-input {
    flex: 1;
    background: #111;
    border: 1px solid #333;
    color: var(--text-main);
    padding: 10px;
    font-family: var(--font-mono);
    font-size: 0.9rem;
}

.chat-input:focus {
    outline: none;
    border-color: var(--neon-pink);
    background: #1a051a;
}

.send-btn {
    background: var(--neon-green);
    border: none;
    color: #000;
    font-weight: bold;
    padding: 0 20px;
    font-family: var(--font-display);
    cursor: pointer;
    text-transform: uppercase;
}

.send-btn:hover {
    background: #fff;
    box-shadow: 4px 4px 0 var(--neon-pink);
    transform: translate(-2px, -2px);
}

/* Responsive Breakpoints */
@media (max-width: 1024px) {
    body {
        overflow-y: auto;
    }
    .main-grid {
        flex-direction: column;
        height: auto;
        overflow: visible;
    }
    .stage-col, .sidebar-col {
        width: 100%;
        height: auto;
    }
    .video-container {
        min-height: 50vh;
    }
    .sidebar-col {
        height: 500px;
    }
}
