/* ==========================================================================
   MixOfAll Online Screen Recorder — Fast, Editorial MixOfAll Design System
   Matches MixOfAll's palette (--paper, --white, --ink, --blue, --line)
   ========================================================================== */

:root {
  --sr-paper: #faf9f6;
  --sr-paper-2: #f3f1ec;
  --sr-white: #ffffff;
  --sr-ink: #202b36;
  --sr-ink-soft: #3a4654;
  --sr-muted: #68737d;
  --sr-line: #e2e4e3;
  --sr-line-strong: #cfd3d1;
  --sr-blue: #2f56c5;
  --sr-blue-dark: #23439e;
  --sr-blue-soft: #edf1fb;
  --sr-green: #1e7a4c;
  --sr-green-soft: #e9f5ee;
  --sr-red: #d92d20;
  --sr-red-soft: #fef2f2;
  --sr-stage-bg: #141b24;
  --sr-shadow-sm: 0 1px 2px rgba(20, 28, 38, 0.05);
  --sr-shadow-md: 0 10px 28px -12px rgba(20, 28, 38, 0.14);
}

/* Studio Outer Card */
.recorder-studio-card {
  background: var(--sr-white);
  border: 1px solid var(--sr-line);
  border-radius: 10px;
  box-shadow: var(--sr-shadow-sm);
  overflow: visible;
  margin-bottom: 28px;
}

/* ==========================================================================
   1. TOP STUDIO TOOLBAR (MixOfAll Editorial Style)
   ========================================================================== */
.studio-dock {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 16px;
  background: var(--sr-paper);
  border-bottom: 1px solid var(--sr-line);
  border-radius: 10px 10px 0 0;
  flex-wrap: wrap;
  position: relative;
  z-index: 60;
}

.dock-item-wrap {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.dock-btn {
  appearance: none;
  border: 1px solid var(--sr-line);
  background: var(--sr-white);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 13px;
  border-radius: 7px;
  transition: background 0.14s ease, border-color 0.14s ease, color 0.14s ease, box-shadow 0.14s ease;
  color: var(--sr-ink-soft);
  font-family: var(--sans, 'DM Sans', -apple-system, BlinkMacSystemFont, sans-serif);
  font-size: 13px;
  font-weight: 600;
  line-height: 1.2;
}

.dock-btn:hover {
  background: var(--sr-paper-2);
  border-color: var(--sr-line-strong);
  color: var(--sr-ink);
}

.dock-icon-circle,
.dock-icon-box {
  width: 24px;
  height: 24px;
  border-radius: 5px;
  background: var(--sr-paper-2);
  color: var(--sr-ink-soft);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  position: relative;
  transition: all 0.14s ease;
  flex-shrink: 0;
}

.dock-icon-circle svg,
.dock-icon-box svg {
  width: 16px !important;
  height: 16px !important;
  stroke: currentColor;
  fill: none;
  stroke-width: 1.9;
  stroke-linecap: round;
  stroke-linejoin: round;
}

/* Active state for Cam / Mic in MixOfAll Blue/Green */
.dock-btn.active-green {
  background: var(--sr-blue-soft);
  border-color: rgba(47, 86, 197, 0.35);
  color: var(--sr-blue-dark);
}

.dock-btn.active-green .dock-icon-circle {
  background: var(--sr-blue);
  color: #ffffff;
}

.dock-btn.muted-off {
  background: var(--sr-white);
  border-color: var(--sr-line);
  color: var(--sr-muted);
}

.dock-btn.muted-off .dock-icon-circle {
  background: var(--sr-paper-2);
  color: var(--sr-muted);
}

/* Active state for other dock buttons */
.dock-btn.active-box {
  background: var(--sr-blue-soft);
  border-color: var(--sr-blue);
  color: var(--sr-blue-dark);
}

.dock-btn.active-box .dock-icon-box {
  background: var(--sr-blue);
  color: #ffffff;
}

/* Aspect Ratio Badge (16:9) */
.dock-badge {
  position: absolute;
  top: -6px;
  right: -8px;
  background: var(--sr-ink);
  color: #ffffff;
  font-size: 9px;
  font-weight: 700;
  padding: 1px 4px;
  border-radius: 4px;
  line-height: 1.1;
  letter-spacing: 0.01em;
}

.dock-divider {
  width: 1px;
  height: 26px;
  background: var(--sr-line);
  margin: 0 2px;
}

.dock-caret {
  font-size: 10px;
  opacity: 0.65;
  margin-left: 2px;
}

/* Popover Dropdown Panels */
.dock-popover {
  display: none;
  position: absolute;
  top: calc(100% + 6px);
  left: 50%;
  transform: translateX(-50%);
  min-width: 260px;
  background: var(--sr-white);
  border: 1px solid var(--sr-line-strong);
  border-radius: 8px;
  box-shadow: var(--sr-shadow-md);
  padding: 14px;
  z-index: 120;
  text-align: left;
}

.dock-popover.open {
  display: block;
}

.dock-popover h4 {
  font-family: var(--sans, sans-serif);
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--sr-muted);
  margin: 0 0 10px 0;
}

.popover-option-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
}

.popover-opt-btn {
  padding: 8px 10px;
  border: 1px solid var(--sr-line);
  border-radius: 6px;
  background: var(--sr-paper);
  color: var(--sr-ink-soft);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  transition: all 0.12s ease;
}

.popover-opt-btn:hover {
  border-color: var(--sr-blue);
  background: var(--sr-white);
  color: var(--sr-blue);
}

.popover-opt-btn.selected {
  background: var(--sr-blue-soft);
  border-color: var(--sr-blue);
  color: var(--sr-blue-dark);
}

/* Background Swatches */
.bg-swatch-row {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 6px;
}

.bg-swatch {
  width: 30px;
  height: 30px;
  border-radius: 6px;
  border: 2px solid transparent;
  cursor: pointer;
  transition: transform 0.12s ease, border-color 0.12s ease;
}

.bg-swatch:hover {
  transform: scale(1.06);
}

.bg-swatch.selected {
  border-color: var(--sr-blue);
  box-shadow: 0 0 0 2px #fff inset;
}

/* ==========================================================================
   2. MAIN STAGE VIEWPORT
   ========================================================================== */
.stage-viewport-wrapper {
  padding: 18px 20px;
  background: var(--sr-paper-2);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

#screenStage {
  position: relative;
  width: 100%;
  max-width: 960px;
  aspect-ratio: 16 / 9;
  background: var(--sr-stage-bg);
  border-radius: 8px;
  overflow: hidden;
  border: 1px solid var(--sr-line-strong);
  box-shadow: var(--sr-shadow-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  user-select: none;
}

/* Native Hardware-Accelerated Screen Preview Video */
#liveScreenVideo {
  display: none;
  width: 100%;
  height: 100%;
  object-fit: contain;
  position: absolute;
  inset: 0;
  z-index: 3;
  pointer-events: none;
}

/* ==========================================================================
   3. ROUND RESIZABLE WEBCAM / AVATAR BUBBLE (100% Circle Fit)
   ========================================================================== */
#webcamBubble {
  position: absolute;
  bottom: 22px;
  left: 22px;
  width: 170px;
  height: 170px;
  aspect-ratio: 1 / 1;
  border-radius: 50% !important;
  overflow: hidden !important;
  border: 3px solid #ffffff;
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.38);
  cursor: grab;
  z-index: 22;
  background: #10161f;
  touch-action: none;
  user-select: none;
  box-sizing: border-box;
}

#webcamBubble:active {
  cursor: grabbing;
  border-color: var(--sr-blue);
}

#webcamBubble video,
#webcamBubble img {
  position: absolute;
  inset: 0;
  width: 100% !important;
  height: 100% !important;
  object-fit: cover !important;
  object-position: center center !important;
  border-radius: 50% !important;
  display: block;
  pointer-events: none;
}

/* Resize Handle on Round Bubble (Always visible so user can resize easily) */
#bubbleResizeHandle {
  position: absolute;
  right: 10%;
  bottom: 10%;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: var(--sr-blue);
  color: #ffffff;
  border: 2px solid #ffffff;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: nwse-resize;
  z-index: 25;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.35);
  opacity: 0.92;
  transition: transform 0.12s ease, background 0.12s ease;
  font-size: 12px;
  line-height: 1;
}

#bubbleResizeHandle:hover {
  transform: scale(1.12);
  background: var(--sr-blue-dark);
}

/* ==========================================================================
   4. INTERACTIVE MARKING / CONFETTI CANVAS OVERLAY
   ========================================================================== */
#annotationCanvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: 18;
  pointer-events: none;
}

#annotationCanvas.drawing-active {
  pointer-events: auto;
  cursor: crosshair;
}

/* Active Custom Area Frame Indicator on Stage */
#activeCropIndicator {
  display: none;
  position: absolute;
  border: 2px dashed #38bdf8;
  background: rgba(56, 189, 248, 0.04);
  z-index: 15;
  pointer-events: none;
  box-sizing: border-box;
}

/* ==========================================================================
   5. START RECORDING COUNTDOWN OVERLAY (3 - 2 - 1)
   ========================================================================== */
#countdownOverlay {
  display: none;
  position: absolute;
  inset: 0;
  background: rgba(20, 27, 36, 0.82);
  z-index: 50;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  color: #ffffff;
}

#countdownNumber {
  width: 120px;
  height: 120px;
  border-radius: 50%;
  background: var(--sr-blue);
  border: 4px solid #ffffff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 60px;
  font-weight: 800;
  font-family: var(--sans, sans-serif);
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.4);
}

/* ==========================================================================
   6. LIVE ENGLISH CAPTIONS / SUBTITLES OVERLAY
   ========================================================================== */
#liveCaptionBanner {
  display: none;
  position: absolute;
  bottom: 20px;
  left: 50%;
  transform: translateX(-50%);
  max-width: 82%;
  background: rgba(20, 27, 36, 0.88);
  color: #ffffff;
  padding: 8px 18px;
  border-radius: 6px;
  font-size: 15px;
  font-weight: 600;
  text-align: center;
  line-height: 1.4;
  z-index: 26;
  pointer-events: none;
  border: 1px solid rgba(255, 255, 255, 0.18);
}

/* ==========================================================================
   7. TELEPROMPTER OVERLAY (Presenter-Only View)
   ========================================================================== */
#teleprompterPanel {
  display: none;
  position: absolute;
  top: 14px;
  left: 50%;
  transform: translateX(-50%);
  width: min(540px, 90%);
  background: rgba(20, 27, 36, 0.92);
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 8px;
  padding: 12px 14px;
  color: #f8fafc;
  z-index: 28;
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.45);
}

/* ==========================================================================
   8. BOTTOM RECORDING CONTROL BAR (MixOfAll Editorial Style)
   ========================================================================== */
.sr-control-bar-wrap {
  padding: 16px 20px 20px;
  background: var(--sr-white);
  border-top: 1px solid var(--sr-line);
  border-radius: 0 0 10px 10px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
}

.sr-pill-bar {
  position: relative;
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  max-width: 960px;
  min-height: 58px;
  background: var(--sr-paper);
  border: 1px solid var(--sr-line-strong);
  border-radius: 10px;
  padding: 8px 14px 8px 78px;
  box-shadow: var(--sr-shadow-sm);
  flex-wrap: wrap;
}

/* Prominent Red Record / Stop Circle Button */
.sr-red-record-btn {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  width: 52px;
  height: 52px;
  border-radius: 50%;
  background: var(--sr-red);
  border: 3px solid #ffffff;
  box-shadow: 0 4px 12px rgba(217, 45, 32, 0.32), 0 0 0 1px rgba(217, 45, 32, 0.2);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.14s ease, background 0.14s ease;
  z-index: 5;
}

.sr-red-record-btn:hover {
  transform: translateY(-50%) scale(1.05);
  background: #b91c1c;
}

.sr-red-record-btn .inner-shape {
  width: 18px;
  height: 18px;
  background: #ffffff;
  border-radius: 50%;
  transition: all 0.16s ease;
}

/* When Recording: Inner white circle turns into Stop square */
.sr-red-record-btn.is-recording .inner-shape {
  width: 16px;
  height: 16px;
  border-radius: 3px;
}

/* Timer Display (0:00) */
.sr-timer-display {
  font-family: var(--sans, sans-serif);
  font-size: 15px;
  font-weight: 700;
  color: var(--sr-ink);
  min-width: 44px;
  text-align: center;
  font-variant-numeric: tabular-nums;
  margin-right: 4px;
}

/* Action Buttons inside Control Bar */
.sr-btn {
  appearance: none;
  height: 36px;
  padding: 0 12px;
  border-radius: 6px;
  border: 1px solid var(--sr-line-strong);
  background: var(--sr-white);
  color: var(--sr-ink-soft);
  font-family: var(--sans, sans-serif);
  font-size: 13px;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  transition: all 0.12s ease;
}

.sr-btn:hover {
  background: var(--sr-paper-2);
  border-color: var(--sr-blue);
  color: var(--sr-blue);
}

.sr-btn.active-solid {
  background: var(--sr-blue);
  color: #ffffff;
  border-color: var(--sr-blue);
}

.sr-btn.active-solid:hover {
  background: var(--sr-blue-dark);
}

.sr-btn svg {
  width: 15px;
  height: 15px;
  stroke: currentColor;
  fill: none;
  stroke-width: 2;
}

/* Square Icon Buttons (Zoom, Pen, Confetti) */
.sr-icon-btn {
  appearance: none;
  width: 36px;
  height: 36px;
  border-radius: 6px;
  border: 1px solid var(--sr-line-strong);
  background: var(--sr-white);
  color: var(--sr-ink-soft);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.12s ease;
  padding: 0;
}

.sr-icon-btn:hover {
  background: var(--sr-paper-2);
  border-color: var(--sr-blue);
  color: var(--sr-blue);
}

.sr-icon-btn.active {
  background: var(--sr-blue);
  color: #ffffff;
  border-color: var(--sr-blue);
}

.sr-icon-btn svg {
  width: 16px;
  height: 16px;
  stroke: currentColor;
  fill: none;
  stroke-width: 2;
}

/* Pause & Cancel Buttons on Right */
.sr-cancel-btn {
  margin-left: auto;
  height: 36px;
  padding: 0 14px;
  border-radius: 6px;
  border: 1px solid var(--sr-line-strong);
  background: var(--sr-white);
  color: var(--sr-ink-soft);
  font-family: var(--sans, sans-serif);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.12s ease;
}

.sr-cancel-btn:hover {
  border-color: var(--sr-red);
  color: var(--sr-red);
  background: var(--sr-red-soft);
}

/* ==========================================================================
   9. FLOATING MARKING TOOLS SUB-BAR
   ========================================================================== */
.marking-subtoolbar {
  display: none;
  align-items: center;
  gap: 6px;
  padding: 10px 14px;
  background: var(--sr-paper);
  border: 1px solid var(--sr-blue);
  border-radius: 8px;
  flex-wrap: wrap;
  width: 100%;
  max-width: 960px;
  box-shadow: var(--sr-shadow-sm);
}

.marking-subtoolbar.open {
  display: flex;
}

.draw-tool-btn {
  padding: 6px 11px;
  border-radius: 6px;
  border: 1px solid var(--sr-line-strong);
  background: var(--sr-white);
  color: var(--sr-ink-soft);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  transition: all 0.12s ease;
}

.draw-tool-btn:hover {
  border-color: var(--sr-blue);
  color: var(--sr-blue);
}

.draw-tool-btn.active {
  background: var(--sr-blue);
  color: #ffffff;
  border-color: var(--sr-blue);
}

.color-dot {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  border: 2px solid #ffffff;
  box-shadow: 0 0 0 1px var(--sr-line-strong);
  cursor: pointer;
  padding: 0;
  transition: transform 0.12s ease;
}

.color-dot.active {
  transform: scale(1.2);
  box-shadow: 0 0 0 2px var(--sr-ink);
}

@media (max-width: 768px) {
  .studio-dock {
    gap: 6px;
    padding: 10px;
  }
  .dock-divider {
    display: none;
  }
  .sr-pill-bar {
    padding: 10px 12px 10px 68px;
    gap: 6px;
  }
  .sr-red-record-btn {
    width: 46px;
    height: 46px;
    left: 10px;
  }
  .sr-cancel-btn {
    margin-left: 0;
  }
}
