/* VoiceMem — Premium Dark Design System
   Pattern: Exaggerated Minimalism
   Mood: dark, cinematic, technical, precision, clean, premium */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;900&display=swap');

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

:root {
  --bg:         #0a0a0f;
  --bg-card:    #12121a;
  --bg-card-hover: #1a1a26;
  --surface:    #1e1e2e;
  --text:       #f0f0f5;
  --text-muted: #8888a0;
  --text-dim:   #55556a;
  --primary:    #DC2626;
  --primary-glow: rgba(220, 38, 38, 0.15);
  --accent:     #2563EB;
  --accent-glow: rgba(37, 99, 235, 0.12);
  --border:     #2a2a3e;
  --border-active: #44446a;
  --success:    #22c55e;
  --radius:     12px;
  --radius-sm:  8px;
  --radius-full: 999px;
  --shadow:     0 4px 24px rgba(0,0,0,0.4);
  --transition: 200ms cubic-bezier(0.4, 0, 0.2, 1);
}

/* ── Global Form Controls (SET STANDARD) ──────────────────── */
/* Every input/select/textarea is themed by default — no browser defaults */
input, select, textarea {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px 16px;
  color: var(--text);
  font: inherit;
  font-size: 0.875rem;
  outline: none;
  transition: border-color var(--transition), box-shadow var(--transition);
  width: 100%;
  -webkit-appearance: none;
  -moz-appearance: none;
  appearance: none;
}

input::placeholder, textarea::placeholder {
  color: var(--text-dim);
}

input:focus, select:focus, textarea:focus {
  border-color: var(--border-active);
  box-shadow: 0 0 0 3px var(--primary-glow);
}

input[type="search"] {
  border-radius: var(--radius);
}

select {
  cursor: pointer;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' fill='%238888a0' viewBox='0 0 16 16'%3E%3Cpath d='M4 6l4 4 4-4'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 36px;
}

textarea {
  resize: vertical;
  min-height: 100px;
}

/* Field group wrapper */
.field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 16px;
}

.field label {
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-dim);
}

/* Global button reset — every button uses design-system classes */
button {
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--text);
  font: inherit;
  font-size: 0.8125rem;
  font-weight: 500;
  padding: 12px 20px;
  border-radius: var(--radius);
  cursor: pointer;
  transition: all var(--transition);
  white-space: nowrap;
  -webkit-appearance: none;
  -moz-appearance: none;
  appearance: none;
}

button:hover {
  border-color: var(--border-active);
  background: var(--bg-card-hover);
}

button:active {
  transform: scale(0.98);
}

button:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

/* Primary button */
.btn-primary {
  background: var(--primary);
  border-color: var(--primary);
  color: #fff;
}

.btn-primary:hover {
  background: rgba(220, 38, 38, 0.85);
  border-color: var(--primary);
}

/* Ghost button */
.btn-ghost {
  background: transparent;
  border-color: var(--border);
  color: var(--text-muted);
}

.btn-ghost:hover {
  border-color: var(--border-active);
  color: var(--text);
}

html {
  font-size: 16px;
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
}

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  min-height: 100dvh;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-x: hidden;
}

/* ── Grain overlay ────────────────────────────────────────── */
body::before {
  content: '';
  position: fixed;
  inset: 0;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noise'%3E%3CfeTurbulence baseFrequency='0.85' numOctaves='6' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noise)' opacity='0.03'/%3E%3C/svg%3E");
  pointer-events: none;
  z-index: 9999;
  opacity: 0.5;
}

/* ── Layout ───────────────────────────────────────────────── */
.app-shell {
  max-width: 480px;
  margin: 0 auto;
  padding: 0 16px;
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
}

@media (min-width: 768px) {
  .app-shell { max-width: 640px; }
}

/* ── Header ───────────────────────────────────────────────── */
.header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 0 16px;
  position: sticky;
  top: 0;
  background: var(--bg);
  z-index: 100;
}

.header-brand {
  font-size: 1.125rem;
  font-weight: 700;
  letter-spacing: -0.03em;
  color: var(--text);
  text-decoration: none;
}

.header-brand span {
  color: var(--primary);
}

.header-nav {
  display: flex;
  gap: 4px;
}

.nav-btn {
  background: none;
  border: 1px solid transparent;
  color: var(--text-muted);
  font: inherit;
  font-size: 0.8125rem;
  font-weight: 500;
  padding: 8px 14px;
  border-radius: var(--radius-full);
  cursor: pointer;
  transition: all var(--transition);
  text-decoration: none;
}

.nav-btn:hover, .nav-btn.active {
  color: var(--text);
  background: var(--surface);
}

.nav-btn.active {
  border-color: var(--border-active);
}

/* ── Page sections ────────────────────────────────────────── */
.page {
  flex: 1;
  padding-bottom: 100px;
}

/* ── Hero / Title ─────────────────────────────────────────── */
.hero-title {
  font-size: clamp(2.5rem, 8vw, 4.5rem);
  font-weight: 900;
  letter-spacing: -0.05em;
  line-height: 1.05;
  margin-bottom: 8px;
}

.hero-subtitle {
  font-size: 1rem;
  color: var(--text-muted);
  font-weight: 400;
  margin-bottom: 40px;
  max-width: 320px;
}

/* ── Mic Button ───────────────────────────────────────────── */
.mic-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 32px;
  margin: 48px 0;
}

.mic-btn {
  width: 120px;
  height: 120px;
  border-radius: 50%;
  border: 2px solid var(--primary);
  background: var(--primary-glow);
  color: var(--primary);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all var(--transition);
  position: relative;
  outline: none;
}

.mic-btn::before {
  content: '';
  position: absolute;
  inset: -8px;
  border-radius: 50%;
  border: 1px solid var(--primary);
  opacity: 0.3;
  transition: all var(--transition);
}

.mic-btn:hover {
  background: rgba(220, 38, 38, 0.25);
  transform: scale(1.05);
}

.mic-btn:hover::before {
  opacity: 0.6;
  inset: -16px;
}

.mic-btn:active {
  transform: scale(0.97);
}

.mic-btn.recording {
  border-color: var(--primary);
  background: var(--primary);
  color: #fff;
  animation: pulse-ring 1.5s ease-in-out infinite;
}

.mic-btn.recording::before {
  opacity: 0.5;
  animation: pulse-ring-outer 1.5s ease-in-out infinite;
}

.mic-btn svg {
  width: 40px;
  height: 40px;
}

@keyframes pulse-ring {
  0%, 100% { box-shadow: 0 0 0 0 rgba(220, 38, 38, 0.4); }
  50% { box-shadow: 0 0 0 20px rgba(220, 38, 38, 0); }
}

@keyframes pulse-ring-outer {
  0%, 100% { inset: -8px; opacity: 0.3; }
  50% { inset: -24px; opacity: 0.6; }
}

.mic-status {
  font-size: 0.875rem;
  color: var(--text-muted);
  font-weight: 500;
  text-align: center;
  min-height: 1.5em;
}

.mic-status.recording {
  color: var(--primary);
}

/* ── Transcript Result ────────────────────────────────────── */
.transcript-result {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  margin-top: 8px;
}

.transcript-result .lang-badge {
  display: inline-block;
  font-size: 0.6875rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  padding: 4px 10px;
  border-radius: var(--radius-full);
  background: var(--accent-glow);
  color: var(--accent);
  margin-bottom: 12px;
}

.transcript-result .transcript-text {
  font-size: 0.9375rem;
  line-height: 1.7;
  color: var(--text);
  white-space: pre-wrap;
}

/* ── Spinner ──────────────────────────────────────────────── */
.spinner {
  width: 32px;
  height: 32px;
  border: 2px solid var(--border);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  margin: 24px auto;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* ── Dashboard ────────────────────────────────────────────── */
.search-box {
  position: relative;
  margin-bottom: 24px;
}

.search-box input {
  width: 100%;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 16px 14px 44px;
  color: var(--text);
  font: inherit;
  font-size: 0.9375rem;
  outline: none;
  transition: border-color var(--transition);
}

.search-box input::placeholder {
  color: var(--text-dim);
}

.search-box input:focus {
  border-color: var(--border-active);
}

.search-box .search-icon {
  position: absolute;
  left: 14px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-dim);
  pointer-events: none;
}

/* ── Conversation List ────────────────────────────────────── */
.conv-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.conv-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  cursor: pointer;
  transition: all var(--transition);
  text-decoration: none;
  color: inherit;
}

.conv-card:hover {
  background: var(--bg-card-hover);
  border-color: var(--border-active);
}

.conv-card .conv-date {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-bottom: 6px;
}

.conv-card .conv-snippet {
  font-size: 0.875rem;
  color: var(--text-muted);
  line-height: 1.5;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.conv-card .conv-meta {
  display: flex;
  gap: 8px;
  margin-top: 10px;
  align-items: center;
}

.conv-card .conv-lang {
  font-size: 0.6875rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  padding: 2px 8px;
  border-radius: var(--radius-full);
  background: var(--accent-glow);
  color: var(--accent);
}

/* ── Detail View ──────────────────────────────────────────── */
.detail-back {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.8125rem;
  color: var(--text-muted);
  text-decoration: none;
  margin-bottom: 24px;
  padding: 8px 0;
  cursor: pointer;
  transition: color var(--transition);
  background: none;
  border: none;
  font: inherit;
}

.detail-back:hover {
  color: var(--text);
}

.detail-header {
  margin-bottom: 24px;
}

.detail-header .detail-date {
  font-size: 0.8125rem;
  color: var(--text-dim);
  margin-bottom: 4px;
}

.detail-header .detail-lang {
  display: inline-block;
  font-size: 0.6875rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  padding: 4px 10px;
  border-radius: var(--radius-full);
  background: var(--accent-glow);
  color: var(--accent);
  margin-top: 8px;
}

.detail-transcript {
  font-size: 0.9375rem;
  line-height: 1.8;
  color: var(--text);
  white-space: pre-wrap;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
}

/* ── Empty State ──────────────────────────────────────────── */
.empty-state {
  text-align: center;
  padding: 60px 20px;
  color: var(--text-dim);
}

.empty-state .empty-icon {
  font-size: 2.5rem;
  margin-bottom: 16px;
  opacity: 0.4;
}

.empty-state p {
  font-size: 0.875rem;
}

/* ── Bottom Nav (mobile) ──────────────────────────────────── */
.bottom-nav {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background: var(--bg);
  border-top: 1px solid var(--border);
  display: flex;
  justify-content: center;
  gap: 0;
  padding: 8px 0;
  padding-bottom: max(8px, env(safe-area-inset-bottom));
  z-index: 200;
}

.bottom-nav a {
  flex: 1;
  max-width: 160px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 8px 16px;
  color: var(--text-dim);
  text-decoration: none;
  font-size: 0.6875rem;
  font-weight: 500;
  transition: color var(--transition);
}

.bottom-nav a.active {
  color: var(--text);
}

.bottom-nav a svg {
  width: 22px;
  height: 22px;
  opacity: 0.6;
}

.bottom-nav a.active svg {
  opacity: 1;
}

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

.fade-in {
  animation: fadeUp 0.4s ease-out;
}

@keyframes fadeUp {
  from { opacity: 0; transform: translateY(12px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ── Section label ────────────────────────────────────────── */
.section-label {
  font-size: 0.6875rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--text-dim);
  margin-bottom: 16px;
  padding: 0 2px;
}

/* ── Error toast ──────────────────────────────────────────── */
.toast {
  position: fixed;
  top: 20px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px 20px;
  font-size: 0.8125rem;
  color: var(--text);
  z-index: 9999;
  box-shadow: var(--shadow);
  animation: toastIn 0.3s ease-out;
}

.toast.error {
  border-color: var(--primary);
}

.toast.success {
  border-color: var(--success);
}

@keyframes toastIn {
  from { opacity: 0; transform: translateX(-50%) translateY(-12px); }
  to   { opacity: 1; transform: translateX(-50%) translateY(0); }
}

/* ── Info Card (How It Works) ─────────────────────────────── */
.info-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  margin-bottom: 8px;
}

.info-card-title {
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 12px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.info-card-title::before {
  content: '';
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: var(--accent);
}

.info-card-body {
  font-size: 0.8125rem;
  color: var(--text-muted);
  line-height: 1.7;
}

.info-card-body p {
  margin-bottom: 10px;
}

.info-card-body p:last-child {
  margin-bottom: 0;
}

.info-card-body code {
  background: var(--surface);
  padding: 2px 6px;
  border-radius: 4px;
  font-size: 0.75rem;
  color: var(--text);
}

.info-list {
  list-style: none;
  padding: 0;
  margin: 0;
}

.info-list li {
  padding: 6px 0;
  padding-left: 16px;
  position: relative;
}

.info-list li::before {
  content: '';
  position: absolute;
  left: 0;
  top: 13px;
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--accent);
  opacity: 0.6;
}

/* ── Enrollment Form ──────────────────────────────────────── */
.enroll-form {
  margin-bottom: 8px;
}

.input-row {
  display: flex;
  gap: 8px;
}

.enroll-input {
  flex: 1;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px 16px;
  color: var(--text);
  font: inherit;
  font-size: 0.875rem;
  outline: none;
  transition: border-color var(--transition);
}

.enroll-input::placeholder {
  color: var(--text-dim);
}

.enroll-input:focus {
  border-color: var(--border-active);
}

.enroll-btn {
  /* Inherits from global button reset */
}

.enroll-btn.btn-primary {
  /* Inherits from global .btn-primary */
}

.enroll-btn.btn-ghost {
  /* Inherits from global .btn-ghost */
}

/* ── Enrollment Wizard ────────────────────────────────────── */
.wizard-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
}

.wizard-name {
  font-size: 1rem;
  font-weight: 600;
  color: var(--text);
}

.wizard-progress {
  font-size: 0.75rem;
  font-weight: 500;
  color: var(--text-muted);
  background: var(--surface);
  padding: 4px 10px;
  border-radius: var(--radius-full);
}

.sample-step {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  margin-bottom: 12px;
}

.step-label {
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-dim);
  margin-bottom: 4px;
}

.step-instruction {
  font-size: 0.8125rem;
  color: var(--text-muted);
  margin-bottom: 12px;
}

.record-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: var(--primary-glow);
  border: 1px solid var(--primary);
  color: var(--primary);
  font: inherit;
  font-size: 0.8125rem;
  font-weight: 500;
  padding: 10px 18px;
  border-radius: var(--radius);
  cursor: pointer;
  transition: all var(--transition);
  outline: none;
}

.record-btn:hover {
  background: rgba(220, 38, 38, 0.25);
}

.record-btn.recording {
  background: var(--primary);
  color: #fff;
  border-color: var(--primary);
}

.record-btn svg {
  width: 18px;
  height: 18px;
}

.step-status {
  margin-top: 10px;
  font-size: 0.75rem;
  color: var(--text-dim);
  min-height: 1em;
}

.step-status.enrolled {
  color: var(--success);
}

.step-status.failed {
  color: var(--primary);
}

/* ── Speaker Badges ───────────────────────────────────────── */
.speaker-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.6875rem;
  font-weight: 600;
  padding: 4px 10px;
  border-radius: var(--radius-full);
  margin-bottom: 12px;
}

.speaker-badge.detected {
  background: rgba(34, 197, 94, 0.12);
  color: var(--success);
}

.speaker-badge.unknown {
  background: rgba(239, 68, 68, 0.12);
  color: #ef4444;
}

.conv-speaker {
  font-size: 0.6875rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  padding: 2px 8px;
  border-radius: var(--radius-full);
  background: rgba(34, 197, 94, 0.12);
  color: var(--success);
}

.detail-speaker {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.75rem;
  font-weight: 500;
  color: var(--text-muted);
  margin-top: 12px;
}

.detail-speaker.detected {
  color: var(--success);
}

.detail-speaker.unknown {
  color: var(--text-dim);
}

/* ── Persons List ─────────────────────────────────────────── */
.persons-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.person-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 16px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  transition: all var(--transition);
}

.person-card:hover {
  background: var(--bg-card-hover);
  border-color: var(--border-active);
}

.person-card-name {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--text);
}

.person-card-name svg {
  color: var(--text-muted);
}

.person-card-count {
  font-size: 0.75rem;
  color: var(--text-dim);
  font-weight: 500;
}

/* ── Bottom Nav: 3 items ──────────────────────────────────── */
.bottom-nav a {
  flex: 1;
  max-width: 160px;
}
