/* OBS widget: program preview + go-live/record + scene switcher. Three sections
   (preview / controls / scenes) carry data-system-card so they hide/reorder like
   the System cards. Rendered into .obs-widget-mount by obs-widget.js. */
.obs-panel { display: flex; }
.obs-widget-mount { width: 100%; height: 100%; display: flex; min-height: 0; border-radius: inherit; }

.obs-wrap {
  position: relative; box-sizing: border-box;
  width: 100%; height: 100%; min-height: 0;
  padding: 16px 18px; display: flex; flex-direction: column; gap: 11px;
  border-radius: inherit; overflow: hidden;
}
.obs-wrap.obs-disconnected { opacity: 0.92; }

/* Header */
.obs-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex: 0 0 auto; }
.obs-logo { font-size: 0.92rem; font-weight: 900; letter-spacing: 0.04em; color: var(--text, #e7e9ee); }
.obs-pills { display: inline-flex; gap: 6px; }
.obs-pill {
  display: none; align-items: center; gap: 5px;
  padding: 3px 9px; border-radius: 999px;
  font-size: 0.6rem; font-weight: 900; letter-spacing: 0.07em;
}
.obs-pill.on { display: inline-flex; }
.obs-pill-dot { position: relative; width: 6px; height: 6px; border-radius: 50%; }
/* Compositor-only ripple — shared `live-ripple` keyframe in styles/global.css
   (an animated box-shadow would tick the main thread every frame, GitHub #99). */
.obs-pill-live .obs-pill-dot::after,
.obs-pill-rec .obs-pill-dot::after {
  content: ''; position: absolute; inset: 0; border-radius: 50%;
  background: currentColor;
  animation: live-ripple 2s ease-in-out infinite;
  will-change: transform, opacity; pointer-events: none;
}
/* Paused while a frosted overlay covers the dashboard (see backgroundfx.css overlay-frozen). */
body.overlay-frozen .obs-pill-live .obs-pill-dot::after,
body.overlay-frozen .obs-pill-rec .obs-pill-dot::after { animation-play-state: paused; }
.obs-pill-live.on { color: var(--color-danger); background: var(--danger-bg); border: 1px solid rgba(var(--danger-rgb),0.38); }
.obs-pill-live .obs-pill-dot { background: #e0245e; }
.obs-pill-rec.on { color: var(--color-warn); background: var(--warning-bg); border: 1px solid rgba(var(--warning-rgb),0.4); }
.obs-pill-rec .obs-pill-dot { background: #f59e0b; }

/* Cards */
.obs-cards { flex: 1 1 auto; min-height: 0; display: flex; flex-direction: column; gap: 10px; }
.obs-card {
  position: relative; min-width: 0; border-radius: 14px; padding: 12px 14px;
  background: rgba(255,255,255,0.028); border: 1px solid rgba(255,255,255,0.07);
}
.obs-card-label {
  font-size: 0.62rem; font-weight: 800; letter-spacing: 0.09em; text-transform: uppercase;
  color: var(--text-dim, #8b91a1); margin-bottom: 9px;
}

/* Preview — fills the leftover height (so controls + scenes are never pushed
   off). The image keeps a 16:9 screen shape and scales to the largest size that
   fits the (often wide-and-short) card; it's centred with the card surface
   around it — no black letterbox bands. */
.obs-card--preview { flex: 1 1 0; min-height: 110px; display: flex; flex-direction: column; }
.obs-preview {
  position: relative; flex: 1 1 auto; width: 100%; min-height: 0;
  border-radius: 10px; overflow: hidden; background: #000;
  color: #f3f7f5;
  display: flex; align-items: center; justify-content: center;
}
/* Fill the whole preview area edge-to-edge (no dark surround / bands); a wide-
   short area crops the OBS frame top/bottom, which reads like a real screen. */
.obs-preview-img { width: 100%; height: 100%; object-fit: cover; display: block; }
.obs-preview-empty { font-size: 0.78rem; opacity: 0.4; font-weight: 600; text-align: center; padding: 8px; }

/* Controls */
.obs-controls { display: flex; flex-wrap: wrap; gap: 8px; }
.obs-btn {
  display: inline-flex; align-items: center; gap: 7px;
  min-height: 36px; padding: 0 14px; border-radius: 10px; cursor: pointer;
  font-size: 12px; font-weight: 800; color: var(--text, #e7e9ee);
  border: 1px solid rgba(255,255,255,0.12); background: rgba(255,255,255,0.05);
  transition: background 0.15s ease, border-color 0.15s ease, opacity 0.15s ease, transform 0.06s ease;
}
.obs-btn:hover:not(:disabled) { background: rgba(255,255,255,0.1); }
.obs-btn:active:not(:disabled) { transform: translateY(1px); }
.obs-btn.ok { border-color: rgba(34,197,94,0.55); background: rgba(34,197,94,0.2); }
.obs-btn.err { border-color: rgba(239,68,68,0.55); background: rgba(239,68,68,0.2); }
.obs-btn-ico { display: inline-flex; }
.obs-btn-ico svg { width: 15px; height: 15px; }
/* Go live = green; while streaming = red "End stream". */
.obs-golive { border-color: rgba(34,197,94,0.5); background: rgba(34,197,94,0.16); }
.obs-golive:hover:not(:disabled) { background: rgba(34,197,94,0.27); }
.obs-golive.is-live { border-color: rgba(var(--danger-rgb),0.55); background: var(--danger-bg); color: var(--color-danger); }
.obs-golive.is-live:hover:not(:disabled) { background: rgba(239,68,68,0.3); }
/* Record red dot accent; while recording, amber-tinted "Stop rec". */
.obs-record .obs-btn-ico { color: var(--color-danger); }
.obs-record.is-rec { border-color: rgba(var(--warning-rgb),0.5); background: var(--warning-bg); color: var(--color-warn); }
.obs-record.is-rec .obs-btn-ico { color: currentColor; }

/* Scenes — natural height, capped so it scrolls instead of squeezing the preview. */
.obs-card--scenes { flex: 0 1 auto; min-height: 0; display: flex; flex-direction: column; }
.obs-scene-list {
  flex: 0 1 auto; max-height: 152px; overflow-y: auto;
  display: flex; flex-direction: column; gap: 6px; padding-right: 4px; scrollbar-width: thin;
}
.obs-scene {
  text-align: left; min-height: 34px; padding: 0 12px; border-radius: 9px; cursor: pointer;
  font-size: 12.5px; font-weight: 700; color: var(--text, #e7e9ee);
  border: 1px solid rgba(255,255,255,0.1); background: rgba(255,255,255,0.04);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  transition: background 0.15s ease, border-color 0.15s ease, transform 0.06s ease;
}
.obs-scene:hover:not(:disabled) { background: rgba(255,255,255,0.09); }
.obs-scene:active:not(:disabled) { transform: translateY(1px); }
.obs-scene.is-active {
  border-color: rgba(var(--accent-rgb, 43,108,255), 0.6);
  background: rgba(var(--accent-rgb, 43,108,255), 0.16); color: #f6fff9;
}
.obs-scene.ok { border-color: rgba(34,197,94,0.5); }
.obs-scene.err { border-color: rgba(239,68,68,0.5); }
.obs-scene-empty { font-size: 0.78rem; opacity: 0.4; font-weight: 600; padding: 8px 2px; }

/* Audio — per-input mute + volume fader (mic, desktop, aux…). Capped like the
   scene list so a long input list scrolls rather than squeezing the preview. */
.obs-card--audio { flex: 0 1 auto; min-height: 0; display: flex; flex-direction: column; }
.obs-audio-list {
  flex: 0 1 auto; max-height: 168px; overflow-y: auto;
  display: flex; flex-direction: column; gap: 8px; padding-right: 4px; scrollbar-width: thin;
}
.obs-audio-row { display: grid; grid-template-columns: 34px 1fr auto; align-items: center; gap: 10px; }
.obs-audio-mute {
  display: inline-flex; align-items: center; justify-content: center;
  width: 34px; height: 34px; padding: 0; border-radius: 9px; cursor: pointer;
  color: var(--text, #e7e9ee);
  border: 1px solid rgba(255,255,255,0.1); background: rgba(255,255,255,0.04);
  transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease, transform 0.06s ease;
}
.obs-audio-mute svg { width: 16px; height: 16px; }
.obs-audio-mute:hover { background: rgba(255,255,255,0.09); }
.obs-audio-mute:active { transform: translateY(1px); }
.obs-audio-row.is-muted .obs-audio-mute {
  color: #ff8ba6; border-color: rgba(224,36,94,0.45); background: rgba(224,36,94,0.16);
}
.obs-audio-body { min-width: 0; display: flex; flex-direction: column; gap: 5px; }
.obs-audio-name {
  font-size: 12px; font-weight: 700; color: var(--text, #e7e9ee);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.obs-audio-row.is-muted .obs-audio-name { opacity: 0.55; }
.obs-audio-pct {
  font-size: 11px; font-weight: 800; font-variant-numeric: tabular-nums;
  color: var(--text-dim, #8b91a1); min-width: 34px; text-align: right;
}

/* Fader — accent-filled track, round grabbable thumb, dims when muted. */
.obs-audio-slider {
  -webkit-appearance: none; appearance: none; width: 100%; height: 5px;
  border-radius: 999px; cursor: pointer; background: rgba(255,255,255,0.14);
  outline: none;
}
.obs-audio-slider::-webkit-slider-thumb {
  -webkit-appearance: none; appearance: none; width: 15px; height: 15px; border-radius: 50%;
  background: var(--accent, #2b6cff); border: 2px solid rgba(255,255,255,0.85);
  box-shadow: 0 1px 4px rgba(0,0,0,0.35); transition: transform 0.08s ease;
}
.obs-audio-slider::-webkit-slider-thumb:active { transform: scale(1.15); }
.obs-audio-slider::-moz-range-thumb {
  width: 15px; height: 15px; border-radius: 50%; border: 2px solid rgba(255,255,255,0.85);
  background: var(--accent, #2b6cff); box-shadow: 0 1px 4px rgba(0,0,0,0.35);
}
.obs-audio-slider::-moz-range-progress { background: var(--accent, #2b6cff); height: 5px; border-radius: 999px; }
.obs-audio-row.is-muted .obs-audio-slider { filter: grayscale(0.8); opacity: 0.5; }
.obs-audio-empty { font-size: 0.78rem; opacity: 0.4; font-weight: 600; padding: 8px 2px; }
