/* Skill Tree Node-Based Interface - Cyberpunk Mainframe Style */

/* Ensure parent containers don't clip content */
#tab-content-skills.tab-content.active {
  overflow-x: visible !important;
  overflow-y: hidden;
}

#skill-tree-container {
  overflow: visible !important;
  position: relative;
  height: 100%;
  width: 100%;
  min-width: 0; /* Allow flex shrinking if needed */
}

.skills-node-container {
  height: 100%;
  display: flex;
  flex-direction: column;
  background: #020202;
  /* Subtle circuit background pattern */
  background-image:
    linear-gradient(rgba(0, 50, 0, 0.1) 1px, transparent 1px),
    linear-gradient(90deg, rgba(0, 50, 0, 0.1) 1px, transparent 1px);
  background-size: 20px 20px;
  font-family: "Courier New", monospace;
  position: relative;
  overflow: visible;
}

/* --- HEADER --- */
.skills-header-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 20px;
  border-bottom: 2px solid #004400;
  background: #050505;
  flex-shrink: 0;
}

.sp-counter {
  color: #0f0;
  font-family: "Courier New", monospace;
  font-size: 0.9rem;
}
.sp-val {
  font-size: 1.2rem;
  font-weight: bold;
  color: #ffd700;
  margin-left: 5px;
}

.filter-controls {
  display: flex;
  gap: 5px;
}
.filter-btn {
  background: transparent;
  border: 1px solid #004400;
  color: #006600;
  padding: 5px 10px;
  cursor: pointer;
  font-size: 0.8rem;
  font-family: "Courier New", monospace;
  transition: all 0.2s;
}
.filter-btn:hover {
  background: rgba(0, 255, 0, 0.1);
  color: #0f0;
}
.filter-btn.active {
  background: #0f0;
  color: #000;
  font-weight: bold;
  box-shadow: 0 0 10px rgba(0, 255, 0, 0.5);
}

/* --- MAIN LAYOUT SPLIT --- */
.skills-main-content {
  flex-grow: 1;
  display: flex;
  overflow: visible; /* Allow inspector panel to extend beyond bounds */
  position: relative;
}

/* --- THE CANVAS --- */
.nodes-canvas-wrapper {
  flex-grow: 1;
  overflow: auto; /* Allow scrolling if tree is huge */
  position: relative;
  /* Add inner shadow to give depth */
  box-shadow: inset 0 0 50px rgba(0, 0, 0, 0.8);
}

.nodes-canvas {
  /* Make canvas big enough for your defined coordinate max ranges */
  /* 3 stats * 500px spacing + padding = ~1600px width */
  min-width: 1600px;
  min-height: 600px;
  position: relative;
  padding: 50px;
}

/* SVG LAYOUT FOR LINES */
.connections-layer {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 0; /* Behind nodes */
  pointer-events: none;
  overflow: visible;
}
.conduit-line {
  stroke: #004400;
  stroke-width: 2;
  stroke-dasharray: 5; /* Dashed "data packet" look */
}
.conduit-line.active-path {
  stroke: #0f0;
  stroke-width: 3;
  stroke-dasharray: none;
  filter: drop-shadow(0 0 5px #0f0);
  animation: flow 2s linear infinite;
}
@keyframes flow {
  from {
    stroke-dashoffset: 20;
  }
  to {
    stroke-dashoffset: 0;
  }
}

/* --- THE HEXAGON NODES --- */
.skill-node-hex {
  position: absolute;
  width: 80px;
  height: 80px;
  background: #0a0a0a;
  /* CSS Hexagon shape */
  clip-path: polygon(50% 0%, 100% 25%, 100% 75%, 50% 100%, 0% 75%, 0% 25%);
  display: flex;
  justify-content: center;
  align-items: center;
  text-align: center;
  cursor: pointer;
  z-index: 1;
  transition: all 0.3s;
  border: 2px solid transparent;
}
.hex-inner {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 5px;
  width: 100%;
  height: 100%;
  justify-content: center;
}
.skill-icon {
  font-size: 1.2rem;
  font-weight: bold;
  margin-bottom: 2px;
  line-height: 1;
}
.skill-title-node {
  font-size: 0.55rem;
  color: #fff;
  line-height: 1;
  text-transform: uppercase;
  font-weight: bold;
  margin-top: 2px;
}
.skill-cost-node {
  font-size: 0.6rem;
  color: #ffd700;
  margin-top: 3px;
  font-weight: bold;
}

/* NODE STATES */
/* 1. Locked Path (Parent not bought) */
.skill-node-hex.locked_path {
  background: #1a1a1a;
  color: #444;
  border: 2px solid #333;
  filter: grayscale(100%) brightness(50%);
}
.skill-node-hex.locked_path .skill-icon,
.skill-node-hex.locked_path .skill-title-node {
  color: #444;
}

/* 2. Locked Funds (Parent bought, not enough SP) */
.skill-node-hex.locked_funds {
  background: #220000;
  color: #aa5555;
  box-shadow: inset 0 0 10px #550000;
  border: 2px solid #550000;
}
.skill-node-hex.locked_funds .skill-icon,
.skill-node-hex.locked_funds .skill-title-node {
  color: #aa5555;
}
.skill-node-hex.locked_funds .skill-cost-node {
  color: #ff0000;
}

/* 3. Available (Ready to buy) */
.skill-node-hex.available {
  background: #001a00;
  color: #0f0;
  /* Pulsing border effect */
  box-shadow:
    inset 0 0 0 2px #0f0,
    0 0 15px #0f0;
  animation: pulseGreen 2s infinite;
  border: 2px solid #0f0;
}
.skill-node-hex.available:hover {
  transform: scale(1.1);
  background: #003300;
  box-shadow:
    inset 0 0 0 2px #0f0,
    0 0 25px #0f0;
}
.skill-node-hex.available .skill-icon,
.skill-node-hex.available .skill-title-node {
  color: #0f0;
}

/* 4. Acquired (Bought) */
.skill-node-hex.acquired {
  background: #0f0;
  color: #000;
  box-shadow: 0 0 20px #0f0;
  border: 2px solid #0f0;
}
.skill-node-hex.acquired .skill-title-node {
  color: #000;
  font-weight: 900;
}
.skill-node-hex.acquired .skill-icon {
  color: #000;
  font-weight: 900;
}
.skill-node-hex.acquired .skill-cost-node {
  display: none;
} /* Hide cost once bought */

/* --- INSPECTOR PANEL (RIGHT SIDE) --- */
.skill-inspector {
  width: 300px;
  min-width: 300px;
  max-width: 300px;
  background: #080808;
  border-left: 2px solid #004400;
  padding: 20px;
  display: flex;
  flex-direction: column;
  /* Slide in animation */
  transform: translateX(100%);
  transition: transform 0.3s ease-in-out;
  flex-shrink: 0;
  overflow-y: auto;
  position: relative;
  z-index: 10; /* Ensure it's above canvas */
  box-shadow: -5px 0 20px rgba(0, 0, 0, 0.8); /* Shadow to show it's above */
}
.skill-inspector.open {
  transform: translateX(0);
}

.inspector-title {
  margin: 0 0 10px 0;
  color: #0f0;
  border-bottom: 1px solid #0f0;
  padding-bottom: 10px;
  font-size: 1.1rem;
  text-transform: uppercase;
  font-weight: bold;
}
.inspector-stat {
  font-size: 0.8rem;
  margin-bottom: 15px;
  color: #666;
  text-transform: uppercase;
}
.inspector-stat.tag-wits {
  color: #0ff;
}
.inspector-stat.tag-fight {
  color: #f00;
}
.inspector-stat.tag-smooth {
  color: #ff0;
}
.inspector-desc {
  font-size: 0.9rem;
  line-height: 1.4;
  color: #ccc;
  flex-grow: 1;
  margin-bottom: 20px;
}

.inspector-footer {
  margin-top: auto;
  padding-top: 20px;
  border-top: 1px dashed #333;
}
.cost-row {
  margin-bottom: 15px;
  color: #888;
  font-size: 0.9rem;
}
.cost-row .val {
  color: #ffd700;
  font-size: 1.2rem;
  font-weight: bold;
  margin-left: 5px;
}

.purchase-btn {
  width: 100%;
  padding: 15px;
  border: none;
  font-weight: bold;
  cursor: pointer;
  background: #0f0;
  color: #000;
  font-family: "Courier New", monospace;
  font-size: 0.9rem;
  text-transform: uppercase;
  transition: all 0.2s;
  box-shadow: 0 0 10px rgba(0, 255, 0, 0.3);
}
.purchase-btn:hover {
  background: #0ff;
  box-shadow: 0 0 20px rgba(0, 255, 255, 0.5);
  transform: scale(1.02);
}
.purchase-btn.disabled {
  background: #333;
  color: #555;
  cursor: not-allowed;
  box-shadow: none;
}
.purchase-btn.disabled:hover {
  transform: none;
  background: #333;
}

.acquired-tag {
  text-align: center;
  color: #0f0;
  border: 1px solid #0f0;
  padding: 10px;
  font-weight: bold;
  background: rgba(0, 255, 0, 0.1);
  text-transform: uppercase;
}

.inspector-placeholder {
  color: #444;
  font-style: italic;
  margin-top: 50px;
  text-align: center;
  font-size: 0.9rem;
}

@keyframes pulseGreen {
  0% {
    box-shadow:
      inset 0 0 0 2px #0f0,
      0 0 5px #0f0;
  }
  50% {
    box-shadow:
      inset 0 0 0 4px #0f0,
      0 0 20px #0f0;
  }
  100% {
    box-shadow:
      inset 0 0 0 2px #0f0,
      0 0 5px #0f0;
  }
}

/* Hide old list-based styles when using node view */
.skills-node-container .skill-trees-grid {
  display: none;
}
