/* ═══════════════════════════════════════════════════════════════════
   3LL Livestudio – Premium Dark Theme CSS
   ═══════════════════════════════════════════════════════════════════ */

/* ─── Variables ─────────────────────────────────────────────────── */
:root {
  /* Colors */
  --bg-base:      #09090e;
  --bg-surface:   #111118;
  --bg-panel:     #16161f;
  --bg-elevated:  #1e1e2a;
  --bg-hover:     #252535;
  --bg-active:    #2a2a3f;

  --border-subtle: rgba(255,255,255,0.06);
  --border-normal: rgba(255,255,255,0.1);
  --border-strong: rgba(255,255,255,0.18);

  --accent:        #7c3aed;
  --accent-hover:  #8b5cf6;
  --accent-glow:   rgba(124,58,237,0.35);
  --accent-dim:    rgba(124,58,237,0.15);

  --live-red:      #ef4444;
  --live-glow:     rgba(239,68,68,0.4);
  --live-dim:      rgba(239,68,68,0.15);

  --success:       #22c55e;
  --warning:       #f59e0b;
  --danger:        #ef4444;

  --text-primary:   #e8e8f2;
  --text-secondary: #9090b0;
  --text-muted:     #5a5a7a;
  --text-accent:    #a78bfa;

  /* Layout */
  --header-h:    52px;
  --footer-h:    88px;
  --sidebar-l-w: 240px;
  --sidebar-r-w: 260px;
  --panel-gap:   1px;

  /* Typography */
  --font-ui:   'Inter', system-ui, sans-serif;
  --font-mono: 'JetBrains Mono', 'Fira Code', monospace;

  /* Radius */
  --r-sm:  4px;
  --r-md:  8px;
  --r-lg:  12px;
  --r-xl:  16px;

  /* Transitions */
  --t-fast:   0.1s ease;
  --t-normal: 0.2s ease;
  --t-slow:   0.35s ease;
}

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

html, body {
  height: 100%;
  overflow: hidden;
  background: var(--bg-base);
  color: var(--text-primary);
  font-family: var(--font-ui);
  font-size: 13px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* ─── App Shell ──────────────────────────────────────────────────── */
#app-header {
  position: fixed;
  top: 0; left: 0; right: 0;
  height: var(--header-h);
  background: var(--bg-panel);
  border-bottom: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 16px;
  z-index: 100;
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}

#app-main {
  position: fixed;
  top: var(--header-h);
  bottom: var(--footer-h);
  left: 0; right: 0;
  display: grid;
  grid-template-columns: var(--sidebar-l-w) 1fr var(--sidebar-r-w);
  gap: var(--panel-gap);
  background: var(--bg-base);
  overflow: hidden;
}

#app-footer {
  position: fixed;
  bottom: 0; left: 0; right: 0;
  height: var(--footer-h);
  background: var(--bg-panel);
  border-top: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  gap: 0;
  z-index: 100;
}

/* ─── Header ─────────────────────────────────────────────────────── */
.app-logo {
  display: flex;
  align-items: center;
  gap: 10px;
}

.logo-text {
  font-size: 15px;
  font-weight: 700;
  letter-spacing: -0.3px;
  color: var(--text-primary);
}

.logo-accent { color: var(--accent-hover); }

.stream-status {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--bg-elevated);
  border: 1px solid var(--border-normal);
  border-radius: 20px;
  padding: 5px 14px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 1.5px;
}

.status-dot {
  width: 8px; height: 8px;
  border-radius: 50%;
  background: var(--text-muted);
  transition: background var(--t-normal), box-shadow var(--t-normal);
}

.status-dot.live {
  background: var(--live-red);
  box-shadow: 0 0 8px var(--live-glow);
  animation: pulse-dot 1.5s ease-in-out infinite;
}

@keyframes pulse-dot {
  0%, 100% { box-shadow: 0 0 6px var(--live-glow); }
  50%       { box-shadow: 0 0 14px var(--live-glow); }
}

.status-text { color: var(--text-secondary); }
.status-text.live { color: var(--live-red); }

.header-stats {
  display: flex;
  align-items: center;
  gap: 20px;
  margin-right: 12px;
}

.stat-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1px;
}

.stat-label {
  font-size: 9px;
  font-weight: 600;
  letter-spacing: 1px;
  color: var(--text-muted);
  text-transform: uppercase;
}

.stat-value {
  font-size: 14px;
  font-weight: 700;
  color: var(--text-primary);
}

.stat-value.mono { font-family: var(--font-mono); font-size: 12px; }

/* ─── Sidebar ────────────────────────────────────────────────────── */
.sidebar {
  background: var(--bg-surface);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  border-right: 1px solid var(--border-subtle);
}

.sidebar-right {
  border-right: none;
  border-left: 1px solid var(--border-subtle);
}

/* ─── Panels ─────────────────────────────────────────────────────── */
.panel {
  display: flex;
  flex-direction: column;
  border-bottom: 1px solid var(--border-subtle);
  max-height: 40%;
  min-height: 120px;
}

.panel-flex { flex: 1; max-height: none; }

.panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 12px;
  background: var(--bg-panel);
  border-bottom: 1px solid var(--border-subtle);
  flex-shrink: 0;
}

.panel-title {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.8px;
  text-transform: uppercase;
  color: var(--text-muted);
}

.panel-actions { display: flex; gap: 4px; }

/* ─── Item Lists ─────────────────────────────────────────────────── */
.item-list {
  list-style: none;
  overflow-y: auto;
  flex: 1;
  padding: 4px 0;
}

.item-list::-webkit-scrollbar { width: 4px; }
.item-list::-webkit-scrollbar-track { background: transparent; }
.item-list::-webkit-scrollbar-thumb { background: var(--bg-active); border-radius: 2px; }

.list-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 7px 12px;
  cursor: pointer;
  user-select: none;
  border-radius: 0;
  transition: background var(--t-fast);
  border-left: 2px solid transparent;
}

.list-item:hover { background: var(--bg-hover); }
.list-item.active {
  background: var(--accent-dim);
  border-left-color: var(--accent);
}

.list-item-icon {
  font-size: 14px;
  width: 20px;
  text-align: center;
  flex-shrink: 0;
}

.list-item-name {
  flex: 1;
  font-size: 12px;
  font-weight: 500;
  color: var(--text-primary);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.list-item-actions {
  display: flex;
  gap: 2px;
  opacity: 0;
  transition: opacity var(--t-fast);
}

.list-item:hover .list-item-actions { opacity: 1; }

.item-visibility-btn {
  background: none; border: none; cursor: pointer;
  color: var(--text-muted);
  padding: 2px;
  border-radius: var(--r-sm);
  transition: color var(--t-fast);
  display: flex; align-items: center;
}

.item-visibility-btn:hover { color: var(--text-primary); }
.item-visibility-btn.hidden { color: var(--text-muted); opacity: 0.4; }

.item-delete-btn {
  background: none; border: none; cursor: pointer;
  color: var(--text-muted);
  padding: 2px;
  border-radius: var(--r-sm);
  transition: color var(--t-fast);
  display: flex; align-items: center;
}

.item-delete-btn:hover { color: var(--danger); }

/* ─── Preview Area ───────────────────────────────────────────────── */
.preview-area {
  background: var(--bg-base);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  position: relative;
}

.preview-container {
  position: relative;
  flex-shrink: 0;
  border-radius: var(--r-md);
  overflow: hidden;
  box-shadow:
    0 0 0 1px var(--border-normal),
    0 8px 40px rgba(0,0,0,0.6),
    0 0 60px rgba(124,58,237,0.05);
}

#preview-canvas {
  display: block;
  cursor: default;
}

.canvas-overlay {
  position: absolute;
  top: 0; left: 0; right: 0; bottom: 0;
  pointer-events: none;
}

.preview-placeholder {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  color: var(--text-muted);
  font-size: 12px;
  pointer-events: none;
}

.preview-placeholder.hidden { display: none; }

.stream-info-bar {
  position: absolute;
  bottom: 12px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  align-items: center;
  gap: 0;
  background: rgba(0,0,0,0.7);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border: 1px solid var(--border-subtle);
  border-radius: 20px;
  padding: 5px 14px;
  white-space: nowrap;
}

.info-item {
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 0 8px;
}

.info-label {
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.8px;
  text-transform: uppercase;
  color: var(--text-muted);
}

.info-value {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-primary);
  display: flex; align-items: center;
}

.info-separator {
  width: 1px; height: 14px;
  background: var(--border-normal);
}

/* ─── Selection Handles ──────────────────────────────────────────── */
.selection-rect {
  position: absolute;
  pointer-events: none;
  border: 2px solid var(--accent);
  box-shadow: 0 0 0 1px rgba(0,0,0,0.5);
}

.selection-handle {
  position: absolute;
  width: 10px; height: 10px;
  background: white;
  border: 2px solid var(--accent);
  border-radius: 2px;
  pointer-events: all;
  transform: translate(-50%, -50%);
}

/* ─── Properties Panel ───────────────────────────────────────────── */
.properties-content {
  overflow-y: auto;
  flex: 1;
  padding: 8px;
}

.properties-content::-webkit-scrollbar { width: 4px; }
.properties-content::-webkit-scrollbar-track { background: transparent; }
.properties-content::-webkit-scrollbar-thumb { background: var(--bg-active); border-radius: 2px; }

.no-selection {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  height: 100%;
  color: var(--text-muted);
  font-size: 12px;
  text-align: center;
  padding: 20px;
}

.prop-group {
  margin-bottom: 14px;
}

.prop-group-title {
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.8px;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-bottom: 8px;
  padding-bottom: 5px;
  border-bottom: 1px solid var(--border-subtle);
}

.prop-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 6px;
}

.prop-label {
  font-size: 11px;
  color: var(--text-secondary);
  flex-shrink: 0;
  min-width: 60px;
}

.prop-input {
  flex: 1;
  background: var(--bg-elevated);
  border: 1px solid var(--border-normal);
  border-radius: var(--r-sm);
  color: var(--text-primary);
  font-family: var(--font-mono);
  font-size: 11px;
  padding: 4px 8px;
  min-width: 0;
  transition: border-color var(--t-fast);
}

.prop-input:focus {
  outline: none;
  border-color: var(--accent);
}

.prop-slider {
  flex: 1;
  -webkit-appearance: none;
  appearance: none;
  height: 4px;
  background: var(--bg-elevated);
  border-radius: 2px;
  cursor: pointer;
}

.prop-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 14px; height: 14px;
  background: var(--accent);
  border-radius: 50%;
  cursor: pointer;
  border: 2px solid var(--bg-surface);
  transition: background var(--t-fast);
}

.prop-slider::-webkit-slider-thumb:hover { background: var(--accent-hover); }

/* ─── Footer / Audio Mixer ───────────────────────────────────────── */
.audio-mixer {
  flex: 1;
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 0 16px;
  border-right: 1px solid var(--border-subtle);
  overflow-x: auto;
}

.mixer-label {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 1px;
  text-transform: uppercase;
  color: var(--text-muted);
  flex-shrink: 0;
}

.mixer-channels {
  display: flex;
  align-items: center;
  gap: 16px;
  flex: 1;
}

.mixer-channel {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

.channel-label {
  font-size: 11px;
  font-weight: 500;
  color: var(--text-secondary);
  white-space: nowrap;
  flex-shrink: 0;
  width: 70px;
}

.volume-bar-container { display: none; } /* Simplified for footer */

.vol-slider {
  -webkit-appearance: none;
  appearance: none;
  width: 90px;
  height: 4px;
  background: linear-gradient(to right, var(--accent) 0%, var(--accent) var(--vol, 80%), var(--bg-elevated) var(--vol, 80%));
  border-radius: 2px;
  cursor: pointer;
}

.vol-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 12px; height: 12px;
  background: white;
  border-radius: 50%;
  cursor: pointer;
  border: 2px solid var(--accent);
}

.vol-value {
  font-size: 10px;
  font-family: var(--font-mono);
  color: var(--text-muted);
  width: 30px;
  text-align: right;
  flex-shrink: 0;
}

.btn-mute {
  background: var(--bg-elevated);
  border: 1px solid var(--border-normal);
  border-radius: var(--r-sm);
  color: var(--text-secondary);
  padding: 4px;
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: all var(--t-fast);
  flex-shrink: 0;
}

.btn-mute:hover { background: var(--bg-hover); color: var(--text-primary); }
.btn-mute.muted { background: var(--live-dim); border-color: var(--live-red); color: var(--live-red); }

/* ─── Stream Controls ────────────────────────────────────────────── */
.stream-controls {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  justify-content: center;
  gap: 6px;
  padding: 8px 16px;
  min-width: 280px;
}

.stream-key-row {
  display: flex;
  gap: 6px;
}

.stream-key-input {
  flex: 1;
  background: var(--bg-elevated);
  border: 1px solid var(--border-normal);
  border-radius: var(--r-sm);
  color: var(--text-primary);
  font-size: 12px;
  padding: 6px 10px;
  transition: border-color var(--t-fast);
  min-width: 0;
}

.stream-key-input::placeholder { color: var(--text-muted); }
.stream-key-input:focus {
  outline: none;
  border-color: var(--accent);
}

.btn-show-key {
  background: var(--bg-elevated);
  border: 1px solid var(--border-normal);
  border-radius: var(--r-sm);
  color: var(--text-secondary);
  padding: 0 8px;
  cursor: pointer;
  display: flex; align-items: center;
  transition: all var(--t-fast);
  flex-shrink: 0;
}

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

.btn-stream {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 9px 20px;
  border-radius: var(--r-md);
  border: none;
  cursor: pointer;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.3px;
  font-family: var(--font-ui);
  background: linear-gradient(135deg, var(--accent), var(--accent-hover));
  color: white;
  box-shadow: 0 4px 14px var(--accent-glow);
  transition: all var(--t-normal);
  position: relative;
  overflow: hidden;
}

.btn-stream::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, transparent 30%, rgba(255,255,255,0.1));
  transition: opacity var(--t-fast);
  opacity: 0;
}

.btn-stream:hover::before { opacity: 1; }
.btn-stream:hover { transform: translateY(-1px); box-shadow: 0 6px 20px var(--accent-glow); }
.btn-stream:active { transform: translateY(0); }

.btn-stream.streaming {
  background: linear-gradient(135deg, var(--live-red), #dc2626);
  box-shadow: 0 4px 14px var(--live-glow);
  animation: stream-pulse 2s ease-in-out infinite;
}

@keyframes stream-pulse {
  0%, 100% { box-shadow: 0 4px 14px var(--live-glow); }
  50%       { box-shadow: 0 4px 24px var(--live-glow); }
}

/* ─── Buttons ────────────────────────────────────────────────────── */
.btn-icon {
  background: var(--bg-elevated);
  border: 1px solid var(--border-normal);
  border-radius: var(--r-sm);
  color: var(--text-secondary);
  padding: 6px;
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: all var(--t-fast);
}

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

.btn-icon-sm {
  background: var(--bg-elevated);
  border: 1px solid var(--border-normal);
  border-radius: var(--r-sm);
  color: var(--text-secondary);
  padding: 4px;
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: all var(--t-fast);
  width: 22px; height: 22px;
}

.btn-icon-sm:hover { background: var(--accent-dim); border-color: var(--accent); color: var(--accent-hover); }

.btn-primary {
  background: linear-gradient(135deg, var(--accent), var(--accent-hover));
  border: none;
  border-radius: var(--r-md);
  color: white;
  font-size: 13px;
  font-weight: 600;
  font-family: var(--font-ui);
  padding: 8px 18px;
  cursor: pointer;
  transition: all var(--t-normal);
  box-shadow: 0 2px 8px var(--accent-glow);
}

.btn-primary:hover { transform: translateY(-1px); box-shadow: 0 4px 14px var(--accent-glow); }

.btn-secondary {
  background: var(--bg-elevated);
  border: 1px solid var(--border-normal);
  border-radius: var(--r-md);
  color: var(--text-secondary);
  font-size: 13px;
  font-weight: 500;
  font-family: var(--font-ui);
  padding: 8px 18px;
  cursor: pointer;
  transition: all var(--t-fast);
}

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

/* ─── Modals ─────────────────────────────────────────────────────── */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.6);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  z-index: 200;
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--t-normal);
}

.modal-backdrop.visible {
  opacity: 1;
  pointer-events: all;
}

.modal {
  position: fixed;
  top: 50%; left: 50%;
  transform: translate(-50%, -50%) scale(0.95);
  width: 480px;
  max-width: calc(100vw - 32px);
  max-height: calc(100vh - 100px);
  background: var(--bg-panel);
  border: 1px solid var(--border-strong);
  border-radius: var(--r-xl);
  z-index: 210;
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--t-normal), transform var(--t-normal);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  box-shadow:
    0 0 0 1px rgba(255,255,255,0.04),
    0 24px 80px rgba(0,0,0,0.8);
}

.modal.visible {
  opacity: 1;
  pointer-events: all;
  transform: translate(-50%, -50%) scale(1);
}

.modal-sm { width: 360px; }

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border-subtle);
  flex-shrink: 0;
}

.modal-header h3 {
  font-size: 15px;
  font-weight: 700;
  color: var(--text-primary);
}

.modal-close {
  background: var(--bg-elevated);
  border: 1px solid var(--border-normal);
  border-radius: var(--r-sm);
  color: var(--text-muted);
  font-size: 12px;
  padding: 4px 8px;
  cursor: pointer;
  transition: all var(--t-fast);
}

.modal-close:hover { background: var(--bg-hover); color: var(--text-primary); }

.modal-body {
  padding: 20px;
  overflow-y: auto;
  flex: 1;
}

.modal-body::-webkit-scrollbar { width: 4px; }
.modal-body::-webkit-scrollbar-thumb { background: var(--bg-active); border-radius: 2px; }

.modal-footer {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  padding: 14px 20px;
  border-top: 1px solid var(--border-subtle);
  flex-shrink: 0;
}

/* ─── Source Type Grid ───────────────────────────────────────────── */
.source-type-grid {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 10px;
}

.source-type-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 16px 12px;
  background: var(--bg-elevated);
  border: 1px solid var(--border-normal);
  border-radius: var(--r-lg);
  color: var(--text-secondary);
  font-size: 12px;
  font-weight: 500;
  font-family: var(--font-ui);
  cursor: pointer;
  transition: all var(--t-normal);
  text-align: center;
}

.source-type-card:hover {
  background: var(--accent-dim);
  border-color: var(--accent);
  color: var(--text-primary);
  transform: translateY(-2px);
  box-shadow: 0 4px 16px var(--accent-glow);
}

/* OBS source cards get a distinct teal/green accent */
.source-type-card--obs {
  border-color: rgba(20,184,166,0.25);
  background: rgba(20,184,166,0.05);
}

.source-type-card--obs:hover {
  background: rgba(20,184,166,0.12);
  border-color: #14b8a6;
  box-shadow: 0 4px 16px rgba(20,184,166,0.3);
}

/* 3D source card styling */
.source-type-card--3d {
  border-color: rgba(236,72,153,0.25);
  background: rgba(236,72,153,0.05);
}

.source-type-card--3d:hover {
  background: rgba(236,72,153,0.12);
  border-color: #ec4899;
  box-shadow: 0 4px 16px rgba(236,72,153,0.3);
}

.obs-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background: rgba(20,184,166,0.15);
  border: 1px solid rgba(20,184,166,0.35);
  border-radius: 20px;
  padding: 2px 8px;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.8px;
  color: #14b8a6;
  margin-bottom: 10px;
}

.stream-status-dot {
  width: 6px; height: 6px;
  border-radius: 50%;
  background: var(--text-muted);
  flex-shrink: 0;
}

.stream-status-dot.active {
  background: var(--success);
  box-shadow: 0 0 6px var(--success);
  animation: pulse-dot 1.5s ease-in-out infinite;
}

.device-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-top: 6px;
}

.device-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  background: var(--bg-elevated);
  border: 1px solid var(--border-normal);
  border-radius: var(--r-md);
  cursor: pointer;
  transition: all var(--t-fast);
}

.device-item:hover,
.device-item.selected {
  background: var(--accent-dim);
  border-color: var(--accent);
}

.device-item-icon { font-size: 16px; flex-shrink: 0; }

.device-item-info { flex: 1; min-width: 0; }

.device-item-name {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-primary);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.device-item-label {
  font-size: 10px;
  color: var(--text-muted);
}

.obs-stream-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-top: 6px;
}

.obs-stream-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  background: var(--bg-elevated);
  border: 1px solid rgba(20,184,166,0.2);
  border-radius: var(--r-md);
  cursor: pointer;
  transition: all var(--t-fast);
}

.obs-stream-item:hover,
.obs-stream-item.selected {
  background: rgba(20,184,166,0.1);
  border-color: #14b8a6;
}

.obs-stream-key {
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 600;
  color: #14b8a6;
}

.hls-loading {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px;
  color: var(--text-muted);
  font-size: 12px;
}


.source-type-icon { font-size: 24px; }

/* ─── Forms ──────────────────────────────────────────────────────── */
.form-group { margin-bottom: 14px; }

.form-label {
  display: block;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.5px;
  color: var(--text-secondary);
  margin-bottom: 6px;
  text-transform: uppercase;
}

.form-input {
  width: 100%;
  background: var(--bg-elevated);
  border: 1px solid var(--border-normal);
  border-radius: var(--r-sm);
  color: var(--text-primary);
  font-size: 13px;
  font-family: var(--font-ui);
  padding: 8px 12px;
  transition: border-color var(--t-fast);
}

.form-input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-dim);
}

.form-input::placeholder { color: var(--text-muted); }

.form-select {
  width: 100%;
  background: var(--bg-elevated);
  border: 1px solid var(--border-normal);
  border-radius: var(--r-sm);
  color: var(--text-primary);
  font-size: 13px;
  font-family: var(--font-ui);
  padding: 8px 12px;
  cursor: pointer;
  transition: border-color var(--t-fast);
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%239090b0' stroke-width='2'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
  padding-right: 32px;
}

.form-select:focus { outline: none; border-color: var(--accent); }

.settings-grid { display: flex; flex-direction: column; gap: 0; }

.settings-tip {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  margin-top: 16px;
  padding: 12px;
  background: rgba(124,58,237,0.1);
  border: 1px solid rgba(124,58,237,0.25);
  border-radius: var(--r-md);
  font-size: 11px;
  color: var(--text-accent);
  line-height: 1.6;
}

.settings-tip svg { flex-shrink: 0; margin-top: 1px; }

/* ─── Toasts ─────────────────────────────────────────────────────── */
.toast-container {
  position: fixed;
  bottom: calc(var(--footer-h) + 16px);
  right: 16px;
  z-index: 300;
  display: flex;
  flex-direction: column-reverse;
  gap: 8px;
  pointer-events: none;
}

.toast {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  background: var(--bg-elevated);
  border: 1px solid var(--border-normal);
  border-radius: var(--r-md);
  font-size: 12px;
  font-weight: 500;
  color: var(--text-primary);
  box-shadow: 0 8px 24px rgba(0,0,0,0.5);
  max-width: 300px;
  pointer-events: all;
  animation: toast-in 0.3s ease;
  border-left: 3px solid var(--accent);
}

.toast.success { border-left-color: var(--success); }
.toast.error   { border-left-color: var(--danger); }
.toast.warning { border-left-color: var(--warning); }

@keyframes toast-in {
  from { opacity: 0; transform: translateX(20px); }
  to   { opacity: 1; transform: translateX(0); }
}

@keyframes toast-out {
  from { opacity: 1; transform: translateX(0); }
  to   { opacity: 0; transform: translateX(20px); }
}

/* ─── Source Config Forms ────────────────────────────────────────── */
.color-picker-row {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 12px;
}

.color-preview {
  width: 48px; height: 48px;
  border-radius: var(--r-md);
  border: 2px solid var(--border-normal);
  cursor: pointer;
  flex-shrink: 0;
}

.hidden-color-input {
  -webkit-appearance: none;
  appearance: none;
  background: none;
  border: none;
  width: 0; height: 0;
  padding: 0;
  visibility: hidden;
}

/* ─── Source Text config ─────────────────────────────────────────── */
.text-preview {
  background: var(--bg-base);
  border: 1px solid var(--border-normal);
  border-radius: var(--r-md);
  padding: 16px;
  margin-bottom: 12px;
  min-height: 60px;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* ─── Misc ───────────────────────────────────────────────────────── */
.mono { font-family: var(--font-mono); }

.divider {
  height: 1px;
  background: var(--border-subtle);
  margin: 8px 0;
}

/* ─── Scrollbar Global ───────────────────────────────────────────── */
* { scrollbar-width: thin; scrollbar-color: var(--bg-active) transparent; }

/* ─── Selection Handle Cursors ───────────────────────────────────── */
[data-handle="nw"], [data-handle="se"] { cursor: nwse-resize; }
[data-handle="ne"], [data-handle="sw"] { cursor: nesw-resize; }
[data-handle="n"],  [data-handle="s"]  { cursor: ns-resize; }
[data-handle="e"],  [data-handle="w"]  { cursor: ew-resize; }

/* ─── Media Queries ──────────────────────────────────────────────── */
@media (max-width: 1200px) {
  :root {
    --sidebar-l-w: 200px;
    --sidebar-r-w: 220px;
  }
}

@media (max-width: 900px) {
  :root {
    --sidebar-r-w: 0px;
  }
  .sidebar-right { display: none; }
}

/* Zen Mode */
body.zen-mode #app-header,
body.zen-mode #sidebar-left,
body.zen-mode #sidebar-right,
body.zen-mode #stream-info-bar {
  display: none !important;
}

body.zen-mode #app-main {
  top: 0;
  bottom: 0;
  grid-template-columns: 1fr;
}


/* 3D Gallery Overlay */
.gallery-3d-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  z-index: 10000;
  background: #000000;
  display: none;
  overflow: hidden;
}

.gallery-3d-overlay.visible {
  display: block;
}

.gallery-3d-close-btn {
  position: absolute;
  top: 20px;
  right: 20px;
  background: rgba(255, 255, 255, 0.2);
  border: none;
  color: white;
  font-size: 24px;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  cursor: pointer;
  z-index: 10001;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.3s;
}

.gallery-3d-close-btn:hover {
  background: rgba(255, 255, 255, 0.4);
}

.gallery-3d-title {
  position: absolute;
  top: 20px;
  left: 20px;
  color: white;
  font-size: 24px;
  font-weight: 600;
  z-index: 10001;
  text-shadow: 0 2px 4px rgba(0,0,0,0.5);
  pointer-events: none;
}

.gallery-3d-hint {
  position: absolute;
  bottom: 20px;
  left: 50%;
  transform: translateX(-50%);
  color: rgba(255, 255, 255, 0.7);
  font-size: 14px;
  z-index: 10001;
  pointer-events: none;
  animation: pulse 2s infinite;
}

@keyframes pulse {
  0% { opacity: 0.5; }
  50% { opacity: 1; }
  100% { opacity: 0.5; }
}

.gallery-3d-scroll-area {
  position: absolute;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  overflow-x: auto;
  overflow-y: hidden;
  z-index: 10002;
}

.gallery-3d-scroll-content {
  height: 100%;
  /* Width dynamically set in JS based on num images */
}

/* Hide scrollbar for a cleaner look */
.gallery-3d-scroll-area::-webkit-scrollbar {
  display: none;
}
.gallery-3d-scroll-area {
  -ms-overflow-style: none;
  scrollbar-width: none;
}

/* User Profile Menu */
.user-profile { position: relative; margin-left: 12px; cursor: pointer; display: flex; align-items: center; }
.user-avatar { width: 32px; height: 32px; border-radius: 4px; background: #333; overflow: hidden; border: 1px solid rgba(255, 255, 255, 0.2); transition: border-color 0.2s ease; }
.user-avatar:hover { border-color: #7c3aed; }
.user-avatar img { width: 100%; height: 100%; object-fit: cover; }
.user-dropdown { position: absolute; top: calc(100% + 8px); right: 0; width: 200px; background: #1e1e24; border: 1px solid #333; border-radius: 8px; box-shadow: 0 10px 25px rgba(0,0,0,0.5); z-index: 1000; padding: 8px 0; display: none; flex-direction: column; }
.user-info { padding: 8px 16px; display: flex; flex-direction: column; text-align: left; }
.user-info strong { font-size: 14px; color: #fff; margin-bottom: 2px; }
.user-info span { font-size: 12px; color: #9ca3af; }
.dropdown-divider { height: 1px; background: #333; border: none; margin: 8px 0; }
.dropdown-item { background: none; border: none; color: #d1d5db; padding: 10px 16px; text-align: left; font-size: 13px; cursor: pointer; transition: background 0.2s ease, color 0.2s ease; width: 100%; }
.dropdown-item:hover { background: rgba(255, 255, 255, 0.05); color: #fff; }
.dropdown-item.text-danger { color: #ef4444; }
.dropdown-item.text-danger:hover { background: rgba(239, 68, 68, 0.1); }
/* --- Billing Modal -------------------------------------------------------- */
.modal-xl { width: 1200px !important; }
.billing-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
}
.billing-card {
  background: #111111;
  border: 1px solid #333;
  border-radius: 12px;
  padding: 24px 20px;
  position: relative;
  display: flex;
  flex-direction: column;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}
.billing-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 8px 24px rgba(0,0,0,0.5);
}
.billing-card.pro {
  border-color: #ec4899;
  box-shadow: 0 0 20px rgba(236,72,153,0.1);
}
.billing-card-header h4 {
  font-size: 18px;
  color: #fff;
  margin: 0 0 4px 0;
  display: flex;
  align-items: center;
  gap: 8px;
}
.billing-subtitle {
  font-size: 12px;
  color: #9ca3af;
  margin-bottom: 12px;
}
.billing-price-row {
  margin-bottom: 4px;
}
.billing-price {
  font-size: 32px;
  font-weight: 800;
  color: #fff;
}
.billing-period {
  font-size: 14px;
  color: #9ca3af;
}
.billing-original-price {
  font-size: 12px;
  color: #6b7280;
  text-decoration: line-through;
  margin-left: 8px;
}
.billing-billed-text {
  font-size: 12px;
  color: #10b981;
  margin-bottom: 24px;
}
.billing-slider-container {
  margin-bottom: 24px;
}
.billing-slider-track {
  width: 100%;
  height: 4px;
  background: #333;
  border-radius: 2px;
  position: relative;
  margin-bottom: 8px;
}
.billing-slider-fill {
  position: absolute;
  left: 0; top: 0; bottom: 0;
  width: 30%;
  background: #fff;
  border-radius: 2px;
}
.billing-slider-thumb {
  position: absolute;
  left: 30%; top: 50%;
  transform: translate(-50%, -50%);
  width: 12px; height: 12px;
  background: #fff;
  border-radius: 50%;
}
.billing-slider-labels {
  display: flex;
  justify-content: space-between;
  font-size: 10px;
  color: #9ca3af;
}
.billing-slider-custom {
  font-size: 12px;
  color: #e5e7eb;
  text-align: center;
  margin-bottom: 8px;
}
.billing-bonus-box {
  background: rgba(234, 179, 8, 0.1);
  border: 1px solid rgba(234, 179, 8, 0.2);
  color: #facc15;
  font-size: 12px;
  text-align: center;
  padding: 6px;
  border-radius: 6px;
  margin-bottom: 16px;
}
.billing-credits-box {
  background: #1f1f23;
  border: 1px solid #333;
  border-radius: 8px;
  padding: 16px;
  margin-bottom: 24px;
  flex: 1;
}
.billing-credits-title {
  color: #ec4899;
  font-size: 14px;
  font-weight: 600;
  margin-bottom: 12px;
  display: flex;
  align-items: center;
  gap: 6px;
}
.billing-credits-title::before {
  content: "?";
}
.billing-per-credit {
  font-size: 13px;
  color: #fff;
  margin-bottom: 8px;
}
.billing-per-credit strong {
  color: #ec4899;
}
.billing-equivalent {
  font-size: 12px;
  color: #9ca3af;
  margin-left: 12px;
  position: relative;
}
.billing-equivalent::before {
  content: "";
  position: absolute;
  left: -12px;
}
.billing-equivalent-details {
  font-size: 12px;
  color: #9ca3af;
  margin-left: 12px;
  margin-top: 4px;
}
.billing-btn {
  width: 100%;
  padding: 12px;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 600;
  border: none;
  cursor: pointer;
  color: #fff;
  margin-bottom: 16px;
}
.billing-btn.solid {
  background: #8b5cf6;
}
.billing-btn.gradient {
  background: linear-gradient(90deg, #ec4899, #f97316);
}
.billing-footer {
  text-align: center;
  font-size: 11px;
  color: #6b7280;
  white-space: pre-line;
}
.billing-badge {
  position: absolute;
  top: -10px;
  right: 16px;
  background: #bef264;
  color: #000;
  font-size: 11px;
  font-weight: 800;
  padding: 4px 10px;
  border-radius: 12px;
}
