/* Voice Cloner — clean, readable, distinctive */
:root {
  --bg: #0f0f0f;
  --surface: #1a1a1a;
  --border: #2a2a2a;
  --text: #e8e8e8;
  --text-muted: #888;
  --accent: #3b82f6;
  --accent-hover: #2563eb;
  --success: #22c55e;
  --error: #ef4444;
  --radius: 10px;
  --font-sans: "DM Sans", system-ui, sans-serif;
  --font-mono: "JetBrains Mono", monospace;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-sans);
  font-size: 16px;
  line-height: 1.5;
}

.layout {
  max-width: 640px;
  margin: 0 auto;
  padding: 2rem 1.5rem;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.header {
  margin-bottom: 2rem;
}

.title {
  font-size: 1.75rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  margin: 0 0 0.5rem 0;
}

.subtitle {
  margin: 0;
  color: var(--text-muted);
  font-size: 0.95rem;
}

.main {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem 1.5rem;
}

.card-title {
  font-size: 1rem;
  font-weight: 600;
  margin: 0 0 0.5rem 0;
}

.hint {
  font-size: 0.875rem;
  color: var(--text-muted);
  margin: 0 0 1rem 0;
}

.voice-source-row {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  margin-bottom: 1rem;
  align-items: flex-end;
}

.profile-select-wrap {
  min-width: 200px;
}

.voice-upload-section {
  margin-top: 0.5rem;
}

.recording-phrase {
  margin-bottom: 1rem;
  padding: 0.75rem 1rem;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  border-left: 3px solid var(--accent);
}

.recording-phrase-label {
  display: block;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.03em;
  margin-bottom: 0.35rem;
}

.recording-phrase-text {
  margin: 0;
  font-size: 0.95rem;
  line-height: 1.5;
  color: var(--text);
}

.saved-profiles-section {
  margin-top: 1rem;
}

.profile-list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.profile-list li {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.5rem 0.75rem;
  background: var(--bg);
  border-radius: 8px;
  margin-bottom: 0.5rem;
  border: 1px solid var(--border);
}

.profile-list li span {
  font-size: 0.9rem;
}

.profile-list .profile-badge {
  font-size: 0.75rem;
  padding: 0.15rem 0.4rem;
  background: var(--border);
  border-radius: 4px;
  color: var(--text-muted);
  margin-left: 0.5rem;
}

.profile-list .btn-ghost {
  padding: 0.25rem 0.5rem;
  font-size: 0.8rem;
}

.voice-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin-bottom: 0.75rem;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.5rem 1rem;
  font-family: var(--font-sans);
  font-size: 0.9rem;
  font-weight: 500;
  border-radius: 8px;
  border: none;
  cursor: pointer;
  text-decoration: none;
  transition: background 0.15s, color 0.15s;
}

.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.btn-primary {
  background: var(--accent);
  color: #fff;
}

.btn-primary:hover:not(:disabled) {
  background: var(--accent-hover);
}

.btn-secondary {
  background: var(--border);
  color: var(--text);
}

.btn-secondary:hover:not(:disabled) {
  background: #333;
}

.btn-ghost {
  background: transparent;
  color: var(--text-muted);
}

.btn-ghost:hover:not(:disabled) {
  color: var(--text);
}

.btn-large {
  padding: 0.75rem 1.5rem;
  font-size: 1rem;
  width: 100%;
}

.voice-status {
  font-size: 0.875rem;
  color: var(--text-muted);
  margin-bottom: 0.5rem;
}

.voice-preview {
  width: 100%;
  height: 48px;
  margin-top: 0.5rem;
}

.text-input {
  width: 100%;
  padding: 0.75rem 1rem;
  font-family: var(--font-sans);
  font-size: 1rem;
  line-height: 1.5;
  color: var(--text);
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  resize: vertical;
  min-height: 100px;
}

.text-input::placeholder {
  color: var(--text-muted);
}

.text-input:focus {
  outline: none;
  border-color: var(--accent);
}

.provider-status {
  font-size: 0.875rem;
  margin-bottom: 1rem;
  padding: 0.5rem 0.75rem;
  background: var(--bg);
  border-radius: 8px;
  border: 1px solid var(--border);
}

.provider-status-label {
  font-weight: 500;
  color: var(--text-muted);
  margin-right: 0.5rem;
}

.provider-status.warn {
  border-color: #b45309;
  background: rgba(180, 83, 9, 0.1);
}

.provider-status.warn #providerStatusText {
  color: #f59e0b;
}

.options-row {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
}

.ref-text-wrap {
  margin-top: 1rem;
}

.ref-text-wrap .text-input {
  width: 100%;
}

.option {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.option-label {
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--text-muted);
}

.option select {
  padding: 0.5rem 0.75rem;
  font-family: var(--font-sans);
  font-size: 0.9rem;
  color: var(--text);
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  min-width: 180px;
}

.option select:focus {
  outline: none;
  border-color: var(--accent);
}

.generate-status {
  font-size: 0.875rem;
  margin-top: 0.75rem;
  min-height: 1.25rem;
}

.generate-status.loading {
  color: var(--accent);
}

.generate-status.error {
  color: var(--error);
}

.generate-status.success {
  color: var(--success);
}

.output-audio {
  width: 100%;
  margin-top: 1rem;
}

.output-actions {
  margin-top: 0.75rem;
}

.footer {
  margin-top: 2rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--border);
  font-size: 0.8rem;
  color: var(--text-muted);
}

.footer a {
  color: var(--accent);
  text-decoration: none;
}

.footer a:hover {
  text-decoration: underline;
}

.footer code {
  font-family: var(--font-mono);
  font-size: 0.85em;
  padding: 0.1em 0.35em;
  background: var(--surface);
  border-radius: 4px;
}

.server-url-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  align-items: center;
  margin-bottom: 0.75rem;
}

.server-url-label {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-muted);
}

.server-url-input {
  flex: 1 1 220px;
  min-width: 180px;
  padding: 0.45rem 0.65rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-mono);
  font-size: 0.8rem;
}

.server-url-hint {
  margin: 0 0 0.75rem;
  font-size: 0.75rem;
  color: var(--text-muted);
}

/* Speak with bot page */
.layout-wide {
  max-width: 720px;
}

.speak-bot-controls {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  align-items: center;
  margin-bottom: 1rem;
}

.speak-bot-status {
  font-size: 0.9rem;
  color: var(--text-muted);
  margin-top: 0.5rem;
}

.speak-bot-status.warn {
  color: #f59e0b;
}

.speak-bot-status.error {
  color: var(--error);
}

.speak-bot-transcript {
  min-height: 2.5rem;
  padding: 0.75rem;
  background: var(--bg);
  border-radius: var(--radius);
  font-size: 0.9rem;
  color: var(--text-muted);
  border: 1px solid var(--border);
}

.speak-bot-log {
  max-height: 320px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.speak-bot-msg {
  padding: 0.75rem 1rem;
  border-radius: var(--radius);
  border: 1px solid var(--border);
}

.speak-bot-msg-user {
  background: rgba(59, 130, 246, 0.12);
  border-color: rgba(59, 130, 246, 0.35);
}

.speak-bot-msg-assistant {
  background: var(--bg);
}

.speak-bot-msg-role {
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-muted);
  display: block;
  margin-bottom: 0.35rem;
}

.speak-bot-msg p {
  margin: 0;
  white-space: pre-wrap;
}
