@import url("https://fonts.googleapis.com/css2?family=Jost:ital,wght@0,100..900;1,100..900&family=Poppins:ital,wght@0,100;0,200;0,300;0,400;0,500;0,600;0,700;0,800;0,900;1,100;1,200;1,300;1,400;1,500;1,600;1,700;1,800;1,900&display=swap");

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  min-height: 100vh;
  width: 100%;
  background: #edeef1;
  font-family: "Poppins", sans-serif;
  overflow-x: auto;
}

.tree-header {
  width: 100vw;
  text-align: center;
  margin: 30px 0 25px;
  padding: 10px 20px;
  white-space: normal;
}

.tree-header h1 {
  margin: 0;
  font-size: 28px;
  font-weight: 800;
  letter-spacing: 0.5px;
  text-transform: uppercase;
  color: #333;
}

.tree-header p {
  margin: 6px 0;
  font-size: 16px;
  font-weight: 600;
  opacity: 0.75;
}

.tree-header h2 {
  margin: 0;
  font-size: 18px;
  font-weight: 700;
  color: #555;
}

.tree {
  width: max-content;
  min-width: 100vw;
  height: auto;
  text-align: center;
  padding: 0 40px 60px;
  white-space: nowrap;
}

.tree ul {
  padding-top: 20px;
  position: relative;
  transition: 0.5s;
}

/* Hide child ul by default */
.tree li ul {
  display: none;
}

/* Show child ul when li has class 'open' */
.tree li.open > ul {
  display: block;
}

.tree li {
  display: inline-table;
  text-align: center;
  list-style: none;
  position: relative;
  padding: 10px;
  transition: 0.5s;
}

/* Garis penghubung antar elemen */
.tree li::before,
.tree li::after {
  content: "";
  position: absolute;
  top: 0;
  width: 51%;
  height: 10px;
  border-top: 1px solid #ccc;
}

.tree li::before {
  right: 50%;
}

.tree li::after {
  left: 50%;
  border-left: 1px solid #ccc;
}

/* Kasus hanya satu anak */
.tree li:only-child::before,
.tree li:only-child::after {
  display: none;
}

/* Sudut atas */
.tree li:first-child::after {
  border-radius: 5px 0 0 0;
}

.tree li:last-child::before {
  border-radius: 0 5px 0 0;
  border-right: 1px solid #ccc;
}

/* Garis vertikal ke bawah */
.tree ul ul::before {
  content: "";
  position: absolute;
  top: 0;
  left: 50%;
  width: 0;
  height: 20px;
  border-left: 1px solid #ccc;
}

/* Kotak node */
.tree a {
  border: 1px solid #ccc;
  padding: 10px;
  display: inline-grid;
  text-decoration: none;
  border-radius: 5px;
  transition: 0.5s;
  position: relative;
  cursor: pointer;
}

/* Tambah panah kecil di akhir link jika parent punya children */
.tree li.has-children > a::after {
  content: "▼";
  font-size: 10px;
  position: absolute;
  right: 10px;
  top: 40%;
  transform: translateY(-50%);
  transition: transform 1s ease;
}

/* Putar panah saat open */
.tree li.open > a::after {
  transform: translateY(-50%) rotate(180deg);
}

.tree li:first-child::before {
  display: none; /* Hilangkan garis kiri anak pertama */
}

.tree li:last-child::after {
  display: none; /* Hilangkan garis kanan anak terakhir */
}

.tree a img {
  width: 50px;
  height: 50px;
  margin-bottom: 10px;
  border-radius: 50%;
  margin: auto;
}

.tree a span {
  display: inline-block;
  text-transform: uppercase;
  letter-spacing: 1px;
  font-weight: 500;
  color: #555;
  position: relative;
}

.tree a span small.desc {
  display: block;
  font-size: 10px;
  font-weight: 400;
  text-transform: none;
  color: #999;
  margin-top: 4px;
  letter-spacing: normal;
}

/* Hover effect */
.tree li a:hover,
.tree li a:hover img,
.tree li a:hover span,
.tree li a:hover + ul li a {
  background: #c8e4f8;
  color: #000;
  border: 1px solid #49a0b4;
  box-shadow: 0 8px -5px #5f5f5f;
  transition: 0.5s;
}

/* Hover untuk garis */
.tree li a:hover + ul li::before,
.tree li a:hover + ul li::after,
.tree li a:hover + ul::before,
.tree li a:hover + ul ul::before {
  border-color: #49a0b4;
}

.profile-tooltip {
  display: none;
  position: absolute;
  background: #fff;
  padding: 10px;
  border-radius: 5px;
  box-shadow: 0 3px 6px rgba(0, 0, 0, 0.2);
  width: 200px;
  z-index: 10;
}

.tree li.open > .profile-tooltip {
  display: block;
  top: 100%;
  left: 50%;
  transform: translateX(-50%);
}

.sub-section .subtitle {
  font-weight: bold;
  font-size: 12px;
  color: #555;
  margin-bottom: 5px;
  margin-left: 10px;
}

/* .sub-section {
  background: #f5f5f5;
  border-left: 3px solid #999;
  margin: 5px 0;
  padding-left: 5px;
} */
