/* =================================================================
   assignment-tree.css  —  Estilos compartidos para páginas de
   asignación jerárquica y plana (Rol↔Funcionalidad, Usuario↔Rol)
   e-multimedia-front | Linktics Solutions
   ================================================================= */

/* ── Contenedor principal ────────────────────────────────────────── */
.assign-container {
  max-height: 520px;
  overflow-y: auto;
  padding: 12px;
  background: var(--md-surface-container-low, #f4fafb);
  border-radius: 14px;
  border: 1px solid var(--md-outline-variant);
}
.assign-container::-webkit-scrollbar { width: 5px; }
.assign-container::-webkit-scrollbar-thumb {
  background: var(--md-outline-variant);
  border-radius: 4px;
}

/* ── Fila de nodo padre (árbol) ──────────────────────────────────── */
.tree-node      { margin-bottom: 6px; }

.tree-parent {
  display: flex;
  align-items: center;
  padding: 12px 16px;
  background: var(--md-surface);
  border-radius: 10px;
  cursor: pointer;
  user-select: none;
  font-weight: 600;
  font-size: 14px;
  color: var(--md-on-surface);
  border: 1px solid transparent;
  gap: 10px;
  transition: background 0.2s, border-color 0.2s, box-shadow 0.2s;
}
.tree-parent:hover {
  background: var(--md-primary-container, #dbeafe);
  border-color: var(--md-primary);
  box-shadow: 0 2px 8px rgba(0,0,0,0.08);
}
.tree-parent.active {
  background: linear-gradient(135deg, var(--md-primary-container, #dbeafe) 0%, var(--md-surface-container-high, #e0f2f4) 100%);
  border-color: var(--md-primary);
  color: var(--md-primary);
}

/* ── Flecha animada ──────────────────────────────────────────────── */
.tree-arrow {
  font-size: 18px;
  color: var(--md-primary);
  transition: transform 0.25s cubic-bezier(.4,0,.2,1);
  flex-shrink: 0;
}
.tree-parent.active .tree-arrow { transform: rotate(90deg); }

/* ── Hijos (árbol) ───────────────────────────────────────────────── */
.tree-children {
  display: none;
  margin-top: 4px;
  padding-left: 28px;
  position: relative;
}
.tree-children::before {
  content: '';
  position: absolute;
  left: 14px;
  top: 0; bottom: 0;
  width: 2px;
  background: linear-gradient(to bottom, var(--md-primary), transparent);
  border-radius: 2px;
  opacity: 0.3;
}
.tree-children.active { display: block; }

/* ── Item hoja (árbol) ───────────────────────────────────────────── */
.tree-leaf {
  display: flex;
  align-items: center;
  padding: 9px 14px;
  border-radius: 8px;
  margin-bottom: 3px;
  gap: 10px;
  border: 1px solid transparent;
  transition: background 0.18s, border-color 0.18s;
}
.tree-leaf:hover {
  background: var(--md-secondary-container, #e0f2fe);
  border-color: var(--md-outline-variant);
}
.tree-leaf:has(.child-chk:checked) {
  background: color-mix(in srgb, var(--md-primary) 8%, transparent);
  border-color: color-mix(in srgb, var(--md-primary) 25%, transparent);
}

/* ── Item plano (lista sin jerarquía) ────────────────────────────── */
.assign-item {
  display: flex;
  align-items: center;
  padding: 12px 16px;
  border-radius: 10px;
  margin-bottom: 6px;
  gap: 12px;
  border: 1px solid var(--md-outline-variant);
  background: var(--md-surface);
  transition: background 0.18s, border-color 0.2s, box-shadow 0.2s;
  cursor: default;
}
.assign-item:hover {
  background: var(--md-surface-container-high, #e0f2f4);
  border-color: var(--md-outline);
  box-shadow: 0 1px 4px rgba(0,0,0,0.06);
}
.assign-item:has(.assign-chk:checked) {
  background: color-mix(in srgb, var(--md-primary) 8%, transparent);
  border-color: var(--md-primary);
  box-shadow: 0 2px 8px rgba(0, 104, 116, 0.12);
}
.assign-item-icon {
  width: 38px; height: 38px;
  border-radius: 50%;
  background: var(--md-primary-container);
  color: var(--md-primary);
  display: flex; align-items: center; justify-content: center;
  font-size: 18px;
  flex-shrink: 0;
}
.assign-item-info { flex: 1; min-width: 0; }
.assign-item-name {
  font-size: 13px;
  font-weight: 600;
  color: var(--md-on-surface);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.assign-item-sub {
  font-size: 11px;
  color: var(--md-on-surface-variant);
  margin-top: 1px;
}

/* ── Checkboxes ──────────────────────────────────────────────────── */
.parent-chk,
.child-chk,
.assign-chk {
  width: 16px; height: 16px;
  accent-color: var(--md-primary);
  cursor: pointer;
  flex-shrink: 0;
}

/* ── Nombres de hoja ─────────────────────────────────────────────── */
.leaf-name  { font-size: 13px; font-weight: 500; color: var(--md-on-surface); }
.leaf-code  { font-size: 10px; color: var(--md-on-surface-variant); margin-top: 1px; }

/* ── Footer — sólo contador ──────────────────────────────────────── */
.assign-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 24px;
  border-top: 1px solid var(--md-outline-variant);
  background: var(--md-surface-container-highest, #f0f8f9);
}
.assign-footer__label {
  font-size: 12px;
  font-weight: 600;
  letter-spacing: .5px;
  color: var(--md-on-surface-variant);
  text-transform: uppercase;
}
.assign-footer__count {
  font-size: 22px;
  font-weight: 700;
  color: var(--md-primary);
  line-height: 1;
}
.assign-footer__count small {
  font-size: 12px;
  font-weight: 500;
  color: var(--md-on-surface-variant);
  margin-left: 4px;
}
