/* multivideo.css — Multi-perspective staging, beep confirm, canvas editor, render modal */

.mv-sub {
  color: var(--text-muted);
  font-size: 0.9rem;
  margin-bottom: 1rem;
  max-width: 620px;
}

/* --- Staging panel (inside #upload-section) --- */

#mv-staging {
  width: 700px;
  max-width: 90%;
  margin-top: 1.25rem;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

#mv-staging-list {
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
}

.mv-stage-item {
  display: flex;
  align-items: center;
  gap: 0.9rem;
  background: var(--surface-glass);
  -webkit-backdrop-filter: blur(20px);
  backdrop-filter: blur(20px);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 0.6rem;
}

.mv-thumb {
  width: 96px;
  height: 56px;
  border-radius: 6px;
  background: #000 center / cover no-repeat;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}

.mv-thumb-spinner {
  width: 18px;
  height: 18px;
  border: 2px solid rgba(255, 255, 255, 0.25);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: mvSpin 0.8s linear infinite;
}

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

.mv-stage-meta { flex: 1; min-width: 0; }
.mv-stage-name { font-weight: 600; font-size: 0.95rem; }
.mv-stage-file {
  color: var(--text-muted);
  font-size: 0.8rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.mv-stage-size { color: var(--text-muted); font-size: 0.8rem; }

.mv-remove {
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-size: 1rem;
  cursor: pointer;
  padding: 0.3rem 0.5rem;
  border-radius: 6px;
}
.mv-remove:hover { color: var(--red); background: var(--surface-hover); }

#mv-staging-actions {
  display: flex;
  gap: 0.6rem;
  justify-content: center;
  flex-wrap: wrap;
}

/* Consistent sizing for every action button in the multi-video flow, so the
   compact beep-banner variants and the standard buttons line up at one height. */
#mv-staging-actions .btn,
#mv-beep-actions .btn,
#mv-canvas-actions .btn,
#mv-render-result-actions .btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 42px;
  padding: 0.55rem 1.25rem;
  font-size: 0.9rem;
  border-radius: 9px;
}

.mv-text-link {
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 0.85rem;
  cursor: pointer;
  text-decoration: underline;
  align-self: center;
}
.mv-text-link:hover { color: var(--text); }

/* --- Shared section cards (beep + canvas) --- */

#mv-beep {
  min-height: calc(100vh - 140px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}

/* Alignment view fills the available space instead of a centered card */
#mv-canvas {
  min-height: calc(100vh - 120px);
  display: flex;
  padding: 1.25rem 1.5rem;
}

#mv-beep-card, #mv-canvas-card {
  background: var(--surface-glass);
  -webkit-backdrop-filter: blur(20px);
  backdrop-filter: blur(20px);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 1.75rem;
  width: 760px;
  max-width: 100%;
  display: flex;
  flex-direction: column;
}

/* The alignment card is a transparent full-size layout wrapper, not a glass card —
   its two children (viewport + settings) are the visible panels instead. */
#mv-canvas-card {
  width: 100%;
  max-width: 1600px;
  margin: 0 auto;
  flex: 1;
  min-height: 0;
  padding: 0;
  background: none;
  -webkit-backdrop-filter: none;
  backdrop-filter: none;
  border: none;
  border-radius: 0;
}

#mv-beep-card h2, #mv-canvas-card h2 { font-size: 1.3rem; margin-bottom: 0.4rem; }

#mv-beep-step {
  font-size: 0.8rem;
  color: var(--accent);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin-bottom: 0.35rem;
}

#mv-beep-video {
  width: 100%;
  max-height: 46vh;
  border-radius: 10px;
  background: #000;
}

#mv-beep-wave-wrap {
  position: relative;
  margin-top: 0.75rem;
  height: 78px;
  cursor: ew-resize;
  touch-action: none;
  background: rgba(0, 0, 0, 0.25);
  border: 1px solid var(--border);
  border-radius: 8px;
}

#mv-beep-wave {
  width: 100%;
  height: 100%;
  display: block;
  pointer-events: none;
  border-radius: 8px;
}

#mv-beep-line {
  position: absolute;
  top: 0;
  bottom: 0;
  width: 2px;
  margin-left: -1px;
  background: var(--green);
  box-shadow: 0 0 6px var(--green);
  display: none;
  pointer-events: none;
}

/* Grab handle on the beep marker for discoverability */
#mv-beep-line::before {
  content: "";
  position: absolute;
  top: -5px;
  left: -4px;
  width: 10px;
  height: 10px;
  border-radius: 3px;
  background: var(--green);
}

#mv-beep-playhead {
  position: absolute;
  top: 0;
  bottom: 0;
  width: 1px;
  margin-left: -0.5px;
  background: rgba(228, 230, 237, 0.7);
  display: none;
  pointer-events: none;
}

#mv-beep-status {
  margin: 0.75rem 0;
  font-size: 0.95rem;
  color: var(--text);
}
#mv-beep-status strong { color: var(--green); }

#mv-beep-actions {
  display: flex;
  gap: 0.6rem;
  justify-content: flex-end;
  flex-wrap: wrap;
}

/* --- Canvas editor: left viewport + right settings panel --- */

/* Indent the header so the title clears the fixed top-left brand logo */
#mv-canvas-header { margin-bottom: 1rem; flex-shrink: 0; padding-left: 7rem; }

#mv-canvas-body {
  flex: 1;
  min-height: 0;
  display: flex;
  gap: 1.25rem;
  align-items: stretch;
}

/* Left: large viewport panel that fills remaining horizontal + vertical space */
#mv-stage-wrap {
  flex: 1 1 auto;
  min-width: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.25);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 1rem;
  min-height: 360px;
}

/* Right: its own settings card */
#mv-settings {
  flex: 0 0 300px;
  display: flex;
  flex-direction: column;
  gap: 1.4rem;
  background: var(--surface-glass);
  -webkit-backdrop-filter: blur(20px);
  backdrop-filter: blur(20px);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 1.25rem;
  overflow-y: auto;
}

#mv-stage {
  position: relative;
  background:
    repeating-conic-gradient(#1c1f2a 0% 25%, #181b24 0% 50%) 50% / 24px 24px;
  border: 1px solid var(--border);
  border-radius: 8px;
  overflow: hidden;
  touch-action: none;
}

.mv-box {
  position: absolute;
  overflow: hidden;
  cursor: move;
  outline: 2px solid rgba(74, 124, 255, 0.6);
  outline-offset: -1px;
  touch-action: none;
}
.mv-box.mv-active { outline-color: var(--accent); z-index: 5; }

.mv-box video {
  width: 100%;
  height: 100%;
  object-fit: fill;
  display: block;
  pointer-events: none;
  transition: opacity 0.12s ease;
}

/* When the two boxes overlap, fade the top one so the perspective underneath
   stays visible while arranging (preview only — the render is fully opaque). */
.mv-box.mv-overlapping video { opacity: 0.5; }

.mv-box-tag {
  position: absolute;
  top: 4px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--accent);
  color: #fff;
  font-size: 0.75rem;
  font-weight: 700;
  width: 18px;
  height: 18px;
  border-radius: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 7;
}

/* Aspect-locked resize handles on all four corners. */
.mv-resize-handle {
  position: absolute;
  width: 15px;
  height: 15px;
  background: var(--accent);
  z-index: 6;
  box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.35);
}
.mv-handle-nw { top: -1px;    left: -1px;  cursor: nwse-resize; border-radius: 6px 0 0 0; }
.mv-handle-ne { top: -1px;    right: -1px; cursor: nesw-resize; border-radius: 0 6px 0 0; }
.mv-handle-sw { bottom: -1px; left: -1px;  cursor: nesw-resize; border-radius: 0 0 0 6px; }
.mv-handle-se { bottom: -1px; right: -1px; cursor: nwse-resize; border-radius: 0 0 6px 0; }

.mv-ctrl-group { display: flex; flex-direction: column; gap: 0.5rem; }
.mv-ctrl-group > label {
  font-size: 0.8rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

/* Segmented orientation toggle */
.mv-segmented {
  display: flex;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 2px;
  gap: 2px;
}
.mv-segmented button {
  flex: 1;
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-size: 0.85rem;
  padding: 0.4rem 0.5rem;
  border-radius: 6px;
  cursor: pointer;
}
.mv-segmented button.active {
  background: var(--accent);
  color: #fff;
}

#mv-dim-presets { display: flex; gap: 0.4rem; flex-wrap: wrap; }
.mv-preset {
  background: var(--surface-hover);
  border: 1px solid var(--border);
  color: var(--text);
  font-size: 0.8rem;
  padding: 0.35rem 0.6rem;
  border-radius: 6px;
  cursor: pointer;
}
.mv-preset:hover { border-color: var(--accent); }
.mv-preset.active { background: var(--accent); border-color: var(--accent); color: #fff; }

.mv-dim-custom { display: flex; align-items: center; gap: 0.4rem; color: var(--text-muted); }
.mv-dim-custom input {
  width: 76px;
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--text);
  border-radius: 6px;
  padding: 0.3rem 0.45rem;
  font-size: 0.85rem;
}

#mv-audio-choice { display: flex; flex-direction: column; gap: 0.35rem; }
#mv-audio-choice label {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.9rem;
  cursor: pointer;
}

/* Actions pinned to the bottom of the settings panel */
#mv-canvas-actions {
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
  margin-top: auto;
}
#mv-canvas-actions .btn { width: 100%; justify-content: center; }

/* --- Render modal --- */

#mv-render-modal {
  position: fixed;
  inset: 0;
  z-index: 5000;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.5);
  -webkit-backdrop-filter: blur(12px);
  backdrop-filter: blur(12px);
}

#mv-render-card {
  background: var(--surface-glass);
  -webkit-backdrop-filter: blur(24px);
  backdrop-filter: blur(24px);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 1.5rem 2rem;
  min-width: 320px;
  max-width: 90%;
  text-align: center;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.5);
}

#mv-render-title { font-size: 1rem; font-weight: 600; margin-bottom: 0.4rem; }

#mv-render-track {
  height: 6px;
  background: var(--surface-hover);
  border-radius: 3px;
  overflow: hidden;
}
#mv-render-fill {
  height: 100%;
  width: 0%;
  background: var(--accent);
  border-radius: 3px;
  transition: width 0.15s ease;
}
#mv-render-pct {
  margin-top: 0.6rem;
  font-size: 0.85rem;
  font-variant-numeric: tabular-nums;
  color: var(--text-muted);
}

#mv-render-result { margin-top: 1.1rem; }
#mv-render-done-msg { font-size: 0.95rem; margin-bottom: 0.8rem; color: var(--green); }
#mv-render-result-actions { display: flex; gap: 0.6rem; justify-content: center; }

body.no-blur #mv-beep-card,
body.no-blur #mv-settings,
body.no-blur .mv-stage-item,
body.no-blur #mv-render-card,
body.no-blur #mv-render-modal {
  -webkit-backdrop-filter: none;
  backdrop-filter: none;
  background: var(--surface);
}

@media (max-width: 900px) {
  #mv-canvas-body { flex-direction: column; }
  #mv-settings { flex-basis: auto; }
  #mv-canvas-actions { margin-top: 0.5rem; }
}

@media (max-width: 768px) {
  #mv-beep-card, #mv-canvas-card { padding: 1.1rem; }
}
