/* Studium-sidebar — portert fra redesignets ReadingSidebar.module.scss +
   sidebar/StudyPanel.module.scss via token-broen. */

.reading-sidebar {
  position: relative;
  background: var(--paper);
  border-left: 1px solid var(--border);
  font-family: var(--sans, system-ui, sans-serif);
  display: flex;
  flex-direction: column;
}

.sidebar-resize {
  position: absolute;
  left: -3px;
  top: 0;
  bottom: 0;
  width: 6px;
  cursor: col-resize;
  z-index: 5;
}
.sidebar-resize:hover,
.sidebar-resize.is-dragging {
  background: var(--gold-soft);
}

.sidebar-content {
  position: sticky;
  top: 3.25rem;
  height: calc(100vh - 3.25rem);
  overflow-y: auto;
  padding: 16px 14px 60px;
}

/* Panelfaner — kun synlige i panelmodus (kontrakt: bibel:panel-tab 1-4) */
.panel-tabbar {
  display: none;
  gap: 2px;
  padding: 8px 10px 0;
  border-bottom: 1px solid var(--border);
  background: var(--paper);
  position: sticky;
  top: 3.25rem;
  z-index: 4;
}
.panel-tab {
  font-size: 12.5px;
  background: transparent;
  border: 0;
  padding: 8px 11px;
  color: var(--muted);
  cursor: pointer;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  white-space: nowrap;
}
.panel-tab:hover {
  color: var(--ink);
}
.panel-tab.is-active {
  color: var(--ink);
  border-bottom-color: var(--gold);
  font-weight: 500;
}

/* ── Studium-blokker ── */

.st-block {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--paper-2);
  margin-bottom: 10px;
  overflow: hidden;
}
.st-block-head {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 12px;
  cursor: pointer;
  list-style: none;
  user-select: none;
}
.st-block-head::-webkit-details-marker {
  display: none;
}
.st-block-title {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--ink);
}
.st-block-count {
  font-size: 0.7rem;
  background: var(--gold-bg);
  color: var(--gold-text);
  border-radius: var(--radius-pill);
  padding: 1px 7px;
  font-weight: 600;
}
.st-block-chevron {
  margin-left: auto;
  color: var(--muted);
  font-size: 0.8rem;
  transition: transform 0.15s ease;
}
.st-block[open] .st-block-chevron {
  transform: rotate(90deg);
}
.st-block-body {
  padding: 0 12px 12px;
  font-size: 0.85rem;
  color: var(--ink-2);
}

.st-empty {
  color: var(--muted);
  font-size: 0.82rem;
  margin: 4px 0;
}

.st-see-all {
  display: inline-block;
  margin-top: 8px;
  font-size: 0.8rem;
  color: var(--gold-text);
  text-decoration: none;
}
.st-see-all:hover {
  text-decoration: underline;
}

/* Oppslag */
.st-lookup-input {
  width: 100%;
  padding: 7px 10px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--paper);
  color: var(--ink);
  font-size: 0.85rem;
}
.st-lookup-input:focus {
  outline: none;
  border-color: var(--gold);
}
.st-lookup-hits {
  list-style: none;
  margin: 8px 0 0;
  padding: 0;
}
.st-lookup-hit {
  display: flex;
  gap: 8px;
  align-items: baseline;
  padding: 5px 6px;
  border-radius: 6px;
  text-decoration: none;
  color: var(--ink);
}
.st-lookup-hit:hover {
  background: var(--paper);
}
.st-lookup-kind {
  flex: 0 0 auto;
  font-size: 0.65rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--gold-text);
  background: var(--gold-bg);
  border-radius: var(--radius-pill);
  padding: 1px 6px;
}
.st-lookup-label {
  font-size: 0.85rem;
}
.st-lookup-sub {
  font-size: 0.72rem;
  color: var(--muted);
}

/* Sammendrag */
.st-summary-item {
  margin-bottom: 12px;
}
.st-summary-sub {
  margin: 0 0 4px;
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
}
.st-summary-text {
  line-height: 1.55;
}

/* Markdown-innhold (views/markdown.tsx) i sidepanelet */
.md p {
  margin: 0 0 8px;
}
.md ul {
  margin: 0 0 8px;
  padding-left: 18px;
}
.md li {
  margin-bottom: 3px;
}
.md h2,
.md h3,
.md h4,
.md h5 {
  margin: 10px 0 4px;
  font-size: 0.9rem;
  font-family: inherit;
  color: var(--ink);
}

/* Chips (personer, temaer, tall) */
.st-chip-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.st-chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 9px;
  border: 1px solid var(--border);
  border-radius: var(--radius-pill);
  background: var(--paper);
  color: var(--ink-2);
  text-decoration: none;
  font-size: 0.8rem;
}
.st-chip:hover {
  border-color: var(--gold-soft);
  color: var(--ink);
}
.st-chip-num {
  font-size: 0.68rem;
  color: var(--gold-text);
}

/* Viktige ord */
.st-word-list {
  list-style: none;
  margin: 0;
  padding: 0;
}
.st-word-item {
  margin-bottom: 6px;
  line-height: 1.5;
}
.st-word-term {
  color: var(--ink);
}
.st-word-more {
  color: var(--muted);
  font-size: 0.78rem;
}

/* Tidslinje-blokk */
.st-timeline-list {
  list-style: none;
  margin: 0;
  padding: 0;
}
.st-timeline-item {
  display: flex;
  gap: 8px;
  align-items: baseline;
  margin-bottom: 6px;
}
.st-timeline-year {
  flex: 0 0 auto;
  font-size: 0.72rem;
  color: var(--muted);
  min-width: 64px;
}
.st-timeline-title {
  color: var(--ink);
  text-decoration: none;
  font-size: 0.85rem;
}
.st-timeline-title:hover {
  color: var(--gold-text);
}

/* Profetier/historier/paralleller-lister */
.st-prop-list {
  list-style: none;
  margin: 0;
  padding: 0;
}
.st-prop-item {
  margin-bottom: 8px;
}
.st-prop-title {
  display: block;
  color: var(--ink);
  text-decoration: none;
  font-size: 0.85rem;
}
.st-prop-title:hover {
  color: var(--gold-text);
}
.st-prop-cat {
  font-size: 0.72rem;
  color: var(--muted);
}

/* Lesetekster/manuskripter */
.st-ms-list {
  list-style: none;
  margin: 0;
  padding: 0;
}
.st-ms-item {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 6px;
  align-items: baseline;
}
.st-ms-title {
  color: var(--ink);
  text-decoration: none;
  font-size: 0.85rem;
}
.st-ms-title:hover {
  color: var(--gold-text);
}
.st-ms-type {
  font-size: 0.7rem;
  color: var(--muted);
  white-space: nowrap;
}
.st-new-ms-link {
  display: inline-block;
  margin-top: 8px;
  font-size: 0.8rem;
  color: var(--gold-text);
  text-decoration: none;
}
.st-new-ms-link:hover {
  text-decoration: underline;
}

/* ── Panel-tidslinje (fane 2 i panelmodus) ── */

.pt-event {
  border-left: 3px solid var(--period-color, var(--gold));
  padding: 6px 0 6px 12px;
  margin-bottom: 14px;
}
.pt-event-header {
  display: flex;
  gap: 8px;
  align-items: baseline;
  flex-wrap: wrap;
}
.pt-event-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--period-color, var(--gold));
  flex: 0 0 auto;
}
.pt-event-year {
  font-size: 0.72rem;
  color: var(--muted);
}
.pt-event-title {
  margin: 0;
  font-size: 0.9rem;
  color: var(--ink);
}
.pt-event-description {
  margin: 6px 0;
  font-size: 0.82rem;
  color: var(--ink-2);
  line-height: 1.5;
}
.pt-event-refs {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.pt-ref-link {
  font-size: 0.75rem;
  color: var(--gold-text);
  text-decoration: none;
  border: 1px solid var(--border);
  border-radius: var(--radius-pill);
  padding: 2px 8px;
  background: var(--paper-2);
}
.pt-ref-link.is-current {
  background: var(--gold-bg);
  border-color: var(--gold-soft);
}
.pt-here {
  color: var(--muted);
}

/* ── Studium-overlegg (mobil) ── */

.studium-overlay {
  position: fixed;
  inset: 0;
  z-index: 80;
  background: var(--paper);
  display: flex;
  flex-direction: column;
}
.studium-overlay-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
}
.studium-overlay-title {
  font-family: var(--serif);
  font-weight: 600;
  color: var(--ink);
}
.studium-overlay-content {
  flex: 1;
  overflow-y: auto;
  padding: 14px;
  font-family: var(--sans, system-ui, sans-serif);
}
.studium-overlay-content .sidebar-content {
  position: static;
  height: auto;
  padding: 0;
}

/* Item-tagging (emner-fanen i versdetaljen) */
.item-tagging .topics-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 12px;
}
.item-tagging .topic-tag {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 8px;
  background: var(--paper);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 0.85rem;
  color: var(--ink);
}
.item-tagging .topic-remove {
  background: none;
  border: none;
  padding: 0;
  margin-left: 4px;
  font-size: 1.1em;
  color: var(--muted);
  cursor: pointer;
  line-height: 1;
  min-width: 24px;
  min-height: 24px;
}
.item-tagging .topic-remove:hover {
  color: var(--ink);
}
.item-tagging .topic-input-wrapper {
  position: relative;
  margin-top: 8px;
}
.item-tagging input[type='text'],
.item-tagging .topic-input {
  width: 100%;
  padding: 8px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--paper);
  color: var(--ink);
  font-size: 0.9rem;
}
.item-tagging .topic-suggestions {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  background: var(--paper);
  border: 1px solid var(--border);
  border-top: none;
  border-radius: 0 0 var(--radius-sm) var(--radius-sm);
  max-height: 200px;
  overflow-y: auto;
  z-index: 1000;
  box-shadow: var(--shadow-md);
}
.item-tagging .topic-suggestion {
  padding: 8px 12px;
  cursor: pointer;
  font-size: 0.85rem;
}
.item-tagging .topic-suggestion:hover,
.item-tagging .topic-suggestion.selected {
  background: var(--paper-2);
}
.item-tagging .topic-new-label {
  color: var(--gold-text);
  font-size: 0.75rem;
  margin-left: 4px;
}
.item-tagging-empty {
  color: var(--muted);
  font-size: 0.85rem;
}
