/* ── Reset & Base ──────────────────────────────────────────────────── */

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

:root {
  --bg-primary: #121318;
  --bg-secondary: #1b1c22;
  --bg-card: #1f2028;
  --bg-hover: #282a33;
  --bg-input: #25262e;
  --text-primary: #e8eaef;
  --text-secondary: #8b8fa3;
  --text-muted: #5c5f72;
  --accent: #4a7dff;
  --accent-hover: #5e8fff;
  --accent-soft: rgba(74, 125, 255, 0.12);
  --danger: #ff4d5e;
  --danger-soft: rgba(255, 77, 94, 0.12);
  --warning: #ffb547;
  --warning-soft: rgba(255, 181, 71, 0.12);
  --success: #3dd68c;
  --success-soft: rgba(61, 214, 140, 0.12);
  --info: #4a7dff;
  --border: #2a2b35;
  --border-light: #33343f;
  --radius: 12px;
  --radius-sm: 8px;
  --radius-lg: 16px;
  --shadow: 0 4px 24px rgba(0, 0, 0, 0.25);
  --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.2);
  --transition: 0.2s ease;
}

html {
  scroll-behavior: smooth;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'SF Pro Display', 'Segoe UI', Roboto, 'Helvetica Neue', sans-serif;
  background: var(--bg-primary);
  color: var(--text-primary);
  line-height: 1.6;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

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

::selection {
  background: var(--accent);
  color: #fff;
}

/* ── Navbar ────────────────────────────────────────────────────────── */

.navbar {
  display: flex;
  align-items: center;
  gap: 20px;
  padding: 0 28px;
  height: 60px;
  background: var(--bg-secondary);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 100;
  backdrop-filter: blur(12px);
}

.navbar-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 0;
  color: var(--text-primary);
  text-decoration: none;
}

.navbar-brand .logo-icon {
  height: 28px;
  width: auto;
}

.navbar-brand .brand-text {
  font-size: 17px;
  font-weight: 700;
  letter-spacing: -0.3px;
  color: var(--text-primary);
}

.navbar-brand .brand-sub {
  font-size: 13px;
  font-weight: 500;
  color: var(--accent);
  opacity: 0.9;
}

.navbar-divider {
  width: 1px;
  height: 24px;
  background: var(--border);
}

.navbar-subtitle {
  font-size: 13px;
  color: var(--text-muted);
  font-weight: 400;
}

.navbar-spacer {
  flex: 1;
}

.navbar-status {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: var(--text-muted);
}

.navbar-status .status-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--success);
}

/* ── Container ─────────────────────────────────────────────────────── */

.container {
  max-width: 960px;
  margin: 0 auto;
  padding: 32px 24px;
  flex: 1;
  width: 100%;
}

/* ── Cards ──────────────────────────────────────────────────────────── */

.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px 24px;
  margin-bottom: 12px;
  transition: all var(--transition);
}

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

.card-clickable {
  cursor: pointer;
}

.card-clickable:hover {
  border-color: var(--accent);
  box-shadow: 0 0 0 1px var(--accent-soft);
}

.card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
}

.card-title {
  font-size: 15px;
  font-weight: 600;
  color: var(--text-primary);
  letter-spacing: -0.2px;
}

.card-meta {
  display: flex;
  gap: 20px;
  flex-wrap: wrap;
  font-size: 13px;
  color: var(--text-secondary);
}

.card-meta span {
  display: flex;
  align-items: center;
  gap: 6px;
}

.card-meta .meta-icon {
  font-size: 14px;
  opacity: 0.7;
}

/* ── Status badges ──────────────────────────────────────────────────── */

.badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 12px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.2px;
  white-space: nowrap;
}

.badge::before {
  content: '';
  width: 6px;
  height: 6px;
  border-radius: 50%;
  flex-shrink: 0;
}

.badge-uploaded { background: var(--accent-soft); color: var(--accent); }
.badge-uploaded::before { background: var(--accent); }

.badge-transcribing { background: var(--warning-soft); color: var(--warning); }
.badge-transcribing::before { background: var(--warning); animation: pulse 1.5s infinite; }

.badge-mapping_speakers { background: var(--warning-soft); color: var(--warning); }
.badge-mapping_speakers::before { background: var(--warning); animation: pulse 1.5s infinite; }

.badge-generating_protocol { background: var(--warning-soft); color: var(--warning); }
.badge-generating_protocol::before { background: var(--warning); animation: pulse 1.5s infinite; }

.badge-completed { background: var(--success-soft); color: var(--success); }
.badge-completed::before { background: var(--success); }

.badge-error { background: var(--danger-soft); color: var(--danger); }
.badge-error::before { background: var(--danger); }

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

/* ── Page header ────────────────────────────────────────────────────── */

.page-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 28px;
  gap: 16px;
}

.page-header h1 {
  font-size: 22px;
  font-weight: 700;
  letter-spacing: -0.4px;
  color: var(--text-primary);
}

.page-header .subtitle {
  font-size: 14px;
  color: var(--text-secondary);
  margin-top: 4px;
}

/* ── Buttons ────────────────────────────────────────────────────────── */

.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 18px;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition);
  text-decoration: none;
  white-space: nowrap;
  letter-spacing: 0.1px;
}

.btn:hover { transform: translateY(-1px); }
.btn:active { transform: translateY(0); }

.btn-primary {
  background: var(--accent);
  color: white;
  border-color: var(--accent);
}
.btn-primary:hover {
  background: var(--accent-hover);
  border-color: var(--accent-hover);
  color: white;
  box-shadow: 0 4px 12px rgba(74, 125, 255, 0.3);
}

.btn-secondary {
  background: var(--bg-hover);
  color: var(--text-primary);
  border-color: var(--border);
}
.btn-secondary:hover {
  background: var(--bg-card);
  border-color: var(--border-light);
  color: var(--text-primary);
}

.btn-danger {
  background: var(--danger);
  color: white;
  border-color: var(--danger);
}

.btn-sm { padding: 5px 12px; font-size: 12px; }
.btn-icon { padding: 8px; }

/* ── Tabs ───────────────────────────────────────────────────────────── */

.tabs {
  display: flex;
  gap: 0;
  margin-bottom: 24px;
  border-bottom: 1px solid var(--border);
}

.tab {
  padding: 12px 24px;
  font-size: 14px;
  font-weight: 500;
  color: var(--text-muted);
  cursor: pointer;
  border: none;
  border-bottom: 2px solid transparent;
  transition: all var(--transition);
  background: none;
  position: relative;
}

.tab:hover {
  color: var(--text-primary);
}

.tab.active {
  color: var(--text-primary);
  border-bottom-color: var(--accent);
}

.tab-content { display: none; }
.tab-content.active { display: block; }

/* ── Transcript ─────────────────────────────────────────────────────── */

.transcript-container {
  max-height: 600px;
  overflow-y: auto;
  padding-right: 4px;
}

.transcript-container::-webkit-scrollbar { width: 4px; }
.transcript-container::-webkit-scrollbar-track { background: transparent; }
.transcript-container::-webkit-scrollbar-thumb { background: var(--border); border-radius: 4px; }
.transcript-container::-webkit-scrollbar-thumb:hover { background: var(--border-light); }

.transcript-line {
  display: flex;
  gap: 14px;
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  margin-bottom: 2px;
  transition: background var(--transition);
  cursor: pointer;
  border-left: 2px solid transparent;
}

.transcript-line:hover {
  background: var(--bg-hover);
}

.transcript-line.highlight {
  background: var(--accent-soft);
  border-left-color: var(--accent);
}

.transcript-time {
  color: var(--text-muted);
  font-family: 'SF Mono', 'Fira Code', 'Consolas', monospace;
  font-size: 12px;
  white-space: nowrap;
  min-width: 52px;
  padding-top: 2px;
}

.transcript-speaker {
  font-weight: 600;
  white-space: nowrap;
  min-width: 140px;
  max-width: 140px;
  overflow: hidden;
  text-overflow: ellipsis;
  font-size: 13px;
  padding-top: 2px;
}

.transcript-text {
  color: var(--text-primary);
  font-size: 14px;
  flex: 1;
  line-height: 1.5;
}

/* Speaker colors — DION-style palette */
.speaker-0 { color: #4a7dff; }
.speaker-1 { color: #3dd68c; }
.speaker-2 { color: #ffb547; }
.speaker-3 { color: #ff6b9d; }
.speaker-4 { color: #a78bfa; }
.speaker-5 { color: #22d3ee; }
.speaker-6 { color: #fb923c; }
.speaker-7 { color: #86efac; }

/* ── Protocol ───────────────────────────────────────────────────────── */

.protocol-content {
  line-height: 1.8;
  color: var(--text-primary);
}

.protocol-content h1 {
  font-size: 20px;
  font-weight: 700;
  margin-bottom: 20px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border);
  letter-spacing: -0.3px;
}

.protocol-content h2 {
  font-size: 17px;
  font-weight: 600;
  color: var(--accent);
  margin-top: 28px;
  margin-bottom: 12px;
  letter-spacing: -0.2px;
}

.protocol-content h3 {
  font-size: 15px;
  font-weight: 600;
  margin-top: 20px;
  margin-bottom: 8px;
}

.protocol-content ul, .protocol-content ol {
  margin-left: 20px;
  margin-bottom: 14px;
}

.protocol-content li {
  margin-bottom: 6px;
  color: var(--text-secondary);
}

.protocol-content table {
  width: 100%;
  border-collapse: collapse;
  margin: 16px 0;
  border-radius: var(--radius-sm);
  overflow: hidden;
}

.protocol-content th,
.protocol-content td {
  padding: 10px 14px;
  border: 1px solid var(--border);
  text-align: left;
  font-size: 13px;
}

.protocol-content th {
  background: var(--bg-secondary);
  font-weight: 600;
  color: var(--text-primary);
}

.protocol-content td {
  color: var(--text-secondary);
}

.protocol-content blockquote {
  border-left: 3px solid var(--accent);
  padding: 10px 18px;
  margin: 16px 0;
  background: var(--accent-soft);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  font-style: italic;
  color: var(--text-secondary);
}

.protocol-content strong { color: var(--text-primary); }

.protocol-content p {
  margin-bottom: 10px;
  color: var(--text-secondary);
}

.protocol-content code {
  background: var(--bg-hover);
  padding: 2px 6px;
  border-radius: 4px;
  font-size: 13px;
  font-family: 'SF Mono', 'Fira Code', 'Consolas', monospace;
}

/* ── Audio player ───────────────────────────────────────────────────── */

.audio-player {
  position: sticky;
  top: 60px;
  background: var(--bg-secondary);
  padding: 14px 18px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  margin-bottom: 20px;
  z-index: 10;
  backdrop-filter: blur(12px);
}

.audio-player audio {
  width: 100%;
  height: 36px;
  border-radius: var(--radius-sm);
}

/* ── Search ─────────────────────────────────────────────────────────── */

.search-box {
  width: 100%;
  padding: 10px 16px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg-input);
  color: var(--text-primary);
  font-size: 14px;
  margin-bottom: 16px;
  transition: all var(--transition);
}

.search-box:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

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

/* ── Empty state ────────────────────────────────────────────────────── */

.empty-state {
  text-align: center;
  padding: 80px 20px;
  color: var(--text-muted);
}

.empty-state .icon {
  font-size: 56px;
  margin-bottom: 20px;
  opacity: 0.6;
}

.empty-state h2 {
  font-size: 18px;
  margin-bottom: 8px;
  color: var(--text-secondary);
  font-weight: 600;
}

.empty-state p {
  font-size: 14px;
  max-width: 400px;
  margin: 0 auto;
  line-height: 1.6;
}

/* ── Participants grid ──────────────────────────────────────────────── */

.participants-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 10px;
  margin-bottom: 24px;
}

.participant-card {
  background: var(--bg-secondary);
  padding: 12px 14px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  gap: 10px;
  border: 1px solid var(--border);
  transition: all var(--transition);
}

.participant-card:hover {
  border-color: var(--border-light);
}

.participant-avatar {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: var(--accent-soft);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 700;
  color: var(--accent);
  flex-shrink: 0;
}

.participant-info { flex: 1; min-width: 0; }
.participant-name {
  font-size: 13px;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.participant-org {
  font-size: 11px;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.participant-role {
  font-size: 11px;
  color: var(--accent);
  font-weight: 600;
}

/* ── Error banner ───────────────────────────────────────────────────── */

.error-banner {
  background: var(--danger-soft);
  border: 1px solid rgba(255, 77, 94, 0.25);
  border-radius: var(--radius);
  padding: 14px 18px;
  margin-bottom: 16px;
  display: flex;
  align-items: center;
  gap: 10px;
}

.error-banner .error-icon {
  font-size: 18px;
  flex-shrink: 0;
}

.error-banner p {
  color: var(--danger);
  font-size: 14px;
  font-weight: 500;
  margin: 0;
}

/* ── Footer ─────────────────────────────────────────────────────────── */

.footer {
  text-align: center;
  padding: 20px;
  font-size: 12px;
  color: var(--text-muted);
  border-top: 1px solid var(--border);
}

.footer a {
  color: var(--text-muted);
  transition: color var(--transition);
}

.footer a:hover {
  color: var(--accent);
}

/* ── Meeting list specific ──────────────────────────────────────────── */

.meeting-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.meeting-item {
  display: flex;
  align-items: center;
  padding: 16px 20px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  transition: all var(--transition);
  cursor: pointer;
  text-decoration: none;
  color: inherit;
  gap: 16px;
}

.meeting-item:hover {
  border-color: var(--accent);
  background: var(--bg-hover);
  color: inherit;
}

.meeting-item-icon {
  width: 40px;
  height: 40px;
  border-radius: var(--radius-sm);
  background: var(--accent-soft);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  flex-shrink: 0;
}

.meeting-item-body {
  flex: 1;
  min-width: 0;
}

.meeting-item-title {
  font-size: 15px;
  font-weight: 600;
  color: var(--text-primary);
  letter-spacing: -0.2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.meeting-item-meta {
  display: flex;
  gap: 16px;
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 4px;
}

.meeting-item-meta span {
  display: flex;
  align-items: center;
  gap: 4px;
}

.meeting-item-status {
  flex-shrink: 0;
}

/* ── Actions bar (detail page) ──────────────────────────────────────── */

.actions-bar {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

/* ── Utilities ──────────────────────────────────────────────────────── */

.mt-2 { margin-top: 8px; }
.mt-4 { margin-top: 16px; }
.mb-2 { margin-bottom: 8px; }
.mb-4 { margin-bottom: 16px; }
.text-muted { color: var(--text-muted); }
.text-sm { font-size: 13px; }
.flex { display: flex; }
.gap-2 { gap: 8px; }
.gap-4 { gap: 16px; }

/* ── Responsive ─────────────────────────────────────────────────────── */

@media (max-width: 768px) {
  .navbar { padding: 0 16px; }
  .container { padding: 20px 16px; }
  .page-header { flex-direction: column; gap: 12px; }
  .actions-bar { width: 100%; }
  .actions-bar .btn { flex: 1; justify-content: center; }
  .meeting-item { padding: 14px 16px; }
  .participants-grid { grid-template-columns: 1fr; }
  .transcript-speaker { min-width: 100px; max-width: 100px; }
  .card-meta { gap: 12px; }
}
