/* =================================================================
   Broken Stones Builder UI — bs-builder.css
   Dark side panel, Windows 11 / Steam / Figma inspired.
   ================================================================= */

/* ---- Panel ---- */
#bs-builder-panel {
  position: fixed;
  top: 0;
  right: 0;
  width: 272px;
  height: 100vh;
  height: 100dvh;
  background: rgba(11, 11, 14, 0.97);
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
  border-left: 1px solid rgba(255, 255, 255, 0.07);
  z-index: 10001;
  display: flex;
  flex-direction: column;
  transform: translateX(100%);
  transition: transform 0.24s cubic-bezier(.4, 0, .2, 1);
  font-family: 'SF Pro Text', 'Segoe UI Variable', 'Segoe UI', system-ui, sans-serif;
  font-size: 12px;
  color: #c0c0c4;
  box-shadow: -16px 0 48px rgba(0, 0, 0, 0.7);
  overflow: hidden;
}

#bs-builder-panel.open {
  transform: translateX(0);
}

/* ---- Header ---- */
.bsb-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 14px 12px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
  flex-shrink: 0;
}

.bsb-header-logo {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.22em;
  color: #fff;
  text-transform: uppercase;
}

.bsb-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #34d399;
  display: inline-block;
  box-shadow: 0 0 8px rgba(52, 211, 153, 0.6);
  flex-shrink: 0;
}

.bsb-close {
  background: none;
  border: none;
  color: rgba(255, 255, 255, 0.35);
  cursor: pointer;
  font-size: 13px;
  padding: 4px 6px;
  border-radius: 4px;
  line-height: 1;
  transition: color 0.15s, background 0.15s;
}
.bsb-close:hover {
  color: #fff;
  background: rgba(255, 255, 255, 0.08);
}

/* ---- Tabs ---- */
.bsb-tabs {
  display: flex;
  padding: 0 14px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
  flex-shrink: 0;
  gap: 2px;
}

.bsb-tab {
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  color: rgba(255, 255, 255, 0.35);
  cursor: pointer;
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.1em;
  padding: 9px 12px 7px;
  text-transform: uppercase;
  transition: color 0.15s, border-color 0.15s;
  margin-bottom: -1px;
}
.bsb-tab:hover { color: rgba(255, 255, 255, 0.65); }
.bsb-tab.active {
  color: #fff;
  border-bottom-color: #34d399;
}

/* ---- Panes ---- */
.bsb-pane {
  display: none;
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 10px 12px;
  flex-direction: column;
  gap: 2px;
  scrollbar-width: thin;
  scrollbar-color: rgba(255, 255, 255, 0.1) transparent;
  min-height: 0;
}
.bsb-pane.active { display: flex; }
.bsb-pane::-webkit-scrollbar { width: 3px; }
.bsb-pane::-webkit-scrollbar-track { background: transparent; }
.bsb-pane::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.1);
  border-radius: 2px;
}

/* ---- Empty state ---- */
.bsb-empty-state {
  color: rgba(255, 255, 255, 0.22);
  font-size: 11px;
  text-align: center;
  padding: 36px 16px;
  line-height: 1.7;
}

/* ---- Section label ---- */
.bsb-section-label {
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.25);
  padding: 6px 0 8px;
}

/* ---- Object grid (spawn cards) ---- */
.bsb-obj-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 7px;
  padding-bottom: 6px;
}

.bsb-obj-card {
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.07);
  border-radius: 9px;
  padding: 14px 8px 10px;
  cursor: grab;
  text-align: center;
  transition: background 0.15s, border-color 0.15s, transform 0.1s;
  user-select: none;
}
.bsb-obj-card:hover {
  background: rgba(255, 255, 255, 0.07);
  border-color: rgba(52, 211, 153, 0.28);
  transform: translateY(-1px);
}
.bsb-obj-card:active { cursor: grabbing; transform: scale(0.96); }
.bsb-obj-card[draggable="true"] { -webkit-user-drag: element; }

.bsb-obj-icon {
  font-size: 20px;
  font-weight: 800;
  font-family: 'Courier New', monospace;
  color: #34d399;
  margin-bottom: 7px;
  line-height: 1;
  letter-spacing: -0.02em;
}

.bsb-obj-label {
  font-size: 9px;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.5);
}

/* ---- Property row ---- */
.bsb-prop-row {
  display: flex;
  flex-direction: column;
  gap: 5px;
  padding: 8px 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.04);
}
.bsb-prop-row:last-child { border-bottom: none; }

.bsb-prop-label {
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.28);
}

/* ---- Inputs ---- */
.bsb-input,
.bsb-textarea {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.09);
  border-radius: 6px;
  color: #e0e0e4;
  font-size: 12px;
  font-family: inherit;
  padding: 7px 10px;
  width: 100%;
  box-sizing: border-box;
  outline: none;
  transition: border-color 0.15s, background 0.15s;
}
.bsb-input:focus,
.bsb-textarea:focus {
  border-color: rgba(52, 211, 153, 0.45);
  background: rgba(255, 255, 255, 0.07);
}
.bsb-textarea {
  resize: vertical;
  min-height: 52px;
  font-family: 'Courier New', monospace;
  letter-spacing: 0.04em;
  line-height: 1.5;
}
.bsb-input.bsb-short {
  width: 58px;
  text-align: center;
  padding: 7px 6px;
}

/* ---- XY row ---- */
.bsb-xy-row {
  display: flex;
  align-items: center;
  gap: 6px;
}
.bsb-xy-row label {
  font-size: 10px;
  color: rgba(255, 255, 255, 0.35);
  font-weight: 700;
  min-width: 12px;
  letter-spacing: 0.06em;
}

/* ---- Slider ---- */
.bsb-slider-wrap {
  position: relative;
  padding-bottom: 20px;
}

.bsb-range {
  width: 100%;
  -webkit-appearance: none;
  appearance: none;
  height: 3px;
  border-radius: 2px;
  background: rgba(255, 255, 255, 0.1);
  outline: none;
  cursor: pointer;
  display: block;
}
.bsb-range::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: #34d399;
  cursor: pointer;
  box-shadow: 0 0 8px rgba(52, 211, 153, 0.5);
  transition: transform 0.1s;
  margin-top: -5.5px;
}
.bsb-range::-webkit-slider-thumb:hover { transform: scale(1.25); }
.bsb-range::-moz-range-thumb {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: #34d399;
  cursor: pointer;
  border: none;
}
.bsb-range::-webkit-slider-runnable-track {
  height: 3px;
  border-radius: 2px;
}

.bsb-ticks {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 16px;
  pointer-events: none;
}

.bsb-tick-edge {
  position: absolute;
  font-size: 9px;
  color: rgba(255, 255, 255, 0.25);
  bottom: 0;
}
.bsb-tick-edge.left  { left: 0; }
.bsb-tick-edge.right { right: 0; }

.bsb-tick-cur {
  position: absolute;
  bottom: 0;
  font-size: 9px;
  color: #34d399;
  transform: translateX(-50%);
  white-space: nowrap;
  font-weight: 600;
  letter-spacing: 0.04em;
}

/* ---- Searchable Select ---- */
.bsb-select-wrap {
  position: relative;
}

.bsb-select-trigger {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.09);
  border-radius: 6px;
  color: #e0e0e4;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 7px 10px;
  font-size: 12px;
  transition: border-color 0.15s;
  user-select: none;
}
.bsb-select-trigger:hover { border-color: rgba(255, 255, 255, 0.18); }

.bsb-select-arrow {
  color: rgba(255, 255, 255, 0.28);
  font-size: 9px;
  margin-left: 6px;
  transition: transform 0.15s;
}
.bsb-select-trigger.open .bsb-select-arrow { transform: rotate(180deg); }

.bsb-select-dropdown {
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  right: 0;
  background: rgba(18, 18, 22, 0.99);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 8px;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.7);
  z-index: 20000;
  overflow: hidden;
}

.bsb-select-search {
  background: rgba(255, 255, 255, 0.04);
  border: none;
  border-bottom: 1px solid rgba(255, 255, 255, 0.07);
  color: #e0e0e4;
  font-size: 11px;
  font-family: inherit;
  outline: none;
  padding: 8px 12px;
  width: 100%;
  box-sizing: border-box;
}
.bsb-select-search::placeholder { color: rgba(255,255,255,0.22); }

.bsb-select-list {
  max-height: 148px;
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: rgba(255,255,255,0.1) transparent;
}

.bsb-select-opt {
  padding: 8px 12px;
  cursor: pointer;
  font-size: 11px;
  color: rgba(255, 255, 255, 0.6);
  transition: background 0.1s, color 0.1s;
}
.bsb-select-opt:hover {
  background: rgba(255, 255, 255, 0.05);
  color: #fff;
}
.bsb-select-opt.bsb-opt-selected {
  color: #34d399;
}

/* ---- Toggle switch ---- */
.bsb-toggle-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 3px 0;
}

.bsb-toggle-label {
  font-size: 10px;
  color: rgba(255, 255, 255, 0.55);
  letter-spacing: 0.04em;
}

.bsb-toggle {
  position: relative;
  background: rgba(255, 255, 255, 0.1);
  border: none;
  border-radius: 11px;
  width: 34px;
  height: 20px;
  cursor: pointer;
  transition: background 0.2s;
  padding: 0;
  flex-shrink: 0;
}
.bsb-toggle.on { background: #34d399; }

.bsb-toggle-thumb {
  position: absolute;
  top: 3px;
  left: 3px;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 1px 4px rgba(0,0,0,0.3);
  transition: transform 0.2s cubic-bezier(.4, 0, .2, 1);
  display: block;
}
.bsb-toggle.on .bsb-toggle-thumb { transform: translateX(14px); }

/* ---- Toolbar ---- */
.bsb-toolbar {
  border-top: 1px solid rgba(255, 255, 255, 0.06);
  padding: 10px 12px 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  flex-shrink: 0;
  background: rgba(0, 0, 0, 0.2);
}

.bsb-toolbar-row {
  display: flex;
  gap: 5px;
  align-items: center;
}

.bsb-icon-btn {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 6px;
  color: rgba(255, 255, 255, 0.6);
  cursor: pointer;
  font-size: 13px;
  padding: 6px 9px;
  line-height: 1;
  transition: background 0.15s, color 0.15s, border-color 0.15s;
}
.bsb-icon-btn:hover {
  background: rgba(255, 255, 255, 0.1);
  border-color: rgba(255, 255, 255, 0.16);
  color: #fff;
}

.bsb-preview-btn {
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.09);
  border-radius: 6px;
  color: rgba(255, 255, 255, 0.6);
  cursor: pointer;
  font-size: 10px;
  font-weight: 600;
  font-family: inherit;
  letter-spacing: 0.12em;
  padding: 7px 14px;
  text-transform: uppercase;
  transition: background 0.15s, color 0.15s, border-color 0.15s;
  width: 100%;
}
.bsb-preview-btn:hover {
  background: rgba(255, 255, 255, 0.09);
  border-color: rgba(255, 255, 255, 0.18);
  color: #fff;
}

.bsb-divider {
  height: 1px;
  background: rgba(255, 255, 255, 0.05);
  margin: 0;
}

/* ---- Action buttons row ---- */
.bsb-actions {
  display: flex;
  gap: 5px;
  padding-top: 8px;
  flex-wrap: wrap;
}

.bsb-action-btn {
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 6px;
  color: rgba(255, 255, 255, 0.6);
  cursor: pointer;
  font-size: 10px;
  font-family: inherit;
  font-weight: 500;
  letter-spacing: 0.05em;
  padding: 6px 11px;
  transition: background 0.15s, color 0.15s, border-color 0.15s;
}
.bsb-action-btn:hover {
  background: rgba(255, 255, 255, 0.09);
  border-color: rgba(255, 255, 255, 0.18);
  color: #fff;
}
.bsb-action-btn.bsb-danger {
  color: rgba(248, 113, 113, 0.8);
  border-color: rgba(248, 113, 113, 0.18);
}
.bsb-action-btn.bsb-danger:hover {
  background: rgba(248, 113, 113, 0.1);
  border-color: rgba(248, 113, 113, 0.35);
  color: #f87171;
}

/* ---- Selected object highlight ---- */
.bsb-selected {
  outline: 2px solid #34d399 !important;
  outline-offset: 2px;
}

/* ---- Grid lines hide toggle ---- */
.bsb-hide-grid .new-grid-items,
.new-grid-items.bsb-hide-grid-lines {
  background-image: none !important;
}

/* ---- NGW build badge shift when panel open ---- */
body.bsb-panel-open #ngw-build-badge {
  right: 286px;
}

/* ---- Object outlines: visible boundaries when builder panel is open ---- */
body.bsb-panel-open .grid-object {
  outline: 1px dashed rgba(52, 211, 153, 0.35);
}
body.bsb-panel-open .grid-object.bsb-selected {
  outline: 2px solid #34d399;
  outline-offset: 1px;
}
