/* ==========================================================================
   VIKING TRANSFERS - GANG SHEET BUILDER (NINJA TRANSFERS STYLE)
   Clean, light-mode, high-precision canvas workspace
   ========================================================================== */

:root {
  --builder-bg: #f1f5f9;
  --header-bg: #ffffff;
  --sidebar-bg: #ffffff;
  --card-bg: #ffffff;
  --border-color: #e2e8f0;
  --border-focus: #019aff;
  --text-main: #0e1726;
  --text-muted: #64748b;
  --ninja-blue: #019aff;
  --ninja-blue-hover: #0080d8;
  --ninja-blue-light: #f0f7ff;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body.builder-body {
  height: 100vh;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  background: var(--builder-bg);
  font-family: Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  color: var(--text-main);
}

/* ==========================================================================
   TOP BUILDER HEADER
   ========================================================================== */

.builder-nav {
  height: 64px;
  background: var(--header-bg);
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 24px;
  z-index: 100;
  flex-shrink: 0;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
}

.builder-nav-left {
  display: flex;
  align-items: center;
  gap: 20px;
}

.back-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  color: var(--text-muted);
  font-size: 14px;
  font-weight: 600;
  transition: color 0.15s;
}
.back-btn:hover {
  color: var(--ninja-blue);
}

.brand-badge {
  display: flex;
  align-items: center;
  gap: 10px;
  padding-left: 14px;
  border-left: 1px solid var(--border-color);
}
.brand-badge img {
  width: 34px;
  height: 34px;
  border-radius: 6px;
}
.brand-badge span {
  font-weight: 800;
  font-size: 16px;
  color: var(--text-main);
}

.builder-sheet-select {
  display: flex;
  align-items: center;
  gap: 8px;
  background: #f8fafc;
  padding: 6px 14px;
  border-radius: 8px;
  border: 1px solid var(--border-color);
}
.builder-sheet-select label {
  font-size: 13px;
  font-weight: 700;
  color: var(--text-muted);
}
.builder-sheet-select select {
  background: transparent;
  color: var(--text-main);
  border: none;
  font-size: 14px;
  font-weight: 800;
  outline: none;
  cursor: pointer;
}

.builder-nav-center {
  display: flex;
  align-items: center;
  gap: 14px;
}

.zoom-controls {
  display: flex;
  align-items: center;
  background: #f8fafc;
  border: 1px solid var(--border-color);
  border-radius: 8px;
  padding: 2px;
}

.zoom-btn {
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
  border-radius: 6px;
  font-size: 16px;
  font-weight: 700;
  cursor: pointer;
}
.zoom-btn:hover {
  background: #ffffff;
  color: var(--text-main);
}

.zoom-level {
  font-size: 12.5px;
  font-weight: 800;
  min-width: 50px;
  text-align: center;
  color: var(--text-main);
}

.btn-autonest-header {
  background: #ffffff;
  color: var(--ninja-blue);
  border: 1.5px solid var(--ninja-blue);
  padding: 8px 18px;
  border-radius: 999px;
  font-size: 13.5px;
  font-weight: 800;
  display: flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  transition: all 0.15s;
}
.btn-autonest-header:hover {
  background: var(--ninja-blue-light);
}

.builder-nav-right {
  display: flex;
  align-items: center;
  gap: 20px;
}

.builder-price-box {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
}
.builder-price-box .price {
  font-size: 22px;
  font-weight: 900;
  color: var(--text-main);
}
.builder-price-box .sub {
  font-size: 11.5px;
  font-weight: 700;
  color: #00b67a;
}

.btn-cart-export {
  background: var(--ninja-blue);
  color: #ffffff;
  padding: 10px 22px;
  border-radius: 999px;
  font-size: 14.5px;
  font-weight: 800;
  box-shadow: 0 4px 14px rgba(1, 154, 255, 0.3);
  cursor: pointer;
  transition: all 0.15s;
}
.btn-cart-export:hover {
  background: var(--ninja-blue-hover);
  transform: translateY(-1px);
}

/* ==========================================================================
   WORKSPACE LAYOUT
   ========================================================================== */

.builder-layout {
  display: flex;
  flex: 1;
  overflow: hidden;
  position: relative;
}

/* Sidebar: Upload & Asset Dock */
.builder-sidebar {
  width: 340px;
  background: var(--sidebar-bg);
  border-right: 1px solid var(--border-color);
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
  z-index: 20;
}

.sidebar-tabs {
  display: flex;
  border-bottom: 1px solid var(--border-color);
  background: #f8fafc;
}

.sidebar-tab {
  flex: 1;
  padding: 14px 12px;
  font-size: 13.5px;
  font-weight: 700;
  color: var(--text-muted);
  text-align: center;
  border-bottom: 2px solid transparent;
  cursor: pointer;
}
.sidebar-tab.active {
  color: var(--ninja-blue);
  border-bottom-color: var(--ninja-blue);
  background: #ffffff;
}

.sidebar-body {
  flex: 1;
  overflow-y: auto;
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 18px;
}

/* Upload Dropzone */
.ninja-dropzone {
  border: 2px dashed #cbd5e1;
  background: #f8fafc;
  border-radius: 12px;
  padding: 26px 16px;
  text-align: center;
  cursor: pointer;
  transition: all 0.2s;
}
.ninja-dropzone:hover, .ninja-dropzone.dragover {
  border-color: var(--ninja-blue);
  background: var(--ninja-blue-light);
}
.ninja-dropzone .icon {
  font-size: 32px;
  margin-bottom: 8px;
}
.ninja-dropzone h4 {
  font-size: 14.5px;
  font-weight: 700;
  color: var(--text-main);
  margin-bottom: 4px;
}
.ninja-dropzone p {
  font-size: 12px;
  color: var(--text-muted);
}

/* Asset Cards */
.asset-dock-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.dock-card {
  background: #ffffff;
  border: 1px solid var(--border-color);
  border-radius: 10px;
  padding: 10px;
  display: flex;
  align-items: center;
  gap: 12px;
  transition: all 0.15s;
}
.dock-card:hover {
  border-color: var(--ninja-blue);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
}

.dock-thumb {
  width: 52px;
  height: 52px;
  border-radius: 6px;
  background: #f1f5f9;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  border: 1px solid var(--border-color);
}
.dock-thumb img {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
}

.dock-info {
  flex: 1;
  min-width: 0;
}
.dock-name {
  font-size: 13px;
  font-weight: 700;
  color: var(--text-main);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.dock-meta {
  font-size: 11.5px;
  color: var(--text-muted);
  margin-top: 2px;
}

.btn-add-dock {
  background: var(--ninja-blue-light);
  color: var(--ninja-blue);
  border: 1px solid var(--ninja-blue-border);
  font-size: 12px;
  font-weight: 800;
  padding: 6px 12px;
  border-radius: 6px;
  cursor: pointer;
}
.btn-add-dock:hover {
  background: var(--ninja-blue);
  color: #fff;
}

/* ==========================================================================
   CANVAS WORKSPACE & RULERS
   ========================================================================== */

.canvas-viewport {
  flex: 1;
  position: relative;
  background: #e9eef4;
  overflow: auto;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 50px;
}

/* Rulers */
.ruler-corner {
  position: absolute;
  top: 0;
  left: 0;
  width: 24px;
  height: 24px;
  background: #ffffff;
  border-right: 1px solid #cbd5e1;
  border-bottom: 1px solid #cbd5e1;
  z-index: 10;
}
.ruler-top {
  position: absolute;
  top: 0;
  left: 24px;
  right: 0;
  height: 24px;
  background: #ffffff;
  border-bottom: 1px solid #cbd5e1;
  z-index: 9;
}
.ruler-left {
  position: absolute;
  top: 24px;
  left: 0;
  bottom: 0;
  width: 24px;
  background: #ffffff;
  border-right: 1px solid #cbd5e1;
  z-index: 9;
}

/* Roll Stage */
.sheet-stage-container {
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.12);
  background: #ffffff;
  position: relative;
  transform-origin: center center;
}

.safe-margin-border {
  position: absolute;
  border: 1px dashed rgba(239, 68, 68, 0.7);
  pointer-events: none;
  z-index: 50;
}
.safe-margin-label {
  position: absolute;
  top: 3px;
  left: 6px;
  font-size: 9.5px;
  font-weight: 800;
  color: #ef4444;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

#gangCanvas {
  display: block;
  width: 100%;
  height: 100%;
}

/* Floating Object Toolbar */
.object-toolbar {
  position: absolute;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%);
  background: #ffffff;
  border: 1px solid var(--border-color);
  border-radius: 999px;
  padding: 8px 20px;
  display: flex;
  align-items: center;
  gap: 14px;
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.12);
  z-index: 60;
  transition: all 0.2s;
}
.object-toolbar.hidden {
  opacity: 0;
  pointer-events: none;
  transform: translate(-50%, 20px);
}

.toolbar-input {
  width: 58px;
  background: #f8fafc;
  border: 1px solid var(--border-color);
  color: var(--text-main);
  border-radius: 6px;
  padding: 4px 6px;
  font-size: 13px;
  font-weight: 700;
  text-align: center;
  outline: none;
}
.toolbar-input:focus {
  border-color: var(--ninja-blue);
}

.toolbar-btn {
  padding: 6px 12px;
  border-radius: 6px;
  font-size: 13px;
  font-weight: 700;
  color: var(--text-main);
  background: #f8fafc;
  border: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  gap: 4px;
  cursor: pointer;
  transition: all 0.15s;
}
.toolbar-btn:hover {
  background: var(--ninja-blue-light);
  color: var(--ninja-blue);
  border-color: var(--ninja-blue);
}
.toolbar-btn-danger:hover {
  background: #fee2e2;
  color: #ef4444;
  border-color: #ef4444;
}

/* Modals */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s;
}
.modal-overlay.active {
  opacity: 1;
  pointer-events: auto;
}

.modal-card {
  background: #ffffff;
  border: 1px solid var(--border-color);
  border-radius: 16px;
  width: 90%;
  max-width: 560px;
  padding: 28px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.2);
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}
.modal-header h3 {
  font-size: 20px;
  font-weight: 800;
  color: var(--text-main);
}
.close-modal-btn {
  font-size: 24px;
  color: var(--text-muted);
  cursor: pointer;
}

.nesting-item-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: #f8fafc;
  border: 1px solid var(--border-color);
  padding: 12px;
  border-radius: 10px;
  margin-bottom: 10px;
}
