/* ═══════════════════════════════════════════════════════════════════════════
   World Wide Band — video_editor.css
   Analog Studio aesthetic · Video Editor page
   ═══════════════════════════════════════════════════════════════════════════ */

/* ── Page wrapper ──────────────────────────────────────────────────────────── */
.ve-wrap {
  max-width: 1440px;
  margin: 0 auto;
  padding: 1rem 1.25rem 3rem;
}

/* ── Header bar ────────────────────────────────────────────────────────────── */
.ve-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1.25rem;
}
.ve-header-spacer { width: 80px; }

.ve-title {
  font-family: var(--font-display);
  font-size: 1.05rem;
  color: var(--cyan);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

/* ── Section labels ────────────────────────────────────────────────────────── */
.ve-section-label {
  font-family: var(--font-mono);
  font-size: 0.68rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--text-3);
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin: 1.5rem 0 0.5rem;
}
.ve-hint {
  font-family: var(--font-body);
  font-size: 0.78rem;
  letter-spacing: 0;
  text-transform: none;
  color: var(--text-3);
  margin-left: 0.25rem;
}

/* ── Frame group — constrains editing + preview frames to 70% width ─────────── */
.ve-frame-group {
  max-width: 70%;
  margin: 0 auto;
}

/* ── Editing Frame wrapper ─────────────────────────────────────────────────── */
.ve-editing-frame-wrap {
  width: 100%;
  background: #000;
  border: 1px solid #000;
  box-shadow:
    0 4px 20px rgba(0,0,0,0.6),
    inset 0 1px 0 rgba(255,255,255,0.05);
  border-radius: var(--radius) var(--radius) 0 0;
  overflow: hidden;
  position: relative;
}

/* ── The 16:9 editing grid ─────────────────────────────────────────────────── */
.ve-frame {
  width: 100%;
  aspect-ratio: 16 / 9;
  display: grid;
  gap: 2px;
  background: #0c0c14;
}

/* ── Individual cells ──────────────────────────────────────────────────────── */
.ve-cell {
  position: relative;
  background: #000;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
}

.ve-cell video {
  width: 100%;
  height: 100%;
  /* contain: never crops — video stays in its 16:9 ratio.
     Cells in the editing frame are already 16:9 (square grid of 16:9 frame),
     so for 16:9 recordings this fills the cell perfectly with no black bars. */
  object-fit: contain;
  background: #000;
  display: block;
  pointer-events: none;
}

/* Logo cell */
.ve-cell-logo {
  background: #000;
  flex-direction: column;
  gap: 0.4rem;
}
.ve-logo-img {
  max-height: 120px;   /* half of hero 240px */
  max-width: 80%;
  object-fit: contain;
  filter: drop-shadow(0 0 10px rgba(45,212,191,0.45));
}

/* Empty cell */
.ve-cell-empty {
  background: #050508;
}

/* Track label (bottom-left of cell) */
.ve-cell-label {
  position: absolute;
  bottom: 5px;
  left: 5px;
  font-family: var(--font-mono);
  font-size: 0.58rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: rgba(255,255,255,0.55);
  background: rgba(0,0,0,0.65);
  padding: 1px 5px;
  border-radius: 3px;
  pointer-events: none;
  white-space: nowrap;
}

/* Event badge (top-left of cell — shows current layout mode) */
.ve-cell-event-badge {
  position: absolute;
  top: 6px;
  left: 6px;
  font-family: var(--font-mono);
  font-size: 0.56rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  padding: 2px 6px;
  border-radius: 3px;
  pointer-events: none;
  display: none;
}
.ve-cell-event-badge.emphasis {
  display: block;
  background: rgba(168,85,247,0.85);
  color: #fff;
  box-shadow: 0 0 8px rgba(168,85,247,0.4);
}
.ve-cell-event-badge.solo {
  display: block;
  background: rgba(45,212,191,0.85);
  color: #000;
  box-shadow: 0 0 8px rgba(45,212,191,0.4);
}

/* 3-dot menu button (top-right of cell) */
.ve-cell-menu-btn {
  position: absolute;
  top: 5px;
  right: 5px;
  background: rgba(10,10,16,0.75);
  border: 1px solid rgba(255,255,255,0.15);
  border-radius: 4px;
  color: var(--text-2);
  width: 26px;
  height: 26px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  opacity: 0;
  transition: opacity 0.15s, background 0.12s, border-color 0.12s;
  z-index: 10;
  font-size: 13px;
  line-height: 1;
}
.ve-cell:hover .ve-cell-menu-btn { opacity: 1; }
.ve-cell-menu-btn:hover {
  background: rgba(10,10,16,0.95);
  color: var(--cyan);
  border-color: var(--cyan);
  box-shadow: 0 0 8px rgba(45,212,191,0.3);
}
/* Disabled during playback */
.ve-cell-menu-btn:disabled,
.ve-cell-menu-btn.is-disabled {
  opacity: 0 !important;
  pointer-events: none;
}

/* ── Context menu ──────────────────────────────────────────────────────────── */
.ve-context-menu {
  position: fixed;
  background: linear-gradient(180deg, #22222e 0%, #14141c 100%);
  border: 1px solid #000;
  box-shadow:
    0 8px 28px rgba(0,0,0,0.7),
    inset 0 1px 0 rgba(255,255,255,0.07);
  border-radius: var(--radius);
  z-index: 9999;
  min-width: 200px;
  overflow: hidden;
}
.ve-cm-header {
  font-family: var(--font-mono);
  font-size: 0.64rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--text-3);
  padding: 9px 12px 7px;
  border-bottom: 1px solid rgba(255,255,255,0.05);
  display: flex;
  align-items: center;
  gap: 6px;
}
.ve-cm-header strong { color: var(--cyan); }

.ve-cm-item {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  padding: 10px 12px;
  background: transparent;
  border: none;
  color: var(--text-2);
  font-family: var(--font-body);
  font-size: 0.9rem;
  cursor: pointer;
  text-align: left;
  transition: background 0.1s, color 0.1s;
}
.ve-cm-item:hover { background: rgba(255,255,255,0.05); color: var(--text); }
.ve-cm-item[data-mode="normal"]:hover  { color: var(--green); }
.ve-cm-item[data-mode="emphasis"]:hover { color: var(--accent-2); }
.ve-cm-item[data-mode="solo"]:hover    { color: var(--cyan); }
.ve-cm-item + .ve-cm-item {
  border-top: 1px solid rgba(255,255,255,0.04);
}
.ve-cm-desc {
  font-size: 0.72rem;
  color: var(--text-3);
  margin-left: auto;
  font-family: var(--font-mono);
  letter-spacing: 0;
}

/* ── Transport bar ─────────────────────────────────────────────────────────── */
.ve-transport {
  display: flex;
  align-items: center;
  gap: 0.9rem;
  padding: 0.55rem 0.9rem;
  background: linear-gradient(180deg, #1d1d28 0%, #14141c 100%);
  border: 1px solid #000;
  border-top: none;
  box-shadow:
    inset 0 1px 0 rgba(255,255,255,0.04),
    inset 0 -1px 0 rgba(0,0,0,0.5);
}

.ve-transport-controls {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  flex-shrink: 0;
}

.ve-time {
  font-family: var(--font-mono);
  font-size: 0.8rem;
  color: var(--cyan);
  background: #000;
  padding: 2px 9px;
  border-radius: 3px;
  min-width: 46px;
  text-align: center;
  box-shadow:
    inset 0 1px 3px rgba(0,0,0,0.6),
    0 0 10px rgba(45,212,191,0.1);
  letter-spacing: 0.05em;
}

.ve-total-time {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  color: var(--text-3);
  letter-spacing: 0.04em;
}

/* Timeline + markers */
.ve-timeline-wrap {
  flex: 1;
  position: relative;
  display: flex;
  flex-direction: column;
}

.ve-seek {
  width: 100%;
  height: 6px;
  -webkit-appearance: none;
  appearance: none;
  background: linear-gradient(
    90deg,
    var(--accent) var(--seek-pct, 0%),
    #2a2a3a var(--seek-pct, 0%)
  );
  border-radius: 3px;
  outline: none;
  cursor: pointer;
  border: 1px solid rgba(0,0,0,0.7);
  box-shadow: inset 0 1px 2px rgba(0,0,0,0.6);
  display: block;
}
.ve-seek::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 15px;
  height: 15px;
  border-radius: 50%;
  background: linear-gradient(180deg, #d8d8e8, #9898b4);
  border: 1px solid #000;
  box-shadow: 0 2px 5px rgba(0,0,0,0.55), inset 0 1px 0 rgba(255,255,255,0.3);
  cursor: pointer;
  margin-top: -5px;
}
.ve-seek::-moz-range-thumb {
  width: 15px;
  height: 15px;
  border-radius: 50%;
  background: linear-gradient(180deg, #d8d8e8, #9898b4);
  border: 1px solid #000;
  cursor: pointer;
}
.ve-seek:disabled { opacity: 0.38; cursor: not-allowed; }

/* Event markers on timeline */
.ve-markers {
  position: relative;
  width: 100%;
  height: 10px;
  margin-top: 4px;
  pointer-events: none;
}
#edit-markers {
  pointer-events: auto;
}
.ve-marker {
  position: absolute;
  top: 0;
  width: 3px;
  height: 100%;
  border-radius: 1px;
  transform: translateX(-50%);
}
#edit-markers .ve-marker {
  cursor: context-menu;
}
.ve-marker.emphasis { background: var(--accent); box-shadow: 0 0 4px var(--accent-glow); }
.ve-marker.solo     { background: var(--cyan);   box-shadow: 0 0 4px var(--cyan-glow); }
.ve-marker.normal   { background: var(--green);  box-shadow: 0 0 4px rgba(74,222,128,0.4); }

.ve-transport-right {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

/* ── Actions bar ───────────────────────────────────────────────────────────── */
.ve-actions {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 0.65rem 0.9rem;
  background: var(--bg-2);
  border: 1px solid #000;
  border-top: none;
  border-radius: 0 0 var(--radius) var(--radius);
  margin-bottom: 0.25rem;
}

.ve-events-count {
  font-family: var(--font-mono);
  font-size: 0.68rem;
  letter-spacing: 0.08em;
  color: var(--text-3);
}
.ve-pause-hint {
  font-family: var(--font-mono);
  font-size: 0.65rem;
  color: var(--amber);
  letter-spacing: 0.06em;
  margin-left: auto;
}

/* ── Preview Frame ─────────────────────────────────────────────────────────── */
.ve-preview-frame-wrap {
  width: 100%;
  aspect-ratio: 16 / 9;
  background: #000;
  border: 1px solid #000;
  box-shadow:
    0 4px 20px rgba(0,0,0,0.6),
    inset 0 1px 0 rgba(255,255,255,0.05);
  border-radius: var(--radius) var(--radius) 0 0;
  overflow: hidden;
  position: relative;
}

.ve-preview-canvas {
  width: 100%;
  height: 100%;
  display: none;
  object-fit: contain;
}

.ve-preview-placeholder {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.9rem;
  color: var(--text-3);
}
.ve-preview-placeholder i { font-size: 2.8rem; opacity: 0.5; }
.ve-preview-placeholder p {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  letter-spacing: 0.08em;
  opacity: 0.65;
}

/* Preview transport — same as edit transport, with bottom radius */
.ve-preview-transport {
  border-radius: 0 0 var(--radius) var(--radius);
}

/* ── Loading overlay ───────────────────────────────────────────────────────── */
.ve-loading {
  position: absolute;
  inset: 0;
  background: rgba(10,10,16,0.88);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.8rem;
  z-index: 50;
  backdrop-filter: blur(2px);
}
.ve-loading i {
  font-size: 2.2rem;
  color: var(--cyan);
  animation: ve-spin 1s linear infinite;
}
.ve-loading p {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  letter-spacing: 0.1em;
  color: var(--text-2);
}
@keyframes ve-spin {
  from { transform: rotate(0deg); }
  to   { transform: rotate(360deg); }
}

/* ── Cyan button variant ───────────────────────────────────────────────────── */
.btn-cyan {
  background: linear-gradient(180deg, var(--cyan-2) 0%, var(--cyan-deep) 100%);
  border: 1px solid #000;
  color: #000;
  font-family: var(--font-mono);
  font-size: 0.72rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.25), 0 2px 6px rgba(0,0,0,0.4);
  transition: transform 0.1s, box-shadow 0.1s, background 0.1s;
}
.btn-cyan:hover:not(:disabled) {
  background: linear-gradient(180deg, #7ef7e8 0%, var(--cyan-2) 100%);
  transform: translateY(-1px);
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.3), 0 4px 10px rgba(0,0,0,0.4), 0 0 12px rgba(45,212,191,0.3);
}
.btn-cyan:active:not(:disabled) {
  transform: translateY(1px);
  box-shadow: inset 0 1px 4px rgba(0,0,0,0.35);
}
.btn-cyan:disabled { opacity: 0.38; cursor: not-allowed; }

/* Export button spin state */
.btn-accent.exporting i { animation: ve-spin 1s linear infinite; }

/* ── Export Modal ──────────────────────────────────────────────────────────── */
.ve-modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.72);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10000;
  backdrop-filter: blur(3px);
}

.ve-modal {
  background: linear-gradient(180deg, #22222e 0%, #14141c 100%);
  border: 1px solid #000;
  border-radius: var(--radius-lg);
  box-shadow:
    inset 0 1px 0 rgba(255,255,255,0.07),
    0 16px 48px rgba(0,0,0,0.8),
    0 0 0 1px rgba(168,85,247,0.15);
  width: min(480px, 94vw);
  overflow: hidden;
}

.ve-modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px 12px;
  border-bottom: 1px solid rgba(255,255,255,0.06);
  font-family: var(--font-display);
  font-size: 0.9rem;
  letter-spacing: 0.06em;
  color: var(--cyan);
}

.ve-modal-close {
  background: none;
  border: none;
  color: var(--text-3);
  cursor: pointer;
  padding: 4px;
  border-radius: 4px;
  line-height: 1;
  font-size: 1rem;
  transition: color 0.15s;
}
.ve-modal-close:hover { color: var(--text); }

.ve-modal-body {
  padding: 18px 18px 14px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.ve-modal-field {
  display: flex;
  flex-direction: column;
  gap: 7px;
}

.ve-modal-label {
  font-family: var(--font-mono);
  font-size: 0.64rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--text-3);
  display: flex;
  align-items: center;
  gap: 5px;
}

.ve-modal-input {
  font-family: var(--font-mono);
  font-size: 0.88rem;
  background: #0a0a10;
  border: 1px solid rgba(255,255,255,0.1);
  color: var(--text);
  padding: 7px 10px;
  border-radius: var(--radius);
  box-shadow: inset 0 1px 3px rgba(0,0,0,0.5);
}
.ve-modal-input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: inset 0 1px 3px rgba(0,0,0,0.5), 0 0 0 2px rgba(168,85,247,0.2);
}

.ve-filename-row {
  display: flex;
  align-items: center;
  gap: 6px;
}
.ve-filename-row .ve-modal-input { flex: 1; }
.ve-ext-badge {
  font-family: var(--font-mono);
  font-size: 0.78rem;
  color: var(--cyan);
  background: rgba(45,212,191,0.1);
  border: 1px solid rgba(45,212,191,0.2);
  border-radius: 4px;
  padding: 4px 8px;
  white-space: nowrap;
  flex-shrink: 0;
}

/* Quality radio cards */
.ve-quality-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 7px;
}

.ve-quality-opt { cursor: pointer; }
.ve-quality-opt input[type="radio"] { display: none; }

.ve-quality-card {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 9px 11px;
  background: linear-gradient(180deg, #1c1c28, #13131b);
  border: 1px solid rgba(255,255,255,0.07);
  border-radius: var(--radius);
  cursor: pointer;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.ve-quality-opt input:checked + .ve-quality-card {
  border-color: var(--accent);
  box-shadow: 0 0 0 1px rgba(168,85,247,0.25), inset 0 0 12px rgba(168,85,247,0.06);
}
.ve-quality-opt:hover .ve-quality-card { border-color: rgba(168,85,247,0.4); }

.ve-quality-name {
  font-family: var(--font-body);
  font-size: 0.84rem;
  font-weight: 600;
  color: var(--text);
  letter-spacing: 0.02em;
}
.ve-quality-desc {
  font-family: var(--font-mono);
  font-size: 0.62rem;
  color: var(--text-3);
  letter-spacing: 0.03em;
}

/* Browse row */
.ve-browse-row {
  display: flex;
  align-items: center;
  gap: 10px;
}
.ve-save-path-label {
  flex: 1;
  font-family: var(--font-mono);
  font-size: 0.74rem;
  color: var(--text-2);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Progress area */
.ve-modal-progress-area {
  padding: 0 18px 14px;
  display: flex;
  flex-direction: column;
  gap: 7px;
}

.ve-progress-track {
  height: 6px;
  background: #0a0a14;
  border-radius: 3px;
  border: 1px solid rgba(0,0,0,0.6);
  overflow: hidden;
  box-shadow: inset 0 1px 2px rgba(0,0,0,0.5);
}
.ve-progress-bar {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, var(--accent), var(--cyan));
  border-radius: 3px;
  transition: width 0.3s ease;
  box-shadow: 0 0 8px rgba(168,85,247,0.4);
}
.ve-progress-bar.indeterminate {
  width: 40% !important;
  animation: ve-progress-slide 1.4s ease-in-out infinite;
}
@keyframes ve-progress-slide {
  0%   { margin-left: -40%; }
  100% { margin-left: 140%; }
}

.ve-progress-label {
  font-family: var(--font-mono);
  font-size: 0.68rem;
  letter-spacing: 0.08em;
  color: var(--text-3);
  text-align: center;
}
.ve-progress-note {
  font-size: 0.65rem;
  color: var(--text-3);
  opacity: 0.6;
  text-align: center;
  margin: 4px 0 0;
  letter-spacing: 0.03em;
}

/* Export engine hint (WebCodecs fast vs realtime fallback) */
.ve-engine-hint {
  font-family: var(--font-mono);
  font-size: 0.68rem;
  letter-spacing: 0.06em;
  padding: 6px 12px;
  border-radius: 6px;
  margin: 2px 0 6px;
  display: none; /* shown by JS */
}
.ve-engine-hint:not(:empty) { display: block; }
.ve-engine-hint.fast {
  background: rgba(34,197,94,0.12);
  color: #4ade80;
  border: 1px solid rgba(34,197,94,0.25);
}
.ve-engine-hint.slow {
  background: rgba(234,179,8,0.10);
  color: #facc15;
  border: 1px solid rgba(234,179,8,0.22);
}

/* ═══════════════════════════════════════════════════════════════════════════
   MOBILE (≤768px) — additive, desktop unchanged. First structural pass:
   stack each "video frame + members" row so the frame gets the full width
   (was 70% frame + fixed 200px members → overflowed narrow screens).
   ═══════════════════════════════════════════════════════════════════════════ */
/* Mobile-only members card (rendered at the bottom of .ve-wrap). Hidden on desktop. */
.ve-members-mobile { display: none; }

@media (max-width: 768px) {
  .ve-wrap { padding: 0.75rem 0.75rem 2rem; }

  /* Header — stack: back button on row 1, the song title alone on a full-width
     row below it so as much of it as possible shows (wraps, no ellipsis). */
  .ve-header { flex-direction: column; align-items: flex-start; gap: 0.5rem; }
  .ve-header-spacer { display: none; }
  .ve-title { width: 100%; white-space: normal; overflow: visible; text-overflow: clip; font-size: 0.95rem; line-height: 1.3; }

  /* Frame + members row → column; frame full width; members card full width below */
  .ve-frame-row     { flex-direction: column; align-items: stretch !important; gap: 1rem !important; }
  .ve-frame-group   { width: 100% !important; max-width: 100% !important; }
  /* Members sidebar is pulled out of the frame rows on mobile and shown at the
     bottom instead (see .ve-members-mobile below). */
  .ve-frame-row > .card    { display: none; }
  .ve-members-mobile       { display: block; }
  .ve-members-mobile .card { width: 100% !important; }

  /* Action + transport rows wrap instead of overflowing off the right edge;
     the seek gets its own full-width row. */
  .ve-actions       { flex-wrap: wrap; }
  .ve-transport     { flex-wrap: wrap; row-gap: 0.5rem; }
  .ve-timeline-wrap { flex: 1 1 100%; order: 5; }
}

/* Modal footer */
.ve-modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  padding: 12px 18px 16px;
  border-top: 1px solid rgba(255,255,255,0.05);
}

/* ── Export status dialog (fire-and-forget flow) ─────────────────────────── */
#ve-status-overlay {
  position: fixed;
  inset: 0;
  z-index: 9999;
  display: none;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.65);
}
#ve-status-box {
  background: #100c1e;
  border: 1px solid rgba(168, 85, 247, 0.4);
  border-radius: 16px;
  padding: 32px 36px 28px;
  max-width: 440px;
  width: calc(100% - 48px);
  box-shadow: 0 20px 60px rgba(0,0,0,0.8);
  color: #e2e8f0;
  text-align: center;
}
#ve-status-icon {
  font-size: 2.4rem;
  color: var(--accent);
  margin-bottom: 14px;
  line-height: 1;
}
#ve-status-msg {
  font-size: 0.95rem;
  line-height: 1.6;
  color: #cbd5e1;
}
#ve-status-footer {
  margin-top: 22px;
  display: flex;
  justify-content: center;
}
@keyframes ve-spin {
  to { transform: rotate(360deg); }
}
.ve-spin {
  display: inline-block;
  animation: ve-spin 1s linear infinite;
}
