/* ============================================
   STYLEJEWELRYS — Components
   ============================================ */

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 9px 16px;
  border-radius: var(--r-pill);
  border: 1px solid var(--line);
  background: var(--surface-3);
  color: var(--text);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: .05em;
  cursor: pointer;
  transition: all var(--dur) var(--ease);
  white-space: nowrap;
}
.btn:hover { border-color: var(--gold); color: var(--gold-light); }
.btn:active { transform: scale(.96); }
.btn--gold {
  background: var(--gold-gradient);
  border-color: transparent;
  color: #0A0A0A;
  font-weight: 800;
  box-shadow: 0 4px 18px rgba(201,162,39,.28);
}
.btn--gold:hover { color: #0A0A0A; filter: brightness(1.08); }
.btn--ghost { background: transparent; }
.btn--icon {
  width: 36px; height: 36px;
  padding: 0;
  border-radius: 50%;
}
.btn--icon svg { width: 17px; height: 17px; }
.btn--sm { padding: 6px 12px; font-size: 11px; }

/* ---------- Chips / Tabs ---------- */
.chips {
  display: flex;
  gap: 7px;
  overflow-x: auto;
  padding: 2px 0 4px;
  scrollbar-width: none;
}
.chips::-webkit-scrollbar { display: none; }
.chip {
  flex: 0 0 auto;
  padding: 6px 13px;
  border-radius: var(--r-pill);
  border: 1px solid var(--line-soft);
  background: transparent;
  color: var(--text-dim);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: .04em;
  cursor: pointer;
  transition: all var(--dur) var(--ease);
}
.chip:hover { color: var(--text); border-color: var(--line); }
.chip[aria-pressed="true"] {
  background: var(--gold-gradient);
  border-color: transparent;
  color: #0A0A0A;
  font-weight: 800;
}

/* ---------- Product Card ---------- */
.card {
  position: relative;
  border-radius: var(--r-md);
  border: 1px solid var(--line-soft);
  background: var(--surface);
  overflow: hidden;
  cursor: pointer;
  transition: all var(--dur) var(--ease);
}
.card:hover {
  border-color: var(--gold);
  transform: translateY(-2px);
  box-shadow: var(--shadow-1);
}
.card[aria-selected="true"] {
  border-color: var(--gold);
  box-shadow: var(--glow-gold);
}
.card-thumb {
  aspect-ratio: 1 / 1;
  display: grid;
  place-items: center;
  background: radial-gradient(80% 80% at 50% 30%, rgba(201,162,39,.10), transparent 70%), var(--surface-2);
  padding: 8px;
}
.card-thumb svg, .card-thumb img { width: 100%; height: 100%; object-fit: contain; }
.card-meta { padding: 7px 9px 9px; }
.card-name {
  font-size: 11px;
  font-weight: 600;
  line-height: 1.25;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.card-price {
  font-size: 11px;
  color: var(--gold);
  font-weight: 700;
  margin-top: 2px;
  letter-spacing: .03em;
}
.card-fav {
  position: absolute;
  top: 6px; right: 6px;
  width: 26px; height: 26px;
  border-radius: 50%;
  border: 0;
  background: rgba(0,0,0,.55);
  backdrop-filter: blur(6px);
  color: var(--text-dim);
  display: grid; place-items: center;
  cursor: pointer;
  z-index: 2;
  transition: color var(--dur) var(--ease);
}
.card-fav svg { width: 13px; height: 13px; }
.card-fav[aria-pressed="true"] { color: var(--accent); }

/* ---------- Try-On Canvas ---------- */
.tryon {
  position: relative;
  width: 100%;
  height: 100%;
  display: grid;
  place-items: center;
  touch-action: none;
  user-select: none;
}
.tryon-model {
  position: relative;
  height: 88%;
  max-height: 620px;
  aspect-ratio: 3 / 5;
  border-radius: var(--r-lg);
  overflow: hidden;
  background: linear-gradient(170deg, var(--surface-2), var(--surface-3));
  box-shadow: var(--shadow-2);
  border: 1px solid var(--line-soft);
}
/* 3D digital human container keeps the same visual frame */
.tryon-model.has-3d {
  background:
    radial-gradient(90% 70% at 50% 18%, rgba(201,162,39,.12), transparent 62%),
    linear-gradient(170deg, #1A1A1A, #0C0C0C);
  overflow: hidden;
}
.tryon-model.has-3d canvas { width: 100% !important; height: 100% !important; display: block; }
.tryon-model > img,
.tryon-model > svg.model-base { width: 100%; height: 100%; object-fit: cover; display: block; }
/* The model SVG is injected inside #modelSvg wrapper */
.tryon-model #modelSvg { width: 100%; height: 100%; display: block; }
.tryon-model #modelSvg > svg { width: 100%; height: 100%; display: block; }

/* Draggable layer */
.layer {
  position: absolute;
  left: 50%; top: 50%;
  transform-origin: center center;
  cursor: grab;
  will-change: transform;
  filter: drop-shadow(0 6px 14px rgba(0,0,0,.5));
}
.layer:active { cursor: grabbing; }
.layer svg, .layer img { display: block; width: 100%; height: auto; pointer-events: none; }
.layer.is-locked { pointer-events: none; }

/* Real product photo on the model.
   The source images are shot on a white background, so we blend them
   into the model using multiply + a soft mask that fades the white edges. */
.layer .layer-photo {
  mix-blend-mode: multiply;
  filter: contrast(1.08) saturate(1.05) drop-shadow(0 2px 6px rgba(0,0,0,.45));
  border-radius: 6px;
}
[data-theme="light"] .layer .layer-photo {
  mix-blend-mode: multiply;
  filter: contrast(1.05) saturate(1.02) drop-shadow(0 2px 6px rgba(0,0,0,.25));
}
/* When the model photo (user upload) is in use, keep photos crisp */
.tryon-model.has-photo .layer .layer-photo {
  mix-blend-mode: normal;
  filter: drop-shadow(0 3px 8px rgba(0,0,0,.5));
}

/* Anchor guides */
.anchor-hint {
  position: absolute;
  width: 15px; height: 15px;
  border: 1px dashed var(--gold);
  border-radius: 50%;
  opacity: .45;
  pointer-events: none;
  transform: translate(-50%, -50%);
}

/* ---------- Floating Toolbar ---------- */
.toolbar {
  position: absolute;
  left: 50%;
  bottom: 14px;
  transform: translateX(-50%);
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 6px;
  border-radius: var(--r-pill);
  background: rgba(10,10,10,.78);
  backdrop-filter: blur(14px);
  border: 1px solid var(--line);
  box-shadow: var(--shadow-2);
  z-index: 20;
  max-width: calc(100% - 24px);
  overflow-x: auto;
  scrollbar-width: none;
}
[data-theme="light"] .toolbar { background: rgba(255,255,255,.86); }
.toolbar::-webkit-scrollbar { display: none; }
.toolbar .btn--icon { width: 33px; height: 33px; background: transparent; border-color: transparent; }
.toolbar .btn--icon:hover { background: var(--surface-3); }
.toolbar .divider { width: 1px; height: 20px; background: var(--line-soft); flex: 0 0 1px; }

/* ---------- Badge ---------- */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 8px;
  border-radius: var(--r-pill);
  font-size: 9px;
  font-weight: 700;
  letter-spacing: .08em;
  text-transform: uppercase;
}
.badge--gold { background: var(--gold-gradient); color: #0A0A0A; }
.badge--accent { background: var(--accent-soft); color: var(--accent); }
.badge--live { background: rgba(255,59,107,.18); color: var(--accent); }
.badge--live::before {
  content: "";
  width: 5px; height: 5px;
  border-radius: 50%;
  background: var(--accent);
  animation: pulse 1.4s infinite;
}
@keyframes pulse {
  0%,100% { opacity: 1; transform: scale(1); }
  50% { opacity: .35; transform: scale(.75); }
}

/* ---------- Modal ---------- */
.modal {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: none;
  place-items: center;
  padding: 18px;
  background: rgba(0,0,0,.78);
  backdrop-filter: blur(8px);
}
.modal.is-open { display: grid; animation: fadeIn .22s var(--ease); }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
.modal-box {
  position: relative;
  width: min(520px, 100%);
  max-height: 86vh;
  overflow-y: auto;
  border-radius: var(--r-lg);
  border: 1px solid var(--line);
  background: var(--surface);
  box-shadow: var(--shadow-2);
  animation: rise .28s var(--ease);
}
@keyframes rise { from { transform: translateY(18px); opacity: 0; } to { transform: none; opacity: 1; } }
.modal-hero {
  aspect-ratio: 4 / 3;
  display: grid;
  place-items: center;
  background: radial-gradient(70% 70% at 50% 35%, rgba(201,162,39,.16), transparent 70%), var(--surface-2);
  padding: 22px;
  border-bottom: 1px solid var(--line-soft);
}
.modal-hero svg, .modal-hero img { width: 100%; height: 100%; object-fit: contain; }
.modal-body { padding: 16px 18px 20px; }
.modal-close {
  position: absolute;
  top: 10px; right: 10px;
  width: 32px; height: 32px;
  border-radius: 50%;
  border: 1px solid var(--line-soft);
  background: rgba(0,0,0,.6);
  color: var(--text);
  display: grid; place-items: center;
  cursor: pointer;
  z-index: 3;
}
.modal-close svg { width: 15px; height: 15px; }

/* ---------- AR View ---------- */
.ar-stage {
  position: relative;
  width: 100%; height: 100%;
  display: grid;
  place-items: center;
  overflow: hidden;
  background: #000;
}
.ar-video, .ar-canvas {
  position: absolute;
  inset: 0;
  width: 100%; height: 100%;
  object-fit: cover;
}
.ar-video { transform: scaleX(-1); }
.ar-canvas { pointer-events: none; }
.ar-placeholder {
  position: relative;
  z-index: 2;
  text-align: center;
  padding: 26px;
  max-width: 340px;
}
.ar-placeholder svg { width: 54px; height: 54px; color: var(--gold); margin-bottom: 12px; }
.ar-placeholder h3 { margin: 0 0 6px; font-size: 16px; letter-spacing: .06em; }
.ar-placeholder p { margin: 0 0 16px; color: var(--text-dim); font-size: 12px; line-height: 1.6; }
.ar-controls {
  position: absolute;
  left: 50%; bottom: 16px;
  transform: translateX(-50%);
  display: flex; gap: 8px;
  z-index: 12;
}

/* ---------- Style / Recommend View ---------- */
.panel {
  width: 100%; height: 100%;
  overflow-y: auto;
  padding: 18px;
}
.panel-inner { max-width: 760px; margin: 0 auto; }
.section-title {
  font-size: 11px;
  letter-spacing: .22em;
  text-transform: uppercase;
  color: var(--gold);
  margin: 0 0 10px;
  font-weight: 700;
}
.field { margin-bottom: 16px; }
.field-label {
  display: block;
  font-size: 11px;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--text-dim);
  margin-bottom: 7px;
  font-weight: 600;
}
.look-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(132px, 1fr));
  gap: 11px;
}
.look-card {
  border-radius: var(--r-md);
  border: 1px solid var(--line-soft);
  background: var(--surface-2);
  padding: 12px;
  text-align: center;
  cursor: pointer;
  transition: all var(--dur) var(--ease);
}
.look-card:hover { border-color: var(--gold); transform: translateY(-2px); }
.look-card svg { width: 100%; height: 76px; object-fit: contain; margin-bottom: 8px; }
.look-card h4 { margin: 0 0 3px; font-size: 12px; letter-spacing: .05em; }
.look-card p { margin: 0; font-size: 10px; color: var(--text-mute); }

/* ---------- Stats / Profile ---------- */
.stat-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 14px;
  border-radius: var(--r-md);
  border: 1px solid var(--line-soft);
  background: var(--surface-2);
  margin-bottom: 9px;
}
.stat-row span:first-child { font-size: 12px; color: var(--text-dim); }
.stat-row span:last-child { font-size: 13px; font-weight: 700; color: var(--gold); }

/* ---------- Toast ---------- */
.toast {
  position: fixed;
  left: 50%;
  bottom: calc(var(--navbar-h) + 18px);
  transform: translate(-50%, 14px);
  padding: 10px 18px;
  border-radius: var(--r-pill);
  background: var(--gold-gradient);
  color: #0A0A0A;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: .04em;
  box-shadow: var(--shadow-2);
  opacity: 0;
  pointer-events: none;
  transition: all .3s var(--ease);
  z-index: 200;
  max-width: calc(100% - 32px);
  text-align: center;
}
.toast.is-show { opacity: 1; transform: translate(-50%, 0); }

/* ---------- Empty state ---------- */
.empty {
  grid-column: 1 / -1;
  text-align: center;
  padding: 26px 12px;
  color: var(--text-mute);
  font-size: 12px;
}

/* ---------- Skeleton ---------- */
.skeleton {
  background: linear-gradient(90deg, var(--surface-2) 25%, var(--surface-3) 50%, var(--surface-2) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.4s infinite;
  border-radius: var(--r-sm);
}
@keyframes shimmer { 0% { background-position: 200% 0; } 100% { background-position: -200% 0; } }
