/* ==========================
   Global Reset & Base Styles
========================== */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  background-color: #121317;
  color: #f5f5f5;
  font-family: "Inter", "Segoe UI", Helvetica, Arial, sans-serif;

  /* ✅ Only one scrollbar for entire page */
  overflow-x: scroll;
  overflow-y: auto;

  /* ✅ Keeps scrollbar stable & visible */
  scrollbar-gutter: stable both-edges;

  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
}

/* ==========================
   Header
========================== */
h2 {
  text-align: center;
  font-weight: 600;
  color: #ffffff;
  font-size: 2.5rem;
  margin: 1.5rem 0;
  letter-spacing: 1px;
}

/* ==========================
   Chart Container
========================== */
.chart {
  position: relative;
  width: max(100%, 1500px); /* ✅ Expands if tree gets large */
  min-height: 100vh;

  /* ✅ Generous padding for off-screen nodes */
  padding: 2rem 4rem 2rem 10rem;

  display: flex;
  justify-content: center;
  align-items: flex-start;
  background-color: #121317;

  /* ✅ Prevent internal scrollbars */
  overflow: visible;
}

/* ==========================
   Node Styles
========================== */
.nodeExample1 {
  background: #1e2026;
  color: #f5f5f5;
  border-radius: 10px;
  border: 1px solid #3a3e47;
  outline: 2px solid #444a57;
  outline-offset: 0;
  padding: 10px 16px;
  min-width: 120px;
  text-align: center;
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.4);
  transition: all 0.2s ease-in-out;
}

.nodeExample1:hover {
  background: #242731;
  transform: translateY(-3px);
  box-shadow: 0 6px 14px rgba(0, 0, 0, 0.6);
  outline-color: #6d79ff;
}

/* ==========================
   Node Text
========================== */
.nodeExample1 .node-name {
  font-size: 1rem;
  font-weight: 600;
  color: #ffffff;
  margin-bottom: 0.2rem;
}

.nodeExample1 .node-title {
  font-size: 0.7rem;
  color: #9aa8ff;
  font-weight: 500;
  opacity: 0.85;
}

/* ==========================
   Connectors (Lines)
========================== */
.Treant {
  position: relative;
  display: inline-block;
  margin: 0 auto;
  transform-origin: top center;
}

.Treant > .node,
.Treant > .pseudo {
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
}

.Treant .connector {
  fill: none;
  stroke: #8a8fa3;
  stroke-width: 2px;
  shape-rendering: geometricPrecision;
}

.Treant .connector:hover {
  stroke: #b3b9ff;
}

/* ==========================
   Scaling Support
========================== */
.chart.scaled {
  transform: scale(0.9);
  transform-origin: top center;
}

/* ==========================
   Collapse Button Styling
========================== */
.node .collapse-switch {
  background-color: #2c2f38;
  border-radius: 50%;
  color: #fff;
  font-weight: bold;
  font-size: 11px;
  width: 22px;
  height: 22px;
  line-height: 22px;
  text-align: center;
  cursor: pointer;
  box-shadow: 0 0 4px rgba(0, 0, 0, 0.4);
  transition: all 0.2s ease;
  border: 1px solid #444;
}

.node .collapse-switch:hover {
  background-color: #3d414c;
}

.node .collapse-switch::before {
  content: "▼";
  font-size: 10px;
}

.node.collapsed .collapse-switch::before {
  content: "▶";
}

/* ==========================
   Responsive Design
========================== */
@media (max-width: 768px) {
  h2 {
    font-size: 1.8rem;
  }

  .nodeExample1 {
    font-size: 0.8rem;
    padding: 8px 12px;
  }

  .chart {
    padding: 1rem 2rem 1rem 5rem; /* smaller left margin on mobile */
  }
}
