/* ============================================================
   PDF Infinito — Componentes
   Todos os elementos interativos e de dados.
   ============================================================ */

/* ══════════════════════════════════════════════════════════
   TOOLBAR — Botões e badges
   ══════════════════════════════════════════════════════════ */

.tb-btn {
  height: 30px;
  padding: 0 10px;
  border-radius: var(--r-md);
  border: 1px solid transparent;
  background: transparent;
  color: var(--text2);
  font-family: var(--font-ui);
  font-size: 12px;
  font-weight: 300;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 6px;
  transition: all var(--t-fast);
  letter-spacing: 0.02em;
  white-space: nowrap;
  user-select: none;
}

.tb-btn:hover {
  background: var(--bg3);
  color: var(--text);
  border-color: var(--border2);
}

.tb-btn.active {
  background: var(--accent-dim2);
  color: var(--accent);
  border-color: rgba(200, 169, 110, 0.25);
}

.tb-btn svg {
  width: 14px;
  height: 14px;
  stroke: currentColor;
  fill: none;
  stroke-width: 1.5;
  stroke-linecap: round;
  stroke-linejoin: round;
  flex-shrink: 0;
}

.tb-badge {
  height: 20px;
  padding: 0 8px;
  border-radius: 10px;
  background: var(--accent-dim);
  color: var(--accent);
  font-size: 10px;
  font-family: var(--font-mono);
  font-weight: 300;
  display: flex;
  align-items: center;
  letter-spacing: 0.05em;
  user-select: none;
}

/* ══════════════════════════════════════════════════════════
   SIDEBAR — Itens de documento
   ══════════════════════════════════════════════════════════ */

.doc-item {
  padding: 10px 16px;
  cursor: pointer;
  border-left: 2px solid transparent;
  transition: all var(--t-fast);
  position: relative;
  user-select: none;
}

.doc-item:hover { background: var(--bg3); }

.doc-item.active {
  background: var(--accent-dim);
  border-left-color: var(--accent);
}

.doc-item-num {
  font-size: 9px;
  color: var(--text3);
  font-family: var(--font-mono);
  margin-bottom: 4px;
  letter-spacing: 0.08em;
}

.doc-item-title {
  font-size: 12px;
  color: var(--text);
  font-weight: 300;
  line-height: 1.4;
  margin-bottom: 4px;
  font-family: var(--font-serif);
  font-style: italic;
}

.doc-item.active .doc-item-title { color: var(--accent); }

.doc-item-meta {
  font-size: 10px;
  color: var(--text3);
  font-family: var(--font-mono);
  display: flex;
  gap: 8px;
}

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

.doc-item-meta svg {
  width: 9px;
  height: 9px;
  stroke: currentColor;
  fill: none;
  stroke-width: 1.5;
}

.doc-progress {
  height: 2px;
  background: var(--bg4);
  margin-top: 6px;
  border-radius: 1px;
  overflow: hidden;
}

.doc-progress-fill {
  height: 100%;
  background: var(--accent2);
  border-radius: 1px;
  transition: width var(--t-slow);
}

.doc-divider {
  height: 1px;
  background: var(--border);
  margin: 4px 0;
}

/* Botão de adicionar PDF */
.add-btn {
  width: 100%;
  height: 34px;
  border-radius: var(--r-md);
  border: 1px dashed var(--border2);
  background: transparent;
  color: var(--text3);
  font-family: var(--font-ui);
  font-size: 12px;
  font-weight: 300;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  transition: all var(--t-normal);
  letter-spacing: 0.03em;
}

.add-btn:hover {
  border-color: var(--accent2);
  color: var(--accent);
  background: var(--accent-dim);
}

.add-btn svg {
  width: 13px;
  height: 13px;
  stroke: currentColor;
  fill: none;
  stroke-width: 1.5;
  stroke-linecap: round;
}

/* ══════════════════════════════════════════════════════════
   ROLO — Segmentos de documento e páginas PDF
   ══════════════════════════════════════════════════════════ */

.doc-segment { position: relative; }

.doc-segment-header {
  position: sticky;
  top: 0;
  z-index: 10;
  background: rgba(14, 14, 15, 0.92);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  padding: 8px 48px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 12px;
}

.doc-segment-num {
  font-size: 9px;
  color: var(--accent2);
  font-family: var(--font-mono);
  letter-spacing: 0.1em;
  width: 24px;
  flex-shrink: 0;
}

.doc-segment-ref {
  font-size: 11px;
  color: var(--text3);
  font-family: var(--font-mono);
  font-weight: 300;
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.doc-segment-pages {
  font-size: 10px;
  color: var(--text3);
  font-family: var(--font-mono);
  flex-shrink: 0;
}

/* Área de páginas do PDF */
.pdf-pages {
  padding: 32px 48px;
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.pdf-page {
  background: #1c1c1e;
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  aspect-ratio: 0.707;
  max-width: 680px;
  margin: 0 auto;
  width: 100%;
  padding: 48px 56px;
  position: relative;
  overflow: hidden;
  transition: border-color var(--t-fast);
}

.pdf-page:hover { border-color: var(--border2); }

.pdf-page-num {
  position: absolute;
  bottom: 16px;
  right: 20px;
  font-size: 9px;
  color: var(--text3);
  font-family: var(--font-mono);
}

/* Canvas wrapper gerado pelo pdf.js */
.pdf-page-canvas {
  display: block;
  width: 100%;
  height: auto;
}

/* ══════════════════════════════════════════════════════════
   ANOTAÇÕES — Highlights, marcadores e cards
   ══════════════════════════════════════════════════════════ */

.highlight {
  border-radius: 2px;
  padding: 1px 2px;
  cursor: pointer;
  position: relative;
  transition: background var(--t-fast);
}

/* Categorias de highlight */
.highlight,
.highlight.conceito   { background: rgba(200, 169, 110, 0.18); }
.highlight.duvida     { background: rgba(96, 144, 176, 0.20); }
.highlight.referencia { background: rgba(106, 154, 106, 0.18); }
.highlight.divergencia{ background: rgba(192, 96, 96, 0.18); }
.highlight.citacao    { background: rgba(154, 106, 176, 0.18); }

.highlight:hover,
.highlight.conceito:hover    { background: rgba(200, 169, 110, 0.32); }
.highlight.duvida:hover      { background: rgba(96, 144, 176, 0.35); }
.highlight.referencia:hover  { background: rgba(106, 154, 106, 0.32); }
.highlight.divergencia:hover { background: rgba(192, 96, 96, 0.32); }
.highlight.citacao:hover     { background: rgba(154, 106, 176, 0.32); }

/* Marcador de anotação inline */
.annotation-marker {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: var(--accent);
  color: var(--bg);
  font-size: 9px;
  font-family: var(--font-mono);
  cursor: pointer;
  vertical-align: middle;
  margin-left: 2px;
  transition: transform var(--t-fast);
  user-select: none;
  flex-shrink: 0;
}

.annotation-marker:hover { transform: scale(1.2); }

/* ══════════════════════════════════════════════════════════
   PAINEL DIREITO — Abas, cards de anotação e links
   ══════════════════════════════════════════════════════════ */

.panel-tabs {
  display: flex;
  gap: 2px;
}

.panel-tab {
  padding: 4px 10px;
  border-radius: var(--r-sm);
  font-size: 11px;
  font-weight: 300;
  color: var(--text3);
  cursor: pointer;
  transition: all var(--t-fast);
  letter-spacing: 0.03em;
  border: none;
  background: transparent;
  font-family: var(--font-ui);
  user-select: none;
}

.panel-tab.active {
  background: var(--accent-dim2);
  color: var(--accent);
}

.panel-tab:hover:not(.active) {
  color: var(--text2);
  background: var(--bg3);
}

/* Card de anotação */
.annotation-card {
  background: var(--bg3);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  padding: 12px;
  margin-bottom: 8px;
  cursor: pointer;
  transition: all var(--t-fast);
}

.annotation-card:hover {
  border-color: var(--border2);
  background: var(--bg4);
}

/* Tag de categoria */
.ann-tag {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  height: 18px;
  padding: 0 7px;
  border-radius: 9px;
  font-size: 9px;
  font-family: var(--font-mono);
  letter-spacing: 0.05em;
  margin-bottom: 8px;
  user-select: none;
}

.ann-tag.conceito   { background: rgba(200, 169, 110, 0.15); color: var(--cat-conceito); }
.ann-tag.duvida     { background: rgba(96, 144, 176, 0.15);  color: var(--cat-duvida); }
.ann-tag.referencia { background: rgba(106, 154, 106, 0.15); color: var(--cat-referencia); }
.ann-tag.divergencia{ background: rgba(192, 96, 96, 0.15);   color: var(--cat-divergencia); }
.ann-tag.citacao    { background: rgba(154, 106, 176, 0.15); color: var(--cat-citacao); }

.ann-dot {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: currentColor;
  flex-shrink: 0;
}

.ann-text {
  font-family: var(--font-serif);
  font-size: 13px;
  font-weight: 300;
  color: var(--text2);
  line-height: 1.6;
  margin-bottom: 8px;
}

.ann-anchor {
  font-size: 10px;
  color: var(--text3);
  font-family: var(--font-mono);
  display: flex;
  align-items: center;
  gap: 4px;
}

.ann-anchor svg {
  width: 10px;
  height: 10px;
  stroke: currentColor;
  fill: none;
  stroke-width: 1.5;
}

/* Card de link */
.link-card {
  background: var(--bg3);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  padding: 10px 12px;
  margin-bottom: 8px;
  cursor: pointer;
  transition: all var(--t-fast);
  display: flex;
  gap: 10px;
  align-items: flex-start;
}

.link-card:hover { border-color: var(--border2); }

.link-icon {
  width: 28px;
  height: 28px;
  border-radius: var(--r-md);
  background: var(--bg4);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.link-icon svg {
  width: 13px;
  height: 13px;
  stroke: var(--accent);
  fill: none;
  stroke-width: 1.5;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.link-info { flex: 1; min-width: 0; }

.link-type {
  font-size: 9px;
  color: var(--text3);
  font-family: var(--font-mono);
  letter-spacing: 0.08em;
  margin-bottom: 3px;
  text-transform: uppercase;
}

.link-desc {
  font-size: 12px;
  color: var(--text2);
  font-weight: 300;
  line-height: 1.4;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.link-ts {
  font-size: 10px;
  color: var(--accent2);
  font-family: var(--font-mono);
  margin-top: 3px;
}

/* Empty state de painel */
.panel-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 100%;
  gap: 10px;
  padding: 24px;
  text-align: center;
}

.panel-empty-text {
  font-size: 11px;
  color: var(--text3);
  font-weight: 300;
  line-height: 1.6;
}

/* ══════════════════════════════════════════════════════════
   PLAYER DE VÍDEO (flutuante)
   ══════════════════════════════════════════════════════════ */

.video-header {
  padding: 8px 12px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.video-title {
  font-size: 11px;
  color: var(--text2);
  font-weight: 300;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  flex: 1;
}

.video-close {
  width: 20px;
  height: 20px;
  border-radius: var(--r-sm);
  border: none;
  background: transparent;
  color: var(--text3);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-left: 8px;
  font-size: 16px;
  line-height: 1;
  transition: all var(--t-fast);
  flex-shrink: 0;
}

.video-close:hover { background: var(--bg3); color: var(--text); }

.video-thumb {
  width: 100%;
  aspect-ratio: 16 / 9;
  background: #0a0a0a;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  overflow: hidden;
}

.video-thumb-bg {
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, #1a1a2e 0%, #16213e 50%, #0f3460 100%);
  opacity: 0.6;
}

.video-play {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: rgba(200, 169, 110, 0.9);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  position: relative;
  z-index: 1;
  transition: transform var(--t-normal);
  border: none;
}

.video-play:hover { transform: scale(1.1); }

.video-play svg {
  width: 18px;
  height: 18px;
  fill: var(--bg);
  margin-left: 2px;
}

.video-controls { padding: 10px 12px; }

.video-timeline {
  height: 3px;
  background: var(--bg4);
  border-radius: 2px;
  margin-bottom: 8px;
  position: relative;
  cursor: pointer;
}

.video-progress {
  height: 100%;
  background: var(--accent);
  border-radius: 2px;
  position: relative;
}

.video-progress::after {
  content: '';
  position: absolute;
  right: -4px;
  top: -3px;
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--accent);
}

.video-timestamp-markers {
  display: flex;
  gap: 4px;
  flex-wrap: wrap;
  margin-top: 6px;
}

.ts-marker {
  height: 20px;
  padding: 0 8px;
  border-radius: 10px;
  background: var(--accent-dim);
  color: var(--accent);
  font-size: 10px;
  font-family: var(--font-mono);
  cursor: pointer;
  border: 1px solid rgba(200, 169, 110, 0.2);
  transition: all var(--t-fast);
  display: flex;
  align-items: center;
  gap: 4px;
}

.ts-marker:hover { background: var(--accent-dim2); }

.ts-marker svg {
  width: 9px;
  height: 9px;
  stroke: currentColor;
  fill: none;
  stroke-width: 1.5;
}

.video-time {
  font-size: 10px;
  color: var(--text3);
  font-family: var(--font-mono);
  display: flex;
  justify-content: space-between;
  margin-top: 4px;
}

/* ══════════════════════════════════════════════════════════
   MODAL — Upload de PDF
   ══════════════════════════════════════════════════════════ */

.modal-title {
  font-family: var(--font-serif);
  font-size: 20px;
  font-weight: 400;
  color: var(--text);
  margin-bottom: 6px;
}

.modal-sub {
  font-size: 12px;
  color: var(--text3);
  font-weight: 300;
  margin-bottom: 20px;
  line-height: 1.5;
}

.upload-drop-zone {
  border: 1px dashed var(--border2);
  border-radius: var(--r-lg);
  padding: 32px;
  text-align: center;
  cursor: pointer;
  transition: all var(--t-normal);
  background: transparent;
  margin-bottom: 16px;
}

.upload-drop-zone:hover,
.upload-drop-zone.drag-over {
  border-color: var(--accent2);
  background: var(--accent-dim);
}

.upload-drop-icon {
  font-size: 32px;
  margin-bottom: 10px;
  opacity: 0.5;
}

.upload-drop-text {
  font-size: 13px;
  color: var(--text3);
  font-weight: 300;
}

.upload-drop-sub {
  font-size: 11px;
  color: var(--text3);
  font-family: var(--font-mono);
  margin-top: 4px;
  opacity: 0.6;
}

.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 20px;
}

/* ── Botões de ação (modal e geral) ── */
.btn {
  height: 32px;
  padding: 0 14px;
  border-radius: var(--r-md);
  border: 1px solid var(--border2);
  background: transparent;
  color: var(--text2);
  font-family: var(--font-ui);
  font-size: 12px;
  font-weight: 300;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 6px;
  transition: all var(--t-fast);
  letter-spacing: 0.02em;
  user-select: none;
}

.btn:hover {
  background: var(--bg4);
  color: var(--text);
}

.btn-primary {
  background: var(--accent-dim2);
  color: var(--accent);
  border-color: rgba(200, 169, 110, 0.3);
}

.btn-primary:hover {
  background: rgba(200, 169, 110, 0.25);
  color: var(--accent);
}

/* ══════════════════════════════════════════════════════════
   UTILITÁRIOS
   ══════════════════════════════════════════════════════════ */

/* Upload de arquivo oculto */
input[type="file"].hidden-input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
  width: 0;
  height: 0;
}

/* Scrollbar global fino */
* {
  scrollbar-width: thin;
  scrollbar-color: var(--bg4) transparent;
}
