/* ═══════════════════════════════════════════════════════════════
   VoiceScribe — Global Design System
   Fonts: Syne (display) + Inter (body/UI)
   Palette: Premium Deep Violet, Blurred Islands, High Contrast
═══════════════════════════════════════════════════════════════ */

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

/* ── Tokens ─────────────────────────────────────────────────── */
:root {
  /* Darker, richer background for better contrast */
  --bg:          #050408;
  --bg-1:        rgba(16, 15, 24, 0.65);
  --bg-2:        rgba(26, 24, 38, 0.7);
  --bg-3:        rgba(34, 31, 52, 0.85);
  
  --border:      rgba(150, 130, 200, 0.2);
  --border-mid:  rgba(160, 140, 220, 0.35);
  --border-hi:   rgba(196, 168, 255, 0.6);

  --accent:      #8F73C2;
  --accent-hi:   #D4C1FF;
  --accent-dim:  rgba(143, 115, 194, 0.2);

  /* Brighter text for maximum readability */
  --text:        #FFFFFF;
  --text-2:      #E6E2F0;
  --text-3:      #C8C2D8;
  --text-4:      #A39CB8;

  --ok:          #6DDBA8;
  --ok-dim:      rgba(109,219,168,0.12);
  --warn:        #F5C15E;
  --err:         #F47067;
  --err-dim:     rgba(244,112,103,0.12);

  --radius-xs:   6px;
  --radius-sm:   10px;
  --radius-md:   16px;
  --radius-lg:   24px;
  --radius-pill: 9999px;

  --font-display: 'Syne', sans-serif;
  --font-ui:      'Inter', sans-serif;

  --transition: 250ms ease;
}

/* ── Reset ──────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }

body {
  background-color: var(--bg);
  color: var(--text);
  font-family: var(--font-ui);
  font-size: 16px; /* Increased base font size */
  line-height: 1.7;
  min-height: 100dvh;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  position: relative;
  overflow-x: hidden;
}

/* ── Blurred Islands Background ─────────────────────────────── */
.bg-blobs {
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  overflow: hidden;
}
.blob {
  position: absolute;
  border-radius: 50%;
  filter: blur(140px);
  opacity: 0.45;
}
.blob-1 {
  top: -15%;
  left: -10%;
  width: 55vw;
  height: 55vw;
  background: linear-gradient(135deg, rgba(123,94,167,0.8), rgba(61,45,91,0.2));
}
.blob-2 {
  bottom: -20%;
  right: -10%;
  width: 65vw;
  height: 65vw;
  background: linear-gradient(315deg, rgba(196,168,255,0.5), rgba(74,51,115,0.1));
}

a { color: var(--accent-hi); text-decoration: none; transition: color var(--transition); }
a:hover { color: var(--text); }

img, svg { display: block; }
button, select, input { font-family: inherit; }
button { cursor: pointer; border: none; background: none; }

/* ── Layout ─────────────────────────────────────────────────── */
.page-wrap {
  max-width: 900px; /* Slightly wider for an airy feel */
  margin: 0 auto;
  padding: 0 32px;
}

/* ── Top Bar ────────────────────────────────────────────────── */
.topbar {
  height: 64px; /* Taller header */
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 0.5px solid var(--border);
  background: rgba(5, 4, 8, 0.5);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  position: sticky;
  top: 0;
  z-index: 200;
  padding: 0 32px;
}

.topbar__logo {
  font-family: var(--font-display);
  font-size: 18px;
  font-weight: 800;
  color: var(--text-2);
  letter-spacing: 0.02em;
}
.topbar__logo span { color: var(--accent-hi); }
.topbar__logo:hover { color: var(--text); }

/* ── Footer ─────────────────────────────────────────────────── */
.footer {
  border-top: 0.5px solid var(--border);
  padding: 64px 32px;
  margin-top: 100px;
  background: rgba(5, 4, 8, 0.4);
}
.footer__inner {
  max-width: 900px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 24px;
}
.footer__brand {
  font-family: var(--font-display);
  font-size: 15px;
  font-weight: 800;
  color: var(--text-3);
}
.footer__brand span { color: var(--accent); }
.footer__nav {
  display: flex;
  gap: 32px;
  list-style: none;
}
.footer__nav a {
  font-size: 15px;
  color: var(--text-3);
  font-weight: 500;
}
.footer__nav a:hover { color: var(--text); }
.footer__copy {
  font-size: 14px;
  color: var(--text-4);
  width: 100%;
  margin-top: 32px;
  padding-top: 32px;
  border-top: 0.5px solid var(--border);
}

/* ── Surface / Main Card ────────────────────────────────────── */
.card {
  background: var(--bg-1);
  border: 0.5px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 48px; /* More breathing room */
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  box-shadow: 0 24px 48px rgba(0,0,0,0.2);
}
.card + .card { margin-top: 24px; }

/* ── Section headers (prose pages) ─────────────────────────── */
.prose-page { padding-top: 64px; padding-bottom: 80px; }
.prose-page h1 { font-family: var(--font-display); font-size: clamp(32px, 5vw, 48px); font-weight: 800; line-height: 1.1; margin-bottom: 12px; }
.prose-page .page-meta { font-size: 15px; color: var(--text-4); margin-bottom: 48px; }
.prose-page h2 { font-family: var(--font-display); font-size: 22px; font-weight: 700; margin: 48px 0 16px; }
.prose-page p, .prose-page ul { color: var(--text-2); margin-bottom: 24px; font-size: 17px; }
.prose-page ul { padding-left: 24px; }
.prose-page ul li { margin-bottom: 10px; }

/* ── Pill / Badge ───────────────────────────────────────────── */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 14px;
  border-radius: var(--radius-pill);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}
.badge--ai {
  background: var(--accent-dim);
  border: 0.5px solid var(--border-mid);
  color: var(--accent-hi);
}
.badge--live {
  background: rgba(109,219,168,0.15);
  border: 0.5px solid rgba(109,219,168,0.3);
  color: var(--ok);
}
.badge--live::before {
  content: '';
  display: inline-block;
  width: 6px; height: 6px;
  border-radius: 50%;
  background: var(--ok);
  animation: blink 2s ease-in-out infinite;
}
@keyframes blink { 0%,100% { opacity: 1; } 50% { opacity: 0.3; } }

/* ── Status Pill ────────────────────────────────────────────── */
.status-pill {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 24px;
  border-radius: var(--radius-pill);
  font-size: 14px;
  font-weight: 600;
  border: 0.5px solid var(--border);
  background: var(--bg-2);
  color: var(--text-2);
  position: relative;
  overflow: hidden;
  justify-content: center;
  min-width: 300px;
  max-width: 92vw;
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}
.status-pill__progress {
  position: absolute;
  inset: 0 auto 0 0;
  background: rgba(196, 168, 255, 0.15);
  transition: width 0.35s ease;
  display: none;
}
.status-pill__inner {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
}
.status-pill__dot {
  width: 8px; height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
  background: var(--text-4);
}
.status-pill__text { flex: 1; justify-content: center; }
.status-pill__time {
  font-variant-numeric: tabular-nums;
  font-size: 13px;
  color: var(--text-4);
  display: none;
}

/* Pill states */
.status-pill[data-state="loading"] { border-color: rgba(196,168,255,0.4); color: var(--text); }
.status-pill[data-state="loading"] .status-pill__dot {
  background: var(--accent-hi);
  animation: spin-dot 0.9s linear infinite;
}
@keyframes spin-dot {
  0%,100% { box-shadow: 0 0 0 4px rgba(196,168,255,0.2); }
  50%      { box-shadow: 0 0 0 6px rgba(196,168,255,0.05); }
}
.status-pill[data-state="ready"] { border-color: rgba(109,219,168,0.4); color: var(--ok); background: var(--ok-dim); }
.status-pill[data-state="ready"] .status-pill__dot { background: var(--ok); }
.status-pill[data-state="recording"] { border-color: rgba(244,112,103,0.4); color: var(--err); background: var(--err-dim); }
.status-pill[data-state="recording"] .status-pill__dot { background: var(--err); animation: rec-pulse 1s ease-in-out infinite; }
@keyframes rec-pulse { 0%,100% { transform: scale(1); opacity: 1; } 50% { transform: scale(1.6); opacity: 0.5; } }
.status-pill[data-state="recording"] .status-pill__time { display: block; }

/* ── Mic Button ─────────────────────────────────────────────── */
.mic-btn {
  width: 96px; height: 96px; /* Bigger button */
  border-radius: 50%;
  background: var(--bg-2);
  border: 0.5px solid var(--border-mid);
  display: flex; align-items: center; justify-content: center;
  color: var(--text-2);
  position: relative;
  transition: all var(--transition);
}
.mic-btn::after {
  content: '';
  position: absolute; inset: -8px;
  border-radius: 50%;
  border: 0.5px solid transparent;
  transition: all var(--transition);
}
.mic-btn:not(:disabled):hover {
  background: var(--bg-3);
  border-color: var(--border-hi);
  color: var(--text);
  transform: scale(1.02);
}
.mic-btn:not(:disabled):hover::after { border-color: var(--border-mid); }
.mic-btn:disabled { opacity: 0.4; cursor: not-allowed; }
.mic-btn.is-recording {
  background: var(--err-dim);
  border-color: rgba(244,112,103,0.6);
  color: var(--err);
  animation: mic-ring 1.4s ease-in-out infinite;
}
@keyframes mic-ring {
  0%,100% { box-shadow: 0 0 0 0 rgba(244,112,103,0.3); }
  50%      { box-shadow: 0 0 0 16px rgba(244,112,103,0); }
}

/* ── Buttons ────────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 20px;
  border-radius: var(--radius-sm);
  border: 0.5px solid var(--border-mid);
  background: var(--bg-2);
  color: var(--text-2);
  font-size: 14px;
  font-weight: 600;
  transition: all var(--transition);
}
.btn:not(:disabled):hover {
  background: var(--bg-3);
  border-color: var(--border-hi);
  color: var(--text);
  transform: translateY(-1px);
}
.btn:disabled { opacity: 0.4; cursor: not-allowed; }
.btn svg { width: 16px; height: 16px; flex-shrink: 0; }

.btn--accent {
  background: var(--accent-dim);
  border-color: rgba(196,168,255,0.4);
  color: var(--accent-hi);
}
.btn--accent:not(:disabled):hover {
  background: rgba(143,115,194,0.3);
  border-color: var(--accent-hi);
  color: var(--text);
}

/* ── Drop Zone ──────────────────────────────────────────────── */
.drop-zone {
  display: block;
  border: 1px dashed var(--border-mid);
  border-radius: var(--radius-md);
  padding: 32px 24px; /* Taller */
  text-align: center;
  cursor: pointer;
  color: var(--text-3);
  font-size: 15px;
  line-height: 1.6;
  background: rgba(26, 24, 38, 0.3);
  transition: all var(--transition);
}
.drop-zone:hover, .drop-zone.drag-active {
  border-color: var(--accent-hi);
  background: var(--accent-dim);
  color: var(--text);
}
.drop-zone svg { width: 28px; height: 28px; margin: 0 auto 12px; color: var(--accent-hi); opacity: 0.8; }
.drop-zone strong { display: block; font-weight: 700; color: var(--text); font-size: 16px; margin-bottom: 6px; }
.drop-zone input[type="file"] { display: none; }

/* ── Transcript Box ─────────────────────────────────────────── */
.transcript-box {
  min-height: 240px; /* Much taller */
  background: rgba(5, 4, 8, 0.4);
  border: 1px solid var(--border-mid);
  border-radius: var(--radius-md);
  padding: 24px;
  font-size: 17px; /* More readable text */
  line-height: 1.8;
  color: var(--text-2);
  white-space: pre-wrap;
  word-break: break-word;
  transition: all var(--transition);
}
.transcript-box.has-text { color: var(--text); border-color: var(--border-hi); background: rgba(5, 4, 8, 0.6); }
.transcript-box.is-partial { color: var(--text-3); font-style: italic; }
.transcript-box:empty::before {
  content: attr(data-placeholder);
  color: var(--text-4);
  font-style: normal;
}

/* ── Independent Info Cards (Replaces Info Grid) ────────────── */
.info-grid {
  display: flex;
  flex-direction: column;
  gap: 20px;
  margin-top: 40px;
}
.info-cell {
  background: var(--bg-1);
  border: 0.5px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 32px 40px;
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  transition: transform var(--transition), border-color var(--transition);
}
.info-cell:hover {
  transform: translateY(-2px);
  border-color: var(--border-mid);
}
.info-cell__label {
  display: inline-block;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--accent-hi);
  margin-bottom: 12px;
  background: var(--accent-dim);
  padding: 4px 10px;
  border-radius: var(--radius-xs);
}
.info-cell__title {
  font-family: var(--font-display);
  font-size: 24px;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 12px;
  letter-spacing: -0.01em;
}
.info-cell__desc {
  font-size: 16px;
  color: var(--text-3);
  line-height: 1.7;
}

/* ── Responsive ─────────────────────────────────────────────── */
@media (max-width: 768px) {
  .page-wrap { padding: 0 20px; }
  .topbar { padding: 0 20px; }
  .card { padding: 28px 20px; }
  .info-cell { padding: 24px 20px; }
  .footer { padding: 40px 20px; }
  .footer__inner { flex-direction: column; align-items: flex-start; gap: 16px; }
  .footer__nav { gap: 20px; flex-wrap: wrap; flex-direction: column; }
  .btn { width: 100%; justify-content: center; }
  #clearBtn { margin-left: 0 !important; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.01ms !important; transition-duration: 0.01ms !important; }
}