﻿/* avatar-modal.css — 3-tab avatar editor (Gallery / 2D Editor / 3D Editor) */

/* ─── Overlay ──────────────────────────────────────────────────────────────── */
.avm-overlay {
  position: fixed;
  inset: 0;
  z-index: 9000;
  background: rgba(6, 6, 14, 0.88);
  backdrop-filter: blur(6px);
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity 250ms ease;
}
.avm-overlay.open {
  opacity: 1;
  pointer-events: all;
}

/* ─── Modal shell ──────────────────────────────────────────────────────────── */
.avm-modal {
  position: relative;
  background: linear-gradient(155deg, hsl(250,22%,10%), hsl(250,25%,7%));
  border: 1px solid rgba(0,240,255,0.22);
  border-radius: 16px;
  width: min(940px, calc(100vw - 32px));
  max-height: calc(100vh - 48px);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  box-shadow:
    0 32px 64px rgba(0,0,0,0.75),
    inset 0 0 0 1px rgba(255,255,255,0.04),
    0 0 0 1px rgba(0,240,255,0.08);
  transform: translateY(16px) scale(0.97);
  transition: transform 280ms cubic-bezier(.22,1,.36,1);
}
.avm-overlay.open .avm-modal {
  transform: translateY(0) scale(1);
}

/* ─── Header (tab bar + close) ──────────────────────────────────────────────── */
.avm-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 18px 0;
  flex-shrink: 0;
}
.avm-tabs {
  display: flex;
  gap: 4px;
  background: rgba(255,255,255,0.04);
  border-radius: 10px;
  padding: 4px;
}
.avm-tab {
  background: transparent;
  border: none;
  color: #7a95b0;
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  padding: 7px 16px;
  border-radius: 7px;
  cursor: pointer;
  transition: background 150ms, color 150ms;
}
.avm-tab.active {
  background: rgba(0,240,255,0.14);
  color: var(--clr-neon-cyan, #00f0ff);
}
.avm-tab--soon {
  opacity: 0.38;
  cursor: not-allowed;
  pointer-events: none;
  position: relative;
}
.avm-soon-badge {
  display: inline-block;
  font-size: 0.55rem;
  font-weight: 800;
  letter-spacing: 1px;
  text-transform: uppercase;
  background: rgba(255,255,255,0.12);
  color: #7a95b0;
  border-radius: 4px;
  padding: 1px 5px;
  margin-left: 5px;
  vertical-align: middle;
}
.avm-close {
  background: rgba(255,255,255,0.06);
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: 8px;
  color: #9eb8d8;
  cursor: pointer;
  font-size: 1rem;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 150ms, color 150ms;
  flex-shrink: 0;
}
.avm-close:hover { background: rgba(255,60,60,0.18); color: #ff3c3c; }

/* ─── Panels ──────────────────────────────────────────────────────────────── */
.avm-panel {
  display: none;
  flex: 1;
  overflow: hidden;
  flex-direction: column;
}
.avm-panel.active { display: flex; }

.avm-panel-hint {
  font-size: 0.78rem;
  color: #5a7a90;
  margin: 12px 18px 0;
  flex-shrink: 0;
}

/* ─── Gallery tab ──────────────────────────────────────────────────────────── */
.avm-panel--gallery {
  overflow-y: auto;
  padding: 0 18px 18px;
}
.avm-gallery-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 10px;
  margin-top: 14px;
}
.avm-gallery-card {
  position: relative;
  background: rgba(255,255,255,0.03);
  border: 2px solid rgba(255,255,255,0.08);
  border-radius: 10px;
  cursor: pointer;
  overflow: hidden;
  padding: 0 0 8px;
  transition: border-color 150ms, transform 150ms;
  text-align: center;
}
.avm-gallery-card:hover { border-color: rgba(0,240,255,0.3); transform: translateY(-2px); }
.avm-gallery-card.selected {
  border-color: var(--clr-neon-cyan, #00f0ff);
  box-shadow: 0 0 12px rgba(0,240,255,0.2);
}
.avm-gallery-img {
  display: block;
  width: 100%;
  aspect-ratio: 1;
  object-fit: cover;
}
.avm-gallery-label {
  display: block;
  margin-top: 6px;
  font-size: 0.72rem;
  font-weight: 600;
  color: #b0c8d8;
}
.avm-gallery-check {
  position: absolute;
  top: 6px; right: 6px;
  background: var(--clr-neon-cyan, #00f0ff);
  color: #000;
  border-radius: 50%;
  width: 20px; height: 20px;
  display: none;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  font-weight: 900;
}
.avm-gallery-card.selected .avm-gallery-check { display: flex; }

/* ─── Shared editor layout (2D + 3D) ─────────────────────────────────────── */
.avm-panel--editor {
  overflow: hidden;
}
.avm-panel--editor.active {
  display: flex;
  flex-direction: column;
}
.avm-editor-layout {
  display: flex;
  gap: 16px;
  flex: 1;
  overflow: hidden;
  padding: 14px 18px 18px;
  min-height: 0;
}

/* Preview side */
.avm-preview-wrap {
  display: flex;
  flex-direction: column;
  gap: 6px;
  flex: 0 0 420px;
}
.avm-canvas2d {
  width: 100%;
  aspect-ratio: 1;
  border-radius: 10px;
  background: #0b0b14;
  border: 1px solid rgba(0,240,255,0.12);
  display: block;
}
.avm-viewport {
  width: 100%;
  flex: 1;
  min-height: 0;
  border-radius: 10px;
  overflow: hidden;
  background: #0b0b14;
  border: 1px solid rgba(0,240,255,0.12);
  position: relative;
}
/* Make the preview-wrap fill height in 3D tab */
.avm-panel--editor.active .avm-preview-wrap {
  flex: 0 0 420px;
}
/* 3D viewport needs explicit height when inside flex column */
.avm-panel[data-panel="editor3d"].active .avm-preview-wrap {
  flex: 0 0 420px;
}
.avm-panel[data-panel="editor3d"].active .avm-viewport {
  height: 460px;
}
.avm-viewport-loading {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  color: #6a8090;
  font-size: 0.82rem;
}
.avm-spinner {
  width: 28px; height: 28px;
  border: 3px solid rgba(0,240,255,0.15);
  border-top-color: #00f0ff;
  border-radius: 50%;
  animation: avm-spin 0.8s linear infinite;
}
@keyframes avm-spin { to { transform: rotate(360deg); } }
.avm-drag-hint {
  font-size: 0.7rem;
  color: #3a5060;
  text-align: center;
  margin: 0;
}

/* Controls side (shared) */
.avm-controls {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 12px;
  overflow-y: auto;
  min-height: 0;
  padding-right: 4px;
}
.avm-controls::-webkit-scrollbar { width: 3px; }
.avm-controls::-webkit-scrollbar-thumb { background: rgba(0,240,255,0.15); border-radius: 2px; }

.avm-section {}
.avm-section-label {
  font-size: 0.67rem;
  font-weight: 700;
  letter-spacing: 2px;
  text-transform: uppercase;
  color: #3a7080;
  margin-bottom: 6px;
}
.avm-chip-group {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

/* Generic text chips */
.avm-chip {
  background: rgba(255,255,255,0.05);
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: 6px;
  color: #9eb8c8;
  font-size: 0.74rem;
  font-weight: 600;
  padding: 5px 10px;
  cursor: pointer;
  transition: background 120ms, border-color 120ms, color 120ms;
  white-space: nowrap;
}
.avm-chip:hover {
  background: rgba(0,240,255,0.08);
  border-color: rgba(0,240,255,0.28);
  color: #00f0ff;
}
.avm-chip.active {
  background: rgba(0,240,255,0.14);
  border-color: var(--clr-neon-cyan, #00f0ff);
  color: #00f0ff;
}
.avm-chip--avatar-part {
  min-height: 40px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
}
.avm-chip--avatar-part::before {
  content: "";
  width: 26px;
  height: 26px;
  border-radius: 5px;
  background: var(--chip-img, linear-gradient(135deg, rgba(255,255,255,0.08), rgba(255,255,255,0.02))) center / contain no-repeat;
  flex: 0 0 auto;
}
.avm-chip--avatar-part:disabled {
  opacity: 0.52;
  cursor: not-allowed;
}
.avm-chip-price,
.avm-lock {
  font-size: 0.58rem;
  color: #f8d66d;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.avm-empty {
  color: #5a7a90;
  font-size: 0.72rem;
}

/* Shader swatch circles */
.avm-shader-group { gap: 8px; align-items: center; }
.avm-shader-swatch {
  width: 30px; height: 30px;
  border-radius: 50%;
  border: 2px solid transparent;
  cursor: pointer;
  transition: transform 120ms, border-color 120ms;
  flex-shrink: 0;
}
.avm-shader-swatch:hover { transform: scale(1.15); }
.avm-shader-swatch.active {
  border-color: #fff;
  transform: scale(1.1);
  box-shadow: 0 0 8px rgba(255,255,255,0.4);
}

/* ─── Action buttons (shared) ─────────────────────────────────────────────── */
.avm-panel-actions {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: auto;
  padding-top: 8px;
}
.avm-btn-save {
  background: linear-gradient(135deg, var(--clr-neon-cyan,#00f0ff), #0088ff);
  border: none;
  border-radius: 8px;
  color: #000;
  font-size: 0.84rem;
  font-weight: 700;
  letter-spacing: 1px;
  padding: 11px;
  cursor: pointer;
  transition: opacity 150ms, transform 150ms;
}
.avm-btn-save:hover   { opacity: 0.88; transform: translateY(-1px); }
.avm-btn-save:disabled{ opacity: 0.45; cursor: default; transform: none; }
.avm-btn-cancel {
  background: rgba(255,255,255,0.05);
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: 8px;
  color: #6a8090;
  font-size: 0.8rem;
  padding: 9px;
  cursor: pointer;
  transition: background 150ms;
}
.avm-btn-cancel:hover { background: rgba(255,255,255,0.09); }

/* Forward-compat: gallery panel actions appear below the grid */
.avm-panel--gallery .avm-panel-actions {
  margin-top: 16px;
  padding-top: 0;
  flex-direction: row;
  gap: 10px;
}
.avm-panel--gallery .avm-btn-save   { flex: 1; }
.avm-panel--gallery .avm-btn-cancel { flex: 0 0 auto; }

/* ─── Responsive ──────────────────────────────────────────────────────────── */
@media (max-width: 700px) {
  .avm-editor-layout {
    flex-direction: column;
    overflow-y: auto;
  }
  .avm-preview-wrap {
    flex: none !important;
  }
  .avm-panel[data-panel="editor3d"].active .avm-viewport {
    height: 280px;
  }
  .avm-controls {
    overflow-y: visible;
    max-height: none;
  }
  .avm-tabs { gap: 2px; }
  .avm-tab  { padding: 6px 10px; font-size: 0.7rem; }
}
