/* VoiceCanvas — Dark theme, developer-friendly */

:root {
  --bg-primary: #0d1117;
  --bg-secondary: #161b22;
  --bg-tertiary: #21262d;
  --border: #30363d;
  --text-primary: #e6edf3;
  --text-secondary: #8b949e;
  --accent: #58a6ff;
  --accent-hover: #79b8ff;
  --success: #3fb950;
  --warning: #d29922;
  --danger: #f85149;
  --record-active: #ff6b6b;
  --font-sans: 'Outfit', -apple-system, BlinkMacSystemFont, sans-serif;
  --font-mono: 'JetBrains Mono', 'Fira Code', monospace;
  --radius: 10px;
  --radius-sm: 6px;
  --shadow: 0 4px 24px rgba(0, 0, 0, 0.4);
}

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

body {
  font-family: var(--font-sans);
  background: var(--bg-primary);
  color: var(--text-primary);
  min-height: 100vh;
  line-height: 1.6;
}

.app {
  max-width: 720px;
  margin: 0 auto;
  padding: 2rem 1.5rem;
}

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

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

.logo-icon {
  font-size: 1.75rem;
  color: var(--accent);
  animation: pulse 2s ease-in-out infinite;
}

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.6; }
}

.logo h1 {
  font-size: 2rem;
  font-weight: 600;
  letter-spacing: -0.02em;
}

.badge {
  font-size: 0.7rem;
  font-weight: 500;
  padding: 0.2rem 0.5rem;
  background: var(--bg-tertiary);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
}

.tagline {
  font-size: 0.95rem;
  color: var(--text-secondary);
  font-weight: 300;
}

/* Cards */
.card {
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.5rem;
  margin-bottom: 1.25rem;
  box-shadow: var(--shadow);
}

.card-title {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  font-size: 1.15rem;
  font-weight: 600;
  margin-bottom: 0.5rem;
}

.step-num {
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--accent);
  color: var(--bg-primary);
  border-radius: 50%;
  font-size: 0.85rem;
  font-weight: 700;
}

.card-desc {
  font-size: 0.9rem;
  color: var(--text-secondary);
  margin-bottom: 1rem;
}

/* Inputs */
.classes-input {
  display: flex;
  gap: 0.75rem;
  margin-bottom: 1rem;
}

#classInput {
  flex: 1;
  padding: 0.65rem 1rem;
  background: var(--bg-tertiary);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  font-family: var(--font-sans);
  font-size: 0.95rem;
}

#classInput:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 2px rgba(88, 166, 255, 0.2);
}

#classInput::placeholder {
  color: var(--text-secondary);
  opacity: 0.7;
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.65rem 1.25rem;
  font-family: var(--font-sans);
  font-size: 0.9rem;
  font-weight: 500;
  border: none;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all 0.2s ease;
}

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

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

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

.btn-lg {
  padding: 0.85rem 1.75rem;
  font-size: 1rem;
}

.btn-record {
  background: var(--bg-tertiary);
  color: var(--text-primary);
  border: 1px solid var(--border);
}

.btn-record:hover:not(:disabled) {
  border-color: var(--accent);
  color: var(--accent);
}

.btn-record.recording {
  background: var(--record-active);
  color: white;
  border-color: var(--record-active);
  animation: recording-pulse 1s ease-in-out infinite;
}

@keyframes recording-pulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(255, 107, 107, 0.4); }
  50% { box-shadow: 0 0 0 8px rgba(255, 107, 107, 0); }
}

.btn-test {
  background: var(--success);
  color: var(--bg-primary);
}

.btn-test:hover:not(:disabled) {
  filter: brightness(1.1);
}

.btn-test.listening {
  background: var(--warning);
  color: var(--bg-primary);
}

.btn-download {
  background: var(--bg-tertiary);
  color: var(--text-primary);
  border: 1px solid var(--border);
}

.btn-download:hover:not(:disabled) {
  border-color: var(--accent);
  color: var(--accent);
}

.btn-icon {
  font-size: 0.8rem;
}

/* Classes list */
.classes-list {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.class-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.4rem 0.75rem;
  background: var(--bg-tertiary);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 0.85rem;
}

.class-chip .remove {
  background: none;
  border: none;
  color: var(--text-secondary);
  cursor: pointer;
  padding: 0 0.2rem;
  font-size: 1rem;
  line-height: 1;
  transition: color 0.2s;
}

.class-chip .remove:hover {
  color: var(--danger);
}

/* Record controls */
.record-controls {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  margin-bottom: 1rem;
}

.select {
  padding: 0.65rem 1rem;
  background: var(--bg-tertiary);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  font-family: var(--font-sans);
  font-size: 0.95rem;
  cursor: pointer;
}

.select:focus {
  outline: none;
  border-color: var(--accent);
}

.record-status {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.status-text {
  font-size: 0.9rem;
  color: var(--text-secondary);
}

.sample-count {
  font-family: var(--font-mono);
  font-size: 0.85rem;
  color: var(--accent);
}

/* Waveform */
.waveform-container {
  position: relative;
  height: 120px;
  background: var(--bg-tertiary);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  overflow: hidden;
}

#waveformCanvas {
  width: 100%;
  height: 100%;
  display: block;
}

.waveform-placeholder {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-secondary);
  font-size: 0.9rem;
  pointer-events: none;
}

.waveform-placeholder.hidden {
  display: none;
}

/* Training */
.train-controls {
  margin-bottom: 1rem;
}

.training-progress {
  margin-top: 1rem;
}

.training-progress.hidden,
.training-result.hidden,
.test-result.hidden {
  display: none !important;
}

.progress-bar {
  height: 8px;
  background: var(--bg-tertiary);
  border-radius: 4px;
  overflow: hidden;
  margin-bottom: 0.5rem;
}

.progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--accent), #a371f7);
  border-radius: 4px;
  width: 0%;
  transition: width 0.3s ease;
}

.progress-info {
  display: flex;
  justify-content: space-between;
  font-size: 0.85rem;
  color: var(--text-secondary);
}

.progress-info span {
  font-family: var(--font-mono);
}

.training-result {
  margin-top: 1rem;
  padding: 1rem;
  background: var(--bg-tertiary);
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
}

.result-badge {
  display: flex;
  align-items: baseline;
  gap: 0.5rem;
}

.result-label {
  font-size: 0.9rem;
  color: var(--text-secondary);
}

.result-value {
  font-family: var(--font-mono);
  font-size: 1.25rem;
  font-weight: 600;
  color: var(--success);
}

/* Test result */
.test-controls {
  margin-bottom: 1rem;
}

.prediction-display {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  padding: 1rem;
  background: var(--bg-tertiary);
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
}

.predicted-command {
  font-size: 1.25rem;
  font-weight: 600;
  color: var(--accent);
}

.prediction-confidence {
  font-family: var(--font-mono);
  font-size: 0.9rem;
  color: var(--text-secondary);
}

/* Footer */
.footer {
  text-align: center;
  margin-top: 2rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--border);
  font-size: 0.8rem;
  color: var(--text-secondary);
}

/* Utility */
.hidden {
  display: none !important;
}
