/* ===== LAYOUT ===== */
.recorder-main {
  display: flex;
  flex-direction: column;
  align-items: center;
  min-height: calc(100vh - 56px);
  padding: 2rem;
}
.setup-panel, .recording-panel, .editor-panel {
  max-width: 720px;
  width: 100%;
}

/* ===== SETUP ===== */
.setup-panel { text-align: center; padding-top: 3.5rem; }
.setup-panel h1 { font-size: 2rem; margin-bottom: 0.4rem; }
.subtitle { color: var(--text-secondary); margin-bottom: 2rem; }

.options {
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
  margin-bottom: 1rem;
  align-items: center;
}

.mic-note {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  color: var(--text-secondary);
  font-size: 0.85rem;
  margin: 0 auto 1.75rem;
  padding: 0.55rem 0.9rem;
  background: var(--bg-secondary);
  border: 1px dashed var(--card-border);
  border-radius: var(--radius-sm);
  max-width: 420px;
  text-align: center;
}
.mic-note svg { flex-shrink: 0; color: var(--accent); }

#setupPanel #startBtn {
  display: flex;
  margin: 0 auto;
}

/* ===== FILENAME ROW ===== */
.filename-row {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin: 1rem 0 0.75rem;
}
.filename-row label {
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-secondary);
  flex-shrink: 0;
}
.filename-input-wrap {
  flex: 1;
  display: flex;
  align-items: center;
  border: 1px solid var(--card-border);
  border-radius: var(--radius-sm);
  background: var(--bg-secondary);
  overflow: hidden;
  transition: border-color var(--transition);
}
.filename-input-wrap:focus-within {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-light);
}
.filename-input-wrap input {
  flex: 1;
  min-width: 0;
  padding: 0.55rem 0.75rem;
  background: transparent;
  border: none;
  outline: none;
  color: var(--text);
  font-family: ui-monospace, 'SF Mono', 'Cascadia Code', Menlo, Consolas, monospace;
  font-size: 0.9rem;
}
.filename-ext {
  padding: 0 0.75rem;
  font-family: ui-monospace, 'SF Mono', 'Cascadia Code', Menlo, Consolas, monospace;
  font-size: 0.85rem;
  color: var(--text-secondary);
  border-left: 1px solid var(--card-border);
  line-height: 2.1;
  flex-shrink: 0;
}

/* ===== MP4 CONVERSION PROGRESS OVERLAY ===== */
.mp4-progress {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.55);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  animation: mp4FadeIn 0.2s ease;
}
.mp4-progress[hidden] { display: none !important; }
@keyframes mp4FadeIn {
  from { opacity: 0; }
  to   { opacity: 1; }
}
.mp4-progress-inner {
  background: var(--card);
  border: 1px solid var(--card-border);
  border-radius: var(--radius);
  padding: 1.75rem 2rem;
  max-width: 420px;
  width: calc(100% - 2rem);
  box-shadow: var(--shadow-lg);
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.85rem;
}
.mp4-progress-spinner {
  width: 38px;
  height: 38px;
  border: 3px solid var(--card-border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: mp4Spin 0.9s linear infinite;
}
@keyframes mp4Spin { to { transform: rotate(360deg); } }
.mp4-progress-title {
  font-size: 1.05rem;
  font-weight: 600;
  color: var(--text);
}
.mp4-progress-sub {
  font-size: 0.82rem;
  color: var(--text-secondary);
  line-height: 1.5;
}
.mp4-progress-bar {
  width: 100%;
  height: 8px;
  background: var(--bg-secondary);
  border-radius: 999px;
  overflow: hidden;
  margin-top: 0.25rem;
}
.mp4-progress-fill {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, var(--accent), var(--accent-hover));
  border-radius: 999px;
  transition: width 0.25s ease;
}
.mp4-progress-pct {
  font-family: ui-monospace, 'SF Mono', 'Cascadia Code', Menlo, Consolas, monospace;
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text);
}
.option {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  cursor: pointer;
  padding: 0.7rem 1.15rem;
  background: var(--card);
  border: 1px solid var(--card-border);
  border-radius: var(--radius-sm);
  transition: all var(--transition);
  width: 100%;
  max-width: 280px;
}
.option:hover { border-color: var(--accent); }
.option input[type="checkbox"] {
  width: 18px;
  height: 18px;
  accent-color: var(--accent);
}
.option-label {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  font-size: 0.92rem;
}

/* ===== RECORDING ===== */
.recording-panel { text-align: center; padding-top: 5rem; }
.recording-indicator {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.7rem;
  font-size: 1.2rem;
  font-weight: 600;
  margin-bottom: 2rem;
}
.rec-dot {
  width: 14px;
  height: 14px;
  background: var(--error);
  border-radius: 50%;
  animation: pulse 1s ease-in-out infinite;
}
@keyframes pulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.4; transform: scale(0.8); }
}

/* ===== VIDEO EDITOR ===== */
.editor-panel { padding-top: 1rem; }
.editor-panel h2 { font-size: 1.4rem; margin-bottom: 1rem; }

/* --- Video --- */
.video-container {
  border-radius: var(--radius) var(--radius) 0 0;
  overflow: hidden;
  background: #000;
  cursor: pointer;
}
.video-container video {
  width: 100%;
  display: block;
}

/* --- Transport --- */
.transport {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.6rem 0.85rem;
  background: var(--card);
  border-left: 1px solid var(--card-border);
  border-right: 1px solid var(--card-border);
}
.transport-btn {
  background: none;
  border: none;
  color: var(--text);
  cursor: pointer;
  padding: 0.25rem;
  border-radius: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: color var(--transition);
  flex-shrink: 0;
}
.transport-btn:hover { color: var(--accent); }

.time-display {
  font-size: 0.78rem;
  font-family: 'Consolas', 'Monaco', monospace;
  color: var(--text-secondary);
  min-width: 36px;
  text-align: center;
  flex-shrink: 0;
}

.seek-bar {
  flex: 1;
  height: 6px;
  background: var(--bg-secondary);
  border-radius: 3px;
  cursor: pointer;
  position: relative;
  overflow: hidden;
}
.seek-fill {
  height: 100%;
  background: var(--accent);
  border-radius: 3px;
  width: 0%;
  pointer-events: none;
}

/* --- Volume --- */
.volume-control {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.45rem 0.85rem;
  background: var(--card);
  border-left: 1px solid var(--card-border);
  border-right: 1px solid var(--card-border);
  border-bottom: 1px solid var(--card-border);
  border-radius: 0 0 var(--radius) var(--radius);
  margin-bottom: 1rem;
}
.volume-control input[type="range"] {
  width: 100px;
  accent-color: var(--accent);
  height: 4px;
}
.volume-label {
  font-size: 0.75rem;
  color: var(--text-secondary);
  font-family: monospace;
  min-width: 32px;
}

/* ===== TRIM SECTION ===== */
.trim-section {
  background: var(--card);
  border: 1px solid var(--card-border);
  border-radius: var(--radius);
  padding: 1rem 1.15rem;
  margin-bottom: 1rem;
}
.trim-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.75rem;
}
.trim-header h3 { font-size: 0.95rem; }

/* --- Filmstrip timeline --- */
.timeline-wrap { position: relative; margin-bottom: 0.6rem; }

.timeline {
  position: relative;
  height: 56px;
  border-radius: 6px;
  overflow: hidden;
  border: 2px solid var(--card-border);
  cursor: pointer;
  user-select: none;
}

.filmstrip {
  display: flex;
  height: 100%;
  width: 100%;
}
.filmstrip img {
  height: 100%;
  flex: 1;
  object-fit: cover;
  pointer-events: none;
}

/* Dim overlays for trimmed-out parts */
.trim-dim {
  position: absolute;
  top: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.55);
  pointer-events: none;
  z-index: 1;
}
.trim-dim-left { left: 0; width: 0; }
.trim-dim-right { right: 0; width: 0; }

/* Drag handles */
.trim-handle {
  position: absolute;
  top: 0;
  bottom: 0;
  width: 14px;
  background: var(--accent);
  cursor: ew-resize;
  z-index: 3;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s;
}
.trim-handle:hover, .trim-handle.dragging { background: var(--accent-hover); }

.trim-handle-start {
  left: 0;
  border-radius: 4px 0 0 4px;
}
.trim-handle-end {
  right: 0;
  border-radius: 0 4px 4px 0;
}

.handle-bar {
  width: 3px;
  height: 18px;
  background: rgba(255, 255, 255, 0.8);
  border-radius: 2px;
}

/* Playhead */
.playhead {
  position: absolute;
  top: 0;
  bottom: 0;
  width: 2px;
  background: #fff;
  box-shadow: 0 0 4px rgba(0,0,0,0.5);
  pointer-events: none;
  z-index: 2;
  left: 0;
}

/* Loading state */
.thumb-loading {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-secondary);
  border-radius: 6px;
  font-size: 0.82rem;
  color: var(--text-secondary);
}
.thumb-loading.hidden { display: none; }

/* --- Trim info --- */
.trim-info {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.78rem;
  font-family: monospace;
  color: var(--text-secondary);
}
.trim-duration-label {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  color: var(--accent);
  font-weight: 500;
}

/* ===== ACTIONS ===== */
.action-buttons {
  display: flex;
  gap: 0.6rem;
  flex-wrap: wrap;
}

/* ===== RESPONSIVE ===== */
@media (max-width: 768px) {
  .recorder-main { padding: 1.25rem; }
  .setup-panel { padding-top: 2rem; }
  .recording-panel { padding-top: 3rem; }
  .action-buttons { flex-direction: column; }
  .action-buttons .btn { width: 100%; }
  .volume-control input[type="range"] { width: 80px; }
  .timeline { height: 44px; }
}
