/* NieR-style hover effects for tree nodes */
.tree-node-item {
  position: relative;
  overflow: hidden;
  transition: color 0.3s ease;
  border-bottom: 1px solid transparent;
}

/* Underline effect */
.tree-node-item::before {
  content: "";
  position: absolute;
  left: 0;
  bottom: 0;
  width: 0;
  height: 1px;
  background-color: var(--color-nier-text-dark);
  transition: width 0.3s ease;
  z-index: 0;
}

/* Text color change on hover */
.tree-node-item:hover {
  color: var(--color-nier-text-dark);
  border-bottom-color: var(--color-nier-text-dark);
}

/* Underline animation on hover */
.tree-node-item:hover::before {
  width: 100%;
}

/* Glitch effect on hover - target the text span directly */
.tree-node-item:hover span.text-nier-dark {
  animation: nier-text-glitch 0.6s ease;
}

/* Alternative - target any span with text */
.tree-node-item:hover span:last-of-type {
  animation: nier-text-glitch 0.6s ease;
}

/* Scan line for tree nodes */
.tree-node-item .scan-line {
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 1px;
  background-color: var(--color-nier-text-dark);
  opacity: 0;
  z-index: 3;
  pointer-events: none;
}

.tree-node-item:hover .scan-line {
  animation: nier-button-scan 0.3s ease forwards;
}

/* Active/click state for tree nodes */
.tree-node-item:active {
  transform: scale(0.98);
}

/* NieR-style Chip Container System - NO INTERACTIONS */
.chip-container {
  position: relative;
}

.chip-parent {
  position: relative;
  padding: 16px;
  border-radius: 0;
  border: 1px solid rgba(0, 0, 0, 0.15); /* Very thin border */
  box-shadow: none;
  overflow: hidden;
  transition: transform 0.2s ease; /* Allow parent scaling */
}

/* Parent Chip Colors - Complete NieR Earth Palette */
.tools-parent {
  background: linear-gradient(135deg, #a67c63 0%, #8b6b52 100%);
}

.frontend-parent {
  background: linear-gradient(135deg, #b8916f 0%, #a67c63 100%);
}

.backend-parent {
  background: linear-gradient(135deg, #c9b896 0%, #b8916f 100%);
}

.database-parent {
  background: linear-gradient(135deg, #e6d7b8 0%, #d4c4a0 100%);
}

/* Locked Parent Category */
.locked-parent {
  background: linear-gradient(135deg, #606060 0%, #4a4a4a 100%);
  border: none;
  cursor: not-allowed;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
}

.chip-locked-category {
  opacity: 0.7;
  flex: 1;
  min-height: 0;
}

/* Chip Cells Column Layout */
.chip-cells-column {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

/* Locked Content Styling */
.locked-content {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 100%;
  width: 100%;
}

.lock-icon {
  width: 40px;
  height: 40px;
  color: #b0b0b0;
  stroke-width: 1.5;
  opacity: 0.8;
  filter: drop-shadow(0 1px 2px rgba(0, 0, 0, 0.3));
}

/* Individual Chip Cells - Keep original grayish overlay */
.chip-cell {
  position: relative;
  width: 100%;
  height: 16px;
  border-radius: 0;
  border: 1px solid rgba(0, 0, 0, 0.2); /* Keep original border */
  background: rgba(0, 0, 0, 0.1); /* Keep original grayish overlay */
  cursor: pointer;
  overflow: hidden;
  box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.2); /* Keep original shadow */
  transition: transform 0.2s ease; /* Allow scale animation */
}

.chip-cell::before {
  content: '';
  position: absolute;
  top: 1px;
  left: 1px;
  right: 1px;
  height: 4px;
  background: rgba(255, 255, 255, 0.1); /* Keep original highlight */
  border-radius: 0;
}

/* Scale animation when tree node is hovered OR selected */
.chip-cell.cell-hovered,
.chip-cell.cell-selected {
  transform: scale(1.05) !important;
  background: rgba(0, 0, 0, 0.1) !important; /* Keep original grayish color */
  border: 1px solid rgba(0, 0, 0, 0.2) !important; /* Keep original border */
  box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.2) !important; /* Keep original shadow */
}

/* Parent categories scale when children are hovered OR selected */
.chip-container.chip-hovered .chip-parent,
.chip-container.chip-selected .chip-parent {
  transform: scale(1.02) !important;
}

/* NO direct hover effects on cells */
.chip-cell:hover,
.chip-cell:focus,
.chip-cell:active {
  background: rgba(0, 0, 0, 0.1) !important; /* Keep original grayish */
  border: 1px solid rgba(0, 0, 0, 0.2) !important; /* Keep original border */
  box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.2) !important; /* Keep original shadow */
  transform: none !important;
  filter: none !important;
  opacity: 1 !important;
  animation: none !important;
  transition: none !important;
}

.chip-cell:hover::before,
.chip-cell:focus::before,
.chip-cell:active::before,
.chip-cell.cell-hovered::before,
.chip-cell.cell-selected::before {
  background: rgba(255, 255, 255, 0.1) !important; /* Keep original highlight */
  height: 4px !important;
  box-shadow: none !important;
}

/* NO CONTAINER EFFECTS */
.chip-normal,
.chip-selected,
.chip-hovered {
  /* No effects */
}

/* Text glitch effect for tree nodes only */
@keyframes nier-text-glitch {
  0%, 100% {
    transform: translateX(0);
    clip-path: inset(0 0 0 0);
  }
  10% {
    transform: translateX(-2px);
    clip-path: inset(0 0 40% 0);
  }
  15% {
    transform: translateX(0);
  }
  20% {
    transform: translateX(1px);
    clip-path: inset(40% 0 0 0);
  }
  25% {
    transform: translateX(0);
  }
  30% {
    transform: translateX(-1px);
    clip-path: inset(20% 0 20% 0);
  }
  35% {
    transform: translateX(0);
  }
}

/* Scan line animation for tree nodes only */
@keyframes nier-button-scan {
  0% {
    opacity: 0.5;
    left: -100%;
  }
  100% {
    opacity: 0;
    left: 100%;
  }
}

/* Responsive Adjustments */
@media (max-width: 768px) {
  .chip-cell {
    height: 12px;
  }

  .chip-cells-column {
    gap: 2px;
  }

  .chip-parent {
    padding: 12px;
  }
}

/* Touch device optimization for tree nodes only */
@media (hover: none) {
  .tree-node-item:active::before {
    width: 100%;
  }

  .tree-node-item:active .scan-line {
    animation: nier-button-scan 0.3s ease forwards;
  }

  .tree-node-item:active {
    color: var(--color-nier-text-dark);
  }
}
