/* Pertinens — Mörkt tema (familj-designspråk) */

:root {
  --bg: #0a0a14;
  --bg-card: #12121e;
  --bg-input: #1a1a2e;
  --border: #2a2a3e;
  --text: #e8d5a3;
  --text-muted: #8a7d6a;
  --gold: #d4a843;
  --gold-hover: #e6bc5a;
  --green: #4a9;
  --yellow: #da3;
  --red: #d55;
  --font: 'Georgia', 'Times New Roman', serif;
  --font-mono: 'Courier New', monospace;
}

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

body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  line-height: 1.6;
  min-height: 100vh;
}

a { color: var(--gold); text-decoration: none; }
a:hover { color: var(--gold-hover); text-decoration: underline; }

/* Nav */
nav {
  background: var(--bg-card);
  border-bottom: 1px solid var(--border);
  padding: 0.75rem 2rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
nav .brand {
  font-size: 1.25rem;
  font-weight: bold;
  color: var(--gold);
  letter-spacing: 0.05em;
}
nav .nav-links { display: flex; gap: 1.5rem; align-items: center; }
nav .nav-links a { color: var(--text-muted); font-size: 0.9rem; text-decoration: none; }
nav .nav-links a:hover { color: var(--text); text-decoration: none; }
.nav-logout {
  background: none; border: none; color: var(--text-muted); font-family: var(--font);
  font-size: 0.9rem; cursor: pointer; padding: 0;
}
.nav-logout:hover { color: var(--text); background: none; }

/* Layout */
.container {
  max-width: 800px;
  margin: 0 auto;
  padding: 2rem 1.5rem;
}
.container-wide {
  max-width: 1100px;
  margin: 0 auto;
  padding: 2rem 1.5rem;
}

/* Cards */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 1.5rem;
  margin-bottom: 1rem;
}
.card h2 {
  color: var(--gold);
  margin-bottom: 1rem;
  font-size: 1.2rem;
}

/* Forms */
label {
  display: block;
  margin-bottom: 0.25rem;
  color: var(--text-muted);
  font-size: 0.85rem;
}
input[type="text"],
input[type="email"],
input[type="password"],
input[type="number"],
select,
textarea {
  width: 100%;
  padding: 0.6rem 0.8rem;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: 4px;
  color: var(--text);
  font-family: var(--font);
  font-size: 0.95rem;
  margin-bottom: 1rem;
}
input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--gold);
}
textarea { resize: vertical; min-height: 80px; }

/* Buttons */
button, .btn {
  display: inline-block;
  padding: 0.6rem 1.5rem;
  background: var(--gold);
  color: var(--bg);
  border: none;
  border-radius: 4px;
  font-family: var(--font);
  font-size: 0.95rem;
  font-weight: bold;
  cursor: pointer;
  transition: background 0.2s;
}
button:hover, .btn:hover { background: var(--gold-hover); }
.btn-secondary {
  background: transparent;
  color: var(--text-muted);
  border: 1px solid var(--border);
}
.btn-secondary:hover {
  color: var(--text);
  border-color: var(--text-muted);
}
.btn-small {
  padding: 0.3rem 0.8rem;
  font-size: 0.8rem;
}

/* Field groups */
.field-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
}
.field-group { margin-bottom: 0.5rem; }

/* Language primary indicator */
.lang-primary {
  border-left: 3px solid var(--gold);
  padding-left: 0.4rem;
}
.lang-primary::after {
  content: " (primär)";
  font-size: 0.75rem;
  color: var(--gold);
}

/* Quality indicators */
.qi { font-size: 0.8rem; padding: 0.15rem 0.5rem; border-radius: 3px; }
.qi-verified { background: rgba(68,170,153,0.15); color: var(--green); }
.qi-personal { background: rgba(221,170,51,0.15); color: var(--yellow); }
.qi-missing { background: rgba(221,85,85,0.15); color: var(--red); }

/* Person list / tree */
.person-node {
  padding: 0.6rem 1rem;
  border-left: 3px solid var(--border);
  margin-bottom: 0.5rem;
  cursor: pointer;
  transition: border-color 0.2s;
}
.person-node:hover { border-color: var(--gold); background: rgba(212,168,67,0.05); }
.person-node .name { font-weight: bold; }
.person-node .meta { font-size: 0.8rem; color: var(--text-muted); }

.children { margin-left: 1.5rem; }

/* Wizard steps */
.wizard-progress {
  display: flex;
  gap: 0.5rem;
  margin-bottom: 2rem;
}
.wizard-step {
  flex: 1;
  height: 4px;
  background: var(--border);
  border-radius: 2px;
}
.wizard-step.done { background: var(--gold); }
.wizard-step.active { background: var(--gold); opacity: 0.6; }

/* Messages */
.msg { padding: 0.75rem 1rem; border-radius: 4px; margin-bottom: 1rem; font-size: 0.9rem; }
.msg-error { background: rgba(221,85,85,0.15); color: var(--red); border: 1px solid rgba(221,85,85,0.3); }
.msg-success { background: rgba(68,170,153,0.15); color: var(--green); border: 1px solid rgba(68,170,153,0.3); }
.msg-info { background: rgba(212,168,67,0.1); color: var(--text-muted); border: 1px solid var(--border); }

/* Assertion chain */
.assertion {
  padding: 0.75rem 1rem;
  border-left: 3px solid var(--border);
  margin-bottom: 0.5rem;
  font-size: 0.9rem;
}
.assertion.active { border-color: var(--gold); }
.assertion.superseded { opacity: 0.5; border-color: var(--text-muted); }
.assertion .field-key { color: var(--gold); font-weight: bold; }
.assertion .verdict { font-size: 0.8rem; }

/* HTMX loading indicator */
.htmx-indicator { display: none; }
.htmx-request .htmx-indicator { display: inline; }
.htmx-request button { opacity: 0.6; pointer-events: none; }

/* Utility */
.text-muted { color: var(--text-muted); }
.text-gold { color: var(--gold); }
.mb-1 { margin-bottom: 0.5rem; }
.mb-2 { margin-bottom: 1rem; }
.mb-3 { margin-bottom: 1.5rem; }
.mt-2 { margin-top: 1rem; }
.flex { display: flex; }
.gap-1 { gap: 0.5rem; }
.gap-2 { gap: 1rem; }
.justify-between { justify-content: space-between; }
.align-center { align-items: center; }
.text-center { text-align: center; }
.d-block { display: block; }

/* Data tables (mörkt tema) */
.data-table { width: 100%; border-collapse: collapse; font-size: 0.9rem; }
.data-table th {
  background: var(--bg-input); color: var(--gold); padding: 0.5rem 0.75rem;
  text-align: left; border-bottom: 2px solid var(--border); font-size: 0.85rem;
}
.data-table td { padding: 0.5rem 0.75rem; border-bottom: 1px solid var(--border); }
.data-table tbody tr:hover { background: rgba(212,168,67,0.05); }
.row-good { border-left: 3px solid var(--green); }
.row-warn { border-left: 3px solid var(--yellow); }
.row-bad { border-left: 3px solid var(--red); }

/* Badges */
.badge { display: inline-block; padding: 0.15rem 0.5rem; border-radius: 3px; font-size: 0.8rem; font-weight: bold; }
.badge-good { background: rgba(68,170,153,0.15); color: var(--green); }
.badge-warn { background: rgba(221,170,51,0.15); color: var(--yellow); }
.badge-bad { background: rgba(221,85,85,0.15); color: var(--red); }

/* Knappvarianter */
.btn-good { background: var(--green); color: var(--bg); }
.btn-good:hover { background: #5cb; }
.btn-warn { background: var(--yellow); color: var(--bg); }
.btn-warn:hover { background: #eb4; }
.btn-bad { background: var(--red); color: var(--bg); }
.btn-bad:hover { background: #e66; }
.btn-sm { padding: 0.3rem 0.6rem; font-size: 0.8rem; }
.btn-block { width: 100%; }

/* Artefaktgrupp (Slussen/Sök) */
.artifact-group {
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: 8px; padding: 1.5rem; margin-bottom: 1.5rem;
}
.artifact-group h3 { color: var(--gold); margin-bottom: 0.75rem; font-size: 1.1rem; }
.artifact-group small { color: var(--text-muted); font-size: 0.85rem; }

/* Inline-formulär (knappar i rad) */
.inline-form { display: inline-block; margin-right: 5px; }

/* Centrerad formulärsida */
.form-page { max-width: 400px; margin: 4rem auto; }

/* Tidslinje */
.timeline-section { border-left: 3px solid var(--gold); padding-left: 16px; }
.event-type { color: var(--gold); font-size: 1.2rem; margin-bottom: 8px; }
.sources-list { font-size: 0.9rem; }
.source-item {
  cursor: pointer; padding: 4px; border: 1px solid var(--border);
  margin: 2px; display: inline-block;
}
.source-item:hover { background: rgba(212,168,67,0.12); }
.preview-pane {
  display: none; position: absolute; background: var(--bg-card);
  border: 1px solid var(--gold); padding: 8px; z-index: 1000;
  box-shadow: 0 4px 12px rgba(212,168,67,0.3);
}

/* Slussen — Glasskiva */
.glasskiva {
  display: flex; gap: 1.5rem; padding: 1rem;
  background: var(--bg-input); border: 1px solid var(--border); border-radius: 8px;
}
.glasskiva-image { flex: 1; min-width: 0; }
.glasskiva-image img { border-radius: 4px; }
.glasskiva-data { flex: 1; min-width: 200px; }

/* Slussen — Mention-kort (designsprak v1: hierarki + luft) */
.mention-card {
  background: var(--bg-card); border: 1px solid var(--border); border-radius: 6px;
  padding: 1rem 1.25rem; margin-bottom: 1rem; border-left: 4px solid var(--border);
}
.mention-card-match { border-left-color: var(--green); }
.mention-card-near { border-left-color: var(--gold, #d4a843); }
.mention-card-conflict { border-left-color: var(--red); }
.mention-card-new { border-left-color: var(--yellow); }
.mention-name { font-size: 1.15rem; font-weight: bold; color: var(--text); }
.mention-role { font-size: 0.85rem; color: var(--text-muted); margin-left: 0.5rem; }
.mention-meta { display: flex; gap: 1rem; font-size: 0.9rem; color: var(--text-muted); margin-top: 0.4rem; }
.mention-meta span { white-space: nowrap; }

/* Slussen — Trestegsvy-badges */
.comparison-fields { display: flex; flex-wrap: wrap; gap: 0.4rem; }
.comp-badge {
  display: inline-block; padding: 0.15rem 0.5rem; border-radius: 3px;
  font-size: 0.8rem; white-space: nowrap;
}
.comp-match { background: rgba(68,170,153,0.15); color: var(--green); }
.comp-near { background: rgba(212,168,67,0.15); color: var(--gold, #d4a843); }
.comp-conflict { background: rgba(221,85,85,0.15); color: var(--red); }
.comp-new { background: rgba(221,170,51,0.15); color: var(--yellow); }

/* Slussen — Batch-bar */
.batch-bar {
  position: fixed; bottom: 0; left: 0; right: 0; z-index: 100;
  background: var(--bg-card); border-top: 2px solid var(--gold);
  padding: 0.75rem 2rem; display: flex; align-items: center; gap: 1rem;
}
.batch-check { accent-color: var(--gold); width: 18px; height: 18px; cursor: pointer; }

/* Brodsmulor (designsprak v1) */
.breadcrumb {
  font-size: 0.85rem; color: var(--text-muted); margin-bottom: 1.5rem;
}
.breadcrumb a { color: var(--text-muted); }
.breadcrumb a:hover { color: var(--gold); }
.breadcrumb .sep { margin: 0 0.4rem; opacity: 0.5; }

/* Modal overlay */
.modal-overlay {
  position: fixed; inset: 0; z-index: 200;
  background: rgba(0,0,0,0.7);
}
.d-none { display: none !important; }
.modal-card {
  max-width: 500px; margin: 10vh auto; position: relative;
  padding-right: 3rem;
}
.modal-close {
  position: absolute; top: 1rem; right: 1rem;
}
.modal-action {
  position: absolute; top: 1rem; right: 3.5rem;
}
.upload-step2 { text-align: center; padding: 2rem 0; }
.cursor-pointer { cursor: pointer; }
/* Upload toggle (person-sida) */
.upload-toggle { position: relative; }
.upload-toggle summary {
  list-style: none; cursor: pointer;
  color: var(--gold); font-family: var(--font);
}
.upload-toggle summary::-webkit-details-marker { display: none; }
.upload-toggle summary:hover { color: var(--gold-hover); text-decoration: underline; }
.upload-panel {
  position: absolute; top: 1.8rem; left: 0; z-index: 50;
  min-width: 320px; padding: 1rem;
}

/* Jobbstatus-rad (person-sidan) */
.job-row {
  display: flex; align-items: center; justify-content: space-between;
  padding: 0.3rem 0; gap: 0.5rem;
}

/* Score-slider (Slussen, council 2026-02-21) */
.filter-row {
  display: flex; align-items: center; gap: 0.75rem;
  padding: 0.6rem 1rem; background: var(--bg-card);
  border: 1px solid var(--border); border-radius: 6px;
}
.filter-label {
  color: var(--text-muted); font-size: 0.85rem;
  white-space: nowrap; user-select: none;
}
.score-value {
  color: var(--gold); font-size: 0.95rem; font-weight: bold;
  min-width: 4ch; text-align: right; font-variant-numeric: tabular-nums;
}
.score-count {
  color: var(--text-muted); font-size: 0.8rem;
  white-space: nowrap; margin-left: auto;
}
.gold-slider {
  -webkit-appearance: none; appearance: none;
  flex: 1; min-width: 120px; height: 6px;
  border-radius: 3px; outline: none; cursor: pointer;
  --val: 0%;
  background: linear-gradient(to right,
    var(--gold) 0%, var(--gold) var(--val),
    var(--bg-input) var(--val), var(--bg-input) 100%);
}
.gold-slider::-webkit-slider-thumb {
  -webkit-appearance: none; width: 16px; height: 16px;
  border-radius: 50%; background: var(--gold);
  border: 2px solid var(--bg-card);
  box-shadow: 0 0 0 1px var(--border); cursor: grab;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}
.gold-slider::-webkit-slider-thumb:hover {
  transform: scale(1.25);
  box-shadow: 0 0 0 2px var(--gold-hover), 0 0 8px rgba(212,168,67,0.3);
}
.gold-slider::-moz-range-thumb {
  width: 16px; height: 16px; border-radius: 50%;
  background: var(--gold); border: 2px solid var(--bg-card);
  box-shadow: 0 0 0 1px var(--border); cursor: grab;
}
.gold-slider::-moz-range-track {
  height: 6px; border-radius: 3px;
  background: var(--bg-input); border: none;
}
.gold-slider::-moz-range-progress {
  height: 6px; border-radius: 3px 0 0 3px; background: var(--gold);
}
.gold-slider:focus-visible {
  outline: 2px solid var(--gold-hover); outline-offset: 3px;
}

/* Antavla / Träd */
.tree-controls {
  display: flex; justify-content: space-between; align-items: center;
  padding: 0.5rem 0; margin-bottom: 0.5rem;
}
.zoom-buttons { display: flex; gap: 0.25rem; }
.zoom-buttons button {
  background: var(--bg-card); border: 1px solid var(--border);
  color: var(--text-muted); width: 32px; height: 32px; border-radius: 4px;
  cursor: pointer; font-size: 1rem;
}
.zoom-buttons button:hover { color: var(--gold); border-color: var(--gold); }
#depthCounter {
  position: fixed; bottom: 20px; left: 20px; z-index: 100;
  background: rgba(10,10,20,0.8); border: 1px solid rgba(212,168,67,0.3);
  border-radius: 6px; padding: 8px 12px;
  font-family: 'Segoe UI', system-ui, sans-serif;
}
.info-panel {
  position: fixed; right: -320px; top: 60px; width: 300px;
  max-height: calc(100vh - 80px); overflow-y: auto; z-index: 200;
  background: rgba(18,18,30,0.95); border: 1px solid rgba(212,168,67,0.3);
  border-radius: 8px; padding: 1.2rem;
  transition: right 0.3s ease;
}
.info-panel.visible { right: 20px; }
.info-panel h2 { color: var(--gold); font-size: 1.1rem; margin-bottom: 0.5rem; }
.info-panel h3 { color: var(--text-muted); font-size: 0.85rem; margin: 0.8rem 0 0.3rem; }
.info-panel .info-details div { font-size: 0.85rem; margin-bottom: 0.2rem; }
.info-panel .info-link {
  color: var(--gold); cursor: pointer; font-size: 0.85rem;
  padding: 0.15rem 0;
}
.info-panel .info-link:hover { text-decoration: underline; }
.info-panel .info-fullpage { margin-top: 1rem; font-size: 0.85rem; }
.info-close {
  position: absolute; top: 8px; right: 10px;
  background: none; border: none; color: var(--text-muted);
  cursor: pointer; font-size: 1.2rem;
}

/* IIIF viewer (Sprint 21) */
.viewer-page { max-width: none; padding: 0; margin: 0; overflow: hidden; }
.viewer-page #uv { width: 100%; height: calc(100vh - 57px); }
.viewer-page .leftPanel { width: 200px !important; min-width: 200px !important; }
.viewer-page .mainPanel { left: 0 !important; }
/* Kompakt footer: sökrad + knappar */
.viewer-page .footerPanel { bottom: 0 !important; }
.viewer-page .footerPanel .searchResults { height: 36px !important; padding: 6px 10px !important; }
.viewer-page .footerPanel .search { height: 30px !important; }
.viewer-page .footerPanel .options { height: 32px !important; padding: 2px 10px !important; }
/* Sök-highlight: bättre kontrast på gulnat papper */
.viewer-page .annotationOverlay .annotation { mix-blend-mode: multiply; }
