/* V1-style CSS for 3DDD.STUDIO V2 (Verge3D) */
:root {
  --font-sans: "Geist Mono", ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
  --font-pixel: "Silkscreen", "Geist Mono", monospace;
}

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

html, body {
  width: 100%;
  height: 100%;
  overflow: hidden;
}

body {
  font-family: var(--font-sans);
  background: white;
  color: black;
  font-size: 12px;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* Custom scrollbar for minimal look */
::-webkit-scrollbar {
  width: 4px;
  height: 4px;
}
::-webkit-scrollbar-track {
  background: white;
}
::-webkit-scrollbar-thumb {
  background: #ccc;
}
::-webkit-scrollbar-thumb:hover {
  background: #000;
}

/* Form elements */
input[type="range"] {
  -webkit-appearance: none;
  appearance: none;
  height: 4px;
  background: #e0e0e0;
  border-radius: 2px;
  outline: none;
}
input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 12px;
  height: 12px;
  background: black;
  border-radius: 50%;
  cursor: pointer;
}
input[type="range"]::-moz-range-thumb {
  width: 12px;
  height: 12px;
  background: black;
  border-radius: 50%;
  cursor: pointer;
  border: none;
}

input[type="color"] {
  -webkit-appearance: none;
  appearance: none;
  border: none;
  padding: 0;
  cursor: pointer;
}
input[type="color"]::-webkit-color-swatch-wrapper {
  padding: 0;
}
input[type="color"]::-webkit-color-swatch {
  border: none;
}

input[type="checkbox"] {
  width: 14px;
  height: 14px;
  accent-color: black;
  cursor: pointer;
}

/* Buttons */
button {
  font-family: var(--font-sans);
  cursor: pointer;
  transition: all 0.15s ease;
}
button:active {
  transform: scale(0.98);
}

/* Select */
select {
  font-family: var(--font-sans);
  font-size: 11px;
  padding: 4px 8px;
  border: 1px solid black;
  background: white;
  color: black;
  cursor: pointer;
  outline: none;
}
select:hover {
  background: #f0f0f0;
}

/* Utility classes */
.hidden {
  display: none !important;
}

/* Animations */
@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.5; }
}
.animate-pulse {
  animation: pulse 2s cubic-bezier(0.4, 0, 0.6, 1) infinite;
}

/* Verge3D annotation markers - hide them */
.v3d-annotation,
.v3d-annotation__marker,
.v3d-annotation__label {
  display: none !important;
}

/* Garment list items */
.garment-item {
  border-bottom: 1px solid black;
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  transition: background 0.15s ease;
  cursor: pointer;
}
.garment-item:hover {
  background: #f8f8f8;
}
.garment-item.active {
  background: #f0f0f0;
}
.garment-item .garment-name {
  font-size: 10px;
  font-weight: bold;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.garment-item .garment-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 9px;
  opacity: 0.5;
}
.garment-item .garment-color {
  width: 8px;
  height: 8px;
  border: 1px solid black;
  display: inline-block;
}

/* Rename / delete row on each library entry */
.garment-row {
  display: flex;
  gap: 6px;
  margin-top: 2px;
}
.garment-act {
  flex: 1;
  font-size: 8px;
  letter-spacing: 0.08em;
  padding: 3px 0;
  border: 1px solid black;
  background: white;
  color: black;
  text-transform: uppercase;
  transition: all 0.15s ease;
}
.garment-act:hover {
  background: black;
  color: white;
}
.garment-act.danger:hover {
  background: white;
  color: #b00;
  border-color: #b00;
}

/* Decal items */
.decal-item {
  border: 1px solid black;
  padding: 8px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  transition: background 0.15s ease;
  cursor: pointer;
  margin-bottom: 8px;
}
.decal-item:hover {
  background: #f8f8f8;
}
.decal-item.active {
  background: #f0f0f0;
}
.decal-item .decal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.decal-item .decal-thumb {
  width: 24px;
  height: 24px;
  object-fit: contain;
  border: 1px solid rgba(0,0,0,0.1);
  background: white;
}
.decal-item .decal-name {
  font-size: 10px;
  font-weight: bold;
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.decal-item .decal-size {
  display: flex;
  justify-content: space-between;
  font-size: 9px;
  margin-bottom: 4px;
}

/* Section headers */
.section-header {
  padding: 8px 12px;
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  font-weight: bold;
  background: #f0f0f0;
  border-bottom: 1px solid black;
  cursor: pointer;
  user-select: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
  transition: background 0.15s ease;
}
.section-header:hover {
  background: #e0e0e0;
}

/* Upload button */
.upload-btn {
  display: block;
  width: 100%;
  padding: 10px;
  text-align: center;
  border: 1px solid black;
  font-size: 11px;
  text-transform: uppercase;
  cursor: pointer;
  transition: all 0.15s ease;
  background: white;
  color: black;
}
.upload-btn:hover {
  background: black;
  color: white;
}

/* Export button */
.export-btn {
  display: block;
  width: 100%;
  padding: 10px;
  text-align: center;
  border: 1px solid black;
  font-size: 11px;
  text-transform: uppercase;
  cursor: pointer;
  transition: all 0.15s ease;
  background: black;
  color: white;
  margin-bottom: 8px;
}
.export-btn:hover {
  background: rgba(0,0,0,0.8);
}

/* Save button */
.save-btn {
  display: block;
  width: 100%;
  padding: 10px;
  text-align: center;
  border: 1px solid black;
  font-size: 11px;
  text-transform: uppercase;
  cursor: pointer;
  transition: all 0.15s ease;
  background: white;
  color: black;
}
.save-btn:hover {
  background: #f0f0f0;
}

/* Toggle button */
.toggle-btn {
  font-size: 9px;
  padding: 4px 8px;
  border: 1px solid #ccc;
  background: white;
  cursor: pointer;
  transition: all 0.15s ease;
}
.toggle-btn:hover {
  background: #f0f0f0;
}
.toggle-btn.active {
  background: black;
  color: white;
  border-color: black;
}

/* Color picker wrapper */
.color-picker-wrapper {
  width: 100%;
  height: 20px;
  border: 1px solid black;
  position: relative;
  margin-bottom: 8px;
  overflow: hidden;
}
.color-picker-wrapper input[type="color"] {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  opacity: 0;
  cursor: pointer;
}
.color-picker-wrapper .color-preview {
  width: 100%;
  height: 100%;
  pointer-events: none;
}

/* Range slider wrapper */
.range-wrapper {
  margin-top: 8px;
}
.range-wrapper .range-label {
  display: flex;
  justify-content: space-between;
  font-size: 9px;
  margin-bottom: 4px;
}

/* Flat lay panel */
.flatlay-panel {
  position: relative;
  border: 1px dashed #ccc;
  min-height: 96px;
  display: flex;
  flex-direction: column;
  transition: background 0.15s ease;
  overflow: hidden;
  padding: 6px;
}
.flatlay-panel:hover {
  background: #f8f8f8;
}
.flatlay-panel .flatlay-btn {
  font-size: 9px;
  text-transform: uppercase;
  font-weight: bold;
  color: #999;
  margin-bottom: 4px;
  padding: 2px;
  text-align: left;
  cursor: pointer;
  width: fit-content;
}
.flatlay-panel .flatlay-btn:hover {
  color: black;
  text-decoration: underline;
}
.flatlay-panel .flatlay-content {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  flex: 1;
  align-content: flex-start;
}

/* ===== Responsive Layout ===== */

/* Grid column states (desktop) */
@media (min-width: 768px) {
  #app.grid-default {
    grid-template-columns: 280px 1fr 280px;
  }
  #app.grid-left-collapsed {
    grid-template-columns: 50px 1fr 280px;
  }
  #app.grid-right-collapsed {
    grid-template-columns: 280px 1fr 50px;
  }
  #app.grid-both-collapsed {
    grid-template-columns: 50px 1fr 50px;
  }
}

/* Mobile overlay styles — sidebars become full-width overlays */
#leftSidebar,
#rightSidebar {
  transition: transform 0.3s ease, opacity 0.3s ease;
}

/* Left sidebar: hidden off-screen by default on mobile */
#leftSidebar {
  transform: translateX(-100%) !important;
}
#leftSidebar.mobile-open {
  transform: translateX(0) !important;
}

/* Right sidebar: hidden off-screen by default on mobile */
#rightSidebar {
  transform: translateX(100%) !important;
}
#rightSidebar.mobile-open {
  transform: translateX(0) !important;
}

/* Desktop: sidebars are always visible (grid handles them), reset transforms */
@media (min-width: 768px) {
  #leftSidebar,
  #rightSidebar {
    transform: none !important;
  }

  /* Collapsed rail visibility */
  .left-rail,
  .right-rail {
    display: none !important;
  }

  /* Full content visible when not collapsed */
  #leftSidebar:not(.desktop-collapsed) .left-rail,
  #rightSidebar:not(.desktop-collapsed) .right-rail {
    display: none !important;
  }
  #leftSidebar:not(.desktop-collapsed) .left-content,
  #rightSidebar:not(.desktop-collapsed) .right-content {
    display: flex !important;
  }

  /* When collapsed: show rail, hide content */
  #leftSidebar.desktop-collapsed .left-rail {
    display: flex !important;
  }
  #leftSidebar.desktop-collapsed .left-content {
    display: none !important;
  }
  #rightSidebar.desktop-collapsed .right-rail {
    display: flex !important;
  }
  #rightSidebar.desktop-collapsed .right-content {
    display: none !important;
  }
}

/* Mobile: rails hidden, content is inside the overlay */
@media (max-width: 767px) {
  .left-rail,
  .right-rail {
    display: none !important;
  }
  #leftSidebar .left-content,
  #rightSidebar .right-content {
    display: flex !important;
  }
}
