/* Engine replay UG dùng chung (skill ug-replay của avada-brain). Pause/resume, tua bằng vạch đáy khung, outro logo Avada là yêu cầu PO đã chốt 2026-10-29: không đổi hành vi. */
@import url("replay-shell.css");  /* khung + thanh chú thích, dùng chung với poster trên docs */
:root { --ease: cubic-bezier(.45,0,.2,1); --pop: cubic-bezier(.34,1.3,.5,1); }
* { box-sizing: border-box; }
/* polaris-2.js đặt color-scheme: light inline trên <html>; phải !important để iframe khớp scheme với trang docs, nếu lệch trình duyệt vẽ nền đục */
html { color-scheme: light; } html.dark { color-scheme: dark !important; }
/* Điện thoại tự phóng chữ (text autosizing) trong khối rộng 1040px của app: chữ to hơn desktop, xuống dòng khác. Tắt để mobile vẽ y như desktop */
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
body { margin: 0; background: transparent; font: 14px/1.5 -apple-system, BlinkMacSystemFont, "Inter", "Segoe UI", sans-serif; color: #1f2124; }
.rp { margin: 0; }

/* ---------- Replay shell (generic) ---------- */
.rp { margin: 0; }
.rp-stage:not(.is-fit) .app { visibility: hidden; }
.rp-host { position: absolute; inset: 0; }
.rp-prog { position: absolute; left: 0; right: 0; bottom: 0; height: 3px; z-index: 10; background: rgba(0,0,0,.06); }
.rp-prog i { display: block; width: 0; height: 100%; background: linear-gradient(90deg, #2c6ecb, #8a3ffc); }
@keyframes rp-bar { to { width: 100%; } }
.rp-play { position: absolute; inset: 0; z-index: 11; display: grid; place-items: center; border: 0; background: rgba(0,0,0,.18); cursor: pointer; }
.rp-play[hidden] { display: none; }
.rp-play span { padding: 10px 18px; border-radius: 999px; background: #1a1a1a; color: #fff; font-weight: 600; }

/* ---------- Fake app, fixed 1040x650, scaled to fit ---------- */
.app { position: absolute; left: 0; top: 0; width: 1040px; height: 650px; overflow: hidden; transform-origin: 0 0; font-family: -apple-system, "system-ui", "San Francisco", "Segoe UI", "Helvetica Neue", sans-serif; color: #303030; /* app luôn sáng: không thừa hưởng màu chữ dark của docs */ }
.app.instant, .app.instant * { transition: none !important; }
.app.fade .world { opacity: 0; }
.world { position: absolute; inset: 0; background: rgb(244,246,248); transform-origin: 520px 325px; transition: transform .7s var(--ease), opacity .35s ease; }
.app.zoom .world { transform: scale(1.3); }
.page { position: absolute; left: 0; right: 0; top: 0; padding: 18px 32px 40px; transition: transform .9s var(--ease); }
.app.scrolled .page { transform: translateY(-420px); }



/* trạng thái giả lập trên host của web component (không chạm được shadow DOM) */
s-button { transition: filter .15s ease, transform .1s ease; display: inline-block; }
s-button.is-hover { filter: brightness(.82); }
s-button.is-press { transform: scale(.96); }
.newrow-flash { animation: rowin 1.4s ease; }
@keyframes rowin { from { background: #eaf4ff; } to { background: transparent; } }

/* khung modal: số đo từ shadow DOM của <s-modal size="base"> thật (polaris-2.js), nội dung bên trong là <s-*> thật */
.overlay { position: absolute; inset: 0; z-index: 20; display: flex; align-items: center; justify-content: center; background: rgba(0,0,0,.5); opacity: 0; pointer-events: none; transition: opacity .25s ease; }
.modal { width: 620px; background: #fff; border-radius: 24px; box-shadow: rgba(0,0,0,.06) 0 2px 3px -1px, rgba(0,0,0,.06) 0 4px 6px -2px, rgba(0,0,0,.06) 0 8px 12px -4px, rgba(0,0,0,.06) 0 16px 24px -6px, rgba(0,0,0,.06) 0 32px 48px -8px, rgba(0,0,0,.08) 0 0 0 1px; transform: translateY(14px) scale(.97); transition: transform .3s var(--pop); }
.app.m-open .overlay { opacity: 1; }
.app.m-open .modal { transform: none; }
.m-h { display: flex; justify-content: space-between; align-items: center; padding: 16px 16px 16px 20px; }
.m-h h2 { margin: 0; font-size: 15px; font-weight: 500; line-height: 22px; color: rgb(16,16,16); }
.m-x { width: 28px; height: 28px; border-radius: 50%; display: grid; place-items: center; background: #fff; box-shadow: 0 0 0 1px rgba(0,0,0,.12), 0 1px 0 rgba(0,0,0,.08); }
.m-x svg { width: 12px; height: 12px; stroke: rgb(48,48,48); stroke-width: 1.8; fill: none; }
.m-b { padding: 4px 20px; display: flex; flex-direction: column; gap: 16px; }
.fld { position: relative; }
s-clickable.is-hover { background: rgb(241,241,241); border-radius: 8px; }
.m-f { display: flex; justify-content: flex-end; align-items: center; gap: 8px; padding: 12px 16px 16px; }
/* nút secondary trong footer s-modal: s-modal tự vẽ (nền trắng + shadow), đo từ shadow DOM */
.m-cancel { display: inline-flex; align-items: center; height: 28px; padding: 0 12px; border-radius: 9999px; background: #fff; font: 500 12px/16px -apple-system, "system-ui", sans-serif; color: rgb(48,48,48);
  box-shadow: rgba(0,0,0,.07) 0 0 0 1px, rgba(0,0,0,.03) 0 2px 20px 0, rgba(0,0,0,.03) 0 5px 20px 0, rgba(0,0,0,.03) 0 8px 60px 0; }
/* menu thả xuống của select: native trên app thật, ở đây vẽ tay kiểu menu hệ điều hành */
.opts { position: absolute; left: 0; right: 0; top: 58px; z-index: 5; background: #fff; border-radius: 10px; padding: 4px; font-size: 13px; box-shadow: 0 8px 24px rgba(0,0,0,.2), 0 0 0 1px rgba(0,0,0,.06); opacity: 0; transform: translateY(-4px); transition: opacity .15s ease, transform .2s var(--ease); pointer-events: none; }
.opts.is-open { opacity: 1; transform: none; }
.opt { padding: 5px 10px 5px 26px; border-radius: 6px; position: relative; }
.opt.is-on:before { content: "✓"; position: absolute; left: 9px; }
.opt.is-hover { background: #005bd3; color: #fff; }

/* polaris2/Toast.jsx (fallback ngoài admin): top-center 12px, viên thuốc, 500 13px/20px */
.toast { position: absolute; left: 50%; top: 12px; z-index: 30; transform: translate(-50%, -8px); opacity: 0; background: #1a1a1a; color: #fff; padding: 6px 14px; border-radius: 999px; font: 500 13px/20px system-ui, sans-serif; transition: opacity .2s ease, transform .3s var(--pop); }
.app.toasted .toast { opacity: 1; transform: translate(-50%, 0); }

/* pointer */
.ptr { position: absolute; z-index: 50; left: 700px; top: 420px; width: 24px; height: 24px; margin: -3px 0 0 -5px; pointer-events: none; transition-property: left, top; transition-timing-function: var(--ease); }
.ptr svg { width: 100%; height: 100%; fill: #111; stroke: #fff; stroke-width: 1.6; filter: drop-shadow(0 2px 3px rgba(0,0,0,.45)); transition: transform .15s ease; }
.ptr:after { content: ""; position: absolute; left: 5px; top: 3px; width: 34px; height: 34px; margin: -17px 0 0 -17px; border: 2px solid rgba(0,91,211,.8); border-radius: 50%; opacity: 0; }
.ptr.is-click:after { animation: ring .45s ease-out; }
.ptr.is-click svg { animation: press .25s ease; }
@keyframes ring { 0% { opacity: .95; transform: scale(.3); } to { opacity: 0; transform: scale(1.2); } }
@keyframes press { 50% { transform: scale(.85); } }
/* ---------- Outro: logo Avada, concept 01 · Spotlight ignite (keyframes chép nguyên từ mẫu) ---------- */
.rp-outro { position: absolute; inset: 0; z-index: 60; display: grid; place-items: center; background: #F4F6FC; opacity: 0; pointer-events: none; transition: opacity .65s ease; }
.app.outro .rp-outro { opacity: 1; }
.app.outro .ptr { opacity: 0; transition: opacity .3s ease; }
.rp-outro .logo { width: 460px; height: auto; display: block; }
.rp-outro .logo .shard-a, .rp-outro .logo .shard-b, .rp-outro .logo .shard-c, .rp-outro .logo .letter, .rp-outro .logo .sweep { transform-box: fill-box; transform-origin: center; }
.rp-outro .logo .shard-a, .rp-outro .logo .shard-b, .rp-outro .logo .shard-c, .rp-outro .logo .letter { opacity: 0; }
.rp-outro .logo .sweep { opacity: 0; transform: translateX(-120%); }
.rp-outro .logo .trail { opacity: 0; }
/* --ot = thời gian đã trôi trong outro (đặt khi tua vào giữa), để logo hiện đúng khung tại mốc đó */
.app.outro-play .rp-outro .shard-a { animation: c1a .80s calc(0s - var(--ot, 0s)) cubic-bezier(.34,1.56,.64,1) both; }
.app.outro-play .rp-outro .shard-b { animation: c1b .80s calc(.05s - var(--ot, 0s)) cubic-bezier(.34,1.56,.64,1) both; }
.app.outro-play .rp-outro .shard-c { animation: c1c .80s calc(.10s - var(--ot, 0s)) cubic-bezier(.34,1.56,.64,1) both; }
.app.outro-play .rp-outro .sweep { animation: sweep .30s calc(.80s - var(--ot, 0s)) ease-out both; }
.app.outro-play .rp-outro .letter { animation: c1letter .60s cubic-bezier(.22,.8,.3,1) both; }
.app.outro-play .rp-outro .l-a1 { animation-delay: calc(1s - var(--ot, 0s)); }
.app.outro-play .rp-outro .l-v { animation-delay: calc(1.06s - var(--ot, 0s)); }
.app.outro-play .rp-outro .l-a2 { animation-delay: calc(1.12s - var(--ot, 0s)); }
.app.outro-play .rp-outro .l-d { animation-delay: calc(1.18s - var(--ot, 0s)); }
.app.outro-play .rp-outro .l-a3 { animation-delay: calc(1.24s - var(--ot, 0s)); }
@keyframes c1a { 0%{opacity:0;transform:translate(-70px,50px) rotate(-10deg)} 74%{opacity:1;transform:translate(5px,-3px) rotate(1deg)} 100%{opacity:1;transform:none} }
@keyframes c1b { 0%{opacity:0;transform:translate(55px,56px) rotate(12deg)} 74%{opacity:1;transform:translate(-5px,3px) rotate(-1deg)} 100%{opacity:1;transform:none} }
@keyframes c1c { 0%{opacity:0;transform:translate(35px,-52px) rotate(9deg)} 74%{opacity:1;transform:translate(-3px,4px) rotate(-1deg)} 100%{opacity:1;transform:none} }
@keyframes sweep { 0%{opacity:0;transform:translateX(-100%)} 15%{opacity:1} 100%{opacity:0;transform:translateX(100%)} }
@keyframes c1letter { 0%{opacity:0;transform:translateX(-32px);clip-path:inset(0 100% 0 0)} 100%{opacity:1;transform:none;clip-path:inset(0)} }


/* ---------- Thanh tua = vạch tiến trình ở đáy khung ---------- */
.rp-prog { height: 14px; background: transparent; cursor: pointer; touch-action: none; outline: none; }
.rp-prog::before { content: ""; position: absolute; left: 0; right: 0; bottom: 0; height: 3px; background: rgba(0,0,0,.08); transition: height .12s ease; }
.rp-prog i { position: absolute; left: 0; bottom: 0; height: 3px; transition: height .12s ease; }
.rp-prog:hover::before, .rp-prog:hover i, .rp-prog:focus-visible::before, .rp-prog:focus-visible i { height: 6px; }
.rp-knob { position: absolute; bottom: -3px; left: 0; width: 12px; height: 12px; margin-left: -6px; border-radius: 50%; background: #fff; box-shadow: 0 0 0 1px rgba(0,0,0,.2), 0 1px 3px rgba(0,0,0,.3); opacity: 0; transition: opacity .12s ease; }
.rp-prog:hover .rp-knob, .rp-prog:focus-visible .rp-knob { opacity: 1; }

/* ---------- Pause ---------- */
.rp-stage { cursor: pointer; }
.app.paused, .app.paused * { animation-play-state: paused !important; }
.rp-paused { position: absolute; inset: 0; z-index: 12; display: grid; place-items: center; background: rgba(0,0,0,.12); pointer-events: none; }
.rp-paused[hidden] { display: none; }
@media (prefers-reduced-motion: reduce) { .rp-outro .logo * { animation: none !important; opacity: 1 !important; transform: none !important; clip-path: none !important; } .rp-outro .logo .sweep { display: none; } .newrow-flash { animation: none; } }
.rp-paused span { padding: 10px 18px; border-radius: 999px; background: rgba(26,26,26,.88); color: #fff; font: 600 14px/1 -apple-system, "Inter", sans-serif; }

/* ---------- Bản nhúng iframe: chú thích (nhãn STEP, nút bước có số, Pause/Replay), màu theo theme docs ----------
   Nút bước được xuống dòng; iframe tự chỉnh chiều cao theo nội dung (fitFrame trong replay.js). */
.app { color-scheme: light; }   /* khung app luôn sáng như admin thật */
body { color: var(--rp-fg); }
/* iframe đã tự cao theo nội dung (fitFrame) nên không bao giờ cần cuộn. Để thanh cuộn kiểu cũ (15px, macOS "luôn hiện") xuất hiện thì bề ngang hụt → khung thấp đi → kẹt thanh cuộn. */
html, body { overflow: hidden; }
