/* -----------------tree section----------------- */
.tree-wrapper {
  width: 100%;
  overflow-x: auto;
  padding-bottom: 40px;
  /* Space for scrollbar */
  text-align: center;
  -webkit-overflow-scrolling: touch;
  /* Smooth scroll on iOS */
}

.tree-wrapper::-webkit-scrollbar {
  height: 8px;
}

.tree-wrapper::-webkit-scrollbar-track {
  background: #e2e8f0;
  border-radius: 4px;
}

.tree-wrapper::-webkit-scrollbar-thumb {
  background: #94a3b8;
  border-radius: 4px;
}

.tree-wrapper::-webkit-scrollbar-thumb:hover {
  background: #64748b;
}

.tree {
  display: inline-flex;
  justify-content: center;
  min-width: 100%;
}

.tree ul {
  padding-top: var(--spacing-xl);
  position: relative;
  display: flex;
  justify-content: center;
}

.tree li {
  list-style-type: none;
  text-align: center;
  position: relative;
  padding: var(--spacing-xl) var(--spacing-xs) 0 var(--spacing-xs);
}

.tree li::before,
.tree li::after {
  content: '';
  position: absolute;
  top: 0;
  border-top: 1px solid var(--border-color);
  width: 50%;
  height: var(--spacing-xl);
}

.tree li::before {
  right: 50%;
  border-right: 1px solid var(--border-color);
}

.tree li::after {
  left: 50%;
  border-left: 1px solid var(--border-color);
}

/* Remove lines if only one child */
.tree li:only-child::before,
.tree li:only-child::after {
  display: none;
}

.tree li:only-child {
  padding-top: 0;
}

/* Top vertical line from parent to children */
.tree li ul::before {
  content: '';
  position: absolute;
  top: 0;
  left: 50%;
  transform: translateX(-50%);
  border-left: 1px solid var(--border-color);
  height: var(--spacing-xl);
  width: 0;
}

/* 5. NODE BOXES */
.tree .box {
  display: inline-block;
  padding: var(--spacing-sm) var(--spacing-md);
  background: var(--color-white);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-sm);
  transition: var(--transition-normal);
  cursor: default;
  font-size: var(--font-size-base);
  color: var(--color-text);
  white-space: nowrap;
  /* Prevent text wrapping inside nodes */
  position: relative;
  z-index: 2;
}

.tree .box:hover {
  background-color: var(--color-gray);
  border-color: var(--color-primary);
  box-shadow: var(--shadow-md);
  transform: translateY(-3px);
}

/* Specific Styles for Root */
.tree>ul>li>.box {
  background: #1e293b;
  color: #fff;
  border: none;
  font-weight: 600;
  font-size: var(--font-size-lg);
}

/* Specific Styles for Level 2 (Branches) */
.tree>ul>li>ul>li>.box {
  border-color: #bfdbfe;
  color: #1e40af;
}

/* 6. INFO CARD */
.tree-card {
  padding: var(--spacing-lg);
  text-align: center;
  transition: var(--transition-normal);
  margin-top: 20px;
  width: 100%;
  max-width: var(--container-md);
  background: white;
  border-radius: 12px;
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--border-color);
}

.tree-card h2 {
  font-family: var(--font-primary);
  font-size: var(--font-size-lg);
  color: var(--color-text);
  line-height: 1.5;
}
