@import url('https://fonts.googleapis.com/css2?family=Space+Grotesk:wght@300;400;500;600;700&family=Inter:wght@300;400;500;600&display=swap');

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

:root {
  --bg: #080808;
  --bg-2: #101010;
  --bg-3: #1a1a1a;
  --border: rgba(255, 255, 255, 0.07);
  --border-hover: rgba(255, 255, 255, 0.14);
  --text: #f0f0f0;
  --text-muted: rgba(240, 240, 240, 0.45);
  --text-subtle: rgba(240, 240, 240, 0.2);
  --accent: #F26419;
  --accent-hover: #D85A17;
  --accent-glow: rgba(242, 100, 25, 0.15);
  --danger: #e05252;
  --success: #4caf7d;
  --radius: 14px;
  --radius-sm: 8px;
}

[x-cloak] { display: none !important; }

html, body {
  min-height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: 'Inter', sans-serif;
  -webkit-font-smoothing: antialiased;
}

/* Grain texture */
body::after {
  content: '';
  position: fixed;
  inset: 0;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='300' height='300'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.75' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='300' height='300' filter='url(%23n)' opacity='0.04'/%3E%3C/svg%3E");
  pointer-events: none;
  z-index: 9999;
  opacity: 0.5;
}

.app-bg {
  position: fixed;
  inset: 0;
  background:
    radial-gradient(ellipse 70% 50% at 50% 110%, rgba(242, 100, 25, 0.08) 0%, transparent 65%),
    radial-gradient(ellipse 40% 30% at 20% 20%, rgba(255,255,255,0.015) 0%, transparent 50%),
    var(--bg);
  z-index: -1;
}

/* ===== NAV ===== */
.app-nav {
  position: sticky;
  top: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem 2rem;
  background: rgba(8, 8, 8, 0.9);
  backdrop-filter: blur(20px);
  border-bottom: 1px solid var(--border);
}
.logo { display: flex; align-items: baseline; gap: 7px; }
.logo-text {
  font-family: 'Space Grotesk', sans-serif;
  font-size: 17px;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--text);
}
.logo-sub {
  font-family: 'Inter', sans-serif;
  font-size: 10px;
  font-weight: 500;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--accent);
}
.nav-tagline { font-size: 11px; letter-spacing: 0.1em; text-transform: uppercase; color: var(--text-subtle); }

.app-content { flex: 1; padding: 2rem; max-width: 860px; margin: 0 auto; width: 100%; }

/* ===== BUTTONS ===== */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  padding: 0.65rem 1.25rem;
  border-radius: var(--radius-sm);
  font-family: 'Inter', sans-serif;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  border: none;
  transition: all 0.18s;
  text-decoration: none;
  white-space: nowrap;
}
.btn:disabled { opacity: 0.45; cursor: not-allowed; transform: none !important; }
.btn-primary { background: var(--accent); color: #fff; }
.btn-primary:hover:not(:disabled) { background: var(--accent-hover); transform: translateY(-1px); }
.btn-ghost { background: transparent; color: var(--text-muted); border: 1px solid var(--border); }
.btn-ghost:hover:not(:disabled) { color: var(--text); border-color: var(--border-hover); background: rgba(255,255,255,0.04); }
.btn-lg { padding: 0.875rem 1.75rem; font-size: 14px; }

/* ===== DROPZONE ===== */
.drop-hero { text-align: center; margin: 3rem 0 2rem; }
.drop-hero h1 {
  font-family: 'Space Grotesk', sans-serif;
  font-size: clamp(28px, 5vw, 42px);
  font-weight: 700;
  letter-spacing: -0.025em;
  line-height: 1.15;
  margin-bottom: 0.75rem;
}
.drop-hero p { color: var(--text-muted); font-size: 15px; max-width: 480px; margin: 0 auto; line-height: 1.65; }
.dropzone {
  border: 2px dashed rgba(255,255,255,0.12);
  border-radius: 20px;
  padding: 3.5rem 2rem;
  text-align: center;
  cursor: pointer;
  transition: all 0.22s;
  background: rgba(255,255,255,0.02);
}
.dropzone:hover, .dropzone.drag-over {
  border-color: var(--accent);
  background: rgba(242, 100, 25, 0.06);
  box-shadow: 0 0 50px rgba(242, 100, 25, 0.08), inset 0 0 30px rgba(242, 100, 25, 0.03);
}
.dropzone-icon { width: 52px; height: 52px; margin: 0 auto 1.125rem; color: var(--text-muted); transition: color 0.22s, transform 0.22s; }
.dropzone:hover .dropzone-icon, .dropzone.drag-over .dropzone-icon { color: var(--accent); transform: translateY(-3px); }
.dropzone h3 { font-family: 'Space Grotesk', sans-serif; font-size: 17px; font-weight: 600; margin-bottom: 0.4rem; }
.dropzone p { font-size: 13px; color: var(--text-muted); }

/* ===== FILE BAR ===== */
.file-bar {
  display: flex;
  align-items: center;
  gap: 0.875rem;
  padding: 0.75rem 1rem;
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  margin-bottom: 1rem;
}
.file-icon {
  width: 34px; height: 34px;
  background: rgba(242, 100, 25, 0.1);
  border-radius: 7px;
  display: flex; align-items: center; justify-content: center;
  color: var(--accent);
  flex-shrink: 0;
  font-size: 9px; font-weight: 800; letter-spacing: 0.02em;
}
.file-name { flex: 1; font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.file-meta { font-size: 12px; color: var(--text-muted); flex-shrink: 0; }
.file-bar .btn { flex-shrink: 0; }

/* ===== WAVEFORM CARD ===== */
.wave-card {
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem 1.25rem 1rem;
  margin-bottom: 1.25rem;
}
#waveform { cursor: text; }
#waveform ::part(region) { border-left: 1px solid rgba(242,100,25,0.35); border-right: 1px solid rgba(242,100,25,0.35); }
#waveform ::part(region-handle) {
  width: 7px;
  border: none;
  background: rgba(242, 100, 25, 0.65);
  border-radius: 3px;
  cursor: ew-resize;
}
#waveform ::part(region-handle):hover { background: var(--accent); }

.cut-list { display: flex; flex-wrap: wrap; gap: 0.4rem; margin-top: 0.75rem; }
.cut-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  background: rgba(224, 82, 82, 0.1);
  border: 1px solid rgba(224, 82, 82, 0.3);
  border-radius: 999px;
  color: #ff9090;
  font-size: 12px;
  padding: 0.3rem 0.4rem 0.3rem 0.75rem;
  font-variant-numeric: tabular-nums;
}
.cut-pill button {
  background: transparent;
  border: none;
  color: #ff9090;
  font-size: 15px;
  line-height: 1;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s;
}
.cut-pill button:hover { background: rgba(224, 82, 82, 0.25); }
.cut-pill.keep {
  background: rgba(76, 175, 125, 0.1);
  border-color: rgba(76, 175, 125, 0.35);
  color: #7fd4a8;
}
.cut-pill.keep button { color: #7fd4a8; }
.cut-pill.keep button:hover { background: rgba(76, 175, 125, 0.25); }
.cut-mode { flex-shrink: 0; }
.cut-mode button { padding: 0.3rem 0.75rem; font-size: 11px; }
.cut-hint { font-size: 11px; color: var(--text-subtle); align-self: center; }
.cut-hint b { color: var(--text-muted); font-weight: 600; }
.transport {
  display: flex;
  align-items: center;
  gap: 0.875rem;
  margin-top: 0.875rem;
}
.play-btn {
  width: 42px; height: 42px;
  border-radius: 50%;
  background: var(--accent);
  color: #fff;
  border: none;
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: background 0.15s, transform 0.15s;
  flex-shrink: 0;
}
.play-btn:hover { background: var(--accent-hover); transform: scale(1.05); }
.time-display {
  font-size: 12px;
  color: var(--text-muted);
  font-variant-numeric: tabular-nums;
  min-width: 96px;
}
.trim-label { font-size: 11px; color: var(--text-subtle); }
.transport-spacer { flex: 1; }

/* A/B switch */
.ab-switch {
  display: flex;
  border: 1px solid var(--border);
  border-radius: 999px;
  overflow: hidden;
}
.ab-switch button {
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-family: 'Space Grotesk', sans-serif;
  font-size: 12px;
  font-weight: 600;
  padding: 0.45rem 1rem;
  cursor: pointer;
  transition: all 0.15s;
}
.ab-switch button.active { background: rgba(242, 100, 25, 0.15); color: var(--accent); }

/* ===== TOOLTIPS & INFO-POINTS ===== */
[data-tip] { position: relative; }
[data-tip]:hover::after, [data-tip]:focus-visible::after {
  content: attr(data-tip);
  position: absolute;
  bottom: calc(100% + 8px);
  left: 50%;
  transform: translateX(-50%);
  background: #1d1d1d;
  border: 1px solid var(--border-hover);
  color: var(--text);
  font-family: 'Inter', sans-serif;
  font-size: 11.5px;
  font-weight: 400;
  letter-spacing: 0;
  text-transform: none;
  line-height: 1.5;
  padding: 0.45rem 0.7rem;
  border-radius: 7px;
  width: max-content;
  max-width: 250px;
  white-space: normal;
  text-align: left;
  z-index: 300;
  pointer-events: none;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.55);
}
@media (hover: none) {
  [data-tip]:hover::after { display: none; }  /* touch: legenda via info-points */
}
.info-dot {
  width: 15px;
  height: 15px;
  border-radius: 50%;
  border: 1px solid var(--border-hover);
  background: transparent;
  color: var(--text-subtle);
  font-family: 'Inter', sans-serif;
  font-size: 9.5px;
  font-weight: 600;
  font-style: normal;
  line-height: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  margin-left: 7px;
  vertical-align: -2px;
  transition: all 0.15s;
  padding: 0;
}
.info-dot:hover, .info-dot.active {
  color: var(--accent);
  border-color: rgba(242, 100, 25, 0.5);
  background: rgba(242, 100, 25, 0.08);
}
.info-legend {
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-left: 2px solid rgba(242, 100, 25, 0.5);
  border-radius: var(--radius-sm);
  padding: 0.7rem 1rem;
  margin-bottom: 0.75rem;
  font-size: 12px;
  color: var(--text-muted);
  line-height: 1.7;
}
.info-legend b { color: var(--text); font-weight: 600; }
.wave-card .info-legend { margin: 0.75rem 0 0; }

/* ===== AUTO-ANALYSE ===== */
.auto-btn {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  background: rgba(242, 100, 25, 0.05);
  border: 1px dashed rgba(242, 100, 25, 0.35);
  border-radius: var(--radius-sm);
  color: var(--accent);
  font-family: 'Inter', sans-serif;
  font-size: 13px;
  font-weight: 500;
  padding: 0.75rem 1rem;
  cursor: pointer;
  transition: all 0.18s;
  margin-bottom: 0.75rem;
}
.auto-btn:hover:not(:disabled) {
  background: rgba(242, 100, 25, 0.1);
  border-color: rgba(242, 100, 25, 0.6);
}
.auto-btn:disabled { opacity: 0.55; cursor: wait; }
.auto-panel {
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-left: 2px solid var(--accent);
  border-radius: var(--radius-sm);
  padding: 0.75rem 1rem;
  font-size: 12.5px;
  color: var(--text-muted);
  line-height: 1.6;
  margin-bottom: 1.25rem;
}

/* ===== CHIP ROWS ===== */
.chip-section { margin-bottom: 1.25rem; }
.chip-section-label {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-bottom: 0.6rem;
}
.chip-row { display: flex; flex-wrap: wrap; gap: 0.45rem; }
.chip {
  background: rgba(255,255,255,0.055);
  border: 1px solid rgba(255, 255, 255, 0.13);
  border-radius: 999px;
  color: rgba(240, 240, 240, 0.82);
  font-family: 'Inter', sans-serif;
  font-size: 13px;
  font-weight: 500;
  padding: 0.5rem 1rem;
  cursor: pointer;
  transition: all 0.16s;
  user-select: none;
}
.chip:hover {
  color: var(--text);
  border-color: rgba(255, 255, 255, 0.25);
  background: rgba(255, 255, 255, 0.09);
  transform: translateY(-1px);
}
.chip.active {
  background: rgba(242, 100, 25, 0.16);
  border-color: rgba(242, 100, 25, 0.55);
  color: var(--accent);
}
.chip .chip-hint { font-size: 10px; color: var(--text-subtle); margin-left: 4px; }
.chip.active .chip-hint { color: rgba(242, 100, 25, 0.6); }

/* ===== ADVANCED PANEL ===== */
.advanced-panel {
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem 1.375rem;
  margin-bottom: 1.25rem;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.125rem 2rem;
}
.adv-field label {
  display: block;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-bottom: 0.5rem;
}
.adv-field .adv-value { color: var(--accent); font-weight: 600; text-transform: none; letter-spacing: 0; }
.adv-field input[type="range"] {
  width: 100%;
  accent-color: var(--accent);
  height: 4px;
}
.adv-field input[type="number"], .adv-field select {
  width: 100%;
  background: rgba(255,255,255,0.04);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 0.55rem 0.75rem;
  color: var(--text);
  font-family: 'Inter', sans-serif;
  font-size: 13px;
  outline: none;
  transition: border-color 0.2s;
}
.adv-field input:focus, .adv-field select:focus { border-color: rgba(242, 100, 25, 0.45); }
.adv-fades { display: flex; gap: 0.75rem; }
.adv-fades > div { flex: 1; }
.adv-fades span { font-size: 11px; color: var(--text-subtle); display: block; margin-bottom: 0.3rem; }

/* ===== ACTION ROW ===== */
.action-row {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin: 1.75rem 0;
}
.action-row .btn-primary { flex: 1; }
.preview-note { font-size: 11px; color: var(--text-subtle); text-align: center; margin-top: -0.75rem; margin-bottom: 1.5rem; }

/* ===== ECHTE A/B ===== */
.abx-panel {
  display: flex;
  align-items: center;
  gap: 1rem;
  background: var(--bg-2);
  border: 1px solid rgba(242, 100, 25, 0.3);
  border-radius: var(--radius);
  padding: 1rem 1.25rem;
  margin: -0.75rem 0 1.5rem;
  flex-wrap: wrap;
  box-shadow: 0 0 40px rgba(242, 100, 25, 0.06);
}
.abx-switch {
  display: flex;
  border: 1px solid var(--border);
  border-radius: 12px;
  overflow: hidden;
}
.abx-switch button {
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-family: 'Space Grotesk', sans-serif;
  font-size: 22px;
  font-weight: 700;
  padding: 0.6rem 1.5rem;
  cursor: pointer;
  transition: all 0.12s;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  min-width: 110px;
}
.abx-switch button small {
  font-family: 'Inter', sans-serif;
  font-size: 10px;
  font-weight: 500;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}
.abx-switch button.active {
  background: rgba(242, 100, 25, 0.16);
  color: var(--accent);
}
.abx-match { font-size: 12px; padding: 0.4rem 0.8rem; }
.abx-info { font-size: 11px; color: var(--text-subtle); flex: 1; min-width: 140px; }
@media (max-width: 600px) {
  .abx-panel { gap: 0.6rem; }
  .abx-switch button { min-width: 80px; padding: 0.5rem 1rem; font-size: 18px; }
}

/* ===== PROGRESS ===== */
.render-panel {
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 2rem 1.75rem;
  margin: 1.75rem 0;
  text-align: center;
}
.render-stage {
  font-family: 'Space Grotesk', sans-serif;
  font-size: 15px;
  font-weight: 600;
  margin-bottom: 1rem;
}
.progress-bar { height: 3px; background: var(--bg-3); border-radius: 2px; overflow: hidden; margin-bottom: 0.6rem; }
.progress-fill { height: 100%; background: var(--accent); border-radius: 2px; transition: width 0.3s; }
.progress-pct { font-size: 12px; color: var(--accent); font-weight: 600; }

/* ===== SUCCESS ===== */
.success-state { text-align: center; padding: 2.5rem 1rem 1rem; }
.success-icon {
  width: 60px; height: 60px;
  background: rgba(76, 175, 125, 0.12);
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  margin: 0 auto 1.5rem;
  color: var(--success);
}
.success-state h2 { font-family: 'Space Grotesk', sans-serif; font-size: 22px; font-weight: 600; margin-bottom: 0.625rem; }
.success-state > p { color: var(--text-muted); font-size: 14px; margin-bottom: 1.5rem; }
.report-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.6rem;
  max-width: 480px;
  margin: 0 auto 1.5rem;
}
.report-cell {
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 0.875rem 0.5rem;
}
.report-cell .report-label { font-size: 10px; letter-spacing: 0.09em; text-transform: uppercase; color: var(--text-muted); margin-bottom: 0.3rem; }
.report-cell .report-value { font-family: 'Space Grotesk', sans-serif; font-size: 16px; font-weight: 600; }
.report-cell .report-value small { font-size: 11px; color: var(--text-muted); font-weight: 400; }
.report-steps { font-size: 12px; color: var(--text-subtle); max-width: 480px; margin: 0 auto 1.75rem; line-height: 1.7; }
.success-actions { display: flex; gap: 0.6rem; justify-content: center; flex-wrap: wrap; }

.error-msg {
  background: rgba(224, 82, 82, 0.08);
  border: 1px solid rgba(224, 82, 82, 0.25);
  border-radius: var(--radius-sm);
  padding: 0.7rem 1rem;
  color: #ff9090;
  font-size: 13px;
  margin: 1rem 0;
}

/* Scrollbar */
::-webkit-scrollbar { width: 5px; }
::-webkit-scrollbar-track { background: var(--bg); }
::-webkit-scrollbar-thumb { background: var(--bg-3); border-radius: 3px; }

@media (max-width: 600px) {
  .app-content { padding: 1.25rem; }
  .app-nav { padding: 0.875rem 1.25rem; }
  .nav-tagline { display: none; }
  .advanced-panel { grid-template-columns: 1fr; }
  .transport { flex-wrap: wrap; }
  .action-row { flex-direction: column; }
  .action-row .btn { width: 100%; }
}
