/* ==========================================================================
 * SOLID3D CAD - Blender-Style Enhancements (CSS)
 * Pie Menus, Viewport Shading, MatCaps, X-Ray, Modifier Stack, Node Shader, Render Studio
 * License: MIT
 * ========================================================================== */

/* --- 1. Blender Pie Menus (Radial Menu) --- */
.blender-pie-menu {
  position: fixed;
  z-index: 99999;
  width: 260px;
  height: 260px;
  transform: translate(-50%, -50%);
  pointer-events: none;
  display: none;
  user-select: none;
}
.blender-pie-menu.active {
  display: block;
}
.pie-center-disc {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 60px;
  height: 60px;
  transform: translate(-50%, -50%);
  background: radial-gradient(circle, #2d3139 0%, #1a1c23 100%);
  border: 2px solid #007acc;
  border-radius: 50%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-size: 11px;
  font-weight: 600;
  box-shadow: 0 0 16px rgba(0, 122, 204, 0.4), inset 0 0 8px rgba(0, 0, 0, 0.6);
  pointer-events: auto;
}
.pie-item {
  position: absolute;
  width: 95px;
  height: 38px;
  background: rgba(28, 31, 38, 0.94);
  backdrop-filter: blur(8px);
  border: 1px solid #3c4250;
  border-radius: 6px;
  color: #e1e4ea;
  font-size: 11px;
  font-weight: 500;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  cursor: pointer;
  pointer-events: auto;
  transition: all 0.12s ease;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.5);
  transform: translate(-50%, -50%);
}
.pie-item:hover {
  background: #007acc;
  border-color: #38a5ff;
  color: #fff;
  box-shadow: 0 0 12px rgba(0, 122, 204, 0.6);
  transform: translate(-50%, -50%) scale(1.08);
}
.pie-item .pie-shortcut {
  font-size: 9px;
  opacity: 0.65;
  background: rgba(0, 0, 0, 0.4);
  padding: 1px 4px;
  border-radius: 3px;
}

/* Pie 8-Direction Positions */
.pie-pos-n  { top: 15px; left: 130px; }
.pie-pos-ne { top: 48px; left: 212px; }
.pie-pos-e  { top: 130px; left: 245px; }
.pie-pos-se { top: 212px; left: 212px; }
.pie-pos-s  { top: 245px; left: 130px; }
.pie-pos-sw { top: 212px; left: 48px; }
.pie-pos-w  { top: 130px; left: 15px; }
.pie-pos-nw { top: 48px; left: 48px; }

/* --- 2. Viewport Shading Header Bar --- */
.viewport-shading-bar {
  position: absolute;
  top: 14px;
  right: 140px;
  display: flex;
  align-items: center;
  gap: 2px;
  background: rgba(26, 29, 36, 0.88);
  backdrop-filter: blur(6px);
  border: 1px solid #363c48;
  border-radius: 6px;
  padding: 3px 5px;
  z-index: 100;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4);
}
.shading-btn {
  background: transparent;
  border: none;
  color: #9aa0ac;
  width: 28px;
  height: 28px;
  border-radius: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 13px;
  transition: all 0.15s ease;
}
.shading-btn svg {
  width: 16px;
  height: 16px;
  fill: currentColor;
  flex-shrink: 0;
  display: block;
  pointer-events: none;
}
.shading-btn i {
  font-size: 14px;
  line-height: 1;
  display: inline-block;
}
.shading-btn:hover {
  background: rgba(255, 255, 255, 0.08);
  color: #fff;
}
.shading-btn.active {
  background: #007acc;
  color: #fff;
  box-shadow: 0 0 8px rgba(0, 122, 204, 0.5);
}
.shading-divider {
  width: 1px;
  height: 18px;
  background: #3e4452;
  margin: 0 4px;
}
.shading-pill {
  font-size: 11px;
  padding: 3px 8px;
  color: #b0b6c4;
  cursor: pointer;
  border-radius: 4px;
  display: flex;
  align-items: center;
  gap: 4px;
}
.shading-pill:hover {
  background: rgba(255, 255, 255, 0.08);
  color: #fff;
}
.shading-pill.active {
  background: #2b5278;
  color: #79c0ff;
  font-weight: 600;
}

/* --- 3. Modifier Stack Panel (Blender-Style) --- */
.modifier-stack-panel {
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-height: 400px;
  overflow-y: auto;
  padding: 4px;
}
.modifier-card {
  background: #21252d;
  border: 1px solid #363c48;
  border-radius: 6px;
  overflow: hidden;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.3);
  transition: border-color 0.15s ease;
}
.modifier-card:hover {
  border-color: #4a5468;
}
.modifier-card.active {
  border-color: #007acc;
}
.modifier-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 12px;
  background: #282d37;
  cursor: pointer;
  border-bottom: 1px solid #363c48;
}
.mod-title {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 600;
  font-size: 12px;
  color: #e1e4ea;
}
.mod-title .mod-icon {
  color: #007acc;
  font-size: 14px;
}
.mod-actions {
  display: flex;
  align-items: center;
  gap: 6px;
}
.mod-btn-action {
  background: transparent;
  border: none;
  color: #8b92a0;
  cursor: pointer;
  font-size: 12px;
  padding: 2px 4px;
  border-radius: 3px;
}
.mod-btn-action:hover {
  background: rgba(255, 255, 255, 0.1);
  color: #fff;
}
.modifier-body {
  padding: 10px 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.mod-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 11px;
  color: #b0b6c4;
}
.mod-row input, .mod-row select {
  background: #181b22;
  border: 1px solid #363c48;
  color: #fff;
  border-radius: 4px;
  padding: 4px 6px;
  font-size: 11px;
  width: 130px;
}

/* --- 4. Node-Based Shader Editor Modal (Blender PBR Shader Graph Studio) --- */
.node-shader-modal-window {
  width: 96vw;
  max-width: 1720px;
  height: 94vh;
  max-height: 960px;
  display: flex;
  flex-direction: column;
  background: #14171d;
  border: 1px solid #363c48;
  border-radius: 8px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.75);
  overflow: hidden;
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

.node-shader-modal-window.fullscreen {
  width: 100vw !important;
  height: 100vh !important;
  max-width: 100vw !important;
  max-height: 100vh !important;
  border-radius: 0 !important;
  border: none !important;
  margin: 0 !important;
  position: fixed !important;
  top: 0 !important;
  left: 0 !important;
  z-index: 2000 !important;
}

.node-shader-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 16px;
  background: #181b22;
  border-bottom: 1px solid #2a2f3a;
  user-select: none;
}

.node-shader-badge {
  font-size: 10px;
  font-weight: 700;
  color: #38a5ff;
  background: rgba(56, 165, 255, 0.12);
  border: 1px solid rgba(56, 165, 255, 0.3);
  padding: 2px 7px;
  border-radius: 10px;
  letter-spacing: 0.5px;
}

.modal-header-btn {
  background: #232833;
  border: 1px solid #363c48;
  color: #c9d1d9;
  width: 28px;
  height: 28px;
  border-radius: 4px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 12px;
  transition: all 0.15s ease;
}

.modal-header-btn:hover {
  background: #007acc;
  border-color: #38a5ff;
  color: #fff;
}

.node-shader-body {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
  padding: 10px 14px;
  gap: 8px;
  overflow: hidden;
  background: #13151b;
}

/* Top Toolbar: Search + Add Node Dropdown + Quick Actions */
.node-shader-top-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
  background: #191c24;
  border: 1px solid #282e3a;
  border-radius: 6px;
  padding: 6px 10px;
}

.node-shader-search-wrap {
  display: flex;
  align-items: center;
  position: relative;
  flex: 1;
  min-width: 240px;
  max-width: 520px;
}

.node-shader-search-input {
  width: 100%;
  background: #12141a;
  border: 1px solid #363c48;
  border-radius: 4px;
  color: #e1e4ea;
  font-size: 12px;
  padding: 5px 28px 5px 10px;
  transition: border-color 0.15s ease;
}

.node-shader-search-input:focus {
  outline: none;
  border-color: #38a5ff;
  box-shadow: 0 0 0 2px rgba(56, 165, 255, 0.2);
}

.node-shader-clear-search-btn {
  position: absolute;
  right: 6px;
  background: transparent;
  border: none;
  color: #798394;
  font-size: 14px;
  cursor: pointer;
  padding: 2px 5px;
  line-height: 1;
  border-radius: 3px;
}

.node-shader-clear-search-btn:hover {
  color: #fff;
  background: rgba(255, 255, 255, 0.1);
}

/* Add Node Dropdown Menu */
.node-dropdown-container {
  position: relative;
  display: inline-block;
}

.node-dropdown-menu {
  display: none;
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  min-width: 230px;
  background: #1c202a;
  border: 1px solid #3b4252;
  border-radius: 6px;
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.7);
  z-index: 100;
  padding: 6px 0;
  user-select: none;
}

.node-dropdown-menu.active {
  display: block;
}

.node-dropdown-group-title {
  padding: 5px 12px 3px;
  font-size: 10px;
  font-weight: 700;
  color: #798394;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.node-dropdown-item {
  padding: 6px 12px;
  font-size: 11px;
  color: #c9d1d9;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 8px;
  transition: all 0.12s ease;
}

.node-dropdown-item:hover {
  background: #007acc;
  color: #ffffff;
}

.node-dropdown-divider {
  height: 1px;
  background: #2a303e;
  margin: 4px 0;
}

.node-toolbar-btn {
  background: #222631;
  border: 1px solid #363c48;
  color: #c9d1d9;
  font-size: 11px;
  padding: 5px 10px;
  border-radius: 4px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-weight: 500;
  transition: all 0.15s ease;
}

.node-toolbar-btn:hover {
  background: #2c3240;
  border-color: #4c566a;
  color: #fff;
}

.node-toolbar-btn.primary {
  background: #1e3a5f;
  border-color: #2563eb;
  color: #93c5fd;
}

.node-toolbar-btn.primary:hover {
  background: #2563eb;
  color: #fff;
}

.node-toolbar-btn.primary-action {
  background: linear-gradient(135deg, #10b981, #059669);
  border-color: #34d399;
  color: #fff;
  font-weight: 600;
}

.node-toolbar-btn.primary-action:hover {
  background: linear-gradient(135deg, #059669, #047857);
  box-shadow: 0 0 10px rgba(16, 185, 129, 0.4);
}

/* Category Filter Pills */
.node-category-pills-bar {
  display: flex;
  align-items: center;
  gap: 6px;
  overflow-x: auto;
  padding: 2px 0 4px;
  scrollbar-width: thin;
}

.node-category-pills-bar::-webkit-scrollbar {
  height: 4px;
}

.node-category-pills-bar::-webkit-scrollbar-thumb {
  background: #2e3440;
  border-radius: 4px;
}

.node-cat-pill {
  background: #1b1e26;
  border: 1px solid #2e3442;
  color: #9aa2b0;
  font-size: 11px;
  padding: 4px 10px;
  border-radius: 14px;
  cursor: pointer;
  white-space: nowrap;
  font-weight: 500;
  transition: all 0.15s ease;
}

.node-cat-pill:hover {
  background: #262c38;
  color: #e1e4ea;
  border-color: #3d4659;
}

.node-cat-pill.active {
  background: #007acc;
  border-color: #38a5ff;
  color: #ffffff;
  font-weight: 600;
  box-shadow: 0 2px 6px rgba(0, 122, 204, 0.35);
}

/* Horizontal Preset Strip */
.node-preset-strip-wrap {
  overflow-x: auto;
  overflow-y: hidden;
  padding: 2px 0 6px;
  scrollbar-width: thin;
}

.node-preset-strip-wrap::-webkit-scrollbar {
  height: 5px;
}

.node-preset-strip-wrap::-webkit-scrollbar-thumb {
  background: #363c48;
  border-radius: 4px;
}

.node-preset-strip {
  display: flex;
  align-items: center;
  gap: 8px;
  width: max-content;
}

.node-preset-card {
  display: flex;
  align-items: center;
  gap: 8px;
  background: #181c24;
  border: 1px solid #2a313f;
  border-radius: 6px;
  padding: 4px 10px;
  cursor: pointer;
  transition: all 0.15s ease;
  user-select: none;
}

.node-preset-card:hover {
  background: #222734;
  border-color: #3e485c;
  transform: translateY(-1px);
}

.node-preset-card.active {
  background: #1b2838;
  border-color: #007acc;
  box-shadow: 0 0 0 1px #007acc, 0 3px 10px rgba(0, 122, 204, 0.3);
}

.node-preset-swatch {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  border: 1px solid rgba(255, 255, 255, 0.25);
  flex-shrink: 0;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.4);
}

.node-preset-card-name {
  font-size: 11px;
  font-weight: 500;
  color: #c9d1d9;
  white-space: nowrap;
}

.node-preset-card.active .node-preset-card-name {
  color: #79c0ff;
  font-weight: 600;
}

/* Canvas Container & Pan/Zoom Viewport */
.node-editor-container {
  display: flex;
  flex: 1;
  min-height: 380px;
  background: #101217;
  position: relative;
  overflow: hidden;
  border-radius: 6px;
  border: 1px solid #282d38;
  cursor: grab;
  user-select: none;
}

.node-editor-container.panning {
  cursor: grabbing !important;
}

.node-canvas-viewport {
  position: absolute;
  top: 0;
  left: 0;
  width: 5000px;
  height: 4000px;
  transform-origin: 0 0;
  will-change: transform;
  background-size: 32px 32px;
  background-image: 
    linear-gradient(to right, rgba(255, 255, 255, 0.035) 1px, transparent 1px),
    linear-gradient(to bottom, rgba(255, 255, 255, 0.035) 1px, transparent 1px);
}

.node-canvas-area {
  flex: 1;
  position: relative;
  overflow: hidden;
}

.node-svg-wires {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  overflow: visible;
  z-index: 1;
}

.node-boxes-layer {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 2;
}

/* Node Box & Headers */
.node-box {
  pointer-events: auto;
  position: absolute;
  width: 200px;
  background: rgba(26, 30, 38, 0.96);
  backdrop-filter: blur(8px);
  border: 1px solid #3b4252;
  border-radius: 7px;
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.65);
  user-select: none;
  font-size: 11px;
  transition: box-shadow 0.15s ease, border-color 0.15s ease;
}

.node-box:hover {
  border-color: #525d73;
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.8);
}

.node-box.header-red .node-header    { background: linear-gradient(90deg, #991b1b, #7f1d1d); }
.node-box.header-green .node-header  { background: linear-gradient(90deg, #166534, #14532d); }
.node-box.header-blue .node-header   { background: linear-gradient(90deg, #1d4ed8, #1e40af); }
.node-box.header-gold .node-header   { background: linear-gradient(90deg, #b45309, #92400e); }
.node-box.header-purple .node-header { background: linear-gradient(90deg, #6d28d9, #5b21b6); }
.node-box.header-teal .node-header   { background: linear-gradient(90deg, #0f766e, #115e59); }

.node-header {
  padding: 7px 10px;
  font-weight: 600;
  color: #ffffff;
  border-top-left-radius: 6px;
  border-top-right-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  cursor: move;
  border-bottom: 1px solid rgba(0, 0, 0, 0.2);
}

.node-body {
  padding: 9px 11px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

/* Sockets */
.node-socket-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin: 3px 0;
  position: relative;
  font-size: 11px;
  color: #abb2bf;
}

.node-socket {
  width: 11px;
  height: 11px;
  border-radius: 50%;
  border: 2px solid #ffffff;
  cursor: pointer;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.node-socket:hover {
  transform: scale(1.4);
  box-shadow: 0 0 8px #fff;
}

.socket-in {
  position: absolute;
  left: -16px;
}

.socket-out {
  position: absolute;
  right: -16px;
}

.socket-color   { background: #e5c07b !important; }
.socket-vector  { background: #c678dd !important; }
.socket-float   { background: #abb2bf !important; }
.socket-shader  { background: #98c379 !important; }

/* Canvas HUD Controls (Bottom Right) */
.node-canvas-hud {
  position: absolute;
  bottom: 12px;
  right: 14px;
  display: flex;
  align-items: center;
  gap: 4px;
  background: rgba(22, 25, 33, 0.88);
  backdrop-filter: blur(8px);
  border: 1px solid #363c48;
  border-radius: 6px;
  padding: 4px 6px;
  z-index: 10;
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.5);
}

.node-hud-btn {
  background: #2a2f3a;
  border: 1px solid #3d4554;
  color: #c9d1d9;
  width: 26px;
  height: 24px;
  border-radius: 4px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 11px;
  font-weight: 600;
  transition: all 0.12s ease;
}

.node-hud-btn:hover {
  background: #007acc;
  border-color: #38a5ff;
  color: #fff;
}

.node-hud-zoom-badge {
  font-size: 11px;
  font-weight: 600;
  color: #79c0ff;
  min-width: 44px;
  text-align: center;
  padding: 0 2px;
}

.node-hud-divider {
  width: 1px;
  height: 16px;
  background: #3d4554;
  margin: 0 2px;
}

.node-canvas-hint {
  position: absolute;
  bottom: 10px;
  left: 14px;
  font-size: 10px;
  color: #636d80;
  pointer-events: none;
  background: rgba(18, 20, 26, 0.7);
  padding: 3px 8px;
  border-radius: 4px;
  border: 1px solid rgba(255, 255, 255, 0.05);
}

/* Material Output Live Preview */
.node-preview-wrapper {
  display: flex;
  flex-direction: column;
  align-items: center;
  margin: 6px 0;
  gap: 4px;
}

.node-preview-canvas-container {
  position: relative;
  border-radius: 6px;
  overflow: hidden;
  border: 1px solid #384152;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4);
}

.node-preview-shapes-bar {
  display: flex;
  align-items: center;
  gap: 4px;
  margin-top: 3px;
}

.node-shape-btn {
  background: #20242e;
  border: 1px solid #343b49;
  color: #9aa2b0;
  font-size: 10px;
  padding: 2px 6px;
  border-radius: 3px;
  cursor: pointer;
  transition: all 0.12s ease;
}

.node-shape-btn:hover {
  background: #2a3140;
  color: #fff;
}

.node-shape-btn.active {
  background: #007acc;
  border-color: #38a5ff;
  color: #fff;
  font-weight: 600;
}

/* Modal Bottom Status Bar */
.node-shader-status-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-top: 4px;
}

.node-status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #10b981;
  box-shadow: 0 0 6px #10b981;
  display: inline-block;
}

/* --- 5. Render Studio & HDRI Panel --- */
.render-studio-controls {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
  gap: 10px;
  margin-top: 10px;
}
.hdri-card {
  background: #21252d;
  border: 2px solid transparent;
  border-radius: 6px;
  padding: 8px;
  text-align: center;
  cursor: pointer;
  transition: all 0.15s ease;
}
.hdri-card:hover {
  background: #2a303a;
  border-color: #4a5468;
}
.hdri-card.active {
  border-color: #007acc;
  background: #1e3347;
}
.hdri-thumbnail {
  width: 100%;
  height: 60px;
  border-radius: 4px;
  margin-bottom: 6px;
  background-size: cover;
  background-position: center;
}
.hdri-title {
  font-size: 11px;
  font-weight: 600;
  color: #e1e4ea;
}

/* --- 6. Modal Inset & Interactive Bevel Form --- */
.tool-slider-row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 8px 0;
}
.tool-slider-row input[type="range"] {
  flex: 1;
}
.tool-slider-row .slider-val {
  min-width: 48px;
  text-align: right;
  font-weight: 600;
  color: #79c0ff;
  font-size: 12px;
}

/* --- 7. Interactive Node Shader Controls & Toolbar --- */
.node-toolbar-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  background: #191c22;
  border: 1px solid #2e3440;
  border-radius: 6px;
  padding: 6px 10px;
  margin-bottom: 8px;
}
.node-preset-pill {
  background: #232832;
  border: 1px solid #384050;
  color: #c9d1d9;
  font-size: 11px;
  padding: 4px 8px;
  border-radius: 4px;
  cursor: pointer;
  transition: all 0.12s ease;
}
.node-preset-pill:hover {
  background: #007acc;
  border-color: #38a5ff;
  color: #fff;
}
.node-ctrl-row {
  display: flex;
  flex-direction: column;
  gap: 2px;
  margin: 3px 0;
}
.node-ctrl-row label {
  font-size: 10px;
  color: #9aa2b0;
  display: flex;
  justify-content: space-between;
}
.node-ctrl-row label .lbl-val {
  color: #79c0ff;
  font-weight: 600;
}
.node-input-range {
  width: 100%;
  accent-color: #3488f7;
  height: 5px;
  cursor: pointer;
}
.node-input-select {
  width: 100%;
  background: #14171d;
  border: 1px solid #363c48;
  color: #e1e4ea;
  border-radius: 3px;
  padding: 3px 5px;
  font-size: 10px;
}

/* --- 8. 500 Household 3D Models Library Modal (SQLite Powered) --- */
.hld-lib-toolbar {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 10px;
}
.hld-lib-search-wrap {
  flex: 1;
  position: relative;
  display: flex;
  align-items: center;
}
.hld-lib-search-input {
  width: 100%;
  background: #15181e;
  border: 1px solid #363c48;
  color: #ffffff;
  border-radius: 6px;
  padding: 8px 32px 8px 12px;
  font-size: 12px;
}
.hld-lib-search-input:focus {
  border-color: #3488f7;
  outline: none;
  box-shadow: 0 0 0 2px rgba(52, 136, 247, 0.2);
}
.hld-lib-clear-btn {
  position: absolute;
  right: 8px;
  background: transparent;
  border: none;
  color: #8b92a0;
  cursor: pointer;
  font-size: 15px;
}
.hld-lib-clear-btn:hover {
  color: #ffffff;
}
.hld-category-dropdown {
  background: #161920;
  border: 1px solid #30363d;
  color: #e1e4ea;
  outline: none;
  cursor: pointer;
  transition: border-color 0.15s ease;
}
.hld-category-dropdown:hover,
.hld-category-dropdown:focus {
  border-color: #388bfd;
}
.hld-category-dropdown optgroup {
  background: #1c2128;
  color: #58a6ff;
  font-weight: 600;
  font-size: 11px;
}
.hld-category-dropdown option {
  background: #161920;
  color: #c9d1d9;
  font-size: 12px;
  padding: 4px;
}

.hld-lib-domain-tabs {
  display: flex;
  align-items: center;
  gap: 6px;
  overflow-x: auto;
  padding: 4px 0 6px 0;
  margin-bottom: 8px;
  border-bottom: 1px solid #282e3a;
  scrollbar-width: thin;
  scrollbar-color: #30363d transparent;
}
.hld-lib-domain-tabs::-webkit-scrollbar {
  height: 4px;
}
.hld-lib-domain-tabs::-webkit-scrollbar-track {
  background: transparent;
}
.hld-lib-domain-tabs::-webkit-scrollbar-thumb {
  background: #30363d;
  border-radius: 4px;
}
.hld-lib-domain-tabs::-webkit-scrollbar-thumb:hover {
  background: #484f58;
}
.hld-domain-tab {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: #161a22;
  border: 1px solid #2a313e;
  color: #9aa2b0;
  font-size: 11px;
  font-weight: 600;
  padding: 5px 11px;
  border-radius: 8px;
  cursor: pointer;
  white-space: nowrap;
  user-select: none;
  transition: all 0.14s ease;
}
.hld-domain-tab:hover {
  background: #212631;
  border-color: #3d4657;
  color: #ffffff;
}
.hld-domain-tab.active {
  background: linear-gradient(135deg, #1d4ed8 0%, #2563eb 100%);
  border-color: #60a5fa;
  color: #ffffff;
  box-shadow: 0 2px 8px rgba(37, 99, 235, 0.35);
}
.hld-domain-count {
  background: rgba(0, 0, 0, 0.35);
  color: #93c5fd;
  font-size: 10px;
  padding: 1px 6px;
  border-radius: 10px;
  font-weight: 500;
}
.hld-domain-tab.active .hld-domain-count {
  background: rgba(0, 0, 0, 0.45);
  color: #ffffff;
}
.hld-lib-categories {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  margin-bottom: 10px;
  padding-bottom: 8px;
  border-bottom: 1px solid #2b303b;
  max-height: 84px;
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: #30363d transparent;
}
.hld-lib-categories::-webkit-scrollbar {
  width: 4px;
}
.hld-lib-categories::-webkit-scrollbar-track {
  background: transparent;
}
.hld-lib-categories::-webkit-scrollbar-thumb {
  background: #30363d;
  border-radius: 4px;
}
.hld-lib-categories::-webkit-scrollbar-thumb:hover {
  background: #484f58;
}
.hld-cat-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: #1c2028;
  border: 1px solid #323846;
  color: #c9d1d9;
  font-size: 11px;
  font-weight: 500;
  padding: 4px 10px;
  border-radius: 14px;
  cursor: pointer;
  transition: all 0.14s ease;
}
.hld-cat-pill:hover {
  background: #272d38;
  border-color: #4f586b;
  color: #fff;
}
.hld-cat-pill.active {
  background: #1f4678;
  border-color: #3488f7;
  color: #ffffff;
  font-weight: 600;
}
.hld-cat-pill.hld-cat-clear {
  background: #2a1b1e;
  border-color: #632a2a;
  color: #f87171;
}
.hld-cat-pill.hld-cat-clear:hover {
  background: #3e2226;
  border-color: #ef4444;
  color: #fff;
}
.hld-cat-count {
  background: rgba(0, 0, 0, 0.35);
  color: #79c0ff;
  font-size: 10px;
  padding: 1px 6px;
  border-radius: 10px;
}
.hld-card-cat {
  cursor: pointer;
  transition: color 0.14s ease;
}
.hld-card-cat:hover {
  color: #58a6ff !important;
  text-decoration: underline;
}
.hld-lib-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
  max-height: 62vh;
  overflow-y: auto;
  padding: 4px 2px;
  transition: opacity 0.15s ease;
}
.hld-model-card {
  background: #1a1d24;
  border: 1px solid #2e3440;
  border-radius: 7px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  transition: all 0.15s ease;
}
.hld-model-card:hover {
  border-color: #3488f7;
  transform: translateY(-2px);
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.45);
}
.hld-card-thumb {
  position: relative;
  width: 100%;
  height: 112px;
  background: #12151b;
  border-bottom: 1px solid #262b35;
  cursor: pointer;
}
.hld-card-thumb canvas {
  width: 100%;
  height: 100%;
  display: block;
}
.hld-badge-code {
  position: absolute;
  top: 6px;
  left: 6px;
  background: rgba(18, 21, 27, 0.85);
  border: 1px solid #363c48;
  color: #79c0ff;
  font-size: 10px;
  font-family: monospace;
  font-weight: 600;
  padding: 1px 6px;
  border-radius: 4px;
}
.hld-badge-parts {
  position: absolute;
  bottom: 6px;
  right: 6px;
  background: rgba(18, 21, 27, 0.85);
  color: #adb5bd;
  font-size: 10px;
  padding: 1px 6px;
  border-radius: 4px;
}
.hld-card-body {
  padding: 8px 10px;
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 3px;
}
.hld-card-cat {
  font-size: 10px;
  color: #79c0ff;
  text-transform: uppercase;
  letter-spacing: 0.3px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.hld-card-title {
  font-size: 12px;
  font-weight: 600;
  color: #ffffff;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.hld-card-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 10px;
  color: #8b92a0;
  margin-top: 2px;
}
.hld-mat-dot {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  border: 1px solid rgba(255, 255, 255, 0.35);
}
.hld-card-mat-label {
  font-size: 10px;
  color: #9aa2b0;
}
.hld-card-footer {
  padding: 6px 10px 9px;
}
.btn-hld-insert {
  width: 100%;
  background: linear-gradient(180deg, #2563eb 0%, #1d4ed8 100%);
  border: 1px solid #3b82f6;
  color: #ffffff;
  font-size: 11px;
  font-weight: 600;
  padding: 6px 8px;
  border-radius: 5px;
  cursor: pointer;
  transition: all 0.14s ease;
}
.btn-hld-insert:hover {
  background: linear-gradient(180deg, #3b82f6 0%, #2563eb 100%);
  box-shadow: 0 0 10px rgba(59, 130, 246, 0.45);
}
.hld-lib-pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
}
.hld-page-btn {
  background: #1c2028;
  border: 1px solid #363c48;
  color: #c9d1d9;
  font-size: 11px;
  padding: 4px 10px;
  border-radius: 4px;
  cursor: pointer;
  min-width: 32px;
}
.hld-page-btn:hover:not(:disabled) {
  background: #2b313e;
  color: #fff;
}
.hld-page-btn.active {
  background: #007acc;
  border-color: #38a5ff;
  color: #fff;
  font-weight: 600;
}
.hld-page-btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

