/* ═══════════════════════════════════════════════════
   FEATURE — SKILLS TAB
   Mirrors the Items tab 3-column shell (browse / controls /
   preview). Scoped under .studio .tab-skills so nothing
   leaks into other panes. Values track items.css so grid /
   tree widths match across tabs.
   ═══════════════════════════════════════════════════ */

.studio .tab-skills .panel-body {
  grid-template-columns: 200px 260px 1fr;
}
.studio .tab-skills .panel-body:has(.browse-col.collapsed) {
  grid-template-columns: 28px 260px 1fr;
}

.studio .tab-skills .controls-col {
  border-right: 1px solid var(--border);
  padding: 14px 12px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  overflow-y: auto;
  background: #f8f8fa;
}

/* ── Search ── */
.studio .tab-skills .npc-search-wrap { display: flex; }

.studio .tab-skills .npc-search {
  width: 100%;
  box-sizing: border-box;
  padding: 6px 10px;
  border: 1px solid var(--border-lo);
  border-radius: 6px;
  background: var(--input-bg);
  color: var(--text);
  font-size: 12px;
  outline: none;
  transition: border-color 0.15s;
}
.studio .tab-skills .npc-search:focus        { border-color: var(--accent); }
.studio .tab-skills .npc-search::placeholder { color: var(--text-dim); }

/* ── Grid wrapper ── */
.studio .tab-skills .npc-grid-wrap {
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--input-bg);
  box-shadow: 0 2px 8px rgba(0,0,0,0.05);
  overflow-x: hidden;
  overflow-y: auto;
  max-height: 340px;
  scrollbar-width: thin;
}
.studio .tab-skills .npc-grid-wrap::-webkit-scrollbar       { width: 8px; }
.studio .tab-skills .npc-grid-wrap::-webkit-scrollbar-track {
  background: var(--chrome-lo);
  border-left: 1px solid var(--border);
  border-radius: 0 8px 8px 0;
}
.studio .tab-skills .npc-grid-wrap::-webkit-scrollbar-thumb {
  background: var(--border-lo);
  border: 2px solid var(--chrome-lo);
  border-radius: 4px;
  min-height: 28px;
}

/* ── Grid + buttons ── */
.studio .tab-skills .npc-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(56px, 1fr));
  gap: 4px;
  padding: 5px;
  box-sizing: border-box;
  width: 100%;
}

.studio .tab-skills .npc-btn {
  background: linear-gradient(180deg, #f6f6f6 0%, #e8e8e8 100%);
  border: none;
  outline: none;
  border-radius: 5px;
  padding: 4px 2px 3px;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  gap: 2px;
  width: 100%;
  height: 72px;
  position: relative;
  overflow: hidden;
  transition: transform 0.2s cubic-bezier(0.22, 1, 0.36, 1), background 0.15s;
}
.studio .tab-skills .npc-btn:hover {
  background: linear-gradient(180deg, #f0f0f0 0%, #e2e2e2 100%);
  transform: translateY(-3px);
}
.studio .tab-skills .npc-btn.active {
  background: linear-gradient(180deg, rgba(74,158,192,0.2) 0%, rgba(42,126,160,0.12) 100%);
}
.studio .tab-skills .npc-btn.active:hover { transform: translateY(0); }

.studio .tab-skills .npc-btn-icon {
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  /* Skill icons are 32×32 — the crisp-edges hint keeps the 1× draw sharp. */
  image-rendering: pixelated;
  image-rendering: crisp-edges;
}
.studio .tab-skills .npc-btn-icon canvas {
  max-width: 40px;
  max-height: 40px;
  image-rendering: pixelated;
  image-rendering: crisp-edges;
}

.studio .tab-skills .npc-btn-label {
  font-size: 9px;
  line-height: 1.15;
  text-align: center;
  color: var(--text);
  width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  padding: 0 2px;
}
.studio .tab-skills .npc-btn.active .npc-btn-label { font-weight: 600; }

.studio .tab-skills .npc-grid-msg {
  grid-column: 1 / -1;
  padding: 24px 8px;
  text-align: center;
  font-size: 12px;
  color: var(--text-dim);
}
.studio .tab-skills .npc-grid-err { color: #c33; }

/* ── Info panel (reuses items-info classes) ── */
.studio .tab-skills .items-info {
  font-size: 12px;
  color: var(--text);
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.studio .tab-skills .items-info-lbl {
  color: var(--text-dim);
  display: inline-block;
  width: 54px;
}

/* ── Preview canvas ── */
.studio .tab-skills #skills-preview-canvas {
  image-rendering: pixelated;
  image-rendering: crisp-edges;
  background: transparent;
}

/* ── Browse column ── */
.studio .tab-skills .browse-col {
  border-right: 1px solid var(--border);
  padding: 14px 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  overflow: hidden;
  background: #f8f8fa;
  min-width: 0;
}

.studio .tab-skills .browse-col-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-bottom: 5px;
  border-bottom: 1px solid var(--border);
}
.studio .tab-skills .browse-col-title {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-mid);
  display: flex;
  align-items: center;
  gap: 6px;
}
.studio .tab-skills .browse-col-title::before {
  content: '';
  width: 2px;
  height: 11px;
  background: var(--accent);
  border-radius: 1px;
}
.studio .tab-skills .browse-col-toggle {
  appearance: none;
  background: transparent;
  border: none;
  color: var(--text-dim);
  cursor: pointer;
  font-size: 11px;
  line-height: 1;
  padding: 2px 4px;
  border-radius: 3px;
  transition: background 0.12s, color 0.12s;
}
.studio .tab-skills .browse-col-toggle:hover {
  background: var(--chrome-lo);
  color: var(--text);
}

.studio .tab-skills .browse-col.collapsed                { padding: 14px 2px; }
.studio .tab-skills .browse-col.collapsed .browse-col-header {
  justify-content: center;
  padding-bottom: 0;
  border-bottom: none;
}
.studio .tab-skills .browse-col.collapsed .browse-col-title { display: none; }
.studio .tab-skills .browse-col.collapsed .items-tree       { display: none; }

/* ── Category tree ── */
.studio .tab-skills .items-tree {
  display: flex;
  flex-direction: column;
  gap: 2px;
  flex: 1;
  overflow-y: auto;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--input-bg);
  padding: 4px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.05);
  scrollbar-width: thin;
  min-height: 0;
}
.studio .tab-skills .items-tree::-webkit-scrollbar       { width: 8px; }
.studio .tab-skills .items-tree::-webkit-scrollbar-track {
  background: var(--chrome-lo);
  border-radius: 4px;
}
.studio .tab-skills .items-tree::-webkit-scrollbar-thumb {
  background: var(--border-lo);
  border: 2px solid var(--chrome-lo);
  border-radius: 4px;
  min-height: 28px;
}

.studio .tab-skills .items-tree-group {
  display: flex;
  flex-direction: column;
}

.studio .tab-skills .items-tree-header {
  appearance: none;
  background: transparent;
  border: none;
  padding: 4px 6px;
  font: 600 12px "Segoe UI", Arial, sans-serif;
  color: var(--text);
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 6px;
  border-radius: 4px;
  text-align: left;
}
.studio .tab-skills .items-tree-header:hover { background: var(--chrome-lo); }
.studio .tab-skills .items-tree-chev {
  width: 10px;
  color: var(--text-dim);
  font-size: 10px;
  line-height: 1;
  flex-shrink: 0;
}

.studio .tab-skills .items-tree-items {
  display: none;
  flex-direction: column;
  gap: 1px;
  padding-left: 18px;
  margin-bottom: 2px;
}
.studio .tab-skills .items-tree-group.open > .items-tree-items { display: flex; }

.studio .tab-skills .items-tree-item {
  appearance: none;
  background: transparent;
  border: none;
  padding: 3px 8px;
  font: 11px "Segoe UI", Arial, sans-serif;
  color: var(--text);
  cursor: pointer;
  border-radius: 4px;
  text-align: left;
  transition: background 0.12s, color 0.12s;
}
.studio .tab-skills .items-tree-item:hover:not(.active) { background: var(--chrome-lo); }
.studio .tab-skills .items-tree-item.active {
  background: var(--accent);
  color: #fff;
  font-weight: 600;
}

/* A leaf-only group (Beginner, Mob Skills) renders its sole row as a
   tree-header that behaves like an item — no chevron, no children row. */
.studio .tab-skills .items-tree-header.is-leaf {
  font-weight: 500;
  font-size: 11px;
}
.studio .tab-skills .items-tree-header.is-leaf .items-tree-chev {
  visibility: hidden;
}
.studio .tab-skills .items-tree-header.is-leaf.active {
  background: var(--accent);
  color: #fff;
  font-weight: 600;
}

/* ── Level row (shown in the controls column when ToolTip is the
      active kind; hidden otherwise) ── */
.studio .tab-skills .skills-level-row {
  display: flex;
  align-items: center;
  gap: 4px;
}
.studio .tab-skills .skills-tt-lvbtn {
  appearance: none;
  background: var(--chrome-lo);
  color: var(--text);
  border: 1px solid var(--border-lo);
  border-radius: 4px;
  padding: 2px 6px;
  font: 600 10px "Segoe UI", Arial, sans-serif;
  cursor: pointer;
  height: 22px;
  line-height: 1;
  min-width: 26px;
  transition: background 0.12s, border-color 0.12s, color 0.12s;
}
.studio .tab-skills .skills-tt-lvbtn:hover:not(:disabled) {
  background: #fff;
  border-color: var(--accent);
  color: var(--accent-text);
}
.studio .tab-skills .skills-tt-lvbtn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}
.studio .tab-skills .skills-tt-lvtext {
  flex: 1;
  text-align: center;
  font: 600 11px "Segoe UI", Arial, sans-serif;
  color: var(--text);
  white-space: nowrap;
}

/* View toggle in the preview toolbar — same chrome as Items tab. */
.studio .tab-skills .items-view-toggle {
  display: inline-flex;
  border: 1px solid var(--border-lo);
  border-radius: 4px;
  overflow: hidden;
}
.studio .tab-skills .items-view-toggle button {
  appearance: none;
  background: var(--chrome-lo);
  color: var(--text-dim);
  border: none;
  border-right: 1px solid var(--border-lo);
  padding: 2px 10px;
  font: 11px "Segoe UI", Arial, sans-serif;
  cursor: pointer;
  height: 20px;
  line-height: 1;
}
.studio .tab-skills .items-view-toggle button:last-child { border-right: none; }
.studio .tab-skills .items-view-toggle button.active {
  background: var(--accent);
  color: #fff;
}
.studio .tab-skills .items-view-toggle button:hover:not(.active) {
  background: var(--border-lo);
  color: var(--text);
}

/* Tooltip render canvas — pixel-art aware. */
.studio .tab-skills #skills-preview-canvas.tooltip-view {
  image-rendering: pixelated;
  image-rendering: crisp-edges;
  background: transparent;
}

/* ── Kind selector (Effect / Hit / Affected / Ball) ── */
.studio .tab-skills .skills-kind-row {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}
.studio .tab-skills .skills-kind-row button {
  appearance: none;
  background: var(--chrome-lo);
  color: var(--text-dim);
  border: 1px solid var(--border-lo);
  border-radius: 4px;
  padding: 2px 8px;
  font: 600 10px "Segoe UI", Arial, sans-serif;
  cursor: pointer;
  height: 20px;
  line-height: 1;
  min-width: 34px;
  transition: background 0.12s, border-color 0.12s, color 0.12s;
}
.studio .tab-skills .skills-kind-row button:hover:not(.active):not(:disabled) {
  background: var(--border-lo);
  color: var(--text);
}
.studio .tab-skills .skills-kind-row button.active {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}
.studio .tab-skills .skills-kind-row button:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}
