/* Voice Bridge PWA — minimal, desktop-primary, mobile-friendly */

:root {
  --bg: #0f172a;
  --surface: #1e293b;
  --surface-2: #334155;
  --text: #f1f5f9;
  --text-muted: #94a3b8;
  --accent: #6366f1;
  --accent-hover: #818cf8;
  --danger: #ef4444;
  --success: #22c55e;
  --warning: #f59e0b;
  --radius: 12px;
  --font: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

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

html, body {
  height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

/* ---- Layout shell ---- */
.shell {
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  max-width: 480px;
  margin: 0 auto;
  padding: 0 16px env(safe-area-inset-bottom, 16px);
}

/* ---- Top bar ---- */
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 0 8px;
  border-bottom: 1px solid var(--surface-2);
  margin-bottom: 32px;
}

.app-name {
  font-size: 1.1rem;
  font-weight: 600;
  letter-spacing: 0.01em;
  color: var(--text);
}

.session-badge {
  font-size: 0.78rem;
  font-family: monospace;
  background: var(--surface-2);
  color: var(--text-muted);
  padding: 2px 10px;
  border-radius: 999px;
}

/* ---- Main content ---- */
.content {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 28px;
  padding-top: 48px;
}

/* ---- Record button ---- */
.record-btn {
  width: 160px;
  height: 160px;
  border-radius: 50%;
  border: 3px solid var(--accent);
  background: var(--surface);
  color: var(--text);
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  transition: background 0.15s, border-color 0.15s, transform 0.1s, box-shadow 0.15s;
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
}

.record-btn:hover {
  background: var(--surface-2);
  border-color: var(--accent-hover);
}

.record-btn[data-recording="true"] {
  background: rgba(239,68,68,0.15);
  border-color: var(--danger);
  box-shadow: 0 0 0 8px rgba(239,68,68,0.12), 0 0 0 16px rgba(239,68,68,0.06);
  animation: pulse 1.2s ease-in-out infinite;
}

.record-btn[data-recording="true"] .record-label {
  color: var(--danger);
}

.record-btn[data-recording="true"] .mic-icon {
  stroke: var(--danger);
}

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

@keyframes pulse {
  0%, 100% { box-shadow: 0 0 0 8px rgba(239,68,68,0.12), 0 0 0 16px rgba(239,68,68,0.06); }
  50%       { box-shadow: 0 0 0 12px rgba(239,68,68,0.18), 0 0 0 24px rgba(239,68,68,0.08); }
}

.mic-icon {
  width: 36px;
  height: 36px;
  stroke: var(--accent);
  fill: none;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
  transition: stroke 0.15s;
}

.record-label {
  font-size: 0.82rem;
  color: var(--text-muted);
  transition: color 0.15s;
}

/* ---- Status row ---- */
.status-row {
  display: flex;
  align-items: center;
  gap: 8px;
}

.status-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--text-muted);
  flex-shrink: 0;
  transition: background 0.2s;
}

.status-dot[data-state="recording"] { background: var(--danger); }
.status-dot[data-state="processing"] {
  background: var(--warning);
  animation: blink 0.8s step-end infinite;
}
.status-dot[data-state="success"] { background: var(--success); }
.status-dot[data-state="error"] { background: var(--danger); }
.status-dot[data-state="idle"] { background: var(--text-muted); }

@keyframes blink {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.3; }
}

.status-text {
  font-size: 0.88rem;
  color: var(--text-muted);
}

/* ---- Transcript box ---- */
.transcript-box {
  width: 100%;
  background: var(--surface);
  border: 1px solid var(--surface-2);
  border-radius: var(--radius);
  padding: 14px 16px;
}

.transcript-label {
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
  margin-bottom: 6px;
}

.transcript-text {
  font-size: 0.95rem;
  line-height: 1.5;
  color: var(--text);
  word-break: break-word;
}

/* ---- Error box ---- */
.error-box {
  width: 100%;
  background: rgba(239,68,68,0.1);
  border: 1px solid rgba(239,68,68,0.3);
  border-radius: var(--radius);
  padding: 12px 16px;
  font-size: 0.88rem;
  color: #fca5a5;
}

/* ---- Settings drawer ---- */
.settings-drawer {
  margin-top: auto;
  padding-top: 24px;
  padding-bottom: 16px;
}

.settings-drawer summary {
  font-size: 0.82rem;
  color: var(--text-muted);
  cursor: pointer;
  user-select: none;
  padding: 4px 0;
  list-style: none;
}
.settings-drawer summary::-webkit-details-marker { display: none; }
.settings-drawer summary::before { content: "+ "; }
.settings-drawer[open] summary::before { content: "- "; }

.settings-body {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 16px 0 0;
}

.settings-body label {
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-top: 8px;
}

.settings-body input {
  background: var(--surface);
  border: 1px solid var(--surface-2);
  border-radius: 8px;
  color: var(--text);
  font-size: 0.9rem;
  padding: 8px 12px;
  width: 100%;
  outline: none;
}

.settings-body input:focus {
  border-color: var(--accent);
}

.settings-body small {
  font-size: 0.75rem;
  color: var(--text-muted);
}

.save-btn {
  margin-top: 8px;
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: 8px;
  padding: 8px 20px;
  font-size: 0.9rem;
  cursor: pointer;
  align-self: flex-start;
  transition: background 0.15s;
}
.save-btn:hover { background: var(--accent-hover); }

.save-confirm {
  font-size: 0.82rem;
  color: var(--success);
  margin-top: 4px;
}
