/* PolyMorph 3D Studio - Modern Dark CAD & Generator Styling */
:root {
  --bg-primary: #090b10;
  --bg-secondary: #11141d;
  --bg-tertiary: #181d2a;
  --bg-card: rgba(24, 29, 42, 0.75);
  --bg-card-hover: rgba(32, 39, 58, 0.85);
  --border-subtle: rgba(255, 255, 255, 0.08);
  --border-active: rgba(0, 240, 255, 0.4);
  --border-glow: 0 0 15px rgba(0, 240, 255, 0.15);

  --accent-cyan: #00f0ff;
  --accent-blue: #3b82f6;
  --accent-purple: #8b5cf6;
  --accent-emerald: #10b981;
  --accent-amber: #f59e0b;
  --accent-rose: #f43f5e;

  --text-primary: #f8fafc;
  --text-secondary: #94a3b8;
  --text-muted: #64748b;

  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 16px;
  --radius-full: 9999px;

  --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.4);
  --shadow-md: 0 8px 24px rgba(0, 0, 0, 0.5);
  --shadow-lg: 0 16px 40px rgba(0, 0, 0, 0.7);

  --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
  --font-mono: 'JetBrains Mono', 'Fira Code', Consolas, Monaco, monospace;
}

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

body {
  font-family: var(--font-sans);
  background-color: var(--bg-primary);
  color: var(--text-primary);
  min-height: 100vh;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  user-select: none;
  -webkit-font-smoothing: antialiased;
}

/* App Header */
.app-header {
  height: 56px;
  background: var(--bg-secondary);
  border-bottom: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 1.25rem;
  z-index: 100;
  backdrop-filter: blur(12px);
}

.brand-group {
  display: flex;
  align-items: center;
  gap: 0.85rem;
}

.brand-logo {
  width: 34px;
  height: 34px;
  background: linear-gradient(135deg, var(--accent-cyan), var(--accent-blue));
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #000;
  font-weight: 800;
  font-size: 1.1rem;
  box-shadow: 0 0 15px rgba(0, 240, 255, 0.35);
}

.brand-title {
  font-size: 1.15rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--text-primary);
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.brand-badge {
  font-size: 0.7rem;
  font-weight: 600;
  padding: 2px 8px;
  background: rgba(0, 240, 255, 0.12);
  color: var(--accent-cyan);
  border: 1px solid rgba(0, 240, 255, 0.25);
  border-radius: var(--radius-full);
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.header-center {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.format-pill-group {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  background: rgba(0, 0, 0, 0.35);
  padding: 4px 10px;
  border-radius: var(--radius-full);
  border: 1px solid var(--border-subtle);
  font-size: 0.75rem;
  font-family: var(--font-mono);
  color: var(--text-secondary);
}

.format-tag {
  color: var(--accent-cyan);
  font-weight: 600;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

/* Language Switcher */
.lang-switcher {
  display: flex;
  background: var(--bg-tertiary);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-full);
  padding: 2px;
}

.lang-btn {
  padding: 4px 12px;
  border: none;
  background: transparent;
  color: var(--text-secondary);
  font-size: 0.75rem;
  font-weight: 600;
  border-radius: var(--radius-full);
  cursor: pointer;
  transition: all 0.2s ease;
  display: flex;
  align-items: center;
  gap: 4px;
}

.lang-btn.active {
  background: var(--accent-blue);
  color: #fff;
  box-shadow: 0 2px 8px rgba(59, 130, 246, 0.4);
}

.lang-btn:hover:not(.active) {
  color: var(--text-primary);
}

/* Main Layout */
.app-container {
  display: flex;
  flex: 1;
  height: calc(100vh - 56px);
  max-height: calc(100vh - 56px);
  position: relative;
  overflow: hidden;
}

/* Sidebar Panels */
.sidebar {
  width: 410px;
  background: var(--bg-secondary);
  border-right: 1px solid var(--border-subtle);
  display: flex;
  flex-direction: column;
  height: calc(100vh - 56px);
  max-height: calc(100vh - 56px);
  z-index: 50;
  transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1), width 0.3s ease;
  backdrop-filter: blur(16px);
  position: relative;
  overflow: hidden;
  flex-shrink: 0;
}

.sidebar.right-sidebar {
  width: 360px;
  border-right: none;
  border-left: 1px solid var(--border-subtle);
}

.sidebar.collapsed-left {
  transform: translateX(-100%);
  position: absolute;
  height: 100%;
}

.sidebar.collapsed-right {
  transform: translateX(100%);
  position: absolute;
  right: 0;
  height: 100%;
}

/* Sidebar Tabs Navigation & Scroll Container */
.sidebar-tabs-container {
  flex: 0 0 auto;
  position: relative;
  display: flex;
  align-items: center;
  background: var(--bg-primary);
  border-bottom: 1px solid var(--border-subtle);
  overflow: hidden;
}

.sidebar-tabs {
  flex: 1 1 auto;
  display: flex;
  padding: 6px 4px;
  gap: 4px;
  overflow-x: auto;
  overflow-y: hidden;
  scroll-behavior: smooth;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: thin;
  scrollbar-color: var(--accent-cyan) rgba(255, 255, 255, 0.05);
}

.sidebar-tabs::-webkit-scrollbar {
  height: 3px;
  display: block;
}

.sidebar-tabs::-webkit-scrollbar-track {
  background: rgba(255, 255, 255, 0.03);
}

.sidebar-tabs::-webkit-scrollbar-thumb {
  background: var(--accent-cyan);
  border-radius: 2px;
}

.tabs-nav-arrow {
  flex: 0 0 24px;
  width: 24px;
  height: 38px;
  background: rgba(13, 15, 22, 0.95);
  border: none;
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  z-index: 10;
  transition: all 0.2s ease;
  padding: 0;
}

.tabs-nav-arrow:hover {
  background: var(--bg-tertiary);
  color: var(--accent-cyan);
}

.tab-btn {
  flex: 1 0 auto;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  padding: 8px 6px;
  border: none;
  background: transparent;
  color: var(--text-secondary);
  font-size: 0.74rem;
  font-weight: 600;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all 0.2s ease;
  white-space: nowrap;
}

.tab-btn:hover {
  color: var(--text-primary);
  background: rgba(255, 255, 255, 0.04);
}

.tab-btn.active {
  background: var(--bg-tertiary);
  color: var(--accent-cyan);
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.3);
  border: 1px solid var(--border-subtle);
}

.tab-btn svg {
  width: 15px;
  height: 15px;
  flex-shrink: 0;
}

/* Sidebar Content Body - Guaranteed Scrollable */
.sidebar-body {
  flex: 1 1 0%;
  min-height: 0;
  height: auto;
  overflow-y: scroll !important;
  overflow-x: hidden;
  padding: 1.15rem 1.15rem 5rem 1.15rem;
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
  -webkit-overflow-scrolling: touch;
  scroll-behavior: smooth;
  overscroll-behavior: contain;
  scrollbar-width: thin;
  scrollbar-color: var(--accent-cyan) rgba(10, 12, 18, 0.6);
}

.sidebar-body::-webkit-scrollbar {
  width: 9px;
  display: block;
}

.sidebar-body::-webkit-scrollbar-track {
  background: rgba(10, 12, 18, 0.6);
  border-radius: 4px;
}

.sidebar-body::-webkit-scrollbar-thumb {
  background: var(--accent-cyan);
  border-radius: 5px;
  border: 2px solid #11141d;
}

.sidebar-body::-webkit-scrollbar-thumb:hover {
  background: #38bdf8;
}

/* Section Cards */
.panel-section {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.9rem;
  position: relative;
  transition: border-color 0.2s ease;
}

.panel-section:hover {
  border-color: rgba(255, 255, 255, 0.14);
}

.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--text-primary);
  letter-spacing: -0.01em;
  cursor: pointer;
  user-select: none;
  padding: 2px 0;
}

.section-header:hover {
  color: var(--accent-cyan);
}

.panel-section.is-collapsed {
  gap: 0;
  padding-bottom: 0.75rem;
}

.panel-section.is-collapsed > *:not(.section-header) {
  display: none !important;
}

.section-header span {
  display: flex;
  align-items: center;
  gap: 6px;
}

.section-header svg {
  width: 16px;
  height: 16px;
  color: var(--accent-cyan);
}

/* Dropzone */
.dropzone {
  border: 2px dashed rgba(255, 255, 255, 0.18);
  border-radius: var(--radius-md);
  padding: 1.75rem 1rem;
  text-align: center;
  background: rgba(0, 0, 0, 0.25);
  cursor: pointer;
  transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.65rem;
}

.dropzone:hover, .dropzone.dragover {
  border-color: var(--accent-cyan);
  background: rgba(0, 240, 255, 0.05);
  box-shadow: 0 0 20px rgba(0, 240, 255, 0.12);
}

.dropzone-icon {
  width: 44px;
  height: 44px;
  border-radius: var(--radius-full);
  background: rgba(0, 240, 255, 0.1);
  color: var(--accent-cyan);
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 0.2rem;
}

.dropzone-icon svg {
  width: 22px;
  height: 22px;
}

.dropzone-title {
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--text-primary);
}

.dropzone-subtitle {
  font-size: 0.72rem;
  color: var(--text-muted);
  line-height: 1.4;
}

/* Controls, Inputs & Selectors */
.control-group {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.control-label {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-secondary);
}

.control-label-value {
  font-family: var(--font-mono);
  color: var(--accent-cyan);
  font-size: 0.72rem;
}

.form-select, .form-input {
  width: 100%;
  background: var(--bg-primary);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  padding: 7px 10px;
  font-size: 0.8rem;
  font-family: inherit;
  outline: none;
  transition: all 0.2s ease;
}

.form-select:focus, .form-input:focus {
  border-color: var(--accent-cyan);
  box-shadow: 0 0 10px rgba(0, 240, 255, 0.2);
}

/* Range Slider */
input[type="range"] {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 5px;
  background: rgba(255, 255, 255, 0.12);
  border-radius: var(--radius-full);
  outline: none;
  margin: 6px 0;
}

input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 15px;
  height: 15px;
  border-radius: 50%;
  background: var(--accent-cyan);
  cursor: pointer;
  box-shadow: 0 0 8px var(--accent-cyan);
  transition: transform 0.15s ease;
}

input[type="range"]::-webkit-slider-thumb:hover {
  transform: scale(1.2);
}

/* Segmented Buttons */
.segmented-control {
  display: flex;
  background: var(--bg-primary);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  padding: 2px;
  gap: 2px;
}

.segment-btn {
  flex: 1;
  padding: 6px 4px;
  border: none;
  background: transparent;
  color: var(--text-secondary);
  font-size: 0.73rem;
  font-weight: 600;
  border-radius: 4px;
  cursor: pointer;
  transition: all 0.18s ease;
  text-align: center;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
}

.segment-btn.active {
  background: var(--accent-blue);
  color: #fff;
  box-shadow: 0 2px 6px rgba(59, 130, 246, 0.35);
}

.segment-btn:hover:not(.active) {
  color: var(--text-primary);
  background: rgba(255, 255, 255, 0.04);
}

/* Action Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 9px 14px;
  border-radius: var(--radius-sm);
  font-size: 0.82rem;
  font-weight: 600;
  border: none;
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  text-decoration: none;
}

.btn-primary {
  background: linear-gradient(135deg, var(--accent-cyan), var(--accent-blue));
  color: #000;
  font-weight: 700;
  box-shadow: 0 4px 14px rgba(0, 240, 255, 0.25);
}

.btn-primary:hover {
  box-shadow: 0 6px 20px rgba(0, 240, 255, 0.4);
  transform: translateY(-1px);
}

.btn-primary:active {
  transform: translateY(0);
}

.btn-secondary {
  background: var(--bg-tertiary);
  color: var(--text-primary);
  border: 1px solid var(--border-subtle);
}

.btn-secondary:hover {
  background: rgba(255, 255, 255, 0.08);
  border-color: rgba(255, 255, 255, 0.18);
}

.btn-success {
  background: linear-gradient(135deg, #10b981, #059669);
  color: #fff;
  box-shadow: 0 4px 14px rgba(16, 185, 129, 0.25);
}

.btn-sm {
  padding: 5px 10px;
  font-size: 0.75rem;
}

.btn-block {
  width: 100%;
}

.btn-icon-only {
  padding: 7px;
  width: 32px;
  height: 32px;
}

.btn svg {
  width: 16px;
  height: 16px;
}

/* Viewport Area */
.viewport-container {
  flex: 1;
  position: relative;
  background: radial-gradient(circle at center, #171b26 0%, #08090e 100%);
  overflow: hidden;
}

#webgl-canvas {
  width: 100%;
  height: 100%;
  display: block;
}

/* Floating Viewport Overlays */
.viewport-overlay-top {
  position: absolute;
  top: 14px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  align-items: center;
  gap: 8px;
  background: rgba(17, 20, 29, 0.85);
  backdrop-filter: blur(14px);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-full);
  padding: 4px 8px;
  z-index: 10;
  box-shadow: var(--shadow-md);
}

.mode-btn {
  background: transparent;
  border: none;
  color: var(--text-secondary);
  padding: 6px 12px;
  font-size: 0.75rem;
  font-weight: 600;
  border-radius: var(--radius-full);
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 5px;
  transition: all 0.2s ease;
}

.mode-btn:hover {
  color: var(--text-primary);
}

.mode-btn.active {
  background: rgba(0, 240, 255, 0.15);
  color: var(--accent-cyan);
  border: 1px solid rgba(0, 240, 255, 0.3);
}

.viewport-overlay-left {
  position: absolute;
  top: 14px;
  left: 14px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  z-index: 10;
}

.viewport-overlay-right {
  position: absolute;
  top: 14px;
  right: 14px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  z-index: 10;
}

.viewport-overlay-bottom {
  position: absolute;
  bottom: 16px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  align-items: center;
  gap: 8px;
  background: rgba(17, 20, 29, 0.85);
  backdrop-filter: blur(14px);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-full);
  padding: 6px 12px;
  z-index: 10;
  box-shadow: var(--shadow-md);
}

.tool-chip {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border-subtle);
  color: var(--text-secondary);
  padding: 5px 10px;
  border-radius: var(--radius-full);
  font-size: 0.74rem;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 5px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.tool-chip:hover, .tool-chip.active {
  background: var(--bg-tertiary);
  color: var(--accent-cyan);
  border-color: rgba(0, 240, 255, 0.3);
}

.toggle-sidebar-btn {
  background: rgba(17, 20, 29, 0.85);
  backdrop-filter: blur(12px);
  border: 1px solid var(--border-subtle);
  color: var(--text-secondary);
  width: 34px;
  height: 34px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s ease;
}

.toggle-sidebar-btn:hover {
  color: var(--text-primary);
  border-color: rgba(255, 255, 255, 0.2);
}

/* CAD Stats Grid */
.stat-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.stat-item {
  background: rgba(0, 0, 0, 0.3);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  padding: 8px 10px;
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.stat-label {
  font-size: 0.68rem;
  color: var(--text-muted);
  text-transform: uppercase;
  font-weight: 600;
  letter-spacing: 0.03em;
}

.stat-val {
  font-size: 0.85rem;
  font-weight: 700;
  font-family: var(--font-mono);
  color: var(--text-primary);
}

/* Color Picker Container */
.color-picker-row {
  display: flex;
  align-items: center;
  gap: 8px;
}

.color-swatch-input {
  -webkit-appearance: none;
  border: none;
  width: 32px;
  height: 32px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  background: transparent;
}

.color-swatch-input::-webkit-color-swatch-wrapper {
  padding: 0;
}

.color-swatch-input::-webkit-color-swatch {
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
}

/* Presets Carousel / Quick Samples */
.samples-row {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 6px;
}

.sample-card {
  background: var(--bg-primary);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  padding: 8px 6px;
  text-align: center;
  cursor: pointer;
  transition: all 0.2s ease;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
}

.sample-card:hover {
  border-color: var(--accent-cyan);
  background: rgba(0, 240, 255, 0.04);
}

.sample-card svg {
  width: 20px;
  height: 20px;
  color: var(--accent-cyan);
}

.sample-name {
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--text-secondary);
}

/* Image Preview Box for 2D to 3D */
.image-preview-container {
  width: 100%;
  height: 120px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-subtle);
  background: #000;
  overflow: hidden;
  position: relative;
  display: none;
}

.image-preview-img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.image-preview-clear {
  position: absolute;
  top: 6px;
  right: 6px;
  background: rgba(0, 0, 0, 0.75);
  border: 1px solid var(--border-subtle);
  color: #fff;
  border-radius: var(--radius-full);
  width: 24px;
  height: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}

/* Batch Conversion List */
.batch-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
  max-height: 200px;
  overflow-y: auto;
}

.batch-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--bg-primary);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  padding: 6px 10px;
  font-size: 0.75rem;
}

.batch-item-name {
  max-width: 150px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-weight: 600;
}

.batch-item-status {
  font-size: 0.7rem;
  padding: 2px 6px;
  border-radius: 4px;
}

.batch-item-status.pending { background: rgba(245, 158, 11, 0.15); color: var(--accent-amber); }
.batch-item-status.done { background: rgba(16, 185, 129, 0.15); color: var(--accent-emerald); }

/* Toast Notifications */
.toast-container {
  position: fixed;
  bottom: 24px;
  right: 24px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  z-index: 9999;
  pointer-events: none;
}

.toast {
  background: var(--bg-secondary);
  border: 1px solid var(--border-subtle);
  border-left: 4px solid var(--accent-cyan);
  padding: 10px 16px;
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--text-primary);
  font-size: 0.82rem;
  font-weight: 500;
  pointer-events: auto;
  animation: slideIn 0.3s cubic-bezier(0.16, 1, 0.3, 1) forwards;
  backdrop-filter: blur(12px);
  min-width: 260px;
}

.toast.toast-success { border-left-color: var(--accent-emerald); }
.toast.toast-error { border-left-color: var(--accent-rose); }
.toast.toast-warning { border-left-color: var(--accent-amber); }

@keyframes slideIn {
  from { transform: translateX(100%); opacity: 0; }
  to { transform: translateX(0); opacity: 1; }
}

/* Loading Overlay */
.loading-overlay {
  position: absolute;
  inset: 0;
  background: rgba(9, 11, 16, 0.8);
  backdrop-filter: blur(8px);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 14px;
  z-index: 200;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease;
}

.loading-overlay.visible {
  opacity: 1;
  pointer-events: auto;
}

.spinner {
  width: 44px;
  height: 44px;
  border: 3px solid rgba(0, 240, 255, 0.15);
  border-top-color: var(--accent-cyan);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

.loading-text {
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--text-primary);
  letter-spacing: 0.02em;
}

/* Slicing Plane Tool Popup / Slider */
.slicing-panel {
  position: absolute;
  bottom: 60px;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(17, 20, 29, 0.9);
  backdrop-filter: blur(14px);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 10px 16px;
  display: none;
  align-items: center;
  gap: 12px;
  z-index: 15;
  width: 320px;
}

.slicing-panel.visible {
  display: flex;
}

/* Responsive adjustments */
@media (max-width: 1080px) {
  .sidebar {
    width: 320px;
  }
  .sidebar.right-sidebar {
    width: 300px;
  }
}

/* Modal Backdrop & Content */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.75);
  backdrop-filter: blur(8px);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  animation: fadeIn 0.2s ease-out;
}

.modal-content {
  background: var(--bg-secondary);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 20px;
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.6), 0 0 20px rgba(0, 240, 255, 0.15);
  width: 100%;
  animation: scaleUp 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes scaleUp {
  from { transform: scale(0.92); opacity: 0; }
  to { transform: scale(1); opacity: 1; }
}

/* Sample 3D Models Grid & Filter Pills */
.samples-filter-container {
  display: flex;
  gap: 4px;
  overflow-x: auto;
  padding: 4px 0 6px 0;
  scrollbar-width: thin;
}

.sample-filter-pill {
  background: var(--bg-tertiary);
  border: 1px solid var(--border-subtle);
  color: var(--text-secondary);
  font-size: 0.68rem;
  font-weight: 600;
  padding: 3px 8px;
  border-radius: var(--radius-full);
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.18s ease;
}

.sample-filter-pill:hover {
  color: var(--text-primary);
  border-color: rgba(255, 255, 255, 0.2);
}

.sample-filter-pill.active {
  background: rgba(0, 240, 255, 0.15);
  color: var(--accent-cyan);
  border-color: rgba(0, 240, 255, 0.4);
}

.samples-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 6px;
  max-height: 230px;
  overflow-y: auto;
  padding-right: 2px;
}

.sample-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  padding: 8px 4px;
  background: var(--bg-primary);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  text-align: center;
}

.sample-card:hover {
  background: var(--bg-tertiary);
  border-color: var(--accent-cyan);
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0, 240, 255, 0.15);
}

.sample-card.active {
  background: rgba(0, 240, 255, 0.1);
  border-color: var(--accent-cyan);
  box-shadow: 0 0 10px rgba(0, 240, 255, 0.25);
}

.sample-card .sample-icon {
  font-size: 1.25rem;
  line-height: 1;
}

.sample-card .sample-name {
  font-size: 0.68rem;
  font-weight: 600;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100%;
}

/* Draw to 3D & 4D Studio Styles */
.draw3d-color-swatch {
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.draw3d-color-swatch:hover {
  transform: scale(1.2);
}

.draw3d-color-swatch.active {
  box-shadow: 0 0 8px var(--accent-cyan);
  transform: scale(1.15);
}

.draw3d-subpanel {
  margin-top: 6px;
  animation: fadeIn 0.2s ease-out;
}

.draw3d-preset-btn {
  transition: all 0.15s ease;
}

.draw3d-preset-btn:hover {
  border-color: var(--accent-cyan);
  color: var(--accent-cyan);
}



