/* ============================================
   Artharogyam — Binary MLM Tree & Plan UI
   ============================================ */

.binary-plan-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: linear-gradient(135deg, var(--primary), var(--primary-dark));
  color: #fff;
  font-size: 0.6875rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  padding: 5px 12px;
  border-radius: 50px;
  margin-bottom: 0.75rem;
}

.binary-tree-panel {
  background: linear-gradient(165deg, #faf9f6 0%, #fff 50%, #f0f5f4 100%);
  border: 1px solid rgba(38, 93, 102, 0.12);
  border-radius: var(--radius-lg);
  padding: 1.5rem 1rem 1.25rem;
  box-shadow: var(--shadow);
  overflow-x: auto;
}

.binary-tree-panel.compact {
  padding: 1rem 0.5rem;
}

.binary-tree-svg-wrap {
  min-width: 320px;
  max-width: 720px;
  margin: 0 auto 1rem;
}

.binary-tree-svg-wrap img,
.binary-tree-svg-wrap svg {
  width: 100%;
  height: auto;
  display: block;
}

.binary-tree-html {
  min-width: 300px;
  margin: 0 auto;
  text-align: center;
}

.bt-level {
  display: flex;
  justify-content: center;
  gap: clamp(1rem, 6vw, 4rem);
  position: relative;
}

.bt-level-0 { margin-bottom: 0.25rem; }

.bt-connectors {
  position: relative;
  height: 36px;
  max-width: 280px;
  margin: 0 auto 0.25rem;
}

.bt-connectors::before {
  content: '';
  position: absolute;
  top: 0;
  left: 50%;
  width: 2px;
  height: 18px;
  background: var(--accent);
  opacity: 0.45;
  transform: translateX(-50%);
}

.bt-connectors::after {
  content: '';
  position: absolute;
  top: 18px;
  left: 25%;
  right: 25%;
  height: 2px;
  background: var(--accent);
  opacity: 0.35;
}

.bt-connectors span {
  position: absolute;
  top: 18px;
  width: 2px;
  height: 18px;
  background: var(--accent);
  opacity: 0.35;
}

.bt-connectors .bt-line-left { left: 25%; }
.bt-connectors .bt-line-right { right: 25%; }

.bt-node {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  min-width: 72px;
}

.bt-avatar {
  position: relative;
  width: 52px;
  height: 52px;
  border-radius: 50%;
  overflow: visible;
  border: 2px solid var(--gold);
  background: var(--white);
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 14px rgba(38, 93, 102, 0.15);
}

.bt-node.compact .bt-avatar {
  width: 40px;
  height: 40px;
}

.bt-node.sm .bt-avatar {
  width: 34px;
  height: 34px;
  border-width: 1px;
}

.bt-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 50%;
}

.bt-icon-badge {
  position: absolute;
  bottom: -2px;
  right: -2px;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--accent);
  color: #fff;
  font-size: 0.5rem;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1.5px solid #fff;
  box-shadow: 0 2px 6px rgba(0,0,0,0.15);
}

.bt-node.sm .bt-icon-badge {
  width: 14px;
  height: 14px;
  font-size: 0.4rem;
}

.bt-avatar i {
  font-size: 1.25rem;
  color: var(--primary);
}

.bt-node.sm .bt-avatar i { font-size: 0.9rem; }

.bt-node-you .bt-avatar {
  width: 64px;
  height: 64px;
  border-width: 3px;
  border-color: var(--accent);
  background: linear-gradient(135deg, var(--primary), var(--primary-dark));
}

.bt-node-you .bt-avatar i {
  color: var(--gold);
  font-size: 1.5rem;
}

.bt-name {
  font-size: 0.6875rem;
  font-weight: 700;
  color: var(--text);
  line-height: 1.2;
}

.bt-meta {
  font-size: 0.5625rem;
  color: var(--text-muted);
  line-height: 1.2;
}

.bt-leg-tag {
  font-size: 0.5625rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  padding: 2px 8px;
  border-radius: 50px;
}

.bt-leg-tag.left {
  background: rgba(38, 93, 102, 0.12);
  color: var(--primary);
}

.bt-leg-tag.right {
  background: rgba(184, 115, 51, 0.15);
  color: var(--accent-dark);
}

.bt-bv {
  font-size: 0.5625rem;
  font-weight: 600;
  color: var(--accent);
}

.binary-legend {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.75rem 1.25rem;
  padding-top: 0.75rem;
  border-top: 1px dashed rgba(38, 93, 102, 0.15);
}

.binary-legend-item {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.75rem;
  color: var(--text-muted);
}

.binary-legend-item i {
  color: var(--accent);
  width: 16px;
  text-align: center;
}

.binary-steps {
  display: grid;
  gap: 1rem;
}

.binary-step-card {
  display: flex;
  gap: 1rem;
  align-items: flex-start;
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem 1.125rem;
}

.binary-step-card .step-icon {
  width: 44px;
  height: 44px;
  border-radius: 12px;
  background: rgba(38, 93, 102, 0.08);
  color: var(--primary);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.125rem;
  flex-shrink: 0;
}

.binary-step-card h6 {
  margin-bottom: 0.25rem;
  color: var(--primary);
}

.binary-step-card p {
  margin: 0;
  font-size: 0.875rem;
  color: var(--text-muted);
  line-height: 1.55;
}

.binary-pair-visual {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 1rem;
  flex-wrap: wrap;
  margin: 1rem 0;
}

.binary-pair-box {
  flex: 1;
  min-width: 120px;
  max-width: 160px;
  text-align: center;
  padding: 1rem;
  border-radius: var(--radius);
  border: 2px solid transparent;
}

.binary-pair-box.left-leg {
  background: rgba(38, 93, 102, 0.06);
  border-color: rgba(38, 93, 102, 0.2);
}

.binary-pair-box.right-leg {
  background: rgba(184, 115, 51, 0.08);
  border-color: rgba(184, 115, 51, 0.25);
}

.binary-pair-box strong {
  display: block;
  font-size: 1.375rem;
  color: var(--primary);
}

.binary-pair-box span {
  font-size: 0.75rem;
  color: var(--text-muted);
}

.binary-pair-equals {
  font-size: 1.5rem;
  color: var(--accent);
  font-weight: 700;
}

.binary-pair-result {
  text-align: center;
  padding: 0.75rem 1.25rem;
  background: linear-gradient(135deg, var(--accent), var(--gold));
  color: #fff;
  border-radius: var(--radius);
  font-weight: 600;
  font-size: 0.875rem;
}

@media (max-width: 575px) {
  .bt-level.depth-2 { gap: 0.75rem; }
  .bt-name { font-size: 0.625rem; }
}
