/* ── Reset & Base ─────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --bg: #0f172a;
  --surface: #1e293b;
  --surface-hover: #334155;
  --border: #334155;
  --text: #f1f5f9;
  --text-muted: #94a3b8;
  --primary: #6366f1;
  --primary-hover: #818cf8;
  --accent: #22d3ee;
  --danger: #f43f5e;
  --radius: 12px;
  --radius-sm: 8px;
}

body {
  font-family: 'Inter', system-ui, -apple-system, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  min-height: 100vh;
}

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

/* ── Header ──────────────────────────────────────────────── */
.header { text-align: center; margin-bottom: 2rem; }

.logo {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.75rem;
  margin-bottom: 0.5rem;
}

.logo h1 {
  font-size: 2rem;
  font-weight: 700;
  background: linear-gradient(135deg, var(--primary), var(--accent));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.subtitle {
  color: var(--text-muted);
  font-size: 0.95rem;
}

/* ── Tabs ────────────────────────────────────────────────── */
.tabs {
  display: flex;
  gap: 0.5rem;
  margin-bottom: 1rem;
}

.tab {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.75rem 1rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--text-muted);
  font-size: 0.9rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s;
}

.tab:hover { border-color: var(--primary); color: var(--text); }
.tab.active {
  background: var(--primary);
  border-color: var(--primary);
  color: #fff;
}

/* ── Panels ──────────────────────────────────────────────── */
.panel { display: none; margin-bottom: 1.25rem; }
.panel.active { display: block; }

/* Drop zone */
.drop-zone {
  border: 2px dashed var(--border);
  border-radius: var(--radius);
  padding: 3rem 2rem;
  text-align: center;
  cursor: pointer;
  transition: all 0.2s;
}
.drop-zone:hover, .drop-zone.drag-over {
  border-color: var(--primary);
  background: rgba(99, 102, 241, 0.05);
}
.drop-zone p { margin-top: 1rem; color: var(--text-muted); }
.drop-zone .link { color: var(--primary); cursor: pointer; text-decoration: underline; }
.drop-zone .hint { display: block; margin-top: 0.5rem; font-size: 0.8rem; color: var(--text-muted); }

.file-name {
  margin-top: 0.75rem;
  font-size: 0.9rem;
  color: var(--accent);
  text-align: center;
}

/* URL input */
.input-group {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 0.75rem 1rem;
}
.input-group input {
  flex: 1;
  background: none;
  border: none;
  color: var(--text);
  font-size: 1rem;
  outline: none;
}
.input-group input::placeholder { color: var(--text-muted); }

/* Textarea */
textarea {
  width: 100%;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 1rem;
  color: var(--text);
  font-size: 0.95rem;
  font-family: inherit;
  resize: vertical;
  outline: none;
}
textarea:focus { border-color: var(--primary); }

/* ── Options ─────────────────────────────────────────────── */
.options {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
  margin-bottom: 1.25rem;
}

.option-group label {
  display: block;
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--text-muted);
  margin-bottom: 0.4rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

select {
  width: 100%;
  padding: 0.65rem 0.85rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-size: 0.9rem;
  font-family: inherit;
  cursor: pointer;
  outline: none;
}
select:focus { border-color: var(--primary); }

.custom-prompt-wrap {
  margin-bottom: 1.25rem;
}
.custom-prompt-wrap label {
  display: block;
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--text-muted);
  margin-bottom: 0.4rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

/* ── Buttons ─────────────────────────────────────────────── */
.btn-primary {
  width: 100%;
  padding: 1rem;
  background: linear-gradient(135deg, var(--primary), #7c3aed);
  border: none;
  border-radius: var(--radius-sm);
  color: #fff;
  font-size: 1.05rem;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  transition: opacity 0.2s, transform 0.1s;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.75rem;
}
.btn-primary:hover { opacity: 0.9; }
.btn-primary:active { transform: scale(0.99); }
.btn-primary:disabled { opacity: 0.5; cursor: not-allowed; }

.spinner {
  width: 20px;
  height: 20px;
  border: 2px solid rgba(255,255,255,0.3);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.btn-icon {
  background: none;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 0.4rem;
  cursor: pointer;
  color: var(--text-muted);
  transition: all 0.2s;
}
.btn-icon:hover { color: var(--text); border-color: var(--text-muted); }

/* ── Results ─────────────────────────────────────────────── */
.results {
  margin-top: 2rem;
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

.result-section {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem;
}

.result-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1rem;
}
.result-header h3 { font-size: 1rem; font-weight: 600; }

.analysis-text {
  font-size: 0.95rem;
  line-height: 1.75;
  white-space: pre-wrap;
  color: var(--text);
}

.audio-section h3 { margin-bottom: 1rem; }

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

audio {
  flex: 1;
  min-width: 200px;
  height: 42px;
}

.btn-download {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 1rem;
  background: var(--surface-hover);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-size: 0.85rem;
  text-decoration: none;
  transition: all 0.2s;
}
.btn-download:hover { border-color: var(--primary); color: var(--primary); }

details summary {
  cursor: pointer;
  font-weight: 600;
  font-size: 0.95rem;
  color: var(--text-muted);
}
details summary:hover { color: var(--text); }

.original-text {
  margin-top: 1rem;
  font-size: 0.85rem;
  color: var(--text-muted);
  white-space: pre-wrap;
  max-height: 300px;
  overflow-y: auto;
}

/* ── Footer ──────────────────────────────────────────────── */
footer {
  margin-top: 3rem;
  text-align: center;
  font-size: 0.8rem;
  color: var(--text-muted);
}

/* ── Responsive ──────────────────────────────────────────── */
@media (max-width: 600px) {
  .container { padding: 1.25rem 1rem 3rem; }
  .tabs { flex-direction: column; }
  .options { grid-template-columns: 1fr; }
  .audio-player { flex-direction: column; }
  audio { width: 100%; }
}
