/* HTR · VLM Annotator — design tokens (mirrors linguistique aesthetic). */

[x-cloak] { display: none !important; }

html { scroll-behavior: smooth; }
body { -webkit-font-smoothing: antialiased; }

/* ============================================================
   Top bar pills
   ============================================================ */
.pill {
  display: inline-flex; align-items: center; gap: 0.4rem;
  padding: 0.4rem 0.7rem;
  background: #f9fafb;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  font-size: 12px;
  color: #374151;
  transition: all 0.15s;
  cursor: pointer;
}
.pill:hover { background: #f3f4f6; border-color: #d1d5db; }
.pill-icon { font-size: 14px; line-height: 1; }
.pill-label { font-weight: 500; color: #6b7280; }
.pill-value { font-weight: 600; color: #111827; }
.pill-ok { background: #ecfdf5; border-color: #a7f3d0; color: #065f46; }
.pill-ok .pill-label { color: #047857; }
.pill-ok .pill-value { color: #064e3b; }
.pill-warn { background: #fffbeb; border-color: #fcd34d; color: #92400e; }
.pill-warn .pill-label { color: #b45309; }
.pill-warn .pill-value { color: #78350f; }
.pill-moe {
  background: linear-gradient(135deg, #f5f3ff 0%, #ede9fe 100%);
  border-color: #c4b5fd;
}
.pill-moe .pill-label { color: #6d28d9; font-weight: 700; }
.pill-moe .pill-value { color: #4c1d95; }
.pill-moe:hover { background: linear-gradient(135deg, #ede9fe 0%, #ddd6fe 100%); border-color: #a78bfa; }

/* ============================================================
   Buttons
   ============================================================ */
.btn {
  display: inline-flex; align-items: center; justify-content: center;
  gap: 0.4rem;
  padding: 0.5rem 0.9rem;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 500;
  transition: all 0.12s;
  border: 1px solid transparent;
  cursor: pointer;
  user-select: none;
  white-space: nowrap;
  line-height: 1.1;
}
.btn-primary { background: #4f46e5; color: white; }
.btn-primary:hover { background: #4338ca; box-shadow: 0 4px 12px rgba(79, 70, 229, 0.3); }
.btn-primary:disabled { background: #c7d2fe; cursor: not-allowed; box-shadow: none; }
.btn-secondary { background: white; border-color: #e5e7eb; color: #374151; }
.btn-secondary:hover { background: #f9fafb; border-color: #d1d5db; }
.btn-secondary:disabled { opacity: 0.45; cursor: not-allowed; }
.btn-ghost { background: transparent; color: #6b7280; }
.btn-ghost:hover { background: #f3f4f6; color: #111827; }
.btn-ghost:disabled { opacity: 0.45; cursor: not-allowed; }
.btn-icon { padding: 0.4rem; min-width: 32px; min-height: 32px; }

/* ============================================================
   Cards
   ============================================================ */
.card {
  background: white;
  border: 1px solid #e5e7eb;
  border-radius: 12px;
  padding: 1rem 1.1rem;
}
.card-title { font-size: 12px; font-weight: 600; color: #6b7280; text-transform: uppercase; letter-spacing: 0.04em; margin-bottom: 0.6rem; }

/* ============================================================
   Status dots (sidebar + meta)
   ============================================================ */
.dot { display: inline-block; width: 7px; height: 7px; border-radius: 50%; flex-shrink: 0; }
.dot-ok      { background: #10b981; }
.dot-warn    { background: #f59e0b; }
.dot-pending { background: #d1d5db; }
.dot-busy    { background: #6366f1; animation: pulse 1.4s ease-in-out infinite; }
.dot-error   { background: #ef4444; }
@keyframes pulse { 50% { opacity: 0.35; } }

/* ============================================================
   Modals
   ============================================================ */
.modal-backdrop {
  position: fixed; inset: 0;
  background: rgba(15, 23, 42, 0.45);
  backdrop-filter: blur(2px);
  z-index: 60;
  display: flex; align-items: center; justify-content: center;
  padding: 1rem;
}
.modal-card {
  background: white;
  border-radius: 14px;
  width: 100%;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: 0 20px 50px rgba(15, 23, 42, 0.25);
}
.modal-header {
  display: flex; align-items: center; gap: 0.5rem;
  padding: 0.85rem 1.2rem;
  border-bottom: 1px solid #e5e7eb;
}
.modal-footer {
  display: flex; align-items: center; justify-content: flex-end; gap: 0.6rem;
  padding: 0.8rem 1.2rem;
  border-top: 1px solid #e5e7eb;
  background: #fafafa;
  border-radius: 0 0 14px 14px;
}

/* ============================================================
   Form bits
   ============================================================ */
.lbl {
  display: block;
  font-size: 11px;
  font-weight: 600;
  color: #6b7280;
  margin-bottom: 0.35rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.input {
  width: 100%;
  padding: 0.5rem 0.7rem;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  font-size: 13px;
  background: white;
  color: #111827;
  transition: border-color 0.12s, box-shadow 0.12s;
  line-height: 1.5;
}
.input:focus {
  outline: none;
  border-color: #6366f1;
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.15);
}
textarea.input { font-family: 'JetBrains Mono', monospace; resize: vertical; min-height: 4rem; }

/* ============================================================
   Editor (transcription textarea with line-number gutter)
   ============================================================ */
.editor {
  width: 100%;
  min-height: 360px;
  padding: 0.85rem 1rem 0.85rem 3rem;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  background:
    linear-gradient(to right, #fafafa 2.5rem, #ffffff 2.5rem);
  font-family: 'JetBrains Mono', ui-monospace, monospace;
  font-size: 13px;
  line-height: 1.65;
  color: #111827;
  resize: vertical;
  transition: border-color 0.12s, box-shadow 0.12s;
}
.editor:focus {
  outline: none;
  border-color: #6366f1;
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.12);
}

/* ============================================================
   Badges
   ============================================================ */
.badge {
  display: inline-block;
  padding: 1px 7px;
  border-radius: 999px;
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.badge-corrected { background: #d1fae5; color: #065f46; }
.badge-uploaded  { background: #fef3c7; color: #92400e; }
.badge-sandbox   { background: #e0e7ff; color: #3730a3; }

/* ============================================================
   Accuracy pills (CER / WER, confidence)
   ============================================================ */
.accuracy-pill {
  display: inline-flex; align-items: center; gap: 0.35em;
  padding: 0.1em 0.6em;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 600;
  font-family: 'JetBrains Mono', monospace;
  background: #f3f4f6;
  color: #374151;
  border: 1px solid #e5e7eb;
}
.accuracy-pill-high { background: #d1fae5; color: #065f46; border-color: #6ee7b7; }
.accuracy-pill-mid  { background: #fef3c7; color: #92400e; border-color: #fcd34d; }
.accuracy-pill-low  { background: #fee2e2; color: #b91c1c; border-color: #fca5a5; }

/* ============================================================
   Spinner
   ============================================================ */
.spinner {
  display: inline-block;
  width: 13px; height: 13px;
  border: 2px solid rgba(255, 255, 255, 0.35);
  border-top-color: white;
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ============================================================
   Toasts
   ============================================================ */
.toast {
  padding: 0.6rem 0.9rem;
  border-radius: 10px;
  background: #111827;
  color: white;
  font-size: 13px;
  box-shadow: 0 8px 24px rgba(15, 23, 42, 0.3);
  animation: slideIn 0.2s ease;
  max-width: 360px;
}
.toast-ok    { background: #047857; }
.toast-warn  { background: #b45309; }
.toast-error { background: #b91c1c; }
@keyframes slideIn { from { transform: translateX(20px); opacity: 0; } to { transform: translateX(0); opacity: 1; } }

/* ============================================================
   Line-numbered transcription display (diff view)
   ============================================================ */
.line-numbered {
  font-size: 13px;
  line-height: 1.7;
  color: #111827;
  font-family: 'JetBrains Mono', monospace;
}
.line-numbered .line {
  display: grid;
  grid-template-columns: 2.25rem 1fr;
  gap: 0.65rem;
  align-items: baseline;
  padding: 0.15rem 0.35rem;
  border-radius: 4px;
}
.line-numbered .line:hover { background: #fafafa; }
.line-numbered .ln {
  color: #9ca3af;
  font-size: 10px;
  text-align: right;
  user-select: none;
  padding-top: 0.25rem;
  font-weight: 500;
}
.line-numbered .lc {
  white-space: pre-wrap;
  word-wrap: break-word;
}
.edited {
  background: #d1fae5;
  border-radius: 3px;
  padding: 0.05rem 4px;
  box-shadow: inset 0 -1px 0 #6ee7b7;
}

/* ============================================================
   Details / summary
   ============================================================ */
details > summary { list-style: none; }
details > summary::-webkit-details-marker { display: none; }
details > summary::before {
  content: "▸";
  margin-right: 0.4rem;
  color: #9ca3af;
  display: inline-block;
  transition: transform 0.15s ease;
}
details[open] > summary::before { transform: rotate(90deg); }

/* ============================================================
   Misc
   ============================================================ */
::selection { background: rgba(99, 102, 241, 0.18); }
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb { background: #d4d4d8; border-radius: 10px; border: 2px solid transparent; background-clip: padding-box; }
::-webkit-scrollbar-thumb:hover { background: #a1a1aa; background-clip: padding-box; border: 2px solid transparent; }
::-webkit-scrollbar-track { background: transparent; }

/* Utility for tighter padding override */
.\!p-0  { padding: 0 !important; }
.\!p-2  { padding: 0.5rem !important; }
.\!p-3  { padding: 0.75rem !important; }
.\!mb-0 { margin-bottom: 0 !important; }
.\!mb-2 { margin-bottom: 0.5rem !important; }
