/* =========================
   GLOBAL RESET
========================= */
*,
*::before,
*::after {
  box-sizing: border-box;
}

/* =========================
   PAGE WRAPPER
========================= */
.cc-wrap {
  height: 92vh;
  padding: 20px;
  background: #000;
  font-family: 'Orbitron', sans-serif;

  display: flex;
  flex-direction: column;
  overflow: hidden; /* 🔑 prevent body scroll bleed */
}

.cc-title {
  font-size: 1.8em;
  margin-bottom: 15px;
}

.glow-text {
  color: var(--tron-cyan);
  text-shadow: 0 0 10px rgba(0,255,255,0.45);
}

/* =========================
   GRID LAYOUT
========================= */
.cc-grid {
  flex: 1;
  min-height: 0; /* 🔑 REQUIRED for scrolling children */

  display: grid;
  grid-template-columns: 240px minmax(0, 1fr) 460px;
  gap: 15px;

  overflow: hidden; /* 🔑 IMPORTANT */
}

/* =========================
   LEFT COLUMN
========================= */
.cc-left {
  min-height: 0;
  overflow-y: auto;

  display: flex;
  flex-direction: column;
  gap: 10px;
  padding-right: 6px;
}

/* =========================
   CENTER VIEWPORT
========================= */
.cc-center {
  min-height: 0;
  overflow: hidden;
}

.cc-viewport {
  position: relative;
  width: 100%;
  height: 100%;

  border: 2px solid var(--tron-cyan);
  background: radial-gradient(circle, #001a1a 0%, #000 100%);
}

.viewport {
  width: 100%;
  height: 100%;
}

/* =========================
   RIGHT COLUMN (SCROLL ROOT)
========================= */
.cc-right {
  min-height: 0;
  overflow-y: auto;
  overflow-x: hidden;

  display: flex;
  flex-direction: column;
  gap: 14px;

  padding: 12px 10px;
  border-right: 3px solid var(--tron-yellow);
}

/* =========================
   GLASS PANELS
========================= */
.glass-panel {
  background: rgba(0,20,20,0.26);
  border: 1px solid rgba(0,255,255,0.10);
  border-radius: 14px;
}

/* =========================
   RESULT CARDS
========================= */
.result-card {
  cursor: pointer;
  padding: 14px;
  background: #070707;
  border-left: 4px solid var(--tron-cyan);
  border-radius: 10px;
}

.result-card:hover {
  background: #0f0f0f;
  border-left-color: var(--tron-yellow);
}

.result-card.sdf-missing {
  cursor: default;
  border-left-color: #ff5252;
  opacity: 0.72;
}

.artifact-warning {
  margin-top: 10px;
  padding: 8px 10px;
  border: 1px solid rgba(255, 82, 82, 0.45);
  color: #ffb3b3;
  background: rgba(80, 0, 0, 0.34);
  font-family: monospace;
  font-size: 0.72rem;
  line-height: 1.25;
}

.result-card-top {
  display: flex;
  justify-content: space-between;
  font-size: 0.7em;
  color: var(--tron-cyan);
}

.exp-chip {
  color: var(--tron-yellow);
}

/* =========================
   HUD
========================= */
/* HUD container */
.hud {
  position: absolute;
  top: 12px;
  left: 12px;
  padding: 8px 10px;
  font-size: 0.72rem;        /* ⬅ smaller text */
  line-height: 1.25;
  max-width: 320px;
  background: rgba(0, 0, 0, 0.55);
  border-radius: 8px;
  pointer-events: none;      /* keeps NGL interaction clean */
}

/* Individual rows */
.hud div {
  margin-bottom: 3px;
  white-space: nowrap;
}

.hud div:last-child {
  margin-bottom: 0;
}


.hud-toggle {
  position: absolute;
  top: 4px;
  right: 6px;

  font-size: 0.75rem;
  font-weight: 700;

  background: transparent;
  border: 1px solid var(--tron-cyan);
  border-radius: 6px;

  color: var(--tron-yellow);                /* GOLD arrow */
  text-shadow:
    0 0 2px var(--tron-cyan),
    0 0 6px rgba(0, 217, 255, 0.65);          /* CYAN glow */

  padding: 2px 6px;
  cursor: pointer;
  pointer-events: auto;

  transition: all 0.2s ease;
}

.hud-toggle:hover {
  background: rgba(255, 215, 0, 0.08);
  box-shadow:
    0 0 6px rgba(0, 217, 255, 0.6),
    inset 0 0 4px rgba(255, 215, 0, 0.4);
}


.hud.collapsed #hud-content {
  display: none;
}

.hud.collapsed {
  padding: 4px 6px;
  width: auto;
}

#hud-content {
  transition: max-height 0.25s ease, opacity 0.2s ease;
  max-height: 300px;
  opacity: 1;
}

.hud.collapsed #hud-content {
  max-height: 0;
  opacity: 0;
  overflow: hidden;
}


/* =========================
   MINI PANELS (RIGHT SIDE)
========================= */
.mini-panel {
  background: rgba(0,0,0,0.35);
  border: 1px solid rgba(0,255,255,0.10);
  border-radius: 14px;
  padding: 12px;

  /* 🔑 DO NOT CLIP HEIGHT */
  overflow: visible;
}

/* =========================
   LEGEND
========================= */
.legend-row {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 0.66em;
  color: #aebbc7;
}

.swatch {
  width: 10px;
  height: 10px;
  border-radius: 3px;
}

/* =========================
   MAP PANEL (SCROLLS WITH COLUMN)
========================= */
.map-panel {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.map-scroll {
  width: 100%;
  height: auto;

  /* NO INTERNAL SCROLL */
  overflow: visible;

  border-radius: 12px;
  border: 1px solid rgba(0,255,255,0.10);
  background: #020607;
}

.map-img {
  display: block;
  width: 100%;
  height: auto;
  background: #020607;
}

/* Optional zoom mode */
.map-scroll.zoomed {
  max-height: 70vh;
  overflow: auto;
}

.map-scroll.zoomed .map-img {
  width: auto;
  transform: scale(1.9);
  transform-origin: top left;
}

/* =========================
   SMILES
========================= */
/* ============================
   SMILES VISIBILITY FIX
   ============================ */

.smiles-box {
  font-size: 0.95rem;          /* ⬆ MUCH larger */
  line-height: 1.45;
  letter-spacing: 0.02em;
  word-break: break-all;       /* allow wrapping */
  white-space: normal;         /* allow multi-line */
  padding: 10px 12px;
  border-radius: 6px;
  background: rgba(0, 0, 0, 0.55);
  border: 1px solid rgba(255, 214, 0, 0.35);
  box-shadow: inset 0 0 10px rgba(255, 214, 0, 0.15);
}

/* Optional: monospace feel for chemistry */
.smiles-box span {
  font-family: "JetBrains Mono", "Consolas", monospace;
}


/* =========================
   PROPERTIES
========================= */
.props-list {
  list-style: none;
  padding: 0;
  margin: 10px 0 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.prop-row {
  display: flex;
  align-items: center;
  justify-content: space-between;

  flex-wrap: wrap;          /* 🔑 allow wrapping */
  row-gap: 6px;             /* 🔑 vertical spacing between rows */
  column-gap: 8px;          /* horizontal spacing */

  padding: 10px 12px;
  border-radius: 12px;
  background: rgba(0,0,0,0.28);
}


/* =========================
   QED BAR
========================= */
.qed-bar-bg {
  height: 10px;
  border-radius: 999px;
  background: rgba(255,255,255,0.08);
  overflow: hidden;
}

.qed-bar-fill {
  height: 100%;
  width: 0%;
  transition: width 180ms ease;
}

.rules {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(80px, 1fr));
  gap: 8px;
  justify-content: center;
}

.rules > * {
  justify-self: center;      /* 🔑 centers each chip */
}


.ligand-metrics-yellow{
  margin-top: 8px;
  font-size: 0.92em;
  line-height: 1.25em;
  color: var(--tron-yellow);
  opacity: 0.95;
}
.muted{ opacity: 0.75; font-size: 0.9em; }

/* ---- METRICS BLOCK (CARD HUD) ---- */
.ligand-metrics{
  margin-top: 10px;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.metric{
  padding: 10px 12px;
  border-radius: 12px;
  background: rgba(0,0,0,0.42);
  border: 1px solid rgba(0,255,255,0.12);
  box-shadow: inset 0 0 12px rgba(0,217,255,0.06);
}

.metric-label{
  font-size: 0.62rem;
  letter-spacing: 0.10em;
  text-transform: uppercase;
  color: rgba(0,217,255,0.85);
  margin-bottom: 6px;
}

.metric-value{
  display: flex;
  align-items: baseline;
  gap: 6px;
  font-family: "JetBrains Mono", "Consolas", monospace;
  font-variant-numeric: tabular-nums;
}

.metric-main{
  font-size: 1.05rem;
  font-weight: 800;
  color: var(--tron-yellow);
  text-shadow: 0 0 8px rgba(255,215,0,0.15);
}

.metric-sub{
  font-size: 0.85rem;
  opacity: 0.75;
  color: rgba(255,215,0,0.9);
}

.metric-unit{
  font-size: 0.78rem;
  opacity: 0.75;
  color: rgba(255,215,0,0.9);
}

.metric-wide{
  grid-column: 1 / -1;
  display: flex;
  justify-content: space-between;
  align-items: baseline;
}

/* progress bar uses CSS var --p */
.metric-bar{
  margin-top: 8px;
  height: 7px;
  border-radius: 999px;
  background: rgba(255,255,255,0.08);
  overflow: hidden;
}

.metric-bar span{
  display: block;
  height: 100%;
  width: var(--p, 0%);
  background: rgba(255,215,0,0.85);
  box-shadow: 0 0 10px rgba(255,215,0,0.25);
}


/* =========================
   % EXPOSED VISIBILITY BOOST
   (Result card header + badge)
========================= */

.result-card-top{
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;

  /* make it a “header strip” */
  padding: 6px 8px;
  margin: -6px -6px 10px;         /* pulls strip outward inside the card */
  border-radius: 10px;

  font-size: 0.74rem;             /* slightly larger than before */
  letter-spacing: 0.06em;
  text-transform: uppercase;

  color: rgba(0,217,255,0.92);    /* tron-cyan-ish */
  background: rgba(0,0,0,0.55);
  border: 1px solid rgba(0,255,255,0.14);
  box-shadow: inset 0 0 14px rgba(0,217,255,0.08);
}

.result-card-top span:first-child{
  /* prevent the left text from squashing the badge */
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: calc(100% - 150px);
}

/* the actual “% EXPOSED” badge */
.exp-chip{
  display: inline-flex;
  align-items: center;
  gap: 8px;

  padding: 5px 10px;
  border-radius: 999px;

  font-weight: 900;
  font-size: 0.76rem;
  letter-spacing: 0.08em;
  white-space: nowrap;

  color: var(--tron-yellow);
  background: rgba(0,0,0,0.70);
  border: 1px solid rgba(255,214,0,0.55);

  box-shadow:
    0 0 10px rgba(255,214,0,0.18),
    inset 0 0 10px rgba(0,217,255,0.08);

  text-shadow:
    0 0 10px rgba(255,214,0,0.35),
    0 0 2px rgba(0,217,255,0.20);
}

/* optional little “status dot” so the eye catches it instantly */
.exp-chip::before{
  content: "";
  width: 8px;
  height: 8px;
  border-radius: 3px;
  background: rgba(255,214,0,0.95);
  box-shadow: 0 0 10px rgba(255,214,0,0.55);
}

/* If your <h3> has default margins, keep spacing tight/consistent */
.result-card-title{
  margin-top: 0;
}

/* =========================
   (Optional) HUD % EXPOSED visibility too
========================= */
#hud-exp{
  display: inline-block;
  padding: 3px 8px;
  border-radius: 8px;

  color: var(--tron-yellow);
  font-weight: 900;
  letter-spacing: 0.06em;

  background: rgba(0,0,0,0.55);
  border: 1px solid rgba(255,214,0,0.35);
  text-shadow: 0 0 10px rgba(255,214,0,0.30);
}

.hud{
  z-index: 5; /* make sure it stays above the protein surface */
}

/* =========================
   CARD TOP: keep badge + keep PDB/CHAIN visible
========================= */

/* switch to grid so left text always gets a real column */
.result-card-top{
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto; /* left can shrink + wrap, right stays tight */
  align-items: center;
  column-gap: 10px;
}

/* override the truncation rule that was killing the left label */
.result-card-top span:first-child{
  max-width: none;            /* <-- remove calc(100% - 150px) behavior */
  white-space: normal;        /* allow wrap */
  overflow: hidden;

  /* clean 2-line clamp so it never looks messy */
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;

  line-height: 1.15;
}

/* keep the badge pinned right */
.exp-chip{
  justify-self: end;
  white-space: nowrap;
}


/* =========================
   CARD TOP: 2-row header
   Row 1: PDB/CHAIN
   Row 2: % EXPOSED
========================= */

.result-card-top{
  display: flex;
  flex-direction: column;
  gap: 6px;

  padding: 8px 10px;
  margin: -6px -6px 10px;       /* keeps the “header strip” effect */
  border-radius: 10px;

  background: rgba(0,0,0,0.55);
  border: 1px solid rgba(0,255,255,0.14);
  box-shadow: inset 0 0 14px rgba(0,217,255,0.08);
}

.card-top-row{
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

/* Row 1: PDB/CHAIN label (allow wrap, never disappear) */
.pdb-chip{
  font-size: 0.74rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: rgba(0,217,255,0.92);

  /* wrapping rules */
  white-space: normal;
  overflow-wrap: anywhere;
  line-height: 1.15;
}

/* Row 2: keep your badge styling, but align nicely on its own row */
.exp-row{
  justify-content: flex-start;
}

/* if you already have .exp-chip styles, keep them — this only tweaks spacing */
.exp-chip{
  align-self: flex-start;
  white-space: nowrap;
}


/* =========================
   LIGAND 3-letter code pill
========================= */
.result-card-title{
  /* remove default h3 spacing */
  margin: 6px auto 10px;
  padding: 8px 14px;

  /* center within the card */
  width: fit-content;      /* pill hugs text */
  text-align: center;

  /* typography */
  font-size: 1.35rem;
  font-weight: 900;
  letter-spacing: 0.14em;
  text-transform: uppercase;

  /* colors */
  color: var(--tron-yellow);                 /* golden yellow */
  background: rgba(0,0,0,0.55);

  /* electric blue border + glow */
  border: 1px solid rgba(0,217,255,0.90);    /* electric blue */
  border-radius: 999px;
  box-shadow:
    0 0 10px rgba(0,217,255,0.25),
    inset 0 0 10px rgba(0,217,255,0.10);

  text-shadow:
    0 0 10px rgba(255,214,0,0.25);
}



[data-tooltip] {
  position: relative;
  cursor: help;
}

/* QED chip must be positioning context */
#qed-chip {
  position: relative;
}

/* Tooltip base (you already mostly have this) */
.qed-tooltip {
  position: absolute;
  bottom: calc(100% + 10px);
  left: 50%;
  transform: translateX(-50%) translateY(4px);

  min-width: 300px;
  max-width: 360px;

  background: rgba(10,10,10,0.95);
  border-radius: 10px;
  padding: 12px 14px;

  font-size: 12px;
  line-height: 1.45;
  font-family: system-ui, monospace;

  box-shadow: 0 12px 40px rgba(0,0,0,0.65);
  pointer-events: none;
  z-index: 5000;

  opacity: 0;
  transition: opacity 120ms ease, transform 120ms ease;
}

/* Show tooltip on hover */
#qed-chip:hover .qed-tooltip {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

/* Line colors */
.qed-line-poor     { color: #ff5252; }
.qed-line-moderate { color: #ffd600; }
.qed-line-good     { color: #00e676; }

.qed-title {
  font-weight: 700;
  color: #ffffff;
  margin-bottom: 6px;
}

.qed-muted {
  color: #aaa;
  margin-top: 8px;
}





#sasa-legend .legend-note{
  position: relative;
  margin-top: 8px;
  padding-left: 26px;
  color: rgba(127, 233, 255, 0.92);
  font-size: 12px;
  line-height: 1.25;
  letter-spacing: 0.06em;  /* more “sigil” feel */
  text-transform: uppercase;
  text-shadow: 0 0 10px rgba(127, 233, 255, 0.25);
}

#sasa-legend .legend-note::before{
  content: "❖";
  position: absolute;
  left: 0;
  top: 0;
  color: rgba(127, 233, 255, 0.95);
  text-shadow:
    0 0 12px rgba(127, 233, 255, 0.60),
    0 0 26px rgba(127, 233, 255, 0.25);
  transform: translateY(-1px) scale(1.05);
}

#sasa-legend{
  background: radial-gradient(circle at 20% 0%,
    rgba(127,233,255,0.08),
    rgba(0,0,0,0) 55%);
  box-shadow: 0 0 22px rgba(24, 138, 161, 0.972);
}




/* Protein name ONLY: 10s color + "electric border" cycling */
.protein-cycler{
  display:inline-block;
  font-weight: 900;
  letter-spacing: .06em;
  text-transform: uppercase;

  /* Smooth fade + glow animation */
  animation: proteinCycle 10s linear infinite;

  /* "electric border" feel (fallback via shadows) */
  -webkit-text-stroke: 1px rgba(0,0,0,.45); /* helps readability on bright glows */
  text-shadow:
    0 0 10px rgba(0,255,255,.25),
    0 0 18px rgba(0,255,255,.18);
}

/* Optional: make it feel alive */
@keyframes proteinCycle{
  /* 0–25%: yellow text with blue electric border */
  0%{
    color:#ffe600; /* electric yellow */
    -webkit-text-stroke-color: rgba(0,255,255,.85); /* electric blue border */
    text-shadow:
      0 0 2px rgba(0,255,255,.95),
      0 0 10px rgba(0,255,255,.85),
      0 0 22px rgba(0,255,255,.55),
      0 0 40px rgba(0,255,255,.25);
    opacity: .92;
  }

  12.5%{ opacity: 1; } /* subtle pulse mid-state */

  /* 25–50%: blue text with red electric border */
  25%{
    color:#00f6ff; /* electric blue/cyan */
    -webkit-text-stroke-color: rgba(255,60,60,.88); /* electric red border */
    text-shadow:
      0 0 2px rgba(255,60,60,.95),
      0 0 10px rgba(255,60,60,.80),
      0 0 22px rgba(255,60,60,.55),
      0 0 40px rgba(255,60,60,.25);
    opacity: .92;
  }

  37.5%{ opacity: 1; }

  /* 50–75%: red text with green electric border */
  50%{
    color:#ff3b3b; /* electric red */
    -webkit-text-stroke-color: rgba(0,255,120,.88); /* electric green border */
    text-shadow:
      0 0 2px rgba(0,255,120,.95),
      0 0 10px rgba(0,255,120,.80),
      0 0 22px rgba(0,255,120,.55),
      0 0 40px rgba(0,255,120,.25);
    opacity: .92;
  }

  62.5%{ opacity: 1; }

  /* 75–100%: green text with yellow electric border */
  75%{
    color:#00ff78; /* electric green */
    -webkit-text-stroke-color: rgba(255,230,0,.90); /* electric yellow border */
    text-shadow:
      0 0 2px rgba(255,230,0,.95),
      0 0 10px rgba(255,230,0,.80),
      0 0 22px rgba(255,230,0,.55),
      0 0 40px rgba(255,230,0,.25);
    opacity: .92;
  }

  87.5%{ opacity: 1; }

  /* loop back cleanly */
  100%{
    color:#ffe600;
    -webkit-text-stroke-color: rgba(0,255,255,.85);
    text-shadow:
      0 0 2px rgba(0,255,255,.95),
      0 0 10px rgba(0,255,255,.85),
      0 0 22px rgba(0,255,255,.55),
      0 0 40px rgba(0,255,255,.25);
    opacity: .92;
  }
}

/* Accessibility: stop animation if user prefers reduced motion */
@media (prefers-reduced-motion: reduce){
  .protein-cycler{ animation:none; }
}
