/* ═══════════════════════════════════════════════════════
   Audio Merger - FrameForge Style
   Fusión vertical de múltiples audios
   ═══════════════════════════════════════════════════════ */

@font-face {
  font-family: 'Phantomuff';
  src: url('../../Assets/font/Phantomuff Difficult Font.ttf') format('truetype');
  font-weight: normal;
  font-style: normal;
}

:root {
  --bg: #0a0a0f;
  --bg-lighter: #14141f;
  --bg-card: #1a1a2e;
  --text: #e0e0e0;
  --text-muted: #a0a0a0;
  --primary: #6366f1;
  --primary-hover: #4f46e5;
  --secondary: #8b5cf6;
  --accent: #ec4899;
  --success: #10b981;
  --warning: #f59e0b;
  --danger: #ef4444;
  --border: #2a2a3e;
  --shadow: rgba(0, 0, 0, 0.3);
}

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

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  min-height: 100vh;
}

/* ─── Phantomuff Font para Títulos ──────────────────── */
.header-title h1,
.instruction-card h3,
.section-header h2,
.card-header h2,
.info-content h3,
.empty-title,
.upload-title {
  font-family: 'Phantomuff', -apple-system, BlinkMacSystemFont, sans-serif;
  letter-spacing: 0.02em;
}

/* ─── Header ─────────────────────────────────────────── */
.header {
  background: var(--bg-lighter);
  border-bottom: 1px solid var(--border);
  padding: 1rem;
  position: sticky;
  top: 0;
  z-index: 100;
}

.header-content {
  max-width: 1200px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  gap: 1.5rem;
}

.brand {
  font-size: 1.25rem;
  font-weight: 700;
  text-decoration: none;
  color: var(--text);
  white-space: nowrap;
}

.brand .hl {
  color: var(--primary);
}

.brand .sep {
  color: var(--text-muted);
  margin: 0 0.25rem;
}

.header-title {
  flex: 1;
}

.header-title h1 {
  font-size: 1.3rem;
  font-weight: 600;
  margin: 0;
}

.header-title .subtitle {
  font-size: 0.8rem;
  color: var(--text-muted);
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}

.btn-back {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 1rem;
  background: var(--bg-card);
  color: var(--text);
  text-decoration: none;
  border-radius: 6px;
  transition: background 0.2s;
  font-size: 0.9rem;
}

.btn-back:hover {
  background: var(--border);
}

.btn-back svg {
  width: 16px;
  height: 16px;
}

/* ─── Container ──────────────────────────────────────── */
.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 1.5rem 1rem;
}

/* ─── Instructions ───────────────────────────────────── */
.instructions {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 1rem;
  margin-bottom: 2rem;
}

.instruction-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  padding: 1.5rem;
  border-radius: 10px;
  text-align: center;
}

.instruction-icon {
  width: 32px;
  height: 32px;
  margin: 0 auto 0.75rem;
  color: var(--primary);
}

.instruction-card h3 {
  font-size: 1rem;
  margin-bottom: 0.5rem;
  font-weight: 600;
  color: var(--text);
}

.instruction-card p {
  font-size: 0.85rem;
  color: var(--text-muted);
  margin: 0;
  line-height: 1.5;
}

/* ─── Upload Section Central ─────────────────────────── */
.upload-section {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 1.5rem;
  margin-bottom: 2rem;
}

.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1rem;
  flex-wrap: wrap;
  gap: 0.75rem;
}

.section-header h2 {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 1.15rem;
  font-weight: 600;
  margin: 0;
}

.section-header h2 svg {
  width: 22px;
  height: 22px;
  color: var(--primary);
}

.audio-count {
  padding: 0.4rem 0.9rem;
  background: var(--bg-lighter);
  border-radius: 12px;
  font-size: 0.8rem;
  color: var(--text-muted);
  font-weight: 500;
}

.btn-small {
  padding: 0.5rem 1rem;
  font-size: 0.85rem;
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  background: var(--bg-lighter);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 6px;
  cursor: pointer;
  transition: background 0.2s, border-color 0.2s;
}

.btn-small:hover {
  background: var(--bg-card);
  border-color: var(--text-muted);
}

.btn-small svg {
  width: 16px;
  height: 16px;
}

.upload-zone-central {
  border: 2px dashed var(--border);
  border-radius: 10px;
  padding: 2.5rem 2rem;
  text-align: center;
  cursor: pointer;
  transition: border-color 0.2s, background 0.2s;
  background: var(--bg-lighter);
}

.upload-zone-central:hover {
  border-color: var(--primary);
  background: var(--bg-card);
}

.upload-zone-central.dragover {
  border-color: var(--primary);
  background: var(--bg-card);
  border-style: solid;
}

.upload-icon-large {
  width: 56px;
  height: 56px;
  margin: 0 auto 1rem;
  color: var(--primary);
}

.upload-title {
  font-size: 1.2rem;
  font-weight: 600;
  margin-bottom: 0.5rem;
  color: var(--text);
}

.upload-hint {
  font-size: 0.9rem;
  color: var(--text-muted);
  margin-bottom: 0.5rem;
}

.upload-formats {
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-bottom: 1rem;
}

/* ─── Audio List ─────────────────────────────────────── */
.audio-list-section {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 1.5rem;
  margin-bottom: 2rem;
}

.audio-list {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.audio-item {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 1rem;
  background: var(--bg-lighter);
  border: 1px solid var(--border);
  border-radius: 8px;
  transition: border-color 0.2s;
}

.audio-item:hover {
  border-color: var(--primary);
}

.audio-number {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  background: var(--primary);
  color: white;
  border-radius: 50%;
  font-weight: 600;
  font-size: 0.9rem;
  flex-shrink: 0;
}

.audio-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 48px;
  height: 48px;
  background: var(--bg-card);
  border-radius: 8px;
  flex-shrink: 0;
}

.audio-icon svg {
  width: 24px;
  height: 24px;
  color: var(--primary);
}

.audio-details {
  flex: 1;
  min-width: 0;
}

.audio-name {
  font-weight: 500;
  margin-bottom: 0.25rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.audio-meta {
  font-size: 0.8rem;
  color: var(--text-muted);
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.sep {
  color: var(--border);
}

.waveform {
  width: 100%;
  max-width: 200px;
  height: 50px;
  border-radius: 6px;
  background: var(--bg);
  display: block;
  flex-shrink: 0;
}

/* ─── Audio Controls ─────────────────────────────────── */
.audio-controls {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.btn-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--text);
  cursor: pointer;
  transition: background 0.2s, border-color 0.2s;
  flex-shrink: 0;
}

.btn-icon:hover {
  background: var(--bg-lighter);
  border-color: var(--text-muted);
}

.btn-icon svg {
  width: 18px;
  height: 18px;
}

.btn-remove {
  border-color: var(--danger);
}

.btn-remove:hover {
  background: var(--danger);
  color: white;
}

.volume-control {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex: 1;
  min-width: 180px;
  padding: 0.5rem 1rem;
  background: var(--bg);
  border-radius: 8px;
}

.volume-icon {
  width: 18px;
  height: 18px;
  color: var(--text-muted);
  flex-shrink: 0;
}

.volume-slider {
  flex: 1;
  height: 4px;
  border-radius: 2px;
  background: var(--border);
  outline: none;
  appearance: none;
  -webkit-appearance: none;
  cursor: pointer;
}

.volume-slider::-webkit-slider-thumb {
  appearance: none;
  -webkit-appearance: none;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--primary);
  cursor: pointer;
}

.volume-slider::-moz-range-thumb {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--primary);
  cursor: pointer;
  border: none;
}

.volume-value {
  font-size: 0.85rem;
  color: var(--text-muted);
  min-width: 40px;
  text-align: right;
}

/* ─── Empty State ────────────────────────────────────── */
.empty-state {
  text-align: center;
  padding: 3rem 1.5rem;
}

.empty-icon {
  width: 64px;
  height: 64px;
  margin: 0 auto 1rem;
  color: var(--text-muted);
  opacity: 0.5;
}

.empty-title {
  font-size: 1.2rem;
  font-weight: 600;
  margin-bottom: 0.75rem;
}

.empty-text {
  color: var(--text-muted);
  font-size: 0.9rem;
  margin-bottom: 0.5rem;
}

/* ─── Action Section ─────────────────────────────────── */
.action-section {
  display: grid;
  gap: 1.5rem;
  margin-bottom: 2rem;
}

.preview-card,
.export-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 1.5rem;
}

.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1.5rem;
  flex-wrap: wrap;
  gap: 0.75rem;
}

.card-header h2 {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 1.15rem;
  font-weight: 600;
  margin: 0;
}

.card-header h2 svg {
  width: 22px;
  height: 22px;
  color: var(--primary);
}

.preview-info {
  display: flex;
  gap: 0.75rem;
  align-items: center;
}

.duration-badge {
  padding: 0.4rem 0.9rem;
  background: var(--bg-lighter);
  border-radius: 12px;
  font-size: 0.8rem;
  color: var(--text-muted);
  font-weight: 500;
}

/* ─── Mix Visualization ──────────────────────────────── */
.mix-visualization {
  background: var(--bg-lighter);
  border-radius: 8px;
  padding: 1rem;
  margin-bottom: 1rem;
}

#mixWaveform {
  width: 100%;
  height: 120px;
  display: block;
  border-radius: 6px;
}

/* ─── Seekbar con Progress Visual ────────────────────── */
.seekbar-container {
  position: relative;
  width: 100%;
  height: 32px;
  margin-bottom: 1rem;
  display: flex;
  align-items: center;
  background: var(--bg-lighter);
  border-radius: 6px;
  padding: 8px 12px;
}

.seekbar {
  width: 100%;
  height: 8px;
  margin: 0;
  padding: 0;
  background: linear-gradient(to right, 
    #6366f1 0%, 
    #6366f1 var(--seekbar-progress, 0%), 
    var(--border) var(--seekbar-progress, 0%), 
    var(--border) 100%);
  appearance: none;
  -webkit-appearance: none;
  cursor: pointer;
  border-radius: 4px;
  outline: none;
  box-shadow: 0 0 12px rgba(99, 102, 241, 0.3);
  transition: box-shadow 0.2s;
}

.seekbar:hover {
  box-shadow: 0 0 16px rgba(99, 102, 241, 0.5);
}

/* Ocultar el track default y usar nuestro gradient */
.seekbar::-webkit-slider-runnable-track {
  width: 100%;
  height: 8px;
  background: transparent;
  border: none;
}

.seekbar::-webkit-slider-thumb {
  appearance: none;
  -webkit-appearance: none;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: #ffffff;
  cursor: grab;
  border: 3px solid #6366f1;
  margin-top: -5px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.5), 0 0 0 2px rgba(99, 102, 241, 0.2);
  transition: all 0.2s;
}

.seekbar::-webkit-slider-thumb:hover {
  transform: scale(1.25);
  border-color: #8b5cf6;
  box-shadow: 0 4px 12px rgba(99, 102, 241, 0.6), 0 0 0 4px rgba(99, 102, 241, 0.3);
}

.seekbar::-webkit-slider-thumb:active {
  transform: scale(1.1);
  cursor: grabbing;
}

.seekbar::-moz-range-track {
  width: 100%;
  height: 8px;
  background: transparent;
  border: none;
}

.seekbar::-moz-range-progress {
  height: 8px;
  background: linear-gradient(90deg, #6366f1, #8b5cf6);
  border-radius: 4px;
}

.seekbar::-moz-range-thumb {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: #ffffff;
  cursor: grab;
  border: 3px solid #6366f1;
  box-shadow: 0 2px 8px rgba(0,0,0,0.5), 0 0 0 2px rgba(99, 102, 241, 0.2);
  transition: all 0.2s;
}

.seekbar::-moz-range-thumb:hover {
  transform: scale(1.25);
  border-color: #8b5cf6;
  box-shadow: 0 4px 12px rgba(99, 102, 241, 0.6), 0 0 0 4px rgba(99, 102, 241, 0.3);
}

.seekbar::-moz-range-thumb:active {
  transform: scale(1.1);
  cursor: grabbing;
}

/* Ocultar el div seekbarProgress ya que usamos CSS variable */
.seekbar-progress {
  display: none;
}

/* ─── Preview Controls ───────────────────────────────── */
.preview-controls {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.btn-control {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.75rem 1.25rem;
  min-width: 150px;
  justify-content: center;
}

.time-display-box {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.75rem 1rem;
  background: var(--bg-lighter);
  border-radius: 8px;
  font-family: 'Courier New', monospace;
  font-size: 0.95rem;
  color: var(--text-muted);
  margin-left: auto;
}

.time-display-box svg {
  width: 18px;
  height: 18px;
}

/* ─── Buttons ────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.75rem 1.5rem;
  border: none;
  border-radius: 8px;
  font-size: 0.95rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s;
  white-space: nowrap;
}

.btn svg {
  width: 18px;
  height: 18px;
}

.btn-primary {
  background: var(--primary);
  color: white;
}

.btn-primary:hover:not(:disabled) {
  background: var(--primary-hover);
  transform: translateY(-2px);
}

.btn-primary:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.btn-secondary {
  background: var(--bg-lighter);
  color: var(--text);
  border: 1px solid var(--border);
}

.btn-secondary:hover {
  background: var(--border);
  border-color: var(--primary);
}

.btn-export {
  width: 100%;
  justify-content: center;
  padding: 1rem 1.5rem;
  font-size: 1rem;
}

/* ─── Export Settings ────────────────────────────────── */
.export-settings {
  display: grid;
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.setting-row {
  display: grid;
  gap: 0.5rem;
}

.setting-row label {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.9rem;
  color: var(--text-muted);
  font-weight: 500;
}

.setting-row label svg {
  width: 16px;
  height: 16px;
}

.select-input,
.text-input {
  width: 100%;
  padding: 0.75rem;
  background: var(--bg-lighter);
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--text);
  font-size: 0.95rem;
  transition: border-color 0.2s;
}

.select-input:focus,
.text-input:focus {
  outline: none;
  border-color: var(--primary);
}

.text-input::placeholder {
  color: var(--text-muted);
  opacity: 0.6;
}

/* ─── Export Progress ────────────────────────────────── */
.export-progress {
  margin-top: 1rem;
}

.progress-bar {
  width: 100%;
  height: 6px;
  background: var(--bg-lighter);
  border-radius: 3px;
  overflow: hidden;
  margin-bottom: 0.5rem;
}

.progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--primary), var(--secondary));
  width: 0%;
  transition: width 0.3s;
}

.progress-text {
  text-align: center;
  font-size: 0.85rem;
  color: var(--text-muted);
  margin: 0;
}

/* ─── Info Box ───────────────────────────────────────── */
.info-box {
  display: flex;
  gap: 1rem;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-left: 4px solid var(--primary);
  border-radius: 12px;
  padding: 1.5rem;
}

.info-icon {
  flex-shrink: 0;
}

.info-icon svg {
  width: 24px;
  height: 24px;
  color: var(--primary);
}

.info-content h3 {
  font-size: 1.05rem;
  margin-bottom: 0.75rem;
}

.info-content ul {
  list-style: none;
  padding: 0;
  margin: 0;
}

.info-content li {
  padding: 0.4rem 0;
  padding-left: 1.5rem;
  position: relative;
  font-size: 0.9rem;
  color: var(--text-muted);
}

.info-content li::before {
  content: '•';
  position: absolute;
  left: 0;
  color: var(--primary);
  font-size: 1.2rem;
}

/* ─── Toast ──────────────────────────────────────────── */
.toast {
  position: fixed;
  bottom: 2rem;
  right: 2rem;
  background: var(--bg-card);
  border: 1px solid var(--border);
  padding: 1rem 1.5rem;
  border-radius: 8px;
  box-shadow: 0 4px 12px var(--shadow);
  transform: translateY(100px);
  opacity: 0;
  transition: all 0.3s;
  z-index: 1000;
  max-width: 300px;
}

.toast.show {
  transform: translateY(0);
  opacity: 1;
}

.toast.success {
  border-left: 4px solid var(--success);
}

.toast.error {
  border-left: 4px solid var(--danger);
}

.toast.warning {
  border-left: 4px solid var(--warning);
}

.toast.info {
  border-left: 4px solid var(--primary);
}

/* ─── Mobile Responsive ──────────────────────────────── */
@media (max-width: 768px) {
  .header-content {
    gap: 1rem;
  }

  .brand {
    font-size: 1.1rem;
  }

  .header-title h1 {
    font-size: 1.15rem;
  }

  .btn-back span {
    display: none;
  }

  .instructions {
    grid-template-columns: repeat(2, 1fr);
    gap: 0.75rem;
  }

  .instruction-card {
    padding: 1rem;
  }

  .instruction-icon {
    width: 24px;
    height: 24px;
  }

  .instruction-card h3 {
    font-size: 0.9rem;
  }

  .instruction-card p {
    font-size: 0.75rem;
  }

  .upload-zone-central {
    padding: 2rem 1rem;
  }

  .upload-icon-large {
    width: 48px;
    height: 48px;
  }

  .upload-title {
    font-size: 1.1rem;
  }

  .audio-item {
    flex-wrap: wrap;
  }

  .waveform {
    width: 100%;
    max-width: 100%;
  }

  .audio-controls {
    width: 100%;
  }

  .volume-control {
    width: 100%;
  }

  .preview-controls {
    flex-direction: column;
  }

  .btn-control {
    width: 100%;
  }

  .time-display-box {
    width: 100%;
    margin-left: 0;
    justify-content: center;
  }

  .export-settings {
    grid-template-columns: 1fr;
  }

  .toast {
    right: 1rem;
    left: 1rem;
    max-width: none;
  }
}

@media (min-width: 769px) {
  .action-section {
    grid-template-columns: 1fr;
  }

  .export-settings {
    grid-template-columns: 1fr 2fr;
  }
}


/* ─── Color Picker ─────────────────────────────────── */
.color-picker-wrapper {
  position: relative;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.color-picker-wrapper input[type="color"] {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
}

.color-picker-label {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.2s;
}

.color-picker-label:hover {
  background: var(--bg-lighter);
  border-color: var(--primary);
  transform: scale(1.05);
}

.color-picker-label svg {
  width: 18px;
  height: 18px;
  color: var(--primary);
}

/* ─── Audio Item Layout Update ─────────────────────────────────── */
.audio-item {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  padding: 1.5rem;
  background: var(--bg-lighter);
  border: 1px solid var(--border);
  border-radius: 12px;
  transition: all 0.2s;
}

.audio-item:hover {
  border-color: var(--primary);
  box-shadow: 0 4px 12px rgba(99, 102, 241, 0.1);
}

.audio-item-header {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.audio-info {
  flex: 1;
  min-width: 0;
}

/* ─── Waveform Container ─────────────────────────────────── */
.waveform-container {
  position: relative;
  width: 100%;
}

.audio-waveform {
  width: 100%;
  height: 60px;
  border-radius: 8px;
  background: var(--bg);
  display: block;
}

/* ─── Seek Bar ─────────────────────────────────── */
.seek-bar-container {
  position: relative;
  width: 100%;
  margin-top: 0.5rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.seek-bar {
  -webkit-appearance: none;
  appearance: none;
  flex: 1;
  height: 6px;
  background: var(--bg-card);
  border-radius: 3px;
  outline: none;
  cursor: pointer;
  transition: all 0.2s;
}

.seek-bar:hover {
  background: var(--bg-lighter);
}

/* Webkit (Chrome, Safari, Edge) */
.seek-bar::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 16px;
  height: 16px;
  background: var(--primary);
  border-radius: 50%;
  cursor: pointer;
  transition: all 0.2s;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.seek-bar::-webkit-slider-thumb:hover {
  transform: scale(1.2);
  background: var(--primary-hover);
}

/* Firefox */
.seek-bar::-moz-range-thumb {
  width: 16px;
  height: 16px;
  background: var(--primary);
  border: none;
  border-radius: 50%;
  cursor: pointer;
  transition: all 0.2s;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.seek-bar::-moz-range-thumb:hover {
  transform: scale(1.2);
  background: var(--primary-hover);
}

.seek-bar::-moz-range-track {
  background: var(--bg-card);
  border-radius: 3px;
}

/* Seek Time Display */
.seek-time {
  font-size: 0.8rem;
  color: var(--text-muted);
  font-family: 'Courier New', monospace;
  min-width: 40px;
  text-align: right;
  flex-shrink: 0;
}

/* ─── Responsive Updates ─────────────────────────────────── */
@media (max-width: 768px) {
  .audio-item-header {
    flex-wrap: wrap;
  }
  
  .color-picker-wrapper {
    order: 3;
  }
  
  .audio-waveform {
    height: 50px;
  }
  
  .seek-bar-container {
    margin-top: 0.25rem;
  }
}

@media (max-width: 480px) {
  .audio-item {
    padding: 1rem;
  }
  
  .audio-number {
    width: 28px;
    height: 28px;
    font-size: 0.8rem;
  }
  
  .color-picker-label {
    width: 32px;
    height: 32px;
  }
  
  .audio-waveform {
    height: 40px;
  }
}

/* ─── Loading Spinner ─────────────────────────────────── */
.loading-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(10, 10, 15, 0.95);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  z-index: 9999;
  backdrop-filter: blur(8px);
}

.loading-spinner {
  width: 64px;
  height: 64px;
  border: 4px solid var(--border);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  margin-bottom: 1.5rem;
}

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

.loading-text {
  font-size: 1.2rem;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 0.5rem;
  text-align: center;
}

.progress-hint {
  font-size: 0.9rem;
  color: var(--text-muted);
  text-align: center;
  max-width: 400px;
  line-height: 1.5;
  padding: 0 1rem;
}

.loading-stage {
  font-size: 0.85rem;
  color: var(--primary);
  margin-top: 0.75rem;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

/* ─── Progress Bar in Loading ─────────────────────────────────── */
.loading-progress {
  width: 100%;
  max-width: 400px;
  margin-top: 1.5rem;
}

.loading-progress-bar {
  width: 100%;
  height: 8px;
  background: var(--bg-lighter);
  border-radius: 4px;
  overflow: hidden;
  margin-bottom: 0.75rem;
  box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.2);
}

.loading-progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--primary), var(--secondary));
  width: 0%;
  transition: width 0.3s ease;
  border-radius: 4px;
  box-shadow: 0 0 12px rgba(99, 102, 241, 0.5);
}

.loading-progress-text {
  font-size: 0.85rem;
  color: var(--text-muted);
  text-align: center;
  font-family: 'Courier New', monospace;
}

/* ─── Loading Animation Variants ─────────────────────────────────── */
.loading-spinner.success {
  border-top-color: var(--success);
  animation: spin-success 0.6s ease-in-out;
}

@keyframes spin-success {
  0% {
    transform: rotate(0deg);
    border-top-color: var(--primary);
  }
  50% {
    border-top-color: var(--success);
  }
  100% {
    transform: rotate(360deg);
    border-top-color: var(--success);
  }
}

.loading-spinner.error {
  border-top-color: var(--danger);
  animation: shake 0.5s ease-in-out;
}

@keyframes shake {
  0%, 100% { transform: translateX(0); }
  10%, 30%, 50%, 70%, 90% { transform: translateX(-8px); }
  20%, 40%, 60%, 80% { transform: translateX(8px); }
}

/* Mobile Loading Adjustments */
@media (max-width: 768px) {
  .loading-spinner {
    width: 48px;
    height: 48px;
    border-width: 3px;
  }
  
  .loading-text {
    font-size: 1rem;
  }
  
  .progress-hint {
    font-size: 0.8rem;
    max-width: 300px;
  }
  
  .loading-progress {
    max-width: 300px;
  }
}

/* ─── Mini Console for Errors ─────────────────────────────────── */
.mini-console {
  position: fixed;
  bottom: -400px;
  left: 0;
  right: 0;
  background: var(--bg-card);
  border-top: 2px solid var(--danger);
  box-shadow: 0 -4px 24px rgba(0, 0, 0, 0.5);
  z-index: 10000;
  max-height: 400px;
  transition: bottom 0.4s cubic-bezier(0.4, 0, 0.2, 1);
  display: flex;
  flex-direction: column;
}

.mini-console.show {
  bottom: 0;
}

.mini-console-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem 1.25rem;
  background: var(--bg-lighter);
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}

.mini-console-title {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  font-weight: 600;
  font-size: 1rem;
  color: var(--danger);
}

.mini-console-title svg {
  width: 20px;
  height: 20px;
}

.mini-console-actions {
  display: flex;
  gap: 0.5rem;
}

.btn-mini {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 0.75rem;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--text);
  font-size: 0.85rem;
  cursor: pointer;
  transition: all 0.2s;
  white-space: nowrap;
}

.btn-mini svg {
  width: 16px;
  height: 16px;
}

.btn-mini:hover {
  background: var(--border);
  border-color: var(--primary);
}

.btn-mini.btn-copy {
  background: var(--primary);
  color: white;
  border-color: var(--primary);
}

.btn-mini.btn-copy:hover {
  background: var(--primary-hover);
}

.btn-mini.btn-copy.copied {
  background: var(--success);
  border-color: var(--success);
}

.mini-console-content {
  flex: 1;
  overflow-y: auto;
  padding: 1.25rem;
  font-family: 'Courier New', monospace;
  font-size: 0.85rem;
  line-height: 1.6;
  color: var(--text);
}

.error-message {
  background: rgba(239, 68, 68, 0.1);
  border-left: 3px solid var(--danger);
  padding: 1rem;
  border-radius: 6px;
  margin-bottom: 1rem;
  word-wrap: break-word;
}

.error-title {
  font-weight: 600;
  color: var(--danger);
  margin-bottom: 0.5rem;
  font-size: 0.9rem;
}

.error-details {
  color: var(--text-muted);
  white-space: pre-wrap;
  word-break: break-word;
}

.error-stack {
  margin-top: 1rem;
  padding-top: 1rem;
  border-top: 1px solid var(--border);
  color: var(--text-muted);
  font-size: 0.8rem;
  white-space: pre-wrap;
  word-break: break-word;
}

.error-help {
  background: var(--bg-lighter);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 1rem;
  margin-top: 1rem;
}

.error-help-title {
  font-weight: 600;
  color: var(--primary);
  margin-bottom: 0.5rem;
  font-size: 0.9rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.error-help-title svg {
  width: 16px;
  height: 16px;
}

.error-help-list {
  list-style: none;
  padding: 0;
  margin: 0;
  color: var(--text-muted);
  font-size: 0.85rem;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}

.error-help-list li {
  padding: 0.4rem 0;
  padding-left: 1.5rem;
  position: relative;
}

.error-help-list li::before {
  content: '→';
  position: absolute;
  left: 0;
  color: var(--primary);
}

/* Mobile adjustments */
@media (max-width: 768px) {
  .mini-console {
    max-height: 50vh;
  }
  
  .mini-console-header {
    padding: 0.75rem 1rem;
  }
  
  .mini-console-title {
    font-size: 0.9rem;
  }
  
  .btn-mini {
    padding: 0.4rem 0.6rem;
    font-size: 0.8rem;
  }
  
  .btn-mini span {
    display: none;
  }
  
  .mini-console-content {
    padding: 1rem;
    font-size: 0.8rem;
  }
  
  .error-message {
    padding: 0.75rem;
  }
}


/* ═══════════════════════════════════════════════════════
   MINI-EDITOR ESTILO CAPCUT - Recorte de Audio
   ═══════════════════════════════════════════════════════ */

/* ─── Audio Item con Mini-Editor ──────────────────────── */
.audio-item {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  padding: 1.5rem;
  background: var(--bg-lighter);
  border: 1px solid var(--border);
  border-radius: 12px;
  transition: all 0.2s;
}

.audio-item:hover {
  border-color: var(--primary);
  box-shadow: 0 4px 12px rgba(99, 102, 241, 0.1);
}

.audio-item-header {
  display: flex;
  align-items: center;
  gap: 1rem;
  flex-wrap: wrap;
}

.audio-number {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  background: var(--primary);
  color: white;
  border-radius: 50%;
  font-weight: 600;
  font-size: 0.9rem;
  flex-shrink: 0;
}

.audio-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 48px;
  height: 48px;
  background: var(--bg-card);
  border-radius: 8px;
  flex-shrink: 0;
}

.audio-icon svg {
  width: 24px;
  height: 24px;
  color: var(--primary);
}

.audio-info {
  flex: 1;
  min-width: 0;
}

.audio-name {
  font-weight: 500;
  margin-bottom: 0.25rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 0.95rem;
}

.audio-meta {
  font-size: 0.8rem;
  color: var(--text-muted);
  display: flex;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.audio-meta .sep {
  color: var(--border);
}

.audio-controls {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-shrink: 0;
}

.btn-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--text);
  cursor: pointer;
  transition: all 0.2s;
  flex-shrink: 0;
}

.btn-icon:hover {
  background: var(--bg);
  border-color: var(--primary);
  transform: translateY(-2px);
}

.btn-icon svg {
  width: 18px;
  height: 18px;
}

.btn-remove {
  border-color: var(--danger);
}

.btn-remove:hover {
  background: var(--danger);
  color: white;
}

/* ─── Mini Editor Timeline (Estilo CapCut) ───────────── */
.mini-editor {
  width: 100%;
  background: var(--bg);
  border-radius: 8px;
  padding: 1rem;
  border: 1px solid var(--border);
}

.editor-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.75rem;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.editor-title {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.editor-title svg {
  width: 16px;
  height: 16px;
  color: var(--primary);
}

.editor-time-info {
  font-size: 0.8rem;
  color: var(--text-muted);
  font-family: 'Courier New', monospace;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.editor-time-info svg {
  width: 14px;
  height: 14px;
}

/* ─── Waveform Container con Trimming ────────────────── */
.waveform-container {
  position: relative;
  width: 100%;
  background: var(--bg-card);
  border-radius: 6px;
  overflow: hidden;
  margin-bottom: 0.75rem;
}

.waveform-track {
  position: relative;
  width: 100%;
  height: 80px;
  display: flex;
  align-items: center;
}

.waveform-canvas {
  width: 100%;
  height: 100%;
  display: block;
}

/* ─── Región de Selección (Trimming Handles) ─────────── */
.trim-region {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  pointer-events: none;
}

.trim-overlay {
  position: absolute;
  top: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.6);
  pointer-events: none;
}

.trim-overlay.left {
  left: 0;
}

.trim-overlay.right {
  right: 0;
}

.trim-selection {
  position: absolute;
  top: 0;
  bottom: 0;
  border: 2px solid var(--primary);
  border-left-width: 4px;
  border-right-width: 4px;
  pointer-events: all;
  cursor: move;
  background: rgba(99, 102, 241, 0.05);
}

.trim-selection:hover {
  background: rgba(99, 102, 241, 0.1);
}

/* ─── Playhead (Indicador de Reproducción) ──────────── */
.playhead {
  position: absolute;
  top: 0;
  bottom: 0;
  width: 2px;
  background: var(--accent);
  z-index: 10;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.2s;
  box-shadow: 0 0 8px rgba(236, 72, 153, 0.6);
}

.playhead.active {
  opacity: 1;
}

.playhead::before {
  content: '';
  position: absolute;
  top: -4px;
  left: -4px;
  width: 10px;
  height: 10px;
  background: var(--accent);
  border-radius: 50%;
  box-shadow: 0 0 8px rgba(236, 72, 153, 0.8);
}

.playhead::after {
  content: '';
  position: absolute;
  bottom: -4px;
  left: -4px;
  width: 10px;
  height: 10px;
  background: var(--accent);
  border-radius: 50%;
  box-shadow: 0 0 8px rgba(236, 72, 153, 0.8);
}

/* ─── Trim Handles (Izquierda y Derecha) ─────────────── */
.trim-handle {
  position: absolute;
  top: 0;
  bottom: 0;
  width: 12px;
  background: var(--primary);
  cursor: ew-resize;
  z-index: 2;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s;
}

.trim-handle:hover {
  background: var(--primary-hover);
  width: 16px;
}

.trim-handle::before {
  content: '';
  width: 3px;
  height: 24px;
  background: white;
  border-radius: 2px;
  opacity: 0.9;
}

.trim-handle.left {
  left: -4px;
  border-top-left-radius: 4px;
  border-bottom-left-radius: 4px;
}

.trim-handle.right {
  right: -4px;
  border-top-right-radius: 4px;
  border-bottom-right-radius: 4px;
}

/* ─── Time Markers ──────────────────────────────────────── */
.time-markers {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.75rem;
  color: var(--text-muted);
  font-family: 'Courier New', monospace;
  margin-bottom: 0.5rem;
}

/* ─── Controles del Editor ──────────────────────────────── */
.editor-controls {
  display: flex;
  gap: 0.5rem;
  align-items: center;
  flex-wrap: wrap;
}

.btn-editor {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 1rem;
  background: var(--bg-lighter);
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--text);
  font-size: 0.85rem;
  cursor: pointer;
  transition: all 0.2s;
  white-space: nowrap;
}

.btn-editor svg {
  width: 16px;
  height: 16px;
}

.btn-editor:hover {
  background: var(--bg-card);
  border-color: var(--primary);
  transform: translateY(-2px);
}

.btn-editor.btn-reset {
  border-color: var(--warning);
}

.btn-editor.btn-reset:hover {
  background: var(--warning);
  color: white;
}

.trim-indicator {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 0.75rem;
  background: var(--bg-card);
  border-radius: 6px;
  font-size: 0.8rem;
  color: var(--text-muted);
  font-family: 'Courier New', monospace;
}

.trim-indicator svg {
  width: 14px;
  height: 14px;
  color: var(--primary);
}

/* ─── Volume Control ─────────────────────────────────────── */
.volume-control {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.75rem 1rem;
  background: var(--bg-card);
  border-radius: 8px;
  margin-top: 0.5rem;
}

.volume-icon {
  width: 20px;
  height: 20px;
  color: var(--text-muted);
  flex-shrink: 0;
}

.volume-label {
  font-size: 0.85rem;
  color: var(--text-muted);
  font-weight: 500;
  min-width: 60px;
}

.volume-slider {
  flex: 1;
  height: 6px;
  border-radius: 3px;
  background: var(--bg-lighter);
  outline: none;
  appearance: none;
  -webkit-appearance: none;
  cursor: pointer;
  position: relative;
}

.volume-slider::-webkit-slider-track {
  height: 6px;
  border-radius: 3px;
  background: var(--bg-lighter);
}

.volume-slider::-webkit-slider-thumb {
  appearance: none;
  -webkit-appearance: none;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: var(--primary);
  cursor: pointer;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
  transition: transform 0.2s;
}

.volume-slider::-webkit-slider-thumb:hover {
  transform: scale(1.2);
  background: var(--primary-hover);
}

.volume-slider::-moz-range-track {
  height: 6px;
  border-radius: 3px;
  background: var(--bg-lighter);
}

.volume-slider::-moz-range-thumb {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: var(--primary);
  cursor: pointer;
  border: none;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
  transition: transform 0.2s;
}

.volume-slider::-moz-range-thumb:hover {
  transform: scale(1.2);
  background: var(--primary-hover);
}

.volume-value {
  font-size: 0.85rem;
  color: var(--text);
  font-weight: 600;
  min-width: 45px;
  text-align: right;
  font-family: 'Courier New', monospace;
}

/* ─── Mobile Responsive ──────────────────────────────────── */
@media (max-width: 768px) {
  .audio-item {
    padding: 1rem;
  }
  
  .audio-item-header {
    gap: 0.75rem;
  }
  
  .audio-number {
    width: 28px;
    height: 28px;
    font-size: 0.85rem;
  }
  
  .audio-icon {
    width: 40px;
    height: 40px;
  }
  
  .audio-icon svg {
    width: 20px;
    height: 20px;
  }
  
  .mini-editor {
    padding: 0.75rem;
  }
  
  .waveform-track {
    height: 60px;
  }
  
  .editor-controls {
    flex-direction: column;
    align-items: stretch;
  }
  
  .btn-editor {
    width: 100%;
    justify-content: center;
  }
  
  .trim-indicator {
    width: 100%;
    justify-content: center;
  }
  
  .trim-handle {
    width: 16px;
  }
  
  .trim-handle:hover {
    width: 20px;
  }
}

@media (max-width: 480px) {
  .audio-item-header {
    flex-direction: column;
    align-items: flex-start;
  }
  
  .audio-controls {
    width: 100%;
    justify-content: flex-end;
  }
  
  .waveform-track {
    height: 50px;
  }
  
  .editor-header {
    flex-direction: column;
    align-items: flex-start;
  }
}
