/* ============================================================
   Tree view — phương án C (accordion icon hai bên)
   Áp dụng cho section "Cây nội dung đào tạo" trong 4 module README
   ============================================================ */

details.tree {
  border: 1px solid var(--md-default-fg-color--lightest);
  border-left-width: 4px;
  border-radius: 6px;
  margin: 0 0 10px;
  padding: 0;
  background: var(--md-default-bg-color);
  overflow: hidden;
  transition: border-color 0.15s ease;
}

details.tree > summary {
  cursor: pointer;
  padding: 12px 16px;
  list-style: none;
  display: flex;
  align-items: center;
  gap: 12px;
  font-weight: 500;
  font-size: 15px;
  user-select: none;
  transition: background 0.15s ease;
}

details.tree > summary::-webkit-details-marker { display: none; }
details.tree > summary::marker { content: ""; }

details.tree > summary::after {
  content: "›";
  margin-left: auto;
  color: var(--md-default-fg-color--light);
  font-size: 22px;
  line-height: 1;
  font-weight: 300;
  transition: transform 0.2s ease;
}

details.tree[open] > summary::after { transform: rotate(90deg); }

details.tree > summary .tree-icon { font-size: 20px; line-height: 1; }
details.tree > summary .tree-title { flex: 1; }
details.tree > summary .tree-count {
  font-size: 12px;
  color: var(--md-default-fg-color--light);
  font-weight: 400;
  background: var(--md-default-fg-color--lightest);
  padding: 2px 10px;
  border-radius: 12px;
  margin-left: 4px;
}

/* Body inside details — padded box, light separator */
.tree-body {
  padding: 12px 16px 14px;
  border-top: 1px solid var(--md-default-fg-color--lightest);
}

.tree-body > *:first-child { margin-top: 0; }
.tree-body > *:last-child  { margin-bottom: 0; }

/* Sub-group: thụt nhẹ với connector line bên trái */
.tree-sub {
  margin: 10px 0 12px;
  padding: 2px 0 2px 14px;
  border-left: 2px solid var(--md-default-fg-color--lightest);
}

.tree-sub > p:first-child,
.tree-sub > strong:first-child {
  display: block;
  margin: 0 0 6px;
  font-size: 14px;
  color: var(--md-default-fg-color);
}

.tree-sub ul { margin: 4px 0 0; padding-left: 22px; }
.tree-sub ul li { margin: 2px 0; }

/* Sub-sub-group: connector line dashed */
.tree-sub .tree-sub { margin-top: 8px; border-left-style: dashed; }

/* Note (yellow) — giữ nguyên cho ghi chú/định nghĩa từ Excel */
.tree-note {
  background: #fff8e1;
  border-left: 3px solid #f9a825;
  padding: 8px 12px;
  border-radius: 4px;
  margin: 4px 0 10px;
  font-size: 13px;
  font-style: italic;
  color: #5f4a00;
}

[data-md-color-scheme="slate"] .tree-note {
  background: #2a2410;
  color: #f0d878;
  border-left-color: #f9a825;
}

/* ====== Phân màu theo nhánh (border-left + hover/open tint) ====== */

details.tree.t-blue   { border-left-color: #185FA5; }
details.tree.t-teal   { border-left-color: #0F6E56; }
details.tree.t-amber  { border-left-color: #BA7517; }
details.tree.t-purple { border-left-color: #534AB7; }
details.tree.t-coral  { border-left-color: #D85A30; }
details.tree.t-pink   { border-left-color: #D4537E; }
details.tree.t-green  { border-left-color: #639922; }
details.tree.t-gray   { border-left-color: #5F5E5A; }
details.tree.t-red    { border-left-color: #A32D2D; }

details.tree:hover { border-color: var(--md-default-fg-color--lighter); }

details.tree.t-blue:hover   > summary,
details.tree.t-blue[open]   > summary { background: #E6F1FB; }
details.tree.t-teal:hover   > summary,
details.tree.t-teal[open]   > summary { background: #E1F5EE; }
details.tree.t-amber:hover  > summary,
details.tree.t-amber[open]  > summary { background: #FAEEDA; }
details.tree.t-purple:hover > summary,
details.tree.t-purple[open] > summary { background: #EEEDFE; }
details.tree.t-coral:hover  > summary,
details.tree.t-coral[open]  > summary { background: #FAECE7; }
details.tree.t-pink:hover   > summary,
details.tree.t-pink[open]   > summary { background: #FBEAF0; }
details.tree.t-green:hover  > summary,
details.tree.t-green[open]  > summary { background: #EAF3DE; }
details.tree.t-gray:hover   > summary,
details.tree.t-gray[open]   > summary { background: #F1EFE8; }
details.tree.t-red:hover    > summary,
details.tree.t-red[open]    > summary { background: #FCEBEB; }

/* Dark mode — giảm độ tươi của tint */
[data-md-color-scheme="slate"] details.tree.t-blue:hover   > summary,
[data-md-color-scheme="slate"] details.tree.t-blue[open]   > summary { background: #1a2a3f; }
[data-md-color-scheme="slate"] details.tree.t-teal:hover   > summary,
[data-md-color-scheme="slate"] details.tree.t-teal[open]   > summary { background: #143028; }
[data-md-color-scheme="slate"] details.tree.t-amber:hover  > summary,
[data-md-color-scheme="slate"] details.tree.t-amber[open]  > summary { background: #2d2412; }
[data-md-color-scheme="slate"] details.tree.t-purple:hover > summary,
[data-md-color-scheme="slate"] details.tree.t-purple[open] > summary { background: #211e3d; }
[data-md-color-scheme="slate"] details.tree.t-coral:hover  > summary,
[data-md-color-scheme="slate"] details.tree.t-coral[open]  > summary { background: #2d1c14; }
[data-md-color-scheme="slate"] details.tree.t-pink:hover   > summary,
[data-md-color-scheme="slate"] details.tree.t-pink[open]   > summary { background: #2d1b25; }
[data-md-color-scheme="slate"] details.tree.t-green:hover  > summary,
[data-md-color-scheme="slate"] details.tree.t-green[open]  > summary { background: #1f2d15; }
[data-md-color-scheme="slate"] details.tree.t-gray:hover   > summary,
[data-md-color-scheme="slate"] details.tree.t-gray[open]   > summary { background: #232220; }
[data-md-color-scheme="slate"] details.tree.t-red:hover    > summary,
[data-md-color-scheme="slate"] details.tree.t-red[open]    > summary { background: #2d1616; }
