/* Vrool AI — Virtual Try-On UI
   Design: minimal, luxury, fashion-first. White surfaces, purple accent #9775AF,
   rounded cards, soft shadows, smooth motion. */

:root {
  --vai-purple: #9775AF;
  --vai-purple-dark: #7c5c96;
  --vai-purple-soft: #f4eefa;
  --vai-ink: #1d1a22;
  --vai-muted: #7b7686;
  --vai-line: rgba(0,0,0,0.08);
  --vai-shadow: 0 18px 60px rgba(28,20,45,0.18);
}

/* ── Try It On button (on listing) ── */
.vrool-ai-tryon-cta {
  display: flex; align-items: center; gap: 12px;
  margin: 14px 0 4px; flex-wrap: wrap;
}
.vrool-ai-tryon-btn {
  display: inline-flex; align-items: center; gap: 9px;
  padding: 13px 22px; border: 0; border-radius: 999px; cursor: pointer;
  background: linear-gradient(135deg, #9775AF, #7c5c96);
  color: #fff; font-weight: 800; font-size: 15px; letter-spacing: .2px;
  box-shadow: 0 8px 22px rgba(151,117,175,0.38);
  transition: transform .16s ease, box-shadow .16s ease;
}
.vrool-ai-tryon-btn:hover { transform: translateY(-1px); box-shadow: 0 12px 28px rgba(151,117,175,0.48); }
.vrool-ai-tryon-btn:active { transform: translateY(0); }
.vrool-ai-tryon-btn .vrool-ai-spark { font-size: 16px; }
.vrool-ai-tryon-sub { color: var(--vai-muted); font-size: 13px; font-weight: 600; }

/* ── Modal ── */
.vrool-ai-modal { position: fixed; inset: 0; z-index: 100050; display: none; isolation: isolate; }
.vrool-ai-modal.is-open { display: block; }
/* Solid overlay (no backdrop-filter): the GPU blur re-rasterizes whenever the
   page behind repaints (SPA prefetch, lazy images, polling), which causes a
   visible background flicker during the long generation wait. A solid, slightly
   darker overlay fully hides the page and never flashes. */
.vrool-ai-modal-backdrop {
  position: absolute; inset: 0; background: rgba(20,15,30,0.72);
}
.vrool-ai-modal-box {
  position: relative; z-index: 1; width: min(680px, calc(100% - 24px));
  max-height: calc(100vh - 40px); overflow: hidden auto;
  margin: 20px auto; background: #fff; border-radius: 26px;
  box-shadow: var(--vai-shadow); animation: vaiPop .22s cubic-bezier(.2,.8,.2,1);
  display: flex; flex-direction: column;
}
@keyframes vaiPop { from { opacity: 0; transform: translateY(14px) scale(.98); } to { opacity: 1; transform: none; } }

.vrool-ai-modal-head {
  display: flex; align-items: flex-start; justify-content: space-between; gap: 12px;
  padding: 20px 22px 12px;
}
.vrool-ai-modal-title { font-size: 19px; font-weight: 900; color: var(--vai-ink); display: flex; align-items: center; gap: 7px; }
.vrool-ai-modal-sub { margin-top: 3px; font-size: 13px; color: var(--vai-muted); font-weight: 600; }
.vrool-ai-modal-close {
  border: 0; background: #f3f1f6; width: 34px; height: 34px; border-radius: 999px;
  font-size: 22px; line-height: 1; color: #555; cursor: pointer; flex: 0 0 auto;
}
.vrool-ai-modal-close:hover { background: #e9e6ee; }
.vrool-ai-modal-body { padding: 8px 22px 24px; }

.vrool-ai-section-label { font-size: 13px; font-weight: 800; color: var(--vai-ink); margin: 12px 0 10px; }

/* "Already tried this on" banner */
/* The class selector's display:flex was overriding the [hidden] attribute's
   UA display:none, so the banner was ALWAYS visible (empty thumbnail) even when
   the user hadn't tried the item. Force [hidden] to win. */
.vrool-ai-tried[hidden] { display: none !important; }
.vrool-ai-tried { display: flex; align-items: center; gap: 12px; text-decoration: none; padding: 10px 12px; margin: 4px 0 14px; border: 1px solid var(--vai-line); border-radius: 14px; background: var(--vai-purple-soft); transition: box-shadow .15s ease, border-color .15s ease; }
.vrool-ai-tried:hover { border-color: var(--vai-purple); box-shadow: 0 6px 16px rgba(151,117,175,0.18); }
.vrool-ai-tried-thumb { width: 46px; height: 60px; border-radius: 10px; overflow: hidden; background: #fff; flex: 0 0 auto; }
.vrool-ai-tried-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.vrool-ai-tried-text { display: flex; flex-direction: column; line-height: 1.25; }
.vrool-ai-tried-text strong { font-size: 14px; font-weight: 800; color: var(--vai-ink); }
.vrool-ai-tried-text span { font-size: 12.5px; font-weight: 700; color: var(--vai-purple); }

/* Saved photos row */
.vrool-ai-models { display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: 12px; }
.vrool-ai-model {
  position: relative; width: 66px; height: 88px; border-radius: 14px; overflow: hidden;
  border: 2px solid transparent; cursor: pointer; background: #f3f1f6; flex: 0 0 auto;
}
.vrool-ai-model img { width: 100%; height: 100%; object-fit: cover; display: block; }
.vrool-ai-model.is-active { border-color: var(--vai-purple); box-shadow: 0 6px 16px rgba(151,117,175,0.35); }
.vrool-ai-model .vrool-ai-model-x {
  position: absolute; top: 3px; right: 3px; width: 20px; height: 20px; border-radius: 999px;
  border: 0; background: rgba(0,0,0,0.6); color: #fff; font-size: 13px; line-height: 20px; cursor: pointer;
}

/* Dropzone */
.vrool-ai-dropzone {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  text-align: center; gap: 3px; padding: 26px 18px; cursor: pointer;
  border: 2px dashed var(--vai-purple); border-radius: 18px; background: var(--vai-purple-soft);
  transition: background .16s ease, border-color .16s ease;
}
.vrool-ai-dropzone:hover, .vrool-ai-dropzone.is-drag { background: #ede2f7; }
.vrool-ai-dz-ico { font-size: 30px; margin-bottom: 4px; }
.vrool-ai-dz-title { font-weight: 800; font-size: 15px; color: var(--vai-ink); }
.vrool-ai-dz-sub { font-size: 12px; color: var(--vai-muted); font-weight: 600; }
.vrool-ai-hint { margin-top: 10px; font-size: 12px; color: var(--vai-muted); font-weight: 600; text-align: center; }

/* Ready step */
.vrool-ai-ready-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.vrool-ai-ready-col { text-align: center; }
.vrool-ai-thumb-lg { border-radius: 16px; overflow: hidden; background: #f3f1f6; aspect-ratio: 3/4; }
.vrool-ai-thumb-lg img { width: 100%; height: 100%; object-fit: cover; display: block; }
.vrool-ai-textbtn { margin-top: 8px; border: 0; background: none; color: var(--vai-purple); font-weight: 700; font-size: 13px; cursor: pointer; }
.vrool-ai-item-title { margin-top: 8px; font-size: 12px; color: var(--vai-muted); font-weight: 600; line-height: 1.3; }

.vrool-ai-generate-btn {
  width: 100%; margin-top: 18px; padding: 15px; border: 0; border-radius: 16px; cursor: pointer;
  background: linear-gradient(135deg, #9775AF, #7c5c96); color: #fff; font-weight: 900; font-size: 16px;
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  box-shadow: 0 10px 26px rgba(151,117,175,0.4); transition: transform .15s ease, box-shadow .15s ease;
}
.vrool-ai-generate-btn:hover { transform: translateY(-1px); }
.vrool-ai-generate-btn[disabled] { opacity: .55; cursor: default; transform: none; box-shadow: none; }
.vrool-ai-credit-note { margin-top: 10px; text-align: center; font-size: 12px; color: var(--vai-muted); font-weight: 600; }

/* Generating */
.vrool-ai-generating { text-align: center; padding: 30px 10px; }
.vrool-ai-spinner {
  width: 44px; height: 44px; border-radius: 999px; margin: 0 auto 16px;
  border: 4px solid rgba(151,117,175,0.2); border-top-color: var(--vai-purple);
  animation: vaiSpin .9s linear infinite;
}
@keyframes vaiSpin { to { transform: rotate(360deg); } }
.vrool-ai-gen-status { font-weight: 900; font-size: 17px; color: var(--vai-ink); }
.vrool-ai-gen-sub { margin-top: 5px; font-size: 13px; color: var(--vai-muted); font-weight: 600; }

/* Before/After slider */
.vrool-ai-compare {
  position: relative; width: 100%; aspect-ratio: 3/4; border-radius: 18px; overflow: hidden;
  background: #111; user-select: none; touch-action: none;
}
.vrool-ai-compare img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; display: block; }
.vrool-ai-compare-before-wrap { position: absolute; inset: 0; width: 50%; overflow: hidden; }
.vrool-ai-compare-before-wrap img { width: auto; }
.vrool-ai-compare-before { width: 100%; }
.vrool-ai-compare-handle {
  position: absolute; top: 0; bottom: 0; left: 50%; width: 3px; background: #fff;
  transform: translateX(-50%); box-shadow: 0 0 0 1px rgba(0,0,0,0.15); cursor: ew-resize;
}
.vrool-ai-compare-handle span {
  position: absolute; top: 50%; left: 50%; transform: translate(-50%,-50%);
  width: 38px; height: 38px; border-radius: 999px; background: #fff;
  box-shadow: 0 4px 12px rgba(0,0,0,0.3);
}
.vrool-ai-compare-handle span::before { content: "\2194"; position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; color: var(--vai-purple); font-weight: 900; }
.vrool-ai-compare-tag {
  position: absolute; bottom: 12px; padding: 4px 10px; border-radius: 999px;
  font-size: 11px; font-weight: 800; color: #fff; background: rgba(0,0,0,0.5); backdrop-filter: blur(4px);
}
.vrool-ai-tag-before { left: 12px; }
.vrool-ai-tag-after { right: 12px; }

.vrool-ai-result-actions { display: flex; gap: 8px; margin-top: 14px; flex-wrap: wrap; }
.vrool-ai-act {
  flex: 1 1 auto; min-width: 90px; display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  padding: 11px 12px; border-radius: 12px; border: 1px solid var(--vai-line); background: #fff;
  font-weight: 700; font-size: 13px; color: var(--vai-ink); cursor: pointer; text-decoration: none;
}
.vrool-ai-act:hover { background: #faf8fc; border-color: var(--vai-purple); }
.vrool-ai-act.is-done { color: #16a34a; border-color: #bbf7d0; background: #f0fdf4; }
.vrool-ai-buy-btn {
  display: block; text-align: center; margin-top: 12px; padding: 14px; border-radius: 14px;
  background: var(--vai-ink); color: #fff; font-weight: 800; font-size: 15px; text-decoration: none;
}

/* Paywall */
.vrool-ai-paywall-title { font-size: 18px; font-weight: 900; color: var(--vai-ink); text-align: center; margin-top: 6px; }
.vrool-ai-paywall-sub { text-align: center; color: var(--vai-muted); font-size: 13px; font-weight: 600; margin: 6px 0 16px; }
.vrool-ai-packs { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; }
.vrool-ai-pack {
  border: 1px solid var(--vai-line); border-radius: 16px; padding: 14px; text-align: center; cursor: pointer;
  transition: border-color .15s ease, box-shadow .15s ease; background: #fff;
}
.vrool-ai-pack:hover { border-color: var(--vai-purple); box-shadow: 0 8px 20px rgba(151,117,175,0.18); }
.vrool-ai-pack-credits { font-weight: 900; font-size: 17px; color: var(--vai-ink); }
.vrool-ai-pack-price { color: var(--vai-purple); font-weight: 800; font-size: 14px; margin-top: 3px; }
.vrool-ai-plus-card { margin-top: 16px; border: 2px solid var(--vai-purple); border-radius: 20px; padding: 18px; background: var(--vai-purple-soft); }
.vrool-ai-plus-name { font-weight: 900; font-size: 16px; color: var(--vai-purple-dark); }
.vrool-ai-plus-price { font-size: 26px; font-weight: 900; color: var(--vai-ink); margin: 2px 0 10px; }
.vrool-ai-plus-price span { font-size: 14px; color: var(--vai-muted); font-weight: 700; }
.vrool-ai-plus-list { list-style: none; padding: 0; margin: 0 0 14px; }
.vrool-ai-plus-list li { font-size: 13px; color: var(--vai-ink); font-weight: 600; padding: 4px 0 4px 22px; position: relative; }
.vrool-ai-plus-list li::before { content: "\2713"; position: absolute; left: 0; color: var(--vai-purple); font-weight: 900; }
.vrool-ai-plus-btn { width: 100%; padding: 13px; border: 0; border-radius: 14px; background: var(--vai-purple); color: #fff; font-weight: 800; font-size: 15px; cursor: pointer; }
.vrool-ai-plus-plans { display: flex; gap: 10px; flex-wrap: wrap; }
.vrool-ai-plan-btn { flex: 1 1 130px; min-width: 0; display: flex; flex-direction: column; align-items: flex-start; gap: 2px; padding: 12px 14px; border: 0; border-radius: 14px; background: var(--vai-purple); color: #fff; cursor: pointer; text-align: left; }
.vrool-ai-plan-btn:hover { background: var(--vai-purple-dark); }
.vrool-ai-plan-btn span { font-size: 12px; font-weight: 700; opacity: .9; }
.vrool-ai-plan-btn strong { font-size: 18px; font-weight: 900; }
.vrool-ai-plan-btn small { font-size: 11px; font-weight: 700; opacity: .85; margin-left: 2px; }

.vrool-ai-error { margin-top: 14px; padding: 12px 14px; border-radius: 12px; background: #fef2f2; border: 1px solid #fecaca; color: #b91c1c; font-size: 13px; font-weight: 700; }

@media (max-width: 560px) {
  .vrool-ai-modal-box { width: 100%; margin: 0; border-radius: 22px 22px 0 0; position: absolute; bottom: 0; max-height: 94vh; animation: vaiSheet .26s cubic-bezier(.2,.8,.2,1); }
  @keyframes vaiSheet { from { transform: translateY(100%); } to { transform: none; } }
  .vrool-ai-packs { grid-template-columns: 1fr 1fr; }
}
