/* BILO page: match original TF Playground layout and sizing */

#bilo-page {
  position: relative;
}

#bilo-page header {
  background-color: #184e44;
}

/* GitHub link: top right (dark icon on tan header) */
#bilo-page .github-link {
  position: absolute;
  top: 0;
  right: 0;
  z-index: 1000;
  width: 60px;
  height: 60px;
  display: block;
}
#bilo-page .github-link .bg {
  fill: rgba(0,0,0,0.15);
}
#bilo-page .github-link:hover .bg {
  fill: rgba(0,0,0,0.25);
}
#bilo-page .github-link .icon {
  fill: #333;
  fill-opacity: 0.8;
}
#bilo-page .github-link:hover .icon {
  fill-opacity: 1;
}

#bilo-page .bilo-network-header {
  position: relative;
  z-index: 2;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  margin-bottom: 4px;
}

#bilo-page .bilo-network-header h4 {
  margin: 0 0 4px 0;
}

#bilo-page .bilo-network-controls {
  display: flex;
  align-items: center;
  gap: 20px;
}

#bilo-page #top-controls .container {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

#bilo-page #top-controls .control-row {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  justify-content: flex-start;
  gap: 8px;
}

#bilo-page .bilo-toggle-group {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 6px;
}

/* Toggle label: same style as other control labels (e.g. Residual points) */
#bilo-page .bilo-toggle-group .toggle-label {
  font-size: 13px;
  color: #777;
  font-weight: 300;
  display: block;
  margin-bottom: 0px;
}

#bilo-page .bilo-toggle {
  display: flex;
  border: 1px solid #ccc;
  border-radius: 2px;
  overflow: visible;
  min-height: 28px;
  box-sizing: border-box;
}

#bilo-page .bilo-toggle-btn {
  padding: 4px 8px;
  font-size: 13px;
  border: none;
  background: #fff;
  color: #333;
  cursor: pointer;
  border-right: 1px solid #ccc;
  box-sizing: border-box;
  min-height: 26px;
}

#bilo-page .bilo-toggle-btn:last-child {
  border-right: none;
}

#bilo-page .bilo-toggle-btn:hover {
  background: #f0f0f0;
}

#bilo-page .bilo-toggle-btn.active {
  background: #183D4E;
  color: #fff;
}

#bilo-page #top-controls .control.bilo-toggle-group {
  max-width: none;
  min-width: 120px;
}

/* Pretrain mode: gray out a_GT, data points, w_rgrad */
#bilo-page #top-controls .control.bilo-pretrain-disabled,
#bilo-page #top-controls .control.bilo-pretrain-disabled label {
  opacity: 0.5;
  pointer-events: none;
}
#bilo-page #top-controls .control.bilo-pretrain-disabled input {
  background: #eee;
  color: #999;
}

#bilo-page #top-controls .control {
  flex: 0 0 auto;
  max-width: 100px;
  min-width: 70px;
  margin-left: 0;
  margin-top: 0;
}

#bilo-page #top-controls .control-input {
  display: block;
  width: 100%;
  max-width: 70px;
  height: 28px;
  padding: 4px 6px;
  font-size: 13px;
  border: 1px solid #ccc;
  border-radius: 2px;
  color: #333;
  background: #fff;
  box-sizing: border-box;
}

#bilo-page #top-controls .control .select select {
  padding: 4px 0;
  font-size: 13px;
  max-width: 140px;
}

#bilo-page #top-controls .control .value {
  font-size: 18px;
}

/* KaTeX math in labels: align baseline, prevent layout shift */
#bilo-page .control label .katex {
  font-size: 1em;
}
#bilo-page .control label .katex-display {
  margin: 0;
  display: inline;
}

#bilo-page .bilo-plus-minus .plus-minus-row {
  display: flex;
  align-items: center;
  gap: 8px;
}

#bilo-page .bilo-plus-minus .plus-minus-value {
  min-width: 24px;
  text-align: center;
  font-size: 14px;
  font-weight: 500;
}

/* Save / Reload weights: minimal boxed buttons */
#bilo-page .bilo-weights-btn {
  padding: 4px 10px;
  font-size: 13px;
  color: #333;
  background: #fff;
  border: 1px solid #999;
  border-radius: 2px;
  cursor: pointer;
  align-self: flex-end;
}
#bilo-page .bilo-weights-btn:hover {
  background: #f5f5f5;
}
#bilo-page .bilo-weights-btn:active {
  opacity: 0.9;
}
/* CSS tooltip so hover always shows text (native title can be delayed or blocked) */
#bilo-page .bilo-weights-btn[data-tooltip]:hover::after,
#bilo-page .bilo-toggle-btn[data-tooltip]:hover::after {
  content: attr(data-tooltip);
  position: absolute;
  bottom: 100%;
  left: 50%;
  transform: translateX(-50%);
  margin-bottom: 4px;
  padding: 4px 8px;
  font-size: 12px;
  font-weight: 400;
  color: #333;
  background: #fff;
  border: 1px solid #999;
  border-radius: 2px;
  white-space: nowrap;
  z-index: 1000;
  pointer-events: none;
}
#bilo-page .bilo-weights-btn[data-tooltip],
#bilo-page .bilo-toggle-btn[data-tooltip] {
  position: relative;
}

/* Tooltips for control inputs (lr_W, lr_a, weights) */
#bilo-page #top-controls .control-input[data-tooltip] {
  position: relative;
}
#bilo-page #top-controls .control-input[data-tooltip]:hover::after {
  content: attr(data-tooltip);
  position: absolute;
  bottom: 100%;
  left: 50%;
  transform: translateX(-50%);
  margin-bottom: 4px;
  padding: 4px 8px;
  font-size: 12px;
  font-weight: 400;
  color: #333;
  background: #fff;
  border: 1px solid #999;
  border-radius: 2px;
  white-space: nowrap;
  z-index: 1000;
  pointer-events: none;
}

/* Main part: strict 2-column layout (override original 3-column .features / .output widths) */
#bilo-page #main-part {
  display: flex;
  flex-direction: row;
  justify-content: stretch;
  margin-top: 20px;
  margin-bottom: 30px;
  align-items: flex-start;
  gap: 0;
}

#bilo-page #main-part .column.features.bilo-network-col {
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
  align-items: stretch;
  width: 55%;
  flex: 1 1 55%;
  min-width: 0;
  max-width: 55%;
  min-height: 460px;
}

#bilo-page #main-part .column.output.bilo-output-col {
  width: 45%;
  flex: 1 1 45%;
  min-width: 0;
  max-width: 45%;
}

#bilo-page .bilo-formula {
  margin: 4px 0 12px 0;
  font-size: 12px;
  color: #777;
}

#bilo-page .bilo-plot-title {
  margin: 12px 0 4px 0;
  font-size: 13px;
}

#bilo-page .bilo-colormap-label {
  margin-top: 12px;
  font-size: 12px;
  color: #777;
}

/* Network diagram: fill container, TF Playground style; no extra space above */
#bilo-page #network {
  position: relative;
  z-index: 1;
  overflow: visible;
  min-height: 400px;
  width: 100%;
  margin-top: 0;
  padding-top: 0;
  flex: 0 0 auto;
}

#bilo-page #network-diagram svg {
  display: block;
}

/* Network: heatmap canvases behind SVG (like original) */
#bilo-page #network {
  position: relative;
}

#bilo-page #network .canvas {
  position: absolute;
  border: 1px solid #000;
  box-sizing: border-box;
  overflow: hidden;
}

#bilo-page #network .canvas canvas {
  display: block;
  width: 100%;
  height: 100%;
}

/* Annotations toggle button: reuse weights style, dark when active */
#bilo-page .bilo-annotations-btn.active {
  background-color: #183D4E;
  color: #fff;
}

/* Callouts: text below target, arrow pointing up with curve */
#bilo-page #network .bilo-callout.bilo-callout-below {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  max-width: 140px;
}
#bilo-page #network .bilo-callout .bilo-callout-arrow-up {
  flex-shrink: 0;
}
#bilo-page #network .bilo-callout-label {
  font-size: 10px;
  font-style: italic;
  color: #555;
  line-height: 1.25;
  text-align: left;
}

/* Mode callout: floating annotation below Mode toggle, does not affect layout */
#bilo-page .bilo-callout-mode {
  position: absolute;
  top: 100%;
  left: 50%;
  transform: translateX(-50%);
  margin-top: 2px;
  z-index: 10;
  pointer-events: none;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0;
  max-width: 400px;
  min-width: 100px;
}
#bilo-page .bilo-callout-mode .bilo-callout-arrow-up {
  flex-shrink: 0;
}
#bilo-page .bilo-callout-mode .bilo-callout-label {
  font-size: 9px;
  font-style: italic;
  color: #555;
  line-height: 1.2;
  text-align: center;
}

/* u(t) plot: larger */
#bilo-page #plot-1d {
  width: 100%;
  height: 240px;
}

/* Loss chart: larger, room for y-tickers */
#bilo-page #loss-chart {
  width: 100%;
  height: 140px;
}

/* Loss chart axes: thin lines, small text, avoid jamming (match original) */
#bilo-page #loss-chart .axis path {
  display: none;
}

#bilo-page #loss-chart .axis line {
  fill: none;
  stroke: #777;
  stroke-width: 1;
  shape-rendering: crispEdges;
}

#bilo-page #loss-chart .axis text {
  fill: #777;
  font-size: 10px;
}

#bilo-page #loss-chart .axis.y-axis text {
  font-size: 9px;
}

#bilo-page #plot-1d .axis path {
  display: none;
}

#bilo-page #plot-1d .axis line {
  fill: none;
  stroke: #777;
  stroke-width: 1;
  shape-rendering: crispEdges;
}

#bilo-page #plot-1d .axis text {
  fill: #777;
  font-size: 10px;
}

/* Article below main part (styled like original playground) */
#bilo-page article {
  background: #fff;
  padding: 80px 0;
  box-shadow: 0 0 4px rgba(0,0,0,0.1);
}
#bilo-page article :first-child h2 {
  margin-top: 0;
}
#bilo-page article a {
  color: #183D4E;
  text-decoration: none;
}
#bilo-page article a:hover {
  text-decoration: underline;
}
