/* ── Reset & base ──────────────────────────────────────── */
body {
  margin: 0; padding: 0;
  background: #f1f5f9;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

/* ── App shell ─────────────────────────────────────────── */
.app-container { display: flex; flex-direction: column; height: 100vh; overflow: hidden; }

.top-bar {
  background: #1e293b;
  padding: 8px 14px;
  flex-shrink: 0;
  min-height: 56px;
  max-height: 56px;
}
.app-title { color: #f8fafc; font-size: 14px; font-weight: 700; margin: 0; }
.graph-stats { color: #f8fafc; font-size: 13px; font-weight: 600; text-align: right; white-space: nowrap; }

/* main-row fills remaining viewport height */
.main-row {
  height: calc(100vh - 56px) !important;
  max-height: calc(100vh - 56px) !important;
  overflow: hidden;
  display: flex !important;
  flex-wrap: nowrap !important;
  align-items: stretch;
}

/* ── Sidebar ───────────────────────────────────────────── */
.sidebar {
  background: #fff;
  border-right: 1px solid #e2e8f0;
  overflow-y: auto;
  padding: 10px 8px 14px 8px;
  flex-shrink: 0;
  scrollbar-width: thin;
  height: 100%;
}

.sidebar-group-header {
  font-size: 10px; font-weight: 800;
  text-transform: uppercase; letter-spacing: .07em;
  color: #94a3b8; padding: 0 4px; margin-bottom: 2px;
}

/* Accordion flush overrides */
.filter-accordion .accordion-item { border: none; }
.filter-accordion .accordion-button {
  padding: 5px 4px;
  background: transparent !important;
  box-shadow: none !important;
  color: #334155 !important;
}
.filter-accordion .accordion-button:not(.collapsed) { color: #1e293b !important; }
.filter-accordion .accordion-body { padding: 2px 4px 6px 6px; }

.toggle-all-btn {
  color: #94a3b8 !important;
  font-size: 10px !important;
  text-decoration: none !important;
}
.toggle-all-btn:hover { color: #3b82f6 !important; }

.filter-checklist label { cursor: pointer; color: #475569; }
.filter-checklist label:hover { color: #1e293b; }

.intensity-slider { padding: 4px 4px 18px 4px; }

/* ── Graph panel ───────────────────────────────────────── */
.graph-col {
  flex: 1 1 0% !important;
  overflow: hidden;
  position: relative;
}

/* ── Legend overlay ────────────────────────────────────── */
.legend-container {
  position: absolute;
  bottom: 18px; left: 14px;
  z-index: 999;
}
.legend-toggle-btn {
  font-size: 11px !important;
  padding: 3px 8px !important;
  border: 1px solid #e2e8f0 !important;
  box-shadow: 0 1px 4px rgba(0,0,0,.08);
  background: rgba(255,255,255,.92) !important;
  backdrop-filter: blur(4px);
}
.legend-toggle-btn:hover { background: #fff !important; }
.legend-body {
  background: rgba(255,255,255,.95);
  backdrop-filter: blur(6px);
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  padding: 10px 12px;
  margin-top: 4px;
  box-shadow: 0 2px 8px rgba(0,0,0,.10);
  min-width: 180px;
}
.legend-section-title {
  font-size: 9px; font-weight: 800;
  text-transform: uppercase; letter-spacing: .07em;
  color: #94a3b8; margin-bottom: 4px;
}

/* ── Detail panel ──────────────────────────────────────── */
.detail-col {
  background: #fff;
  border-left: 1px solid #e2e8f0;
  overflow: hidden;
  flex-shrink: 0 !important;
  height: 100%;
  display: flex;
  flex-direction: column;
}
.detail-panel {
  flex: 1;
  overflow-y: auto;
  padding: 14px 12px;
  scrollbar-width: thin;
}
.detail-placeholder { color: #94a3b8; font-size: 12px; margin: 0; }
.edit-foto-btn {
  font-size: 11px !important;
  padding: 3px 10px !important;
  color: #94a3b8 !important;
  border-color: #e2e8f0 !important;
}

/* ── Actor card ────────────────────────────────────────── */
.actor-card-header { text-align: center; margin-bottom: 6px; }
.actor-card-name { font-size: 14px; font-weight: 700; color: #1e293b; margin-bottom: 4px; }
.actor-card-cargo { font-size: 11px; color: #64748b; margin: 3px 0; }
.actor-card-aliases { font-size: 10px; color: #94a3b8; margin: 2px 0; }

.stats-row {
  display: flex; align-items: center; justify-content: center;
  background: #f8fafc; border-radius: 8px; padding: 8px 0; margin-bottom: 2px;
}
.stat-item { text-align: center; padding: 0 16px; }
.stat-number { font-size: 20px; font-weight: 800; color: #1e293b; }
.stat-label { font-size: 10px; color: #94a3b8; display: block; margin-top: -2px; }
.stat-divider { width: 1px; height: 30px; background: #e2e8f0; }

/* ── Edge card ─────────────────────────────────────────── */
.edge-header {
  display: flex; align-items: flex-start;
  gap: 6px; margin-bottom: 10px;
  padding: 8px; background: #f8fafc; border-radius: 8px;
}
.edge-actor { font-size: 12px; font-weight: 700; color: #1e293b; flex: 1; }
.edge-origem { text-align: right; }
.edge-destino { text-align: left; }
.edge-arrow { font-size: 14px; padding-top: 2px; white-space: nowrap; }

/* ── Relation cards ────────────────────────────────────── */
.relations-list { max-height: 60vh; overflow-y: auto; scrollbar-width: thin; }
.rel-card {
  border-left: 3px solid #e2e8f0;
  padding: 6px 8px;
  margin-bottom: 8px;
  background: #f8fafc;
  border-radius: 0 6px 6px 0;
  font-size: 12px;
}
.rel-card-header { display: flex; align-items: center; margin-bottom: 2px; }
.rel-card-counterpart { font-size: 12px; font-weight: 600; color: #334155; margin-bottom: 3px; }
.rel-card-footer { font-size: 10px; color: #94a3b8; margin-top: 3px; }

.trecho-quote {
  font-size: 11px; color: #475569;
  border-left: none;
  padding: 3px 0;
  margin: 3px 0;
  font-style: italic;
  line-height: 1.5;
  display: -webkit-box;
  -webkit-line-clamp: 4;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.episode-link { font-weight: 700; color: #3b82f6; text-decoration: none; }
.episode-link:hover { text-decoration: underline; }

/* ── Síntese narrativa ─────────────────────────────────── */
.sinopse-block {
  margin-bottom: 8px;
}
.sinopse-text {
  font-size: 12px;
  line-height: 1.65;
  color: #334155;
  background: #f0f7ff;
  border-left: 3px solid #3b82f6;
  padding: 8px 10px;
  border-radius: 0 6px 6px 0;
  margin: 4px 0 0 0;
  font-style: italic;
}

/* ── Ficha estratégica ─────────────────────────────────── */
.ficha-estrategica {
  background: #f8fafc;
  border-radius: 8px;
  padding: 8px 10px;
  margin-bottom: 2px;
}
.ficha-section-title {
  font-size: 9px; font-weight: 800;
  text-transform: uppercase; letter-spacing: .07em;
  color: #94a3b8; margin-bottom: 4px;
}
.ficha-row {
  display: flex; align-items: center;
  padding: 3px 2px;
  border-radius: 4px;
}
.ficha-row:hover { background: #f1f5f9; }

/* ── Node hover tooltip ────────────────────────────────── */
.node-tooltip {
  position: absolute;
  top: 10px;
  left: 10px;
  background: rgba(15, 23, 42, 0.88);
  color: #f8fafc;
  border-radius: 7px;
  padding: 7px 11px;
  font-size: 12px;
  pointer-events: none;
  z-index: 1000;
  max-width: 220px;
  box-shadow: 0 2px 10px rgba(0,0,0,.25);
  backdrop-filter: blur(4px);
  border: 1px solid rgba(255,255,255,.08);
  line-height: 1.4;
  display: none;
}

/* ── Layout switcher ───────────────────────────────────── */
.layout-switcher {
  display: flex;
  align-items: center;
  gap: 5px;
}
.layout-label {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: #64748b;
  white-space: nowrap;
}
.layout-btn {
  font-size: 10px !important;
  padding: 2px 7px !important;
  border: 1px solid #e2e8f0 !important;
  box-shadow: 0 1px 3px rgba(0,0,0,.06);
  background: rgba(255,255,255,.92) !important;
  backdrop-filter: blur(4px);
  white-space: nowrap;
}
.layout-btn:hover { background: #fff !important; }
.btn-primary.layout-btn {
  background: #1e293b !important;
  color: #f8fafc !important;
  border-color: #1e293b !important;
}

/* ── Sidebar legend card ───────────────────────────────── */
.sidebar-legend-card {
  background: #f1f5f9;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  padding: 10px 12px 12px 12px;
  margin-top: 6px;
}

/* ── References accordion ──────────────────────────────── */
.references-accordion .accordion-item { border: none; }
.references-accordion .accordion-button {
  font-size: 11px; font-weight: 700;
  color: #64748b !important;
  text-transform: uppercase; letter-spacing: .07em;
  padding: 6px 0;
  background: transparent !important;
  box-shadow: none !important;
}
.references-accordion .accordion-button:not(.collapsed) { color: #1e293b !important; }
.references-accordion .accordion-body { padding: 6px 0 0 0; }
