/* ============================================================
   styles.css — clean, minimal, pedagogical look for the
   BFO / CCO Visualizer.
   ============================================================ */

:root {
  --bg: #ffffff;
  --grid: rgba(0, 0, 0, 0.035); /* very faint grid lines */
  --ink: #1f2430;               /* primary text */
  --ink-soft: #5b6472;          /* secondary text */
  --line: #e7e9ee;              /* hairline borders */
  --accent: #6c8cff;            /* subtle brand accent */
  --focus-ring: rgba(108, 140, 255, 0.35);
  --panel-shadow: 0 10px 40px rgba(20, 30, 60, 0.12);
  --radius: 12px;
  --font: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  height: 100%;
  font-family: var(--font);
  color: var(--ink);
  background: var(--bg);
  overflow: hidden;
}

/* ---------- Top bar ---------- */
#topbar {
  position: relative;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 10px 18px;
  background: rgba(255, 255, 255, 0.9);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--line);
}

.topbar-left {
  display: flex;
  align-items: center;
  gap: 18px;
  min-width: 0;
}

.brand {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 700;
  font-size: 15px;
  white-space: nowrap;
}

.brand-dot {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: radial-gradient(circle at 30% 30%, #aec6ff, #6c8cff);
}

/* Breadcrumbs */
#breadcrumbs {
  display: flex;
  align-items: center;
  flex-wrap: nowrap;
  overflow-x: auto;
  gap: 2px;
  min-width: 0;
  scrollbar-width: thin;
}

#breadcrumbs .crumb {
  border: none;
  background: none;
  font-family: inherit;
  font-size: 13px;
  color: var(--ink-soft);
  padding: 4px 8px;
  border-radius: 8px;
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.15s, color 0.15s;
}

#breadcrumbs .crumb:hover {
  background: #f2f4fa;
  color: var(--ink);
}

#breadcrumbs .crumb.current {
  color: var(--ink);
  font-weight: 600;
}

#breadcrumbs .sep {
  color: #c2c8d4;
  font-size: 12px;
  user-select: none;
}

/* Top bar right cluster */
.topbar-right {
  display: flex;
  align-items: center;
  gap: 10px;
}

/* Search */
.search-wrap {
  position: relative;
}

#search-input {
  width: 200px;
  padding: 7px 12px;
  font-family: inherit;
  font-size: 13px;
  color: var(--ink);
  background: #f6f7fb;
  border: 1px solid var(--line);
  border-radius: 20px;
  outline: none;
  transition: width 0.2s, box-shadow 0.15s, background 0.15s;
}

#search-input:focus {
  width: 240px;
  background: #fff;
  box-shadow: 0 0 0 4px var(--focus-ring);
}

#search-results {
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  width: 320px;
  max-height: 360px;
  overflow-y: auto;
  margin: 0;
  padding: 6px;
  list-style: none;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--panel-shadow);
  z-index: 40;
}

#search-results li {
  padding: 8px 10px;
  border-radius: 8px;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

#search-results li:hover,
#search-results li.active {
  background: #f2f4fa;
}

#search-results .res-label {
  font-size: 13px;
  font-weight: 500;
}

#search-results .res-meta {
  font-size: 11px;
  color: var(--ink-soft);
}

#search-results .res-label mark {
  background: #fff1ad;
  border-radius: 3px;
  padding: 0 1px;
}

#search-results .empty {
  padding: 10px;
  font-size: 13px;
  color: var(--ink-soft);
  cursor: default;
}

/* Toggle (BFO only / BFO + CCO) */
.toggle {
  display: inline-flex;
  background: #f0f2f8;
  border-radius: 20px;
  padding: 3px;
}

.toggle button {
  border: none;
  background: none;
  font-family: inherit;
  font-size: 12.5px;
  font-weight: 500;
  color: var(--ink-soft);
  padding: 5px 12px;
  border-radius: 16px;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
}

.toggle button.active {
  background: #fff;
  color: var(--ink);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

/* Generic icon-ish buttons */
.icon-btn {
  border: 1px solid var(--line);
  background: #fff;
  font-family: inherit;
  font-size: 12.5px;
  font-weight: 500;
  color: var(--ink-soft);
  padding: 6px 12px;
  border-radius: 18px;
  cursor: pointer;
  transition: background 0.15s, color 0.15s, border-color 0.15s;
}

.icon-btn:hover {
  background: #f6f7fb;
  color: var(--ink);
  border-color: #d7dbe6;
}

/* ---------- Stage ---------- */
#stage {
  position: absolute;
  inset: 56px 0 0 0; /* below top bar */
  /* very faint grid */
  background-color: var(--bg);
  background-image: linear-gradient(var(--grid) 1px, transparent 1px),
    linear-gradient(90deg, var(--grid) 1px, transparent 1px);
  background-size: 40px 40px;
}

#focus-display {
  position: absolute;
  top: 18px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 10;
  display: flex;
  align-items: center;
  gap: 10px;
  pointer-events: none;
}

#focus-name {
  font-size: 22px;
  font-weight: 700;
  letter-spacing: -0.01em;
  text-transform: capitalize;
}

.source-badge {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.04em;
  padding: 3px 8px;
  border-radius: 10px;
  background: #eef1fb;
  color: #5566b8;
}

.source-badge.cco {
  background: #f3ecff;
  color: #8257c5;
}

#viz {
  display: block;
  width: 100%;
  height: 100%;
  cursor: grab;
}

#viz:active {
  cursor: grabbing;
}

/* Circle + label styling lives mostly inline via D3, but base rules here */
#viz circle {
  cursor: pointer;
  transition: filter 0.15s;
}

#viz circle.hover {
  filter: drop-shadow(0 5px 14px rgba(70, 90, 170, 0.28));
}

#viz .node-label {
  font-family: var(--font);
  font-weight: 500;
  fill: #2b313d;
  text-anchor: middle;
  pointer-events: none;
  text-transform: capitalize;
}

#viz .cco-badge {
  font-family: var(--font);
  font-weight: 700;
  fill: #8257c5;
  text-anchor: middle;
  pointer-events: none;
}

#hint {
  position: absolute;
  bottom: 14px;
  left: 50%;
  transform: translateX(-50%);
  font-size: 12px;
  color: var(--ink-soft);
  background: rgba(255, 255, 255, 0.75);
  padding: 5px 12px;
  border-radius: 14px;
  pointer-events: none;
}

/* ---------- Tooltip ---------- */
#tooltip {
  position: absolute;
  z-index: 30;
  pointer-events: none;
  background: #1f2430;
  color: #fff;
  font-size: 12px;
  padding: 6px 10px;
  border-radius: 8px;
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.25);
  transform: translate(-50%, -130%);
  white-space: nowrap;
}

#tooltip .tip-source {
  opacity: 0.7;
  margin-left: 6px;
}

/* ---------- Info panel ---------- */
#info-panel {
  position: absolute;
  top: 56px;
  right: 0;
  bottom: 0;
  width: 360px;
  z-index: 25;
  background: #fff;
  border-left: 1px solid var(--line);
  box-shadow: var(--panel-shadow);
  padding: 22px 22px 30px;
  overflow-y: auto;
  animation: slidein 0.18s ease;
}

@keyframes slidein {
  from {
    transform: translateX(20px);
    opacity: 0;
  }
  to {
    transform: translateX(0);
    opacity: 1;
  }
}

#info-close {
  position: absolute;
  top: 14px;
  right: 14px;
  padding: 4px 9px;
}

#info-content h2 {
  margin: 0 6px 4px 0;
  font-size: 20px;
  text-transform: capitalize;
  padding-right: 30px;
}

.info-section {
  margin-top: 18px;
}

.info-section h3 {
  margin: 0 0 6px;
  font-size: 11px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--ink-soft);
}

.info-section p,
.info-section li {
  font-size: 13.5px;
  line-height: 1.5;
  color: var(--ink);
}

.info-section ul {
  margin: 0;
  padding-left: 18px;
}

.info-id {
  font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  font-size: 12px;
  color: var(--ink-soft);
  word-break: break-all;
}

.info-link {
  color: var(--accent);
  text-decoration: none;
}

.info-link:hover {
  text-decoration: underline;
}

.chip {
  display: inline-block;
  font-size: 12.5px;
  padding: 4px 10px;
  margin: 0 6px 6px 0;
  border-radius: 14px;
  background: #f2f4fa;
  color: var(--ink);
  cursor: pointer;
  border: 1px solid var(--line);
  transition: background 0.15s;
  text-transform: capitalize;
}

.chip:hover {
  background: #e6ebff;
}

.restriction {
  font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  font-size: 12px;
}
