/* ===== SFS-style Garage Workspace ===== */

.garage-screen-new {
  display: flex;
  flex-direction: column;
  height: 100%;
  background: #1a1a2e;
  overflow: hidden;
}

/* --- Category Tabs --- */
.garage-tabs {
  display: flex;
  gap: 4px;
  padding: 6px 8px;
  background: #0f0f1e;
  overflow-x: auto;
  flex-shrink: 0;
}

.gtab {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 4px 10px;
  border: 1px solid #444;
  border-radius: 6px;
  background: #222;
  color: #aaa;
  font-size: 11px;
  white-space: nowrap;
  cursor: pointer;
  transition: all 0.15s;
}

.gtab.active {
  background: #2a4a6a;
  color: #fff;
  border-color: #4a8abf;
}

.gtab-icon {
  display: block;
  width: 24px;
  height: 24px;
  flex-shrink: 0;
}

.gtab-icon .part-svg {
  width: 100%;
  height: 100%;
}

.gtab-label {
  font-size: 11px;
}

/* --- Palette (part list) --- */
.garage-palette {
  display: flex;
  gap: 6px;
  padding: 6px 8px;
  background: #12122a;
  overflow-x: auto;
  flex-shrink: 0;
  min-height: 44px;
  align-items: center;
}

.palette-part {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  padding: 4px 6px;
  border: 1.5px solid #666;
  border-radius: 6px;
  background: #1e1e3a;
  color: #ccc;
  font-size: 10px;
  white-space: nowrap;
  cursor: grab;
  user-select: none;
  touch-action: none;
  transition: transform 0.1s;
  min-width: 56px;
}

.palette-part:active {
  transform: scale(0.95);
}

.palette-svg {
  width: 48px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.palette-svg .part-svg {
  width: 100%;
  height: 100%;
}

.palette-star {
  font-size: 8px;
  line-height: 1;
}

.palette-name {
  font-size: 9px;
  max-width: 56px;
  overflow: hidden;
  text-overflow: ellipsis;
  text-align: center;
}

.palette-empty {
  color: #666;
  font-size: 13px;
  padding: 4px 8px;
}

/* --- Workspace wrapper --- */
.garage-workspace-wrap {
  flex: 1;
  display: flex;
  overflow: hidden;
  position: relative;
  justify-content: center;
  padding: 0;
  cursor: grab;
}
.garage-workspace-wrap:active {
  cursor: grabbing;
}

/* --- Grid workspace --- */
.garage-workspace {
  position: relative;
  background-image:
    linear-gradient(to right, rgba(100, 100, 150, 0.18) 1px, transparent 1px),
    linear-gradient(to bottom, rgba(100, 100, 150, 0.18) 1px, transparent 1px);
  background-color: #16162e;
  border: 1px solid #333;
  border-radius: 4px;
  flex-shrink: 0;
  touch-action: none;
}

/* --- Grid Parts --- */
.grid-part {
  position: absolute;
  border: none;
  border-radius: 2px;
  background: transparent;
  cursor: grab;
  user-select: none;
  touch-action: none;
  transition: filter 0.15s;
  z-index: 1;
  overflow: visible;
}

.grid-part .part-svg {
  width: 100%;
  height: 100%;
  display: block;
}

.grid-part:active {
  cursor: grabbing;
}

.grid-part.selected {
  filter: drop-shadow(0 0 4px rgba(68, 170, 255, 0.8)) drop-shadow(0 0 10px rgba(68, 170, 255, 0.4));
  z-index: 2;
}

/* --- Connection indicators --- */
.conn-indicator {
  position: absolute;
  width: 12px;
  height: 6px;
  background: #4af;
  border-radius: 3px;
  z-index: 3;
  opacity: 0.7;
  pointer-events: none;
}

/* --- Snap preview --- */
.snap-preview {
  position: absolute;
  border: 2px dashed #4af;
  border-radius: 4px;
  pointer-events: none;
  z-index: 5;
  transition: border-color 0.1s;
}

.snap-preview.valid {
  border-color: #4caf50;
  background: rgba(76, 175, 80, 0.1);
}

.snap-preview.invalid {
  border-color: #f44336;
  background: rgba(244, 67, 54, 0.1);
}

/* --- Drag ghost --- */
.drag-ghost {
  position: fixed;
  border: none;
  border-radius: 2px;
  background: transparent;
  pointer-events: none;
  z-index: 9999;
  opacity: 0.7;
}

.drag-ghost .part-svg {
  width: 100%;
  height: 100%;
  display: block;
}

/* --- Action buttons (delete / duplicate) --- */
.garage-actions {
  position: absolute;
  top: 8px;
  right: 8px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  z-index: 10;
}

.garage-zoom {
  position: absolute;
  bottom: 8px;
  right: 8px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  z-index: 10;
}
.garage-zoom .gact-btn {
  color: #ddd;
  font-size: 20px;
}

.gact-btn {
  width: 40px;
  height: 40px;
  border: 1px solid #555;
  border-radius: 8px;
  background: rgba(30, 30, 50, 0.9);
  font-size: 18px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s;
}

.gact-btn:hover {
  background: rgba(50, 50, 80, 0.9);
}

.gact-delete:hover {
  background: rgba(180, 40, 40, 0.7);
}

/* --- Part info panel --- */
.garage-info {
  padding: 0 10px;
  min-height: 0;
  flex-shrink: 0;
}

.info-header {
  padding: 4px 8px;
  font-size: 13px;
  font-weight: bold;
  color: #eee;
  background: rgba(30, 30, 60, 0.6);
  border-radius: 4px;
  margin-bottom: 2px;
}

.info-detail {
  font-size: 11px;
  color: #aaa;
  padding: 2px 8px 4px;
  line-height: 1.5;
}

/* --- Stats bar --- */
.garage-stats {
  padding: 6px 12px;
  font-size: 12px;
  color: #aaa;
  background: #0f0f1e;
  text-align: center;
  flex-shrink: 0;
}

/* --- Complete button --- */
.garage-complete-btn {
  margin: 6px 12px 10px;
  padding: 12px;
  border: none;
  border-radius: 8px;
  background: linear-gradient(135deg, #2a6a2a, #3a8a3a);
  color: #fff;
  font-size: 16px;
  font-weight: bold;
  cursor: pointer;
  flex-shrink: 0;
  transition: background 0.15s;
}

.garage-complete-btn:hover {
  background: linear-gradient(135deg, #3a8a3a, #4aaa4a);
}

.garage-complete-btn:active {
  transform: scale(0.98);
}

/* --- Toast notifications --- */
.garage-toast {
  position: fixed;
  top: 60px;
  left: 50%;
  transform: translateX(-50%) translateY(-20px);
  padding: 10px 24px;
  border-radius: 8px;
  font-size: 14px;
  font-weight: bold;
  color: #fff;
  z-index: 10000;
  opacity: 0;
  transition: opacity 0.3s, transform 0.3s;
  pointer-events: none;
}

.garage-toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

.garage-toast.success {
  background: rgba(40, 160, 40, 0.95);
  box-shadow: 0 2px 12px rgba(40, 160, 40, 0.4);
}

.garage-toast.error {
  background: rgba(200, 50, 50, 0.95);
  box-shadow: 0 2px 12px rgba(200, 50, 50, 0.4);
}
