:root {
    --bg-color: #0d0e15;
    --panel-bg: rgba(25, 27, 40, 0.65);
    --panel-border: rgba(255, 255, 255, 0.08);
    --accent-primary: #ff3366;
    --accent-secondary: #7e57c2;
    --text-primary: #f0f0f5;
    --text-muted: #8b8d99;
    --green: #00e676;
    --red: #ff3b3b;
    --yellow: #ffb83b;
}

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

body {
    font-family: 'Outfit', sans-serif;
    background: var(--bg-color);
    color: var(--text-primary);
    height: 100vh;
    overflow: hidden;
}

/* Ambient blobs */
body::before {
    content: '';
    position: fixed; top: -20%; left: -10%;
    width: 50vw; height: 50vw;
    background: radial-gradient(circle, rgba(126,87,194,0.15) 0%, transparent 70%);
    filter: blur(80px); z-index: -1; pointer-events: none;
}
body::after {
    content: '';
    position: fixed; bottom: -20%; right: -10%;
    width: 60vw; height: 60vw;
    background: radial-gradient(circle, rgba(255,51,102,0.1) 0%, transparent 70%);
    filter: blur(80px); z-index: -1; pointer-events: none;
}

/* ── App shell ──────────────────────────────────────────────── */
.app-container { display: flex; flex-direction: column; height: 100vh; }

.glass-panel {
    background: var(--panel-bg);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid var(--panel-border);
    border-radius: 12px;
}
.glass-inset {
    background: rgba(0,0,0,0.35);
    border: 1px solid rgba(0,0,0,0.5);
    border-bottom-color: rgba(255,255,255,0.04);
    border-radius: 8px;
    padding: 12px;
}

/* ── Header ─────────────────────────────────────────────────── */
.app-header {
    display: flex; align-items: center; justify-content: space-between;
    padding: 12px 24px; margin: 12px; flex-shrink: 0;
    gap: 12px;
}
.logo { display: flex; align-items: center; gap: 10px; }
.logo h1 { font-weight: 800; font-size: 1.4rem; }
.logo-icon { font-size: 20px; }
.version-tag {
    font-size: 11px; font-weight: 600; color: var(--text-muted);
    background: rgba(255,255,255,0.06); border-radius: 4px;
    padding: 2px 7px; letter-spacing: 0.5px;
}
.header-center { display: flex; align-items: center; gap: 10px; }
.live-badge {
    background: var(--red); color: white; font-weight: 800;
    font-size: 11px; padding: 3px 8px; border-radius: 4px;
    animation: blink 1.4s infinite;
}
.nav-link {
    color: var(--text-muted);
    text-decoration: none;
    font-size: 14px;
    font-weight: 600;
    transition: color 0.2s;
    padding: 4px 8px;
    border-radius: 4px;
}
.nav-link:hover { color: var(--text-primary); background: rgba(255,255,255,0.05); }
.nav-link.active { color: var(--accent-primary); }

/* ── Properties Panel ────────────────────────────────────────── */
.properties-panel {
    display: flex; flex-direction: column; gap: 10px;
    background: rgba(0,0,0,0.3); padding: 12px; border-radius: 6px;
    border: 1px solid var(--panel-border);
}
.prop-row {
    display: flex; gap: 8px; align-items: center;
}
.prop-label {
    width: 60px; font-size: 11px; color: var(--text-muted); font-weight: 600; text-transform: uppercase;
}
.prop-input {
    flex: 1; background: rgba(0,0,0,0.5); border: 1px solid rgba(255,255,255,0.1);
    color: var(--text-primary); padding: 4px 8px; border-radius: 4px;
    font-size: 12px; font-family: 'Outfit', sans-serif;
    outline: none; transition: border-color 0.2s;
}
.prop-input:focus { border-color: var(--accent-primary); }
.source-item.active-source > .source-item-top {
    background: rgba(126,87,194,0.15); /* Soft purple highlight */
    border-radius: 4px; padding-left: 4px; margin-left: -4px;
    box-shadow: inset 2px 0 0 var(--accent-secondary);
}
#stream-timer { font-weight: 700; font-size: 15px; letter-spacing: 1px; font-family: monospace; }
.status-badge {
    display: flex; align-items: center; gap: 8px;
    font-size: 12px; font-weight: 600;
    padding: 5px 12px; background: rgba(0,0,0,0.4); border-radius: 20px;
}
.indicator { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; }

.indicator.red    { background: var(--red);    box-shadow: 0 0 7px var(--red); }
.indicator.yellow { background: var(--yellow); box-shadow: 0 0 7px var(--yellow); }
.indicator.green  { background: var(--green);  box-shadow: 0 0 7px var(--green); }

/* ── Workspace ──────────────────────────────────────────────── */
.workspace {
    display: flex; flex: 1; min-height: 0;
    padding: 0 12px 12px; gap: 12px; overflow: hidden;
}

/* ── Sidebars ───────────────────────────────────────────────── */
.sidebar {
    width: 272px; flex-shrink: 0;
    display: flex; flex-direction: column;
    padding: 16px; overflow-y: auto;
    scrollbar-width: thin;
    scrollbar-color: rgba(255,255,255,0.12) transparent;
}
.sidebar::-webkit-scrollbar { width: 4px; }
.sidebar::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.12); border-radius: 3px; }

.panel-section { margin-bottom: 16px; }
.panel-heading {
    font-size: 10px; font-weight: 700;
    text-transform: uppercase; letter-spacing: 1.3px;
    color: var(--text-muted); margin-bottom: 10px;
    display: flex; align-items: center; justify-content: space-between;
}
.subtitle { font-size: 11px; color: var(--text-muted); margin-bottom: 10px; line-height: 1.4; }
.divider { height: 1px; background: var(--panel-border); margin: 14px 0; flex-shrink: 0; }

.item-list { list-style: none; margin-bottom: 10px; }
.item-list li {
    padding: 8px 11px; background: rgba(255,255,255,0.03);
    border-radius: 6px; margin-bottom: 5px; cursor: pointer;
    transition: background 0.18s; font-size: 13px;
}
.item-list li:hover { background: rgba(255,255,255,0.07); }
.item-list li.active {
    background: linear-gradient(90deg, rgba(126,87,194,0.22), transparent);
    border-left: 3px solid var(--accent-secondary);
}

.badge {
    background: rgba(126,87,194,0.28); color: var(--accent-secondary);
    border-radius: 10px; padding: 1px 7px; font-size: 10px; font-weight: 700;
}

/* ── Buttons ────────────────────────────────────────────────── */
.btn {
    width: 100%; padding: 10px 16px; border-radius: 8px;
    font-family: inherit; font-weight: 600; font-size: 13px;
    cursor: pointer; border: none; outline: none;
    transition: transform 0.2s, box-shadow 0.2s, filter 0.2s;
}
.btn:focus-visible { outline: 2px solid var(--accent-secondary); outline-offset: 2px; }
.btn.small { padding: 7px 11px; font-size: 12px; }
.btn.huge  { padding: 16px 20px; font-size: 16px; font-weight: 800; }
.btn.primary {
    background: linear-gradient(135deg, var(--accent-primary), var(--accent-secondary));
    color: white; box-shadow: 0 4px 14px rgba(255,51,102,0.3);
}
.btn.primary:hover { transform: translateY(-2px); box-shadow: 0 8px 22px rgba(255,51,102,0.5); filter: brightness(1.08); }
.btn.danger { background: #c0392b; color: white; box-shadow: 0 4px 14px rgba(192,57,43,0.3); }
.btn.danger:hover { background: #e74c3c; }
.btn.secondary { background: rgba(255,255,255,0.05); color: var(--text-primary); border: 1px solid rgba(255,255,255,0.1); }
.btn.secondary:hover { background: rgba(255,255,255,0.09); }
.source-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }

/* ── Input groups ───────────────────────────────────────────── */
.input-group { margin-bottom: 9px; }
.input-group input[type="text"],
.input-group input[type="password"] {
    width: 100%; background: rgba(0,0,0,0.45);
    border: 1px solid var(--panel-border); padding: 9px 11px;
    border-radius: 6px; color: var(--text-primary);
    font-family: 'Outfit', sans-serif; font-size: 13px; outline: none;
    transition: border-color 0.2s, box-shadow 0.2s;
}
.input-group input:focus { border-color: var(--accent-secondary); box-shadow: 0 0 0 3px rgba(126,87,194,0.18); }

/* ── Canvas area ────────────────────────────────────────────── */
.preview-area {
    flex: 1; min-width: 0;
    display: flex; flex-direction: column;
    gap: 10px; align-items: stretch;
}
.canvas-wrapper {
    flex: 1; min-height: 0;
    position: relative; overflow: hidden; background: #000; padding: 0;
}
canvas { display: block; width: 100%; height: 100%; object-fit: contain; }
.canvas-overlays {
    position: absolute; top: 12px; left: 12px; right: 12px;
    display: flex; justify-content: space-between; pointer-events: none;
}
.resolution-badge {
    background: rgba(0,0,0,0.65); padding: 3px 9px;
    border-radius: 4px; font-size: 10px; font-weight: 600;
    backdrop-filter: blur(4px);
}
.recording-indicator {
    color: #ff5555; font-weight: 800; font-size: 12px; letter-spacing: 1px;
    animation: blink 1.4s infinite;
    background: rgba(0,0,0,0.6); padding: 3px 9px; border-radius: 4px;
}
@keyframes blink { 0%,100%{opacity:1} 50%{opacity:0.2} }
.hidden { display: none !important; }

/* ── A/V Controls Bar ───────────────────────────────────────── */
.av-controls-bar {
    display: flex; align-items: center; gap: 18px;
    padding: 10px 16px; flex-shrink: 0; flex-wrap: wrap;
}
.av-group {
    display: flex; align-items: center; gap: 8px; font-size: 12px;
}
.av-group label { color: var(--text-muted); font-weight: 600; white-space: nowrap; }
.av-divider { width: 1px; height: 24px; background: var(--panel-border); }
.vol-slider {
    -webkit-appearance: none; appearance: none;
    width: 90px; height: 4px;
    background: rgba(255,255,255,0.15); border-radius: 2px; outline: none; cursor: pointer;
}
.vol-slider::-webkit-slider-thumb {
    -webkit-appearance: none; width: 14px; height: 14px; border-radius: 50%;
    background: var(--accent-primary); cursor: pointer;
    box-shadow: 0 0 6px rgba(255,51,102,0.5);
}
.vol-label { font-size: 11px; color: var(--text-muted); min-width: 34px; }
.av-btn {
    background: rgba(255,255,255,0.06); border: 1px solid rgba(255,255,255,0.1);
    border-radius: 6px; padding: 4px 8px; cursor: pointer; font-size: 14px;
    color: var(--text-primary); transition: background 0.15s;
}
.av-btn:hover { background: rgba(255,255,255,0.13); }
.av-btn.muted { color: var(--red); }
.av-select {
    background: rgba(0,0,0,0.45); border: 1px solid var(--panel-border);
    color: var(--text-primary); padding: 5px 8px; border-radius: 6px;
    font-family: inherit; font-size: 12px; cursor: pointer; outline: none;
}
.av-select:focus { border-color: var(--accent-secondary); }

/* ── Platform cards ─────────────────────────────────────────── */
.platform-cards-list { display: flex; flex-direction: column; gap: 7px; }
.platform-card {
    display: flex; justify-content: space-between; align-items: center;
    padding: 10px 12px; border-radius: 8px;
    background: rgba(255,255,255,0.03);
    border: 1px solid var(--panel-border);
    transition: border-color 0.2s, background 0.2s;
}
.platform-card.configured {
    border-color: rgba(0,230,118,0.25);
    background: rgba(0,230,118,0.04);
}
.platform-card-left { display: flex; align-items: center; gap: 10px; }
.platform-dot-lg {
    width: 10px; height: 10px; border-radius: 50%; flex-shrink: 0;
}
.platform-name { font-size: 13px; font-weight: 600; }
.platform-status { font-size: 10px; margin-top: 2px; }
.platform-status.ok { color: var(--green); }
.platform-status.empty { color: var(--text-muted); }
.platform-hint { font-size: 10px; color: var(--text-muted); margin-top: 4px; line-height: 1.5; opacity: 0.8; }
.platform-dot-twitch  { background: #9146ff; box-shadow: 0 0 6px #9146ff80; }
.platform-dot-youtube { background: #ff0000; box-shadow: 0 0 6px #ff000080; }
.platform-dot-facebook { background: #1877f2; box-shadow: 0 0 6px #1877f280; }
.platform-dot-tiktok  { background: #00f2ea; box-shadow: 0 0 6px #00f2ea80; }
.platform-dot-kick    { background: #53fc18; box-shadow: 0 0 6px #53fc1880; }
.platform-dot-custom  { background: #7e57c2; box-shadow: 0 0 6px #7e57c280; }
.key-modal-hint {
    margin-top: 10px; font-size: 12px; color: var(--text-muted);
    background: rgba(126,87,194,0.1); border: 1px solid rgba(126,87,194,0.2);
    border-radius: 6px; padding: 8px 12px; line-height: 1.5; text-align: left;
}
.key-set-btn {
    background: rgba(126,87,194,0.2); border: 1px solid rgba(126,87,194,0.35);
    color: #c5b3f0; border-radius: 6px; padding: 5px 10px;
    font-family: inherit; font-size: 11px; font-weight: 600;
    cursor: pointer; white-space: nowrap;
    transition: background 0.15s;
}
.key-set-btn:hover { background: rgba(126,87,194,0.35); }
.key-clear-btn {
    background: rgba(255,59,59,0.1); border: 1px solid rgba(255,59,59,0.25);
    color: #ff8080; border-radius: 6px; padding: 5px 10px;
    font-family: inherit; font-size: 11px; font-weight: 600;
    cursor: pointer; white-space: nowrap;
    transition: background 0.15s;
}
.key-clear-btn:hover { background: rgba(255,59,59,0.2); }

/* ── Source list item controls ──────────────────────────────── */
.source-item {
    display: flex; flex-direction: column;
    padding: 6px 10px; gap: 4px;
    background: rgba(255,255,255,0.03); border-radius: 6px;
    margin-bottom: 4px; border: 1px solid transparent;
    transition: border-color 0.15s;
}
.source-item:hover { border-color: rgba(255,255,255,0.08); }
.source-item-top { display: flex; justify-content: space-between; align-items: center; }
.source-label strong { font-size: 13px; font-weight: 600; }
.source-label small { display: block; font-size: 10px; color: var(--text-muted); margin-top: 2px; }
.layer-controls { display: flex; gap: 8px; align-items: center; }
.action-btn {
    background: transparent; border: none; cursor: pointer;
    font-size: 11px; color: var(--text-muted); padding: 2px 4px;
    font-weight: 700;
    transition: color 0.15s, transform 0.15s, text-shadow 0.15s; line-height: 1;
}
.action-btn:hover { color: var(--text-primary); transform: scale(1.18); }
.action-btn.animate-btn:hover { color: #ffdd57; text-shadow: 0 0 8px #ffdd5780; }
.action-btn.remove-btn:hover { color: var(--red); }
.source-av-controls {
    display: flex; align-items: center; gap: 10px;
}
.source-vol-slider {
    -webkit-appearance: none; appearance: none;
    flex: 1; height: 3px;
    background: rgba(255,255,255,0.15); border-radius: 2px; outline: none; cursor: pointer;
}
.source-vol-slider::-webkit-slider-thumb {
    -webkit-appearance: none; width: 12px; height: 12px; border-radius: 50%;
    background: var(--accent-secondary); cursor: pointer;
}
.source-mute-btn {
    background: transparent; border: none; font-size: 14px; cursor: pointer;
    padding: 0; transition: transform 0.15s; color: var(--text-primary);
}
.source-mute-btn:hover { transform: scale(1.2); }
.source-mute-btn.muted { color: var(--red); }
.vu-bar-container {
    height: 3px; background: rgba(255,255,255,0.08); border-radius: 2px; overflow: hidden;
}
.vu-bar { height: 100%; width: 0%; transition: width 0.05s linear; border-radius: 2px; }

/* ── Console ────────────────────────────────────────────────── */
.debug-console { display: flex; flex-direction: column; min-height: 0; }
.console-output {
    flex: 1; min-height: 70px; max-height: 180px;
    overflow-y: auto; font-family: 'Courier New', monospace;
    font-size: 10.5px; line-height: 1.6; color: #50fa7b;
    white-space: pre-wrap; word-break: break-all;
    scrollbar-width: thin; scrollbar-color: rgba(255,255,255,0.1) transparent;
}
.console-output::-webkit-scrollbar { width: 4px; }
.console-output::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.1); border-radius: 3px; }

/* ── Key entry modal ────────────────────────────────────────── */
.key-modal-field {
    width: 100%; background: rgba(0,0,0,0.5);
    border: 1px solid rgba(126,87,194,0.4); padding: 12px 14px;
    border-radius: 8px; color: var(--text-primary);
    font-family: monospace; font-size: 14px; outline: none;
    transition: border-color 0.2s, box-shadow 0.2s;
}
.key-modal-field:focus {
    border-color: var(--accent-secondary);
    box-shadow: 0 0 0 3px rgba(126,87,194,0.2);
}

/* ── Modal shared ───────────────────────────────────────────── */
.modal-overlay {
    position: fixed; inset: 0; background: rgba(0,0,0,0.85);
    z-index: 1000; display: flex; justify-content: center; align-items: center;
    backdrop-filter: blur(8px);
}
.modal-content {
    background: rgba(12,13,22,0.98); width: 100%; max-width: 460px;
    padding: 38px; text-align: center;
    box-shadow: 0 24px 60px rgba(0,0,0,0.7);
}
.modal-content h2 { margin-bottom: 12px; }
.modal-content p { color: var(--text-muted); line-height: 1.6; font-size: 13px; }
.instructions-box { text-align: left; padding: 14px; line-height: 1.7; font-size: 13px; }
.instructions-box code {
    background: rgba(126,87,194,0.2); padding: 1px 5px; border-radius: 3px; font-size: 12px;
}

/* ── Auth tabs ───────────────────────────────────────────────── */
:root { --accent: #c5b3f0; }
.auth-tab {
    flex: 1; background: transparent; border: none; border-bottom: 2px solid transparent;
    color: var(--text-muted); font-family: inherit; font-size: 14px; font-weight: 600;
    padding: 8px 16px; cursor: pointer; transition: color 0.2s, border-color 0.2s;
}
.auth-tab:hover { color: var(--text-primary); }
.auth-tab.active { color: var(--text-primary); border-bottom-color: var(--accent-primary); }

/* ── Catalog / Marketplace ───────────────────────────────────── */
.catalog-container {
    max-width: 1200px;
    margin: 40px auto;
    padding: 0 20px;
}
.catalog-section { margin-bottom: 60px; }
.catalog-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 30px;
}
.catalog-card {
    background: var(--panel-bg);
    border: 1px solid var(--panel-border);
    border-radius: 16px;
    overflow: hidden;
    transition: transform 0.3s, box-shadow 0.3s, border-color 0.3s;
    cursor: pointer;
    position: relative;
}
.catalog-card:hover {
    transform: translateY(-8px);
    box-shadow: 0 20px 40px rgba(0,0,0,0.4);
    border-color: rgba(255,51,102,0.3);
}
.catalog-thumb {
    width: 100%;
    aspect-ratio: 16/9;
    background: #1a1a2e;
    display: flex;
    justify-content: center;
    align-items: center;
    position: relative;
}
.catalog-thumb img { width: 100%; height: 100%; object-fit: cover; }
.catalog-live-tag {
    position: absolute; top: 12px; left: 12px;
    background: var(--red); color: white;
    font-size: 10px; font-weight: 800;
    padding: 3px 8px; border-radius: 4px;
    box-shadow: 0 4px 10px rgba(255,59,59,0.4);
}
.catalog-info { padding: 20px; }
.catalog-title { font-size: 18px; font-weight: 700; margin-bottom: 6px; color: var(--text-primary); }
.catalog-meta { font-size: 12px; color: var(--text-muted); display: flex; justify-content: space-between; }
.catalog-username { color: var(--accent-secondary); font-weight: 600; }

.empty-state {
    text-align: center;
    padding: 80px 20px;
    color: var(--text-muted);
    background: rgba(255,255,255,0.02);
    border-radius: 20px;
    border: 2px dashed rgba(255,255,255,0.05);
}

.video-modal {
    position: fixed; inset: 0; background: rgba(0,0,0,0.95);
    z-index: 2000; display: flex; justify-content: center; align-items: center;
    padding: 40px;
}
.video-modal-content {
    width: 100%; max-width: 1000px;
    aspect-ratio: 16/9;
    background: #000; box-shadow: 0 0 100px rgba(255,51,102,0.2);
    position: relative;
}

/* ── Chat Dashboard ── */
#chat-box {
    scrollbar-width: thin;
    scrollbar-color: rgba(255,255,255,0.1) transparent;
}
#chat-box::-webkit-scrollbar {
    width: 6px;
}
#chat-box::-webkit-scrollbar-thumb {
    background: rgba(255,255,255,0.1);
    border-radius: 3px;
}
#chat-input::placeholder {
    color: rgba(255,255,255,0.3);
}
.video-modal-close {
    position: absolute; top: -50px; right: 0;
    background: none; border: none; color: white;
    font-size: 30px; cursor: pointer;
}
