/* ============================================================
   THE JAAL — graph-style.css
   Fullscreen Graph Explorer Page
   ============================================================ */

:root {
  --bg:          #050816;
  --bg-2:        #080d1e;
  --bg-card:     #0c1228;
  --blue:        #2563EB;
  --cyan:        #06B6D4;
  --purple:      #8B5CF6;
  --amber:       #F59E0B;
  --text:        #94A3B8;
  --text-bright: #FFFFFF;
  --text-mid:    #CBD5E1;
  --border:      rgba(255,255,255,0.07);
  --border-mid:  rgba(255,255,255,0.12);
  --font-serif:  'DM Serif Display', Georgia, serif;
  --font-sans:   'DM Sans', system-ui, sans-serif;
  --font-mono:   'DM Mono', monospace;
  --topbar-h:    56px;
  --filter-h:    44px;
  --panel-w:     300px;
  --ease-out:    cubic-bezier(0.16, 1, 0.3, 1);
}

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

html, body {
  width: 100%; height: 100%;
  overflow: hidden;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-sans);
  -webkit-font-smoothing: antialiased;
}

a { color: inherit; text-decoration: none; }
button { border: none; background: none; cursor: pointer; font-family: inherit; }
canvas { display: block; }

/* ══════════════════════════════════════════════════════════════
   TOPBAR
══════════════════════════════════════════════════════════════ */
.topbar {
  position: fixed;
  top: 0; left: 0; right: 0;
  height: var(--topbar-h);
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0 1.25rem;
  background: rgba(5,8,22,0.92);
  backdrop-filter: blur(20px);
  border-bottom: 1px solid var(--border);
}

/* Left */
.topbar__left {
  display: flex;
  align-items: center;
  gap: 0.9rem;
  flex-shrink: 0;
  min-width: 0;
}

.topbar__back {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  font-family: var(--font-mono);
  font-size: 0.68rem;
  letter-spacing: 0.1em;
  color: var(--text);
  padding: 0.35rem 0.75rem;
  border: 1px solid var(--border-mid);
  border-radius: 6px;
  white-space: nowrap;
  flex-shrink: 0;
  transition: color 0.2s, border-color 0.2s, background 0.2s;
}
.topbar__back:hover {
  color: var(--text-bright);
  border-color: rgba(255,255,255,0.2);
  background: rgba(255,255,255,0.04);
}

.topbar__divider {
  width: 1px; height: 24px;
  background: var(--border-mid);
  flex-shrink: 0;
}

.topbar__person {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  min-width: 0;
}

.topbar__avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--blue), var(--cyan));
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-serif);
  font-size: 0.85rem;
  color: #fff;
  flex-shrink: 0;
  border: 1px solid rgba(255,255,255,0.1);
  overflow: hidden; /* THIS was missing */
}

.topbar__avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.topbar__name {
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--text-bright);
  line-height: 1.2;
  white-space: nowrap;
}
.topbar__sub {
  font-family: var(--font-mono);
  font-size: 0.56rem;
  letter-spacing: 0.1em;
  color: var(--text);
  font-weight: 300;
}

/* Center */
.topbar__center {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  letter-spacing: 0.14em;
  color: var(--text);
  display: flex;
  align-items: center;
  gap: 0.4rem;
  flex-shrink: 0;
}
.topbar__logo-bracket { color: var(--blue); }
.topbar__sep          { color: var(--border-mid); }
.topbar__page         { color: var(--text-mid); }

/* Right */
.topbar__right {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-shrink: 0;
}

.topbar__search {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  background: rgba(255,255,255,0.04);
  border: 1px solid var(--border-mid);
  border-radius: 7px;
  padding: 0.35rem 0.8rem;
  color: var(--text);
  width: 180px;
  transition: border-color 0.2s;
}
.topbar__search:focus-within {
  border-color: rgba(37,99,235,0.5);
}
.topbar__search input {
  flex: 1; background: none; border: none; outline: none;
  color: var(--text-bright); font-family: var(--font-sans); font-size: 0.8rem;
}
.topbar__search input::placeholder { color: var(--text); }

.topbar__zoom {
  display: flex;
  align-items: center;
  gap: 0.3rem;
  background: rgba(255,255,255,0.04);
  border: 1px solid var(--border-mid);
  border-radius: 7px;
  padding: 0.2rem 0.4rem;
}

.ctrl-btn {
  width: 26px; height: 26px;
  display: flex; align-items: center; justify-content: center;
  font-size: 1rem;
  color: var(--text-mid);
  border-radius: 5px;
  transition: color 0.2s, background 0.2s;
  line-height: 1;
}
.ctrl-btn:hover {
  color: var(--text-bright);
  background: rgba(255,255,255,0.07);
}

.ctrl-scale {
  font-family: var(--font-mono);
  font-size: 0.65rem;
  letter-spacing: 0.06em;
  color: var(--text);
  min-width: 40px;
  text-align: center;
  user-select: none;
}

/* ══════════════════════════════════════════════════════════════
   FILTER BAR
══════════════════════════════════════════════════════════════ */
.filterbar {
  position: fixed;
  top: var(--topbar-h);
  left: 0; right: 0;
  height: var(--filter-h);
  z-index: 90;
  background: rgba(5,8,22,0.82);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
}

.filterbar__inner {
  display: flex;
  align-items: center;
  gap: 1rem;
  height: 100%;
  padding: 0 1.25rem;
  overflow-x: auto;
  scrollbar-width: none;
}
.filterbar__inner::-webkit-scrollbar { display: none; }

.filterbar__label {
  font-family: var(--font-mono);
  font-size: 0.6rem;
  letter-spacing: 0.14em;
  color: var(--text);
  text-transform: uppercase;
  white-space: nowrap;
  flex-shrink: 0;
}

.filterbar__pills {
  display: flex;
  gap: 0.4rem;
  flex-shrink: 0;
}

.fpill {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  font-family: var(--font-mono);
  font-size: 0.6rem;
  letter-spacing: 0.08em;
  color: var(--text);
  padding: 0.28rem 0.75rem;
  border: 1px solid var(--border-mid);
  border-radius: 100px;
  background: rgba(255,255,255,0.03);
  white-space: nowrap;
  cursor: pointer;
  transition: color 0.2s, border-color 0.2s, background 0.2s;
}
.fpill__dot {
  width: 6px; height: 6px;
  border-radius: 50%;
  flex-shrink: 0;
}
.fpill.active, .fpill:hover {
  color: var(--text-bright);
  border-color: rgba(37,99,235,0.45);
  background: rgba(37,99,235,0.1);
}

.filterbar__legend {
  display: flex;
  gap: 1rem;
  margin-left: auto;
  flex-shrink: 0;
}
.fleg {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  font-family: var(--font-mono);
  font-size: 0.56rem;
  letter-spacing: 0.08em;
  color: var(--text);
  white-space: nowrap;
}
.fleg__dot {
  width: 7px; height: 7px;
  border-radius: 50%;
  flex-shrink: 0;
}

/* ══════════════════════════════════════════════════════════════
   MAIN CANVAS
══════════════════════════════════════════════════════════════ */
.graph-main {
  position: fixed;
  top: calc(var(--topbar-h) + var(--filter-h));
  left: 0;
  right: var(--panel-w);
  bottom: 0;
  overflow: hidden;
  transition: right 0.35s var(--ease-out);
}

body.panel-hidden .graph-main { right: 0; }

#graphCanvas {
  width: 100%;
  height: 100%;
  cursor: grab;
  display: block;
}
#graphCanvas:active { cursor: grabbing; }

/* Hint */
.graph-hint {
  position: absolute;
  bottom: 1.5rem;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-family: var(--font-mono);
  font-size: 0.6rem;
  letter-spacing: 0.1em;
  color: var(--text);
  background: rgba(5,8,22,0.8);
  border: 1px solid var(--border);
  padding: 0.5rem 1rem;
  border-radius: 100px;
  pointer-events: none;
  white-space: nowrap;
  opacity: 1;
  transition: opacity 0.6s ease;
}
.graph-hint.hidden { opacity: 0; }

/* ══════════════════════════════════════════════════════════════
   DETAIL PANEL (desktop right sidebar)
══════════════════════════════════════════════════════════════ */
.detail-panel {
  position: fixed;
  top: calc(var(--topbar-h) + var(--filter-h));
  right: 0; bottom: 0;
  width: var(--panel-w);
  background: var(--bg-card);
  border-left: 1px solid var(--border-mid);
  display: flex;
  flex-direction: column;
  padding: 1.5rem 1.25rem;
  overflow-y: auto;
  z-index: 80;
  transform: translateX(100%);
  transition: transform 0.35s var(--ease-out);
  scrollbar-width: thin;
  scrollbar-color: rgba(255,255,255,0.1) transparent;
  gap: 0;
}
.detail-panel.open { transform: translateX(0); }

.detail-panel__close {
  position: absolute;
  top: 1rem; right: 1rem;
  width: 28px; height: 28px;
  border: 1px solid var(--border-mid);
  border-radius: 50%;
  color: var(--text);
  display: flex; align-items: center; justify-content: center;
  transition: color 0.2s, border-color 0.2s;
  cursor: pointer;
}
.detail-panel__close:hover { color: var(--text-bright); border-color: rgba(255,255,255,0.22); }

.dp-head {
  display: flex;
  align-items: flex-start;
  gap: 0.9rem;
  margin-bottom: 1.5rem;
  padding-right: 1.5rem;
}
.dp-avatar {
  width: 48px; height: 48px;
  border-radius: 10px;
  background: linear-gradient(135deg, var(--blue), var(--cyan));
  display: flex; align-items: center; justify-content: center;
  font-family: var(--font-serif);
  font-size: 1.1rem;
  color: #fff;
  flex-shrink: 0;
  border: 1px solid rgba(255,255,255,0.1);
}
.dp-badge {
  font-family: var(--font-mono);
  font-size: 0.56rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--cyan);
  margin-bottom: 0.3rem;
  font-weight: 300;
}
.dp-name {
  font-family: var(--font-serif);
  font-size: 1.2rem;
  font-weight: 400;
  color: var(--text-bright);
  line-height: 1.2;
  margin-bottom: 0.2rem;
}
.dp-sub {
  font-size: 0.78rem;
  color: var(--text);
  font-weight: 300;
  line-height: 1.4;
}

.dp-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.6rem 0;
  border-bottom: 1px solid var(--border);
}
.dp-row__label {
  font-family: var(--font-mono);
  font-size: 0.6rem;
  letter-spacing: 0.1em;
  color: var(--text);
  text-transform: uppercase;
  font-weight: 300;
}
.dp-row__val {
  font-size: 0.82rem;
  color: var(--text-mid);
  font-weight: 500;
}

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

.dp-section-label {
  font-family: var(--font-mono);
  font-size: 0.6rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--cyan);
  margin-bottom: 0.75rem;
  font-weight: 300;
}

.dp-conn-list {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  margin-bottom: 0.5rem;
}
.dp-conn-item {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.5rem 0.7rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: rgba(255,255,255,0.02);
  cursor: pointer;
  transition: border-color 0.2s, background 0.2s;
}
.dp-conn-item:hover {
  border-color: rgba(37,99,235,0.35);
  background: rgba(37,99,235,0.07);
}
.dp-conn-dot { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; }
.dp-conn-name { font-size: 0.82rem; color: var(--text-mid); flex: 1; }
.dp-conn-arrow { font-size: 0.7rem; color: var(--text); }

.dp-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.75rem;
  background: var(--blue);
  color: #fff;
  font-family: var(--font-sans);
  font-size: 0.82rem;
  font-weight: 500;
  border-radius: 8px;
  margin-top: auto;
  transition: background 0.2s;
}
.dp-btn:hover { background: #1d4ed8; }

/* ══════════════════════════════════════════════════════════════
   MOBILE BOTTOM SHEET
══════════════════════════════════════════════════════════════ */
.sheet {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 200;
  pointer-events: none;
}
.sheet.open { pointer-events: auto; }

.sheet__backdrop {
  position: absolute; inset: 0;
  background: rgba(5,8,22,0.65);
  backdrop-filter: blur(4px);
  opacity: 0;
  transition: opacity 0.3s ease;
}
.sheet.open .sheet__backdrop { opacity: 1; }

.sheet__panel {
  position: absolute;
  bottom: 0; left: 0; right: 0;
  background: #0a1020;
  border: 1px solid var(--border-mid);
  border-bottom: none;
  border-radius: 20px 20px 0 0;
  padding: 0.6rem 1.5rem 2.5rem;
  max-height: 80vh;
  overflow-y: auto;
  transform: translateY(100%);
  transition: transform 0.35s var(--ease-out);
}
.sheet.open .sheet__panel { transform: translateY(0); }

.sheet__handle {
  width: 40px; height: 4px;
  background: rgba(255,255,255,0.15);
  border-radius: 2px;
  margin: 0 auto 1.25rem;
}
.sheet__close {
  position: absolute; top: 1rem; right: 1.25rem;
  width: 28px; height: 28px;
  border: 1px solid var(--border-mid); border-radius: 50%;
  color: var(--text); font-size: 0.75rem;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer;
  transition: color 0.2s;
}
.sheet__close:hover { color: var(--text-bright); }

.sheet__head {
  display: flex; align-items: flex-start; gap: 1rem; margin-bottom: 1.25rem;
}
.sheet__avatar {
  width: 48px; height: 48px; border-radius: 10px;
  background: linear-gradient(135deg, var(--blue), var(--cyan));
  display: flex; align-items: center; justify-content: center;
  font-family: var(--font-serif); font-size: 1.1rem; color: #fff;
  flex-shrink: 0; border: 1px solid rgba(255,255,255,0.1);
}
.sheet__badge {
  font-family: var(--font-mono); font-size: 0.58rem;
  letter-spacing: 0.14em; text-transform: uppercase;
  color: var(--cyan); margin-bottom: 0.25rem; font-weight: 300;
}
.sheet__name {
  font-family: var(--font-serif); font-size: 1.3rem;
  font-weight: 400; color: var(--text-bright); line-height: 1.2; margin-bottom: 0.2rem;
}
.sheet__sub { font-size: 0.85rem; color: var(--text); font-weight: 300; }

.sheet__rows { margin-bottom: 1rem; }
.sheet__row {
  display: flex; justify-content: space-between; align-items: center;
  padding: 0.55rem 0; border-bottom: 1px solid var(--border);
}
.sheet__row-label {
  font-family: var(--font-mono); font-size: 0.6rem;
  letter-spacing: 0.1em; color: var(--text); text-transform: uppercase; font-weight: 300;
}
.sheet__row-val { font-size: 0.82rem; color: var(--text-mid); font-weight: 500; }

.sheet__btn {
  display: block; width: 100%; text-align: center;
  padding: 0.85rem; background: var(--blue); color: #fff;
  font-family: var(--font-sans); font-size: 0.9rem; font-weight: 500;
  border-radius: 10px; margin-top: 1.25rem;
  transition: background 0.2s;
}
.sheet__btn:hover { background: #1d4ed8; }

/* ══════════════════════════════════════════════════════════════
   RESPONSIVE
══════════════════════════════════════════════════════════════ */
@media (max-width: 900px) {
  :root { --panel-w: 0px; }
  .detail-panel { display: none; }
  .sheet        { display: block; }
  .graph-main   { right: 0 !important; }
  .topbar__center  { display: none; }
  .topbar__search  { width: 140px; }
  .filterbar__legend { display: none; }
}

@media (max-width: 600px) {
  .topbar { padding: 0 0.85rem; gap: 0.6rem; }
  .topbar__back span { display: none; }
  .topbar__sub    { display: none; }
  .topbar__search { width: 120px; }
  .topbar__zoom   { display: none; }
  .filterbar__inner { padding: 0 0.85rem; gap: 0.6rem; }
}
