/* ─── Reset & Base ─────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --bg-light: #ffffff;
  --surface: #ffffff;
  --card:    #f8f9fa;
  --border:  rgba(0,0,0,0.08);
  --border2: rgba(0,0,0,0.15);
  --hava:    #810014;
  --hava2:   #5c000e;
  --grey:    #808080;
  --text:    #1d1d1f;
  --muted:   rgba(0,0,0,0.55);
  --font-display: 'Bebas Neue', sans-serif;
  --font-body:    'Montserrat', sans-serif;
  --safe-bottom: env(safe-area-inset-bottom, 0px);
}

html, body {
  height: 100%;
  background: var(--bg-light);
  color: var(--text);
  font-family: var(--font-body);
  font-size: 15px;
  overflow: hidden;
}

/* ─── Layout ───────────────────────────────────────── */
.app {
  display: flex;
  flex-direction: column;
  height: 100dvh;
  position: relative;
  background: radial-gradient(circle at top right, #ffffff, #f0f0f0);
}

.brand-bg {
  position: absolute;
  top: -10%;
  right: -10%;
  width: 80vh;
  height: 80vh;
  background-image: url('images/hava_logo.svg');
  background-repeat: no-repeat;
  background-position: center;
  background-size: contain;
  opacity: 0.03;
  filter: grayscale(1);
  pointer-events: none;
  z-index: 0;
}

/* ─── Header ───────────────────────────────────────── */
.header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 20px;
  background: rgba(255, 255, 255, 0.95);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border);
  position: absolute;
  top: 0; left: 0; right: 0;
  z-index: 300;
  pointer-events: none;
}
.header-logo {
  pointer-events: all;
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
}
.logo-mark {
  width: 32px; height: 32px;
  background: var(--hava);
  display: flex; align-items: center; justify-content: center;
  clip-path: polygon(0 0, 100% 0, 100% 72%, 72% 100%, 0 100%);
}
.logo-mark span {
  font-family: var(--font-display);
  font-size: 16px;
  color: var(--bg-light);
  line-height: 1;
}
.logo-text {
  font-family: var(--font-display);
  font-size: 22px;
  letter-spacing: 0.04em;
  color: var(--text);
}
.logo-tag {
  font-size: 10px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted);
  margin-top: -2px;
}
.header-studio-btn {
  pointer-events: all;
  background: var(--hava);
  color: #fff;
  border: none;
  font-family: var(--font-display);
  font-size: 13px;
  letter-spacing: 0.06em;
  padding: 8px 14px;
  clip-path: polygon(0 0, 100% 0, 100% 65%, 90% 100%, 0 100%);
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 6px;
  transition: transform 0.15s, background 0.2s;
  -webkit-tap-highlight-color: transparent;
}
.header-studio-btn:hover {
  background: #a01a2b;
  transform: scale(1.02);
}
.header-studio-btn:active {
  transform: scale(0.98);
}

/* ─── Main Viewer ──────────────────────────────────── */
.viewer-wrap {
  flex: 1;
  position: relative;
  background: var(--bg-light);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

model-viewer {
  width: 100%;
  height: 100%;
  background-color: transparent;
  --poster-color: transparent;
}

/* Custom AR button inside model-viewer */
.ar-btn {
  position: absolute;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--hava);
  color: var(--bg-light);
  font-family: var(--font-display);
  font-size: 18px;
  letter-spacing: 0.06em;
  padding: 14px 32px;
  border: none;
  cursor: pointer;
  clip-path: polygon(0 0, 100% 0, 100% 70%, 92% 100%, 0 100%);
  white-space: nowrap;
  display: flex;
  align-items: center;
  gap: 10px;
  transition: background 0.2s, transform 0.15s;
  -webkit-tap-highlight-color: transparent;
}
.ar-btn:hover { background: #a01a2b; transform: translateX(-50%) scale(1.03); }
.ar-btn:active { transform: translateX(-50%) scale(0.97); }
.ar-btn svg { width: 20px; height: 20px; }

/* model-viewer default AR button — hidden, we use custom */
model-viewer::part(default-ar-button) { display: none; }

/* Placeholder/loading state */
.viewer-placeholder {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 16px;
  pointer-events: none;
  transition: opacity 0.4s;
}
.viewer-placeholder.hidden { opacity: 0; }

.placeholder-ring {
  width: 120px; height: 120px;
  border: 1px solid var(--border2);
  border-top-color: var(--hava);
  border-radius: 50%;
  animation: spin 1.4s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.placeholder-text {
  font-size: 13px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
}

/* Empty state (no product selected) */
.empty-state {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 20px;
  padding: 40px;
  text-align: center;
}
.empty-state-icon {
  width: 80px; height: 80px;
  border: 1px dashed var(--border2);
  display: flex; align-items: center; justify-content: center;
  transform: rotate(45deg);
}
.empty-state-icon svg {
  width: 32px; height: 32px;
  transform: rotate(-45deg);
  opacity: 0.4;
}
.empty-state h2 {
  font-family: var(--font-display);
  font-size: 28px;
  letter-spacing: 0.04em;
  line-height: 1.1;
}
.empty-state p {
  font-size: 13px;
  color: var(--muted);
  max-width: 260px;
  line-height: 1.6;
}
.empty-state-arrow {
  font-size: 24px;
  animation: bounce 1.8s ease-in-out infinite;
}
@keyframes bounce { 0%,100%{transform:translateY(0)} 50%{transform:translateY(8px)} }

/* ─── Controls Bar ─────────────────────────────────── */
.controls-bar {
  position: absolute;
  right: 16px;
  top: 50%;
  transform: translateY(-50%);
  display: flex;
  flex-direction: column;
  gap: 8px;
  z-index: 50;
}
.ctrl-btn {
  width: 44px; height: 44px;
  background: rgba(255,255,255,0.8);
  backdrop-filter: blur(12px);
  border: 1px solid var(--border);
  color: var(--text);
  display: flex; align-items: center; justify-content: center;
  cursor: pointer;
  font-size: 18px;
  transition: border-color 0.2s, background 0.2s;
  -webkit-tap-highlight-color: transparent;
}
.ctrl-btn:hover { border-color: var(--hava); background: rgba(129, 0, 20, 0.08); }
.ctrl-btn:active { background: rgba(52, 120, 246, 0.15); }
.ctrl-btn.active { border-color: var(--hava); color: var(--hava); }

/* ─── Scale Panel ──────────────────────────────────── */
.scale-panel {
  position: absolute;
  right: 70px;
  top: 50%;
  transform: translateY(-50%);
  background: rgba(255,255,255,0.92);
  backdrop-filter: blur(16px);
  border: 1px solid var(--border2);
  padding: 16px;
  width: 200px;
  z-index: 60;
  display: none;
}
.scale-panel.open { display: block; }
.scale-panel h4 {
  font-family: var(--font-display);
  font-size: 15px;
  letter-spacing: 0.08em;
  margin-bottom: 14px;
  color: var(--hava);
}
.scale-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
}
.scale-row label {
  font-size: 11px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
}
.scale-row span {
  font-size: 13px;
  font-weight: 500;
  min-width: 48px;
  text-align: right;
}
input[type=range] {
  width: 100%;
  margin: 6px 0 14px;
  hava-color: var(--hava);
  cursor: pointer;
}
.scale-reset {
  width: 100%;
  background: transparent;
  border: 1px solid var(--border2);
  color: var(--muted);
  font-family: var(--font-body);
  font-size: 11px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  padding: 7px;
  cursor: pointer;
  transition: border-color 0.2s, color 0.2s;
}
.scale-reset:hover { border-color: var(--hava); color: var(--hava); }

/* ─── Info Panel ───────────────────────────────────── */
.info-panel {
  position: absolute;
  left: 16px;
  top: 80px;
  background: rgba(255,255,255,0.92);
  backdrop-filter: blur(16px);
  border: 1px solid var(--border2);
  padding: 14px 16px;
  width: 190px;
  z-index: 60;
  display: none;
  animation: slideIn 0.2s ease;
}
.info-panel.open { display: block; }
@keyframes slideIn { from { opacity:0; transform:translateX(-8px); } to { opacity:1; transform:translateX(0); } }
.info-panel .prod-name {
  font-family: var(--font-display);
  font-size: 18px;
  letter-spacing: 0.04em;
  line-height: 1.1;
  margin-bottom: 10px;
}
.info-row {
  display: flex;
  justify-content: space-between;
  padding: 5px 0;
  border-bottom: 1px solid var(--border);
  font-size: 12px;
}
.info-row:last-child { border-bottom: none; }
.info-row .lbl { color: var(--muted); }
.info-row .val { font-weight: 500; color: var(--hava); }

.info-specs {
  margin-top: 12px;
  padding-top: 10px;
  border-top: 1px solid var(--border2);
}
.spec-item {
  margin-bottom: 6px;
}
.spec-item-lbl {
  display: block;
  font-size: 10px;
  text-transform: uppercase;
  color: var(--muted);
  letter-spacing: 0.04em;
  margin-bottom: 1px;
}
.spec-item-val {
  display: block;
  font-size: 11px;
  color: var(--text);
  font-weight: 400;
  line-height: 1.3;
}

/* ─── Bottom Sheet / Product Library ──────────────── */
.sheet {
  position: relative;
  background: var(--surface);
  border-top: 1px solid var(--border);
  z-index: 200;
  transition: height 0.35s cubic-bezier(0.32,0.72,0,1);
  overflow: hidden;
  display: flex;
  flex-direction: column;
}
.sheet.collapsed { height: 118px; }
.sheet.expanded  { height: min(420px, 55dvh); }

.sheet-handle-area {
  padding: 10px 0 8px;
  display: flex;
  flex-direction: column;
  align-items: center;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  gap: 6px;
}
.sheet-handle {
  width: 20px; height: 14px;
  color: var(--muted);
  display: flex; align-items: center; justify-content: center;
  transition: transform 0.35s cubic-bezier(0.32,0.72,0,1);
}
.sheet-handle svg { width: 100%; height: 100%; }
.sheet.expanded .sheet-handle {
  transform: rotate(180deg);
}
.sheet-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 4px 20px 10px;
}
.sheet-title {
  display: none; /* Removed as requested/simplify */
}
.sheet-count {
  font-size: 11px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
}

/* Category tabs */
.sheet-tabs {
  display: flex;
  gap: 0;
  padding: 0 20px;
  overflow-x: auto;
  scrollbar-width: none;
  -ms-overflow-style: none;
  border-bottom: 1px solid var(--border);
  margin-bottom: 0px;
}
.sheet-tabs-label {
  padding: 12px 20px 4px;
  font-size: 9px;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--muted);
  font-weight: 600;
}
.sheet-tabs::-webkit-scrollbar { display: none; }
.tab-btn {
  background: none;
  border: none;
  color: var(--muted);
  font-family: var(--font-body);
  font-size: 11px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  padding: 10px 14px;
  cursor: pointer;
  border-bottom: 1.5px solid transparent;
  white-space: nowrap;
  transition: all 0.2s;
  margin-bottom: -1px;
}
.tab-btn.active { color: var(--hava); border-bottom-color: var(--hava); font-weight: 600; }

/* Product grid */
.product-grid {
  display: flex;
  gap: 12px;
  padding: 12px 20px calc(12px + var(--safe-bottom));
  overflow-x: auto;
  overflow-y: hidden;
  scrollbar-width: none;
  -ms-overflow-style: none;
  flex: 1;
  align-items: flex-start;
}
.product-grid::-webkit-scrollbar { display: none; }

/* Product card */
.prod-card {
  flex: 0 0 auto;
  width: 140px;
  background: var(--card);
  border: 1px solid var(--border);
  cursor: pointer;
  transition: border-color 0.2s, transform 0.15s;
  -webkit-tap-highlight-color: transparent;
  position: relative;
  overflow: hidden;
}
.prod-card:hover { border-color: var(--border2); transform: translateY(-2px); }
.prod-card.selected {
  border-color: var(--hava);
  transform: translateY(-2px);
}
.prod-card.selected::after {
  content: '✓';
  position: absolute;
  top: 6px; right: 8px;
  background: var(--hava);
  color: var(--bg-light);
  font-size: 10px;
  font-weight: 700;
  width: 18px; height: 18px;
  display: flex; align-items: center; justify-content: center;
  border-radius: 50%;
  z-index: 2;
}
.prod-img {
  width: 100%;
  aspect-ratio: 1 / 1;
  background: #f0f0f4;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  position: relative;
}
.prod-img img {
  width: 100%; height: 100%;
  object-fit: contain;
  padding: 8px;
}
.prod-img-placeholder {
  width: 48px; height: 48px;
  opacity: 0.12;
}
.prod-anchor-badge {
  position: absolute;
  bottom: 5px; left: 5px;
  background: rgba(255,255,255,0.7);
  border: 1px solid var(--border2);
  font-size: 9px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  padding: 2px 6px;
  color: var(--muted);
}
.prod-info {
  padding: 8px 10px 10px;
}
.prod-title {
  font-family: var(--font-display);
  font-size: 14px;
  letter-spacing: 0.04em;
  line-height: 1.2;
  margin-bottom: 3px;
}
.prod-dim {
  font-size: 10px;
  color: var(--muted);
  letter-spacing: 0.04em;
}

/* ─── Toast ────────────────────────────────────────── */
.toast {
  position: fixed;
  top: 80px;
  left: 50%;
  transform: translateX(-50%) translateY(-8px);
  background: var(--card);
  border: 1px solid var(--border2);
  padding: 10px 18px;
  font-size: 13px;
  color: var(--text);
  white-space: nowrap;
  z-index: 999;
  opacity: 0;
  transition: opacity 0.25s, transform 0.25s;
  pointer-events: none;
}
.toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

/* ─── AR Not Supported Banner ──────────────────────── */
.ar-unsupported {
  display: none;
  position: absolute;
  bottom: 90px;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(129, 0, 20, 0.08);
  border: 1px solid rgba(129, 0, 20, 0.2);
  color: var(--hava);
  font-size: 12px;
  padding: 10px 16px;
  text-align: center;
  max-width: 280px;
  z-index: 80;
}

/* ─── Disclaimer Note ──────────────────────────────── */
.disclaimer-note {
  display: none; /* Hidden now, replaced by popup */
}

.info-disclaimer {
  margin-top: 16px;
  padding-top: 10px;
  border-top: 1px dashed var(--border2);
  font-size: 10px;
  color: var(--muted);
  line-height: 1.4;
  font-style: italic;
}

/* ─── Disclaimer Popup ─────────────────────────────── */
.popup-overlay {
  position: fixed; inset: 0;
  background: rgba(0,0,0,0.4);
  backdrop-filter: blur(4px);
  z-index: 2000;
  display: none; align-items: center; justify-content: center;
  padding: 20px;
  opacity: 0; transition: opacity 0.3s ease;
}
.popup-overlay.show { display: flex; opacity: 1; }

.popup-card {
  background: var(--surface);
  width: 100%; max-width: 320px;
  padding: 24px;
  box-shadow: 0 20px 40px rgba(0,0,0,0.15);
  transform: translateY(20px); transition: transform 0.3s ease;
  clip-path: polygon(0 0, 100% 0, 100% 85%, 92% 100%, 0 100%);
}
.popup-overlay.show .popup-card { transform: translateY(0); }

.popup-header {
  display: flex; justify-content: space-between; align-items: center;
  margin-bottom: 16px;
}
.popup-header h3 {
  font-family: var(--font-display);
  font-size: 20px; letter-spacing: 0.04em;
  color: var(--hava);
}
.popup-close {
  background: none; border: none; font-size: 24px; color: var(--muted); cursor: pointer;
}
.popup-body {
  font-size: 14px; line-height: 1.6; color: var(--text); margin-bottom: 24px;
}
.popup-btn {
  width: 100%; background: var(--hava); color: #fff; border: none;
  font-family: var(--font-display); font-size: 16px; letter-spacing: 0.06em;
  padding: 12px; cursor: pointer; transition: background 0.2s;
  clip-path: polygon(0 0, 100% 0, 100% 75%, 94% 100%, 0 100%);
}

.floating-info-btn {
  position: fixed;
  bottom: 130px; /* Above the collapsed sheet */
  left: 16px;
  width: 38px; height: 38px;
  background: rgba(255,255,255,0.85);
  backdrop-filter: blur(10px);
  border: 1px solid var(--border2);
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  color: var(--muted);
  cursor: pointer;
  z-index: 150;
  transition: transform 0.2s, background 0.2s;
  box-shadow: 0 4px 12px rgba(0,0,0,0.08);
}
.floating-info-btn:hover { background: #fff; color: var(--hava); transform: scale(1.1); }

@media (min-width: 1024px) {
  .floating-info-btn { bottom: 24px; }
}

/* ─── Screenshot flash ─────────────────────────────── */
.flash-overlay {
  position: fixed;
  inset: 0;
  background: white;
  z-index: 9999;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.05s;
}
.flash-overlay.flash {
  opacity: 0.85;
  transition: opacity 0.05s;
}

/* ─── Responsive ────────────────────────────────────── */
@media (min-width: 600px) {
  .prod-card { width: 160px; }
}

/* ─── Studio 3D Mode ────────────────────────────────── */
.studio-modal {
  position: fixed; inset: 0; z-index: 1000;
  background: var(--surface);
  display: flex; flex-direction: column;
  opacity: 0; pointer-events: none;
  transition: opacity 0.3s ease;
}
.studio-modal.open { opacity: 1; pointer-events: all; }

/* Header */
.studio-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}
.studio-title {
  font-family: var(--font-display); font-size: 20px;
  letter-spacing: 0.06em; color: var(--text);
  display: flex; align-items: center; gap: 10px;
}
.studio-title svg { color: var(--hava); }
.studio-subtitle {
  font-size: 12px; color: var(--muted);
  letter-spacing: 0.04em; margin-top: 2px;
}
.studio-header-actions { display: flex; gap: 12px; align-items: center; }
.studio-btn {
  font-family: var(--font-display); font-size: 15px; letter-spacing: 0.06em;
  padding: 8px 16px; border: none; cursor: pointer;
  display: flex; align-items: center; gap: 6px;
  transition: background 0.2s, transform 0.15s;
}
@media (max-width: 600px) {
  .studio-subtitle { display: none; }
  .studio-btn span { display: none; }
  .studio-btn { padding: 8px 12px; }
  .studio-title { font-size: 16px; font-weight: normal; }
}
.studio-btn.primary {
  background: var(--hava); color: #fff;
  clip-path: polygon(0 0, 100% 0, 100% 70%, 90% 100%, 0 100%);
}
.studio-btn.primary:hover { background: #a01a2b; transform: scale(1.02); }
.studio-close {
  width: 36px; height: 36px;
  background: var(--card); border: 1px solid var(--border);
  color: var(--muted);
  display: flex; align-items: center; justify-content: center;
  cursor: pointer; transition: background 0.2s, color 0.2s;
}
.studio-close:hover { background: var(--border); color: var(--text); }

/* Body & Workspace */
.studio-body { flex: 1; display: flex; flex-direction: column; overflow: hidden; position: relative; height: 100%; }
.studio-workspace { flex: 1; display: flex; flex-direction: column; position: relative; height: 100%; }
.studio-bg-container {
  flex: 1; position: relative;
  display: flex; align-items: center; justify-content: center;
  overflow: hidden; background: #ecedf1; user-select: none;
  padding: 3rem; box-sizing: border-box;
}
#studioBgImg { 
  max-width: 100%; max-height: 100%; 
  width: auto; height: auto;
  object-fit: contain; display: block; pointer-events: none; 
}
.studio-items-area { position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%); pointer-events: none; }

/* Drop Zone */
.drop-zone {
  flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 20px; padding: 40px; cursor: pointer;
  border: 1.5px dashed var(--border2); margin: 20px;
  transition: border-color 0.2s, background 0.2s;
}
.drop-zone:hover, .drop-zone.drag-over { border-color: var(--hava); background: rgba(129, 0, 20, 0.05); }
.drop-zone-icon {
  width: 72px; height: 72px; border: 1.5px solid var(--border);
  display: flex; align-items: center; justify-content: center; color: var(--muted); position: relative;
}
.drop-zone-icon svg { width: 32px; height: 32px; }
.drop-zone-icon::after {
  content: '+'; position: absolute; bottom: -8px; right: -8px;
  width: 22px; height: 22px; background: var(--hava); color: #fff;
  font-size: 16px; display: flex; align-items: center; justify-content: center; border-radius: 50%;
}
.drop-zone-title { font-family: var(--font-display); font-size: 22px; color: var(--text); }
.drop-zone-sub { font-size: 13px; color: var(--muted); text-align: center; }
.drop-zone-btn {
  background: var(--hava); color: #fff; font-family: var(--font-display); font-size: 16px;
  border: none; padding: 12px 28px; cursor: pointer;
  clip-path: polygon(0 0, 100% 0, 100% 70%, 93% 100%, 0 100%); transition: background 0.2s;
}

/* Catalog Bottom Sheet */
.studio-catalog {
  position: absolute; bottom: 0; left: 0; width: 100%; box-sizing: border-box; z-index: 100;
  background: rgba(255, 255, 255, 0.8); backdrop-filter: blur(12px);
  border-top: 1px solid var(--border);
  padding: 12px 20px calc(12px + var(--safe-bottom)); flex-shrink: 0;
  transition: padding 0.3s;
}
.studio-catalog-header {
  display: flex; justify-content: space-between; align-items: center; cursor: pointer;
  margin-bottom: 12px;
}
.studio-catalog-title { font-size: 11px; text-transform: uppercase; letter-spacing: 0.08em; color: var(--muted); }
.stu-cat-chev { transition: transform 0.3s; color: var(--muted); }
.studio-catalog.collapsed .studio-catalog-header { margin-bottom: 0; }
.studio-catalog.collapsed .studio-catalog-list { display: none; }
.studio-catalog.collapsed .stu-cat-chev { transform: rotate(-180deg); }
.studio-catalog-list {
  display: flex; gap: 12px; overflow-x: auto; padding-bottom: 4px;
  scrollbar-width: thin; scrollbar-color: rgba(255,255,255,0.2) transparent;
}
.studio-catalog-item {
  width: 100px; flex-shrink: 0; background: var(--surface); border: 1px solid var(--border); border-radius: 8px;
  cursor: pointer; transition: background 0.2s, border-color 0.2s; padding: 8px;
}
.studio-catalog-item:hover { background: var(--card); border-color: var(--border2); }
.studio-catalog-item img { width: 100%; aspect-ratio: 1; object-fit: contain; }
.studio-catalog-item-name { font-size: 10px; color: var(--text); text-align: center; margin-top: 6px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* 3D Widget Item */
.studio-item-widget {
  position: absolute; pointer-events: none; /* Only children are pointer events to allow drag through transparent parts */
  border: 1px solid transparent; transition: border-color 0.2s;
  box-sizing: border-box;
}
.studio-item-widget:hover, .studio-item-widget.active { border-color: var(--hava); }
.studio-item-widget model-viewer { width: 100%; height: 100%; pointer-events: all; }

.widget-controls {
  position: absolute; top: -36px; left: 50%; transform: translateX(-50%);
  background: rgba(255,255,255,0.9); backdrop-filter: blur(8px); border: 1px solid var(--border2);
  display: flex; gap: 4px; padding: 4px; border-radius: 6px;
  opacity: 0; pointer-events: none; transition: opacity 0.2s;
}
.studio-item-widget.active .widget-controls { opacity: 1; pointer-events: all; z-index: 10; }

.widget-btn {
  width: 28px; height: 28px; background: transparent; border: none; color: #fff;
  display: flex; align-items: center; justify-content: center; cursor: pointer; border-radius: 4px;
}
.widget-btn:hover { background: rgba(255,255,255,0.15); }
.widget-btn.drag-handle { cursor: grab; }
.widget-btn.drag-handle:active { cursor: grabbing; }
.widget-btn.delete { color: #ff453a; }

.widget-resize {
  position: absolute; bottom: 0; right: 0; width: 20px; height: 20px;
  cursor: se-resize; opacity: 0; pointer-events: none;
  background: linear-gradient(135deg, transparent 50%, rgba(255,255,255,0.5) 50%);
  z-index: 10;
}
.studio-item-widget.active .widget-resize { opacity: 1; pointer-events: all; }

/* ─── Desktop Optimization (Option 2: Adaptive Desktop) ─── */
@media (min-width: 1024px) {
  /* Main Application - Sidebar Mode */
  .app { flex-direction: row; }
  .viewer-wrap { flex: 1; }
  .sheet {
    position: relative; height: 100dvh !important; width: 400px !important;
    border-left: 1px solid var(--border); border-top: none;
    display: flex; flex-direction: column;
  }
  .sheet-handle { display: none !important; }
  .sheet-handle-area { cursor: default; pointer-events: none; padding-top: 30px; }
  .product-grid { 
    grid-template-columns: repeat(2, 1fr); 
    padding-bottom: 40px; 
    align-content: flex-start;
  }
  
  /* Studio 3D - Sidebar Mode */
  .studio-modal {
    display: grid !important;
    grid-template-rows: auto minmax(0, 1fr);
    grid-template-columns: 1fr 360px;
    grid-template-areas: 
      "header header"
      "workspace catalog";
    height: 100dvh;
    overflow: hidden;
  }
  .studio-header { grid-area: header; }
  .studio-body { grid-area: workspace; }
  .studio-catalog {
    grid-area: catalog;
    position: relative !important;
    width: 100% !important;
    height: 100%;
    border-left: 1px solid var(--border); 
    border-top: none;
    background: #f8f9fa; 
    backdrop-filter: none;
    padding: 24px;
    display: flex; flex-direction: column;
  }
  .studio-catalog-header { cursor: default; pointer-events: none; margin-bottom: 24px; }
  .stu-cat-chev { display: none; }
  .studio-catalog.collapsed .studio-catalog-list { display: flex; } /* Prevent collapsing on PC */
  .studio-catalog-list {
    flex-direction: row; flex-wrap: wrap; align-content: flex-start;
    gap: 16px; overflow-y: auto; overflow-x: hidden; height: 100%;
    padding-right: 8px; /* For scrollbar */
  }
  .studio-catalog-item { 
    width: calc(50% - 8px); aspect-ratio: 0.9; 
    display: flex; flex-direction: column; justify-content: center; 
  }
  .studio-catalog-item img { width: 100%; height: auto; max-height: 80px; margin-bottom: 8px; }
  .studio-catalog-item-name { font-size: 11px; white-space: normal; }
}