/* ═══════════════════════════════════════════════
   Avatar Creator Pro v3 — Dark Studio UI
   Design: precision tool aesthetic, not decorative
═══════════════════════════════════════════════ */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600&family=Space+Grotesk:wght@600;700&display=swap');

/* ── Reset & Root ── */
#acp-root {
  --c-bg:      #0b0d13;
  --c-panel:   #13151f;
  --c-surface: #1b1e2e;
  --c-lift:    #222538;
  --c-border:  #2a2d45;
  --c-accent:  #6c5fff;
  --c-accent2: #3ecfff;
  --c-success: #3dd68c;
  --c-warn:    #f5a623;
  --c-error:   #f56565;
  --c-text:    #e2e6f8;
  --c-dim:     #6c739e;
  --c-muted:   #3a3f5c;
  --r:    8px;
  --r-sm: 5px;
  font-family: 'Inter', system-ui, -apple-system, sans-serif;
  font-size: 13px;
  line-height: 1.4;
  color: var(--c-text);
  box-sizing: border-box;
}
#acp-root *, #acp-root *::before, #acp-root *::after { box-sizing: inherit; }

/* ── Shell ── */
.acp-shell {
  position: relative;
  display: flex;
  width: 100%; height: 100%;
  overflow: hidden;
  border-radius: 14px;
  box-shadow: 0 40px 100px rgba(0,0,0,0.75), 0 0 0 1px rgba(255,255,255,0.04);
}

/* ── Viewport ── */
.acp-viewport {
  flex: 1 1 0;
  min-width: 0;
  position: relative;
  background: var(--c-bg);
  overflow: hidden;
}
.acp-viewport canvas {
  display: block;
  width: 100% !important;
  height: 100% !important;
}

/* ── Loader ── */
.acp-loader {
  position: absolute; inset: 0;
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  background: var(--c-bg);
  z-index: 20;
  gap: 16px;
  transition: opacity 0.4s ease;
}
.acp-spinner {
  width: 44px; height: 44px;
  border: 3px solid var(--c-border);
  border-top-color: var(--c-accent);
  border-radius: 50%;
  animation: spin 0.75s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
.acp-loader-label { color: var(--c-dim); font-size: 13px; letter-spacing: 0.02em; }
.acp-error { color: var(--c-error); text-align: center; padding: 20px; max-width: 280px; }

/* ── Camera buttons ── */
.acp-cambtns {
  position: absolute;
  bottom: 14px; right: 14px;
  display: flex; flex-direction: column; gap: 6px;
}
.acp-cambtn {
  width: 36px; height: 36px;
  background: rgba(19,21,31,0.82);
  border: 1px solid var(--c-border);
  border-radius: var(--r-sm);
  color: var(--c-text);
  font-size: 16px;
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  backdrop-filter: blur(8px);
  transition: border-color 0.15s, background 0.15s;
}
.acp-cambtn:hover {
  border-color: var(--c-accent);
  background: rgba(108,95,255,0.18);
}

/* ── Panel ── */
.acp-panel {
  width: 284px;
  flex-shrink: 0;
  background: var(--c-panel);
  border-left: 1px solid var(--c-border);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

/* ── Header ── */
.acp-hdr {
  padding: 12px 14px;
  background: var(--c-surface);
  border-bottom: 1px solid var(--c-border);
  display: flex; align-items: center; gap: 10px;
}
.acp-brand {
  font-family: 'Space Grotesk', sans-serif;
  font-size: 13px; font-weight: 700;
  color: var(--c-accent);
  white-space: nowrap;
  letter-spacing: 0.01em;
  flex-shrink: 0;
}
.acp-nameinput {
  flex: 1; min-width: 0;
  background: rgba(255,255,255,0.05);
  border: 1px solid var(--c-border);
  border-radius: var(--r-sm);
  color: var(--c-text);
  padding: 5px 8px;
  font-size: 11.5px;
  font-family: inherit;
  outline: none;
  transition: border-color 0.18s;
}
.acp-nameinput:focus { border-color: var(--c-accent); }
.acp-nameinput::placeholder { color: var(--c-dim); }

/* ── Tab bar ── */
.acp-tabbar {
  display: flex;
  flex-wrap: wrap;
  gap: 2px;
  padding: 6px 8px;
  background: var(--c-bg);
  border-bottom: 1px solid var(--c-border);
}
.acp-tabn {
  flex: 1 1 auto;
  min-width: 0;
  background: transparent;
  border: 1px solid transparent;
  border-radius: var(--r-sm);
  color: var(--c-dim);
  padding: 4px 2px 3px;
  cursor: pointer;
  font-family: inherit;
  font-size: 9.5px;
  display: flex; flex-direction: column;
  align-items: center; gap: 2px;
  transition: all 0.14s;
}
.acp-tabn > span:first-child { font-size: 14px; line-height: 1.2; }
.acp-tablabel { display: block; }
.acp-tabn:hover { color: var(--c-text); background: var(--c-lift); }
.acp-tabn.act {
  background: var(--c-accent);
  color: #fff;
  border-color: transparent;
  font-weight: 600;
}

/* ── Scrollable content ── */
.acp-content {
  flex: 1 1 0;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 12px;
  scrollbar-width: thin;
  scrollbar-color: var(--c-muted) transparent;
}
.acp-content::-webkit-scrollbar { width: 3px; }
.acp-content::-webkit-scrollbar-thumb { background: var(--c-muted); border-radius: 2px; }

/* ── Section labels ── */
.acp-sec {
  font-family: 'Space Grotesk', sans-serif;
  font-size: 9px; font-weight: 700;
  letter-spacing: 0.11em;
  text-transform: uppercase;
  color: var(--c-dim);
  margin: 12px 0 7px;
}
.acp-sec:first-child { margin-top: 0; }

/* ── Expressions grid ── */
.acp-exprgrid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 4px;
  margin-bottom: 4px;
}
.acp-exprbtn {
  background: var(--c-surface);
  border: 1px solid var(--c-border);
  border-radius: var(--r);
  padding: 7px 3px 5px;
  color: var(--c-text);
  font-family: inherit;
  cursor: pointer;
  display: flex; flex-direction: column;
  align-items: center; gap: 3px;
  transition: all 0.14s;
}
.acp-exprbtn:hover { border-color: var(--c-accent2); }
.acp-exprbtn.act { background: rgba(62,207,255,0.12); border-color: var(--c-accent2); color: var(--c-accent2); }
.acp-expricon { font-size: 18px; line-height: 1; }
.acp-exprlbl { font-size: 9px; text-align: center; }

/* ── Slider rows ── */
.acp-row {
  display: grid;
  grid-template-columns: 1fr auto 32px;
  align-items: center;
  gap: 6px;
  margin-bottom: 5px;
}
.acp-rowlbl {
  font-size: 11.5px;
  color: var(--c-text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.acp-rowval {
  font-size: 10px;
  color: var(--c-dim);
  text-align: right;
  font-variant-numeric: tabular-nums;
  min-width: 28px;
}

/* ── Range slider ── */
.acp-slider {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 3px;
  border-radius: 2px;
  background: var(--c-muted);
  outline: none;
  cursor: pointer;
}
.acp-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 13px; height: 13px;
  border-radius: 50%;
  background: var(--c-accent);
  border: 2px solid var(--c-panel);
  box-shadow: 0 0 6px rgba(108,95,255,0.65);
  cursor: pointer;
  transition: transform 0.12s;
}
.acp-slider::-webkit-slider-thumb:hover { transform: scale(1.35); }
.acp-slider::-moz-range-thumb {
  width: 13px; height: 13px;
  border-radius: 50%;
  background: var(--c-accent);
  border: 2px solid var(--c-panel);
  cursor: pointer;
}

/* ── Swatches ── */
.acp-swatches {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  margin-bottom: 6px;
}
.acp-swatch {
  width: 30px; height: 30px;
  border-radius: 50%;
  border: 2px solid transparent;
  cursor: pointer;
  transition: transform 0.14s, border-color 0.14s, box-shadow 0.14s;
  flex-shrink: 0;
}
.acp-swatch:hover { transform: scale(1.18); }
.acp-swatch.act {
  border-color: var(--c-accent2);
  box-shadow: 0 0 0 3px rgba(62,207,255,0.28);
  transform: scale(1.14);
}
.acp-tonename {
  font-size: 11px;
  color: var(--c-dim);
  margin-bottom: 4px;
}

/* ── Colour inputs ── */
.acp-colorwide {
  width: 100%; height: 34px;
  border: 1px solid var(--c-border);
  border-radius: var(--r-sm);
  background: var(--c-surface);
  cursor: pointer;
  padding: 2px 4px;
  margin-bottom: 4px;
}
.acp-colorsm {
  width: 38px; height: 26px;
  border: 1px solid var(--c-border);
  border-radius: var(--r-sm);
  background: var(--c-surface);
  cursor: pointer;
  padding: 1px 2px;
}

/* ── Toggle switches ── */
.acp-toggle {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 8px;
  cursor: pointer;
  font-size: 12px;
  color: var(--c-text);
}
.acp-toggle input { position: absolute; opacity: 0; width: 0; height: 0; }
.acp-toggletrack {
  width: 32px; height: 18px;
  background: var(--c-muted);
  border-radius: 9px;
  position: relative;
  flex-shrink: 0;
  transition: background 0.2s;
}
.acp-toggletrack::after {
  content: '';
  position: absolute;
  width: 12px; height: 12px;
  top: 3px; left: 3px;
  background: #fff;
  border-radius: 50%;
  transition: transform 0.2s;
}
.acp-toggle input:checked + .acp-toggletrack { background: var(--c-accent); }
.acp-toggle input:checked + .acp-toggletrack::after { transform: translateX(14px); }

/* ── Export card ── */
.acp-exportcard {
  background: var(--c-surface);
  border: 1px solid var(--c-border);
  border-radius: var(--r);
  padding: 18px;
  text-align: center;
}
.acp-exporticon { font-size: 36px; margin-bottom: 10px; }
.acp-exportcard h3 {
  font-family: 'Space Grotesk', sans-serif;
  font-size: 15px; font-weight: 700;
  margin: 0 0 8px;
}
.acp-exportcard p { color: var(--c-dim); font-size: 12px; margin: 0 0 12px; line-height: 1.5; }
.acp-checklist {
  list-style: none; padding: 0; margin: 0 0 16px;
  text-align: left;
}
.acp-checklist li { font-size: 11.5px; color: var(--c-dim); padding: 2px 0; }

/* ── Hint text ── */
.acp-hint { font-size: 11px; color: var(--c-dim); margin: 4px 0 10px; line-height: 1.45; }

/* ── Buttons ── */
.acp-btn {
  border: none;
  border-radius: var(--r-sm);
  padding: 8px 13px;
  font-size: 12px; font-family: inherit; font-weight: 500;
  cursor: pointer;
  display: inline-flex; align-items: center; gap: 5px;
  transition: all 0.16s;
}
.acp-save {
  background: rgba(61,214,140,0.12);
  color: var(--c-success);
  border: 1px solid var(--c-success);
}
.acp-save:hover { background: rgba(61,214,140,0.24); }
.acp-export {
  background: rgba(108,95,255,0.14);
  color: var(--c-accent);
  border: 1px solid var(--c-accent);
}
.acp-export:hover { background: rgba(108,95,255,0.28); }
.acp-secondary {
  background: var(--c-surface);
  color: var(--c-dim);
  border: 1px solid var(--c-border);
}
.acp-secondary:hover { border-color: var(--c-accent); color: var(--c-text); }
.acp-fullbtn { width: 100%; justify-content: center; padding: 11px; font-size: 13px; margin-bottom: 8px; }

/* ── Footer ── */
.acp-footer {
  padding: 10px 12px;
  border-top: 1px solid var(--c-border);
  background: var(--c-bg);
  display: flex; gap: 6px; align-items: center;
}
.acp-footer .acp-save, .acp-footer .acp-export { flex: 1; justify-content: center; }

/* ── Toasts ── */
.acp-toast {
  position: fixed;
  bottom: 24px; left: 50%;
  transform: translateX(-50%) translateY(12px);
  padding: 9px 20px;
  border-radius: 50px;
  font-family: 'Inter', sans-serif;
  font-size: 13px;
  background: var(--c-surface);
  border: 1px solid var(--c-border);
  color: var(--c-text);
  box-shadow: 0 8px 32px rgba(0,0,0,0.5);
  opacity: 0;
  transition: all 0.22s ease;
  z-index: 999999;
  white-space: nowrap;
}
.acp-toast.show { opacity:1; transform: translateX(-50%) translateY(0); }
.acp-toast-success { border-color: var(--c-success); color: var(--c-success); }
.acp-toast-error   { border-color: var(--c-error);   color: var(--c-error); }
.acp-toast-warn    { border-color: var(--c-warn);     color: var(--c-warn); }
.acp-toast-info    { border-color: var(--c-accent2);  color: var(--c-accent2); }

/* ── Photo-personalization modal (overlay, doesn't tear down the Three.js canvas) ── */
.acp-photomodal {
  position: absolute; inset: 0;
  z-index: 50;
  display: flex; align-items: center; justify-content: center;
  background: rgba(6,7,11,0.82);
  backdrop-filter: blur(3px);
}
.acp-faceclose {
  position: absolute; top: 10px; right: 10px;
  z-index: 2;
  width: 30px; height: 30px;
  background: var(--c-surface); border: 1px solid var(--c-border); border-radius: 50%;
  color: var(--c-dim); cursor: pointer; font-size: 13px;
  display: flex; align-items: center; justify-content: center;
}
.acp-faceclose:hover { color: var(--c-text); border-color: var(--c-accent); }
.acp-photocard {
  position: relative;
  width: 94%; max-height: 92%;
  max-width: 420px;
  background: var(--c-panel);
  border: 1px solid var(--c-border);
  border-radius: var(--r);
  box-shadow: 0 24px 64px rgba(0,0,0,0.6);
  overflow-y: auto;
  padding: 22px 20px;
}
.acp-photobody h3 {
  margin: 0 0 6px; font-family:'Space Grotesk',sans-serif;
  font-size: 15px; font-weight: 600; color: var(--c-text);
}
.acp-camstatus {
  padding: 10px 0; text-align: center;
  font-size: 12px; color: var(--c-dim);
}

/* ── Login form ── */
.acp-loginform { display: flex; flex-direction: column; gap: 12px; }
.acp-loginform label {
  display: flex; flex-direction: column; gap: 5px;
  font-size: 12px; color: var(--c-dim);
}
.acp-loginform input {
  background: var(--c-surface); border: 1px solid var(--c-border); border-radius: var(--r-sm);
  color: var(--c-text); font-size: 13px; padding: 9px 10px; font-family: inherit;
}
.acp-loginform input:focus { outline: none; border-color: var(--c-accent); }
.acp-loginerr {
  font-size: 12px; color: var(--c-error);
  background: rgba(245,101,101,0.1); border: 1px solid rgba(245,101,101,0.3);
  border-radius: var(--r-sm); padding: 8px 10px;
}

/* ── Webcam capture ── */
.acp-camwrap {
  position: relative; width: 100%; aspect-ratio: 4/3;
  background: #000; border-radius: var(--r-sm); overflow: hidden;
}
.acp-camwrap video, .acp-camwrap img {
  width: 100%; height: 100%; object-fit: cover; display: block;
  transform: scaleX(-1); /* mirror, like a mirror/selfie camera */
}
.acp-camopts {
  display: flex; flex-direction: column; gap: 10px;
  margin-top: 14px; font-size: 12px; color: var(--c-dim);
}
.acp-camopts label { display: flex; flex-direction: column; gap: 5px; }
.acp-camopts select, .acp-camopts input[type="range"] {
  width: 100%;
}
.acp-camopts select {
  background: var(--c-surface); border: 1px solid var(--c-border); border-radius: var(--r-sm);
  color: var(--c-text); font-size: 13px; padding: 8px 10px; font-family: inherit;
}
.acp-cambtnrow {
  display: flex; gap: 8px; margin-top: 14px; flex-wrap: wrap;
}
.acp-cambtnrow .acp-btn { flex: 1 1 auto; }
.acp-linkbtn {
  display: block; margin: 14px auto 0; background: none; border: none;
  color: var(--c-dim); font-size: 11px; text-decoration: underline; cursor: pointer;
  font-family: inherit;
}
.acp-linkbtn:hover { color: var(--c-text); }

/* ── Responsive ── */
@media (max-width: 680px) {
  .acp-shell { flex-direction: column; }
  .acp-panel { width: 100%; max-height: 52%; border-left: none; border-top: 1px solid var(--c-border); }
  .acp-viewport { height: 48%; }
  .acp-exprgrid { grid-template-columns: repeat(5, 1fr); }
}

/* ── WP resets ── */
#acp-root button { line-height: normal; }
#acp-root input[type="range"]  { padding: 0; margin: 0; }
#acp-root input[type="color"]  { padding: 0; }
