/* ==========================================================================
   Two Viz (2vz.in) — Webinar Mode Stylesheet
   Strictly Slate & Electric Cyan Palette (Zero Purple/Violet)
   ========================================================================== */

:root {
  --bg-app: #0d1420;
  --bg-surface: #151c2a;
  --bg-surface-elevated: #1e283b;
  --bg-tile: #111723;
  --bg-glass: rgba(21, 28, 42, 0.85);

  --border-subtle: rgba(255, 255, 255, 0.08);
  --border-strong: rgba(255, 255, 255, 0.16);
  --border-focus: rgba(6, 182, 212, 0.55);

  --accent-primary: #06b6d4;
  --accent-primary-hover: #0891b2;
  --accent-glow: rgba(6, 182, 212, 0.3);
  --accent-subtle: rgba(6, 182, 212, 0.12);

  --accent-success: #10b981;
  --accent-danger: #f43f5e;
  --accent-warning: #f59e0b;

  --text-main: #f1f5f9;
  --text-muted: #94a3b8;
  --text-dim: #64748b;

  --radius-sm: 8px;
  --radius-md: 14px;
  --radius-lg: 20px;
  --radius-pill: 9999px;

  --shadow-sm: 0 2px 6px rgba(0, 0, 0, 0.25);
  --shadow-md: 0 10px 24px -4px rgba(0, 0, 0, 0.35);
  --shadow-lg: 0 20px 32px -8px rgba(0, 0, 0, 0.5);
  --shadow-glow: 0 0 24px var(--accent-glow);

  --font-family: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --transition-fast: 0.15s cubic-bezier(0.4, 0, 0.2, 1);
  --transition-normal: 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

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

body {
  font-family: var(--font-family);
  background-color: var(--bg-app);
  color: var(--text-main);
  min-height: 100vh;
  line-height: 1.5;
  background-image: 
    radial-gradient(ellipse 80% 50% at 50% -10%, rgba(6, 182, 212, 0.16) 0%, transparent 70%),
    radial-gradient(500px 500px at 90% 15%, rgba(16, 185, 129, 0.11) 0%, transparent 60%),
    radial-gradient(600px 600px at 50% 85%, rgba(6, 182, 212, 0.08) 0%, transparent 70%);
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

.hidden {
  display: none !important;
}

/* Header */
.webinar-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(13, 20, 32, 0.88);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--border-subtle);
  height: 68px;
  display: flex;
  align-items: center;
  padding: 0 24px;
}

.header-container {
  max-width: 1300px;
  width: 100%;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.brand-group {
  display: flex;
  align-items: center;
  gap: 12px;
  text-decoration: none;
}

.brand-icon-wrap {
  width: 38px;
  height: 38px;
  border-radius: var(--radius-sm);
  overflow: hidden;
  border: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-surface);
}

.brand-logo-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.brand-title {
  font-size: 1.25rem;
  font-weight: 800;
  color: var(--text-main);
  letter-spacing: -0.02em;
}

.brand-pill {
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--accent-primary);
  background: var(--accent-subtle);
  padding: 3px 8px;
  border-radius: var(--radius-pill);
  border: 1px solid rgba(6, 182, 212, 0.25);
}

.webinar-pill {
  font-size: 0.72rem;
  font-weight: 700;
  color: #38bdf8;
  background: rgba(56, 189, 248, 0.12);
  padding: 3px 8px;
  border-radius: var(--radius-pill);
  border: 1px solid rgba(56, 189, 248, 0.28);
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 14px;
}

.btn-back-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--text-muted);
  text-decoration: none;
  padding: 8px 14px;
  border-radius: var(--radius-sm);
  transition: var(--transition-fast);
  border: 1px solid transparent;
}

.btn-back-link:hover {
  color: var(--text-main);
  background: var(--bg-surface-elevated);
  border-color: var(--border-subtle);
}

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

.toast {
  pointer-events: auto;
  background: var(--bg-surface-elevated);
  border: 1px solid var(--border-strong);
  color: var(--text-main);
  padding: 12px 18px;
  border-radius: var(--radius-md);
  font-size: 0.88rem;
  font-weight: 500;
  box-shadow: var(--shadow-lg);
  display: flex;
  align-items: center;
  gap: 10px;
  animation: toastIn 0.25s ease-out;
}

.toast.success {
  border-color: rgba(16, 185, 129, 0.5);
  box-shadow: 0 0 15px rgba(16, 185, 129, 0.2);
}

@keyframes toastIn {
  from { opacity: 0; transform: translateY(12px); }
  to { opacity: 1; transform: translateY(0); }
}

/* Floating Reactions */
.reaction-layer {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 8000;
  overflow: hidden;
}

.floating-reaction {
  position: absolute;
  bottom: 80px;
  font-size: 2.2rem;
  animation: floatUp 2.8s cubic-bezier(0.2, 0.8, 0.4, 1) forwards;
  will-change: transform, opacity;
}

@keyframes floatUp {
  0% { opacity: 0; transform: translateY(0) scale(0.6) rotate(0deg); }
  15% { opacity: 1; transform: translateY(-30px) scale(1.15) rotate(5deg); }
  80% { opacity: 0.85; }
  100% { opacity: 0; transform: translateY(-400px) scale(1) rotate(-10deg); }
}

/* Main Layout Views */
.webinar-view {
  max-width: 1300px;
  margin: 0 auto;
  padding: 24px 20px 60px;
}

/* ==========================================================================
   LOBBY / SETUP VIEW
   ========================================================================== */
.lobby-hero {
  text-align: center;
  max-width: 780px;
  margin: 20px auto 36px;
}

.badge-tag {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 14px;
  background: var(--accent-subtle);
  border: 1px solid rgba(6, 182, 212, 0.3);
  border-radius: var(--radius-pill);
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--accent-primary);
  margin-bottom: 16px;
}

.pulse-dot {
  width: 8px;
  height: 8px;
  background: var(--accent-primary);
  border-radius: 50%;
  box-shadow: 0 0 8px var(--accent-primary);
  animation: pulseGlow 1.8s infinite;
}

@keyframes pulseGlow {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.4; transform: scale(0.85); }
}

.lobby-title {
  font-size: clamp(2rem, 4vw, 2.8rem);
  font-weight: 800;
  letter-spacing: -0.03em;
  line-height: 1.15;
  margin-bottom: 14px;
}

.gradient-text {
  background: linear-gradient(135deg, #06b6d4 0%, #38bdf8 50%, #10b981 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.lobby-desc {
  font-size: 1.05rem;
  color: var(--text-muted);
  line-height: 1.6;
}

/* Mode Switch Tabs */
.mode-tabs {
  display: flex;
  justify-content: center;
  gap: 10px;
  margin-bottom: 28px;
}

.mode-tab-btn {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  color: var(--text-muted);
  font-family: inherit;
  font-size: 0.95rem;
  font-weight: 600;
  padding: 10px 22px;
  border-radius: var(--radius-pill);
  cursor: pointer;
  transition: var(--transition-fast);
  display: flex;
  align-items: center;
  gap: 8px;
}

.mode-tab-btn:hover {
  color: var(--text-main);
  background: var(--bg-surface-elevated);
}

.mode-tab-btn.active {
  background: var(--accent-subtle);
  border-color: var(--accent-primary);
  color: var(--accent-primary);
  box-shadow: 0 0 16px var(--accent-glow);
}

/* Setup Card Grid */
.setup-container {
  max-width: 900px;
  margin: 0 auto;
}

.setup-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 32px;
  box-shadow: var(--shadow-lg);
}

.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
  margin-bottom: 20px;
}

@media (max-width: 640px) {
  .form-row {
    grid-template-columns: 1fr;
  }
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 20px;
}

.form-group label {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-muted);
}

.form-group input,
.form-group select {
  background: var(--bg-tile);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  color: var(--text-main);
  font-family: inherit;
  font-size: 0.95rem;
  padding: 12px 14px;
  outline: none;
  transition: var(--transition-fast);
}

.form-group input:focus,
.form-group select:focus {
  border-color: var(--border-focus);
  box-shadow: 0 0 0 3px rgba(6, 182, 212, 0.15);
}

/* Studio Preview Box */
.preview-box {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 9;
  background: #000;
  border-radius: var(--radius-md);
  overflow: hidden;
  border: 1px solid var(--border-subtle);
  margin-bottom: 20px;
}

.preview-video {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.preview-overlay {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 16px;
  pointer-events: none;
}

.audio-meter-bar {
  width: 100%;
  height: 4px;
  background: rgba(255, 255, 255, 0.15);
  border-radius: var(--radius-pill);
  overflow: hidden;
}

.audio-meter-fill {
  width: 0%;
  height: 100%;
  background: var(--accent-success);
  transition: width 0.05s ease;
}

.source-selectors {
  display: flex;
  gap: 10px;
  margin-bottom: 24px;
}

.source-btn {
  flex: 1;
  background: var(--bg-surface-elevated);
  border: 1px solid var(--border-subtle);
  color: var(--text-muted);
  font-family: inherit;
  font-size: 0.88rem;
  font-weight: 600;
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: var(--transition-fast);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

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

.source-btn.active {
  background: var(--accent-subtle);
  border-color: var(--accent-primary);
  color: var(--accent-primary);
}

.btn-primary-action {
  width: 100%;
  background: var(--accent-primary);
  border: none;
  color: #04131d;
  font-family: inherit;
  font-size: 1.05rem;
  font-weight: 700;
  padding: 14px 20px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: var(--transition-fast);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  box-shadow: 0 4px 18px var(--accent-glow);
}

.btn-primary-action:hover {
  background: var(--accent-primary-hover);
  transform: translateY(-1px);
}

.btn-primary-action:active {
  transform: translateY(1px);
}

/* Architecture Callout Banner */
.arch-card {
  margin-top: 32px;
  background: rgba(6, 182, 212, 0.05);
  border: 1px solid rgba(6, 182, 212, 0.2);
  border-radius: var(--radius-md);
  padding: 20px 24px;
  display: flex;
  gap: 16px;
  align-items: flex-start;
}

.arch-icon {
  font-size: 1.8rem;
  line-height: 1;
}

.arch-info h4 {
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--accent-primary);
  margin-bottom: 4px;
}

.arch-info p {
  font-size: 0.84rem;
  color: var(--text-muted);
  line-height: 1.5;
}

/* ==========================================================================
   BROADCAST STUDIO & VIEWER THEATRE
   ========================================================================== */
.stage-grid {
  display: grid;
  grid-template-columns: 1fr 340px;
  gap: 20px;
  align-items: start;
}

@media (max-width: 980px) {
  .stage-grid {
    grid-template-columns: 1fr;
  }
}

.main-stage {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

/* Stage Header Bar */
.stage-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 12px 18px;
}

.stage-title-wrap {
  display: flex;
  align-items: center;
  gap: 12px;
}

.live-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: rgba(244, 63, 94, 0.15);
  border: 1px solid rgba(244, 63, 94, 0.4);
  color: var(--accent-danger);
  font-size: 0.75rem;
  font-weight: 800;
  padding: 4px 10px;
  border-radius: var(--radius-pill);
  letter-spacing: 0.05em;
}

.live-dot {
  width: 6px;
  height: 6px;
  background: var(--accent-danger);
  border-radius: 50%;
  animation: pulseGlow 1.2s infinite;
}

.stage-title {
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--text-main);
}

.stage-metrics {
  display: flex;
  align-items: center;
  gap: 16px;
}

.metric-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text-muted);
  background: var(--bg-surface-elevated);
  padding: 5px 12px;
  border-radius: var(--radius-pill);
  border: 1px solid var(--border-subtle);
}

.metric-pill.highlight {
  color: var(--accent-primary);
  border-color: rgba(6, 182, 212, 0.3);
}

.btn-share-link {
  background: var(--accent-subtle);
  border: 1px solid rgba(6, 182, 212, 0.35);
  color: var(--accent-primary);
  font-family: inherit;
  font-size: 0.82rem;
  font-weight: 700;
  padding: 6px 14px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: var(--transition-fast);
  display: flex;
  align-items: center;
  gap: 6px;
}

.btn-share-link:hover {
  background: rgba(6, 182, 212, 0.22);
}

/* Video Player Screen */
.stage-screen {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 9;
  background: #000;
  border-radius: var(--radius-lg);
  overflow: hidden;
  border: 1px solid var(--border-strong);
  box-shadow: var(--shadow-lg);
}

.stage-video {
  width: 100%;
  height: 100%;
  object-fit: contain;
  background: #000;
}

/* Play Overlay for Viewers */
.viewer-play-overlay {
  position: absolute;
  inset: 0;
  background: rgba(13, 20, 32, 0.85);
  backdrop-filter: blur(8px);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 14px;
  z-index: 20;
  cursor: pointer;
  transition: opacity 0.2s;
}

.play-circle {
  width: 72px;
  height: 72px;
  border-radius: 50%;
  background: var(--accent-primary);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #04131d;
  font-size: 1.8rem;
  box-shadow: 0 0 30px var(--accent-glow);
  transition: transform 0.2s;
}

.viewer-play-overlay:hover .play-circle {
  transform: scale(1.08);
}

.play-prompt-text {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--text-main);
}

.play-subtext {
  font-size: 0.85rem;
  color: var(--text-muted);
}

/* Buffering / Connecting Spinner Overlay */
.buffer-overlay {
  position: absolute;
  inset: 0;
  background: rgba(13, 20, 32, 0.88);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 16px;
  z-index: 15;
}

.spinner {
  width: 44px;
  height: 44px;
  border: 3px solid rgba(6, 182, 212, 0.2);
  border-top-color: var(--accent-primary);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* Control Dock */
.control-dock {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 12px 18px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.dock-group {
  display: flex;
  align-items: center;
  gap: 10px;
}

.dock-btn {
  background: var(--bg-surface-elevated);
  border: 1px solid var(--border-subtle);
  color: var(--text-main);
  font-family: inherit;
  font-size: 0.88rem;
  font-weight: 600;
  padding: 8px 16px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: var(--transition-fast);
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.dock-btn:hover {
  background: rgba(255, 255, 255, 0.08);
  border-color: var(--border-strong);
}

.dock-btn.danger {
  background: rgba(244, 63, 94, 0.15);
  border-color: rgba(244, 63, 94, 0.35);
  color: var(--accent-danger);
}

.dock-btn.danger:hover {
  background: var(--accent-danger);
  color: #fff;
}

.dock-btn.active {
  background: var(--accent-subtle);
  border-color: var(--accent-primary);
  color: var(--accent-primary);
}

/* Reaction Bar */
.reaction-bar {
  display: flex;
  align-items: center;
  gap: 8px;
}

.btn-emoji {
  background: var(--bg-surface-elevated);
  border: 1px solid var(--border-subtle);
  font-size: 1.25rem;
  width: 40px;
  height: 40px;
  border-radius: var(--radius-pill);
  cursor: pointer;
  transition: transform 0.15s, background 0.15s;
  display: flex;
  align-items: center;
  justify-content: center;
}

.btn-emoji:hover {
  transform: scale(1.2);
  background: rgba(255, 255, 255, 0.1);
  border-color: var(--border-strong);
}

.btn-emoji:active {
  transform: scale(0.95);
}

/* Sidebar Drawer (Chat & Swarm Telemetry) */
.stage-sidebar {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  display: flex;
  flex-direction: column;
  height: 600px;
  overflow: hidden;
  box-shadow: var(--shadow-md);
}

.sidebar-tabs {
  display: flex;
  border-bottom: 1px solid var(--border-subtle);
}

.sidebar-tab-btn {
  flex: 1;
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-family: inherit;
  font-size: 0.88rem;
  font-weight: 700;
  padding: 12px;
  cursor: pointer;
  transition: var(--transition-fast);
  border-bottom: 2px solid transparent;
}

.sidebar-tab-btn.active {
  color: var(--accent-primary);
  border-bottom-color: var(--accent-primary);
  background: rgba(6, 182, 212, 0.05);
}

.sidebar-content {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

/* Chat Messages */
.chat-scroll {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.chat-bubble {
  background: var(--bg-tile);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 10px 12px;
  font-size: 0.88rem;
  line-height: 1.4;
}

.chat-bubble.host {
  border-color: rgba(6, 182, 212, 0.3);
  background: rgba(6, 182, 212, 0.06);
}

.chat-author {
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--text-muted);
  margin-bottom: 4px;
  display: flex;
  justify-content: space-between;
}

.chat-author.host-author {
  color: var(--accent-primary);
}

.chat-form {
  padding: 12px;
  border-top: 1px solid var(--border-subtle);
  display: flex;
  gap: 8px;
}

.chat-input {
  flex: 1;
  background: var(--bg-tile);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  color: var(--text-main);
  font-family: inherit;
  font-size: 0.88rem;
  padding: 8px 12px;
  outline: none;
}

.chat-input:focus {
  border-color: var(--border-focus);
}

.chat-send-btn {
  background: var(--accent-primary);
  border: none;
  color: #04131d;
  font-family: inherit;
  font-size: 0.88rem;
  font-weight: 700;
  padding: 8px 14px;
  border-radius: var(--radius-sm);
  cursor: pointer;
}

/* Swarm Telemetry Panel */
.telemetry-panel {
  padding: 18px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.telemetry-card {
  background: var(--bg-tile);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 14px;
}

.telemetry-card h5 {
  font-size: 0.82rem;
  font-weight: 700;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-bottom: 10px;
  letter-spacing: 0.04em;
}

.telemetry-row {
  display: flex;
  justify-content: space-between;
  font-size: 0.84rem;
  margin-bottom: 8px;
}

.telemetry-row:last-child {
  margin-bottom: 0;
}

.telemetry-val {
  font-weight: 700;
  color: var(--accent-primary);
}

.telemetry-banner {
  background: rgba(16, 185, 129, 0.08);
  border: 1px solid rgba(16, 185, 129, 0.25);
  border-radius: var(--radius-md);
  padding: 12px;
  font-size: 0.82rem;
  color: var(--accent-success);
  line-height: 1.4;
  text-align: center;
}
