/* LocalAudio — Styles */
:root {
  --bg: #0f172a;
  --surface: #1e293b;
  --surface2: #334155;
  --text: #f1f5f9;
  --text-muted: #94a3b8;
  --accent: #6366f1;
  --accent-hover: #4f46e5;
  --success: #22c55e;
  --danger: #ef4444;
  --border: #334155;
}

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

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.app { max-width: 900px; margin: 0 auto; padding: 0 20px 40px; width: 100%; }

/* Header */
header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 0;
  border-bottom: 1px solid var(--border);
  margin-bottom: 24px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 20px;
  font-weight: 700;
  color: var(--text);
}

.header-right { display: flex; align-items: center; gap: 12px; }

/* Badges */
.badge {
  padding: 4px 12px;
  border-radius: 12px;
  font-size: 12px;
  font-weight: 600;
}
.badge.free { background: var(--surface2); color: var(--text-muted); }
.badge.pro { background: #dcfce7; color: #16a34a; }

/* Buttons */
.btn {
  padding: 8px 20px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface);
  color: var(--text);
  cursor: pointer;
  font-size: 14px;
  transition: all 0.15s;
}
.btn:hover { background: var(--surface2); }
.btn-primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn-primary:hover { background: var(--accent-hover); }
.btn-success { background: var(--success); border-color: var(--success); color: #fff; }
.btn-success:hover { opacity: 0.9; }

/* Cards */
.card {
  background: var(--surface);
  border-radius: 12px;
  padding: 24px;
  margin-bottom: 16px;
  border: 1px solid var(--border);
}

/* Drop Zone */
.dropzone {
  border: 2px dashed var(--border);
  border-radius: 12px;
  padding: 48px 24px;
  text-align: center;
  cursor: pointer;
  transition: all 0.2s;
}
.dropzone:hover, .dropzone.drag { border-color: var(--accent); background: rgba(99,102,241,0.05); }
.drop-icon { width: 48px; height: 48px; color: var(--accent); margin-bottom: 12px; }
.dropzone p { margin: 4px 0; }
.hint { color: var(--text-muted); font-size: 13px; }

/* Waveform */
.waveform-container { position: relative; margin-bottom: 16px; }
#waveformCanvas {
  width: 100%;
  height: 160px;
  background: var(--bg);
  border-radius: 8px;
  display: block;
}
.selection-overlay {
  position: absolute;
  top: 0; left: 0; right: 0; bottom: 0;
  display: flex;
  align-items: center;
  pointer-events: none;
}
.selection-fill {
  height: 100%;
  background: rgba(99, 102, 241, 0.2);
  border-left: 2px solid var(--accent);
  border-right: 2px solid var(--accent);
  pointer-events: auto;
  cursor: ew-resize;
}
.selection-handle {
  width: 12px;
  height: 32px;
  background: var(--accent);
  border-radius: 4px;
  cursor: ew-resize;
  pointer-events: auto;
}
.selection-handle.left { margin-left: -6px; }
.selection-handle.right { margin-right: -6px; }
.time-display {
  display: flex;
  justify-content: space-between;
  font-size: 13px;
  color: var(--text-muted);
  margin-top: 8px;
}

/* Controls */
.trim-controls, .export-options {
  display: flex;
  gap: 16px;
  align-items: flex-end;
  flex-wrap: wrap;
}
.control-group { display: flex; flex-direction: column; gap: 4px; }
.control-group label { font-size: 12px; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.05em; }
.control-group input, .control-group select {
  padding: 8px 12px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
  min-width: 100px;
}
.control-group input:focus, .control-group select:focus { outline: none; border-color: var(--accent); }

/* Progress */
.progress-bar {
  margin-top: 16px;
  height: 8px;
  background: var(--surface2);
  border-radius: 4px;
  overflow: hidden;
  position: relative;
}
.progress-fill {
  height: 100%;
  background: var(--accent);
  width: 0%;
  transition: width 0.3s;
}
.progress-bar span {
  position: absolute;
  top: 16px;
  left: 50%;
  transform: translateX(-50%);
  font-size: 12px;
  color: var(--text-muted);
}

/* Message */
.msg {
  padding: 12px 16px;
  border-radius: 8px;
  margin-top: 16px;
  font-size: 14px;
}
.msg.success { background: #dcfce7; color: #16a34a; }
.msg.error { background: #fee2e2; color: #dc2626; }
.msg.info { background: #dbeafe; color: #2563eb; }
.hidden { display: none !important; }

/* Footer */
footer {
  text-align: center;
  padding: 24px 0;
  color: var(--text-muted);
  font-size: 13px;
  border-top: 1px solid var(--border);
  margin-top: 32px;
}
footer nav { margin-top: 8px; }
footer nav a {
  color: var(--accent);
  text-decoration: none;
  margin: 0 12px;
}
footer nav a:hover { text-decoration: underline; }

/* Install banner */
.install-banner {
  background: linear-gradient(135deg, var(--accent), #8b5cf6);
  padding: 12px 20px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}
.install-banner button { background: #fff; color: var(--accent); border: none; padding: 6px 16px; border-radius: 6px; cursor: pointer; font-weight: 600; }

/* Responsive */
@media (max-width: 640px) {
  .trim-controls, .export-options { flex-direction: column; align-items: stretch; }
  .control-group input, .control-group select { min-width: unset; width: 100%; }
}
