/* QR Studio hosted-page builder (assets/vv-member-qr-pages.js). Every class
   is vvpb-. Same wireframe rules as vv-member-qr.css: hairlines, two radii,
   colour through portal tokens, shadows only on floating overlays (the
   sticky bar and the preview sheet). */

/* Stepper */
.vvpb-stepper { margin: 0 0 1rem; }
.vvpb-steps { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: .4rem; counter-reset: none; }
.vvpb-st button {
    appearance: none; width: 100%; display: flex; align-items: center; gap: .5rem; padding: .55rem .65rem; background: var(--surface);
    border: 1px solid var(--border); border-radius: var(--radius-sm); font: 600 .78rem/1.25 var(--font-sans); color: var(--muted); cursor: pointer; text-align: left;
    transition: border-color .2s ease-out, color .2s ease-out;
}
.vvpb-st button:disabled { cursor: default; opacity: .7; }
.vvpb-st button:not(:disabled):hover { border-color: var(--accent-line); color: var(--heading); }
.vvpb-st-n { flex: 0 0 auto; width: 1.5rem; height: 1.5rem; border-radius: 50%; border: 1px solid var(--border); display: inline-grid; place-items: center; font-size: .72rem; }
.vvpb-st-n .vv-mono-ic { width: 13px; height: 13px; }
.vvpb-st.is-current button { border-color: var(--vv-blue); color: var(--heading); }
.vvpb-st.is-current .vvpb-st-n { border-color: var(--vv-blue); background: var(--vv-blue); color: #fff; }
.vvpb-st.is-done .vvpb-st-n { border-color: var(--vv-blue); color: var(--accent-text); }
@media (max-width: 640px) { .vvpb-st-l { display: none; } .vvpb-st.is-current .vvpb-st-l { display: inline; } .vvpb-steps { grid-template-columns: auto auto auto auto; } .vvpb-st.is-current { grid-column: span 1; } }

/* Layout: sections left, phone right */
.vvpb-grid { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 1.25rem; align-items: start; }
.vvpb-side { position: sticky; top: 5rem; }
.vvpb-side-head { display: flex; align-items: center; justify-content: center; gap: .5rem; margin: 0 0 .7rem; }
.vvpb-side-close { display: none; }
.vvpb-side-note { text-align: center; }
.vvpb-seg { display: inline-grid; grid-template-columns: 1fr 1fr; border: 1px solid var(--border); border-radius: var(--radius-sm); overflow: hidden; }
.vvpb-seg button { appearance: none; border: 0; background: var(--surface); color: var(--muted); font: 600 .78rem/1 var(--font-sans); padding: .5rem .9rem; cursor: pointer; transition: background-color .2s ease-out, color .2s ease-out; }
.vvpb-seg button + button { border-left: 1px solid var(--border); }
.vvpb-seg button[aria-pressed="true"] { background: var(--accent-tint-strong); color: var(--heading); }
.vvpb-qrview { min-height: 100%; display: grid; align-content: center; justify-items: center; gap: .7rem; padding: 1.5rem; background: #fff; text-align: center; }
.vvpb-qrview svg { width: 100%; max-width: 230px; height: auto; display: block; }
.vvpb-qrview p { font-size: .72rem; color: var(--vv-muted); margin: 0; overflow-wrap: anywhere; }
.vvpb-qrview--empty .vv-mono-ic { width: 40px; height: 40px; stroke: #c9d1da; }

/* Section cards */
.vvpb-sec { border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); margin: 0 0 .75rem; min-width: 0; }
.vvpb-sec.is-open { border-color: var(--accent-line); }
.vvpb-sec-h { margin: 0; font: inherit; }
.vvpb-sec-head { appearance: none; width: 100%; display: flex; align-items: center; gap: .8rem; padding: .85rem 1rem; background: none; border: 0; cursor: pointer; text-align: left; color: var(--text); border-radius: var(--radius); }
.vvpb-sec-ic { flex: 0 0 auto; width: 2.4rem; height: 2.4rem; border: 1px solid var(--border); border-radius: var(--radius-sm); display: grid; place-items: center; background: var(--bg); }
.vvpb-sec-ic .vv-mono-ic { width: 19px; height: 19px; stroke: var(--vv-blue); }
.vvpb-sec-txt { flex: 1 1 auto; min-width: 0; }
.vvpb-sec-txt b { display: block; font-size: .9rem; color: var(--heading); }
.vvpb-sec-txt small { display: block; font-size: .76rem; color: var(--muted); margin-top: .1rem; }
.vvpb-chev { width: 18px; height: 18px; stroke: var(--muted); transition: transform .2s ease-out; }
.vvpb-sec.is-open .vvpb-chev { transform: rotate(180deg); }
.vvpb-sec-body { padding: 0 1rem 1rem; border-top: 1px solid var(--border); padding-top: .9rem; }
.vvpb-grid2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .7rem .9rem; }
.vvpb-field { min-width: 0; }
.vvpb-field--wide { grid-column: 1 / -1; }
.vvpb-field--grow { flex: 1 1 auto; }
@media (max-width: 560px) { .vvpb-grid2 { grid-template-columns: minmax(0, 1fr); } }
.vvpb-counter { text-align: right; }
.vvpb-check { padding-top: 0; margin-bottom: .4rem; }

/* Palettes + colours */
.vvpb-pals { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: .45rem; margin: 0 0 .9rem; }
@media (max-width: 480px) { .vvpb-pals { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
.vvpb-pal { appearance: none; display: flex; height: 2.4rem; padding: 3px; border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--surface); cursor: pointer; gap: 3px; transition: border-color .2s ease-out; }
.vvpb-pal span { flex: 1 1 50%; border-radius: 4px; }
.vvpb-pal[aria-pressed="true"] { border: 2px solid var(--heading); padding: 2px; }
.vvpb-colors { display: grid; grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr); gap: .7rem; align-items: end; }
.vvpb-swap { margin-bottom: .15rem; }
@media (max-width: 480px) { .vvpb-colors { grid-template-columns: minmax(0, 1fr); } .vvpb-swap { justify-self: start; } }

/* Image dropzone */
.vvpb-drop { display: flex; align-items: center; gap: .9rem; border: 1px dashed var(--border); border-radius: var(--radius); padding: .8rem; margin: 0 0 .9rem; background: var(--bg); transition: border-color .2s ease-out, background-color .2s ease-out; }
.vvpb-drop.is-over { border-color: var(--vv-blue); background: var(--accent-tint); }
.vvpb-drop img, .vvpb-drop-ic { flex: 0 0 auto; width: 4.5rem; height: 4.5rem; border-radius: var(--radius-sm); object-fit: cover; border: 1px solid var(--border); background: var(--surface); }
.vvpb-drop-ic { padding: 1.1rem; stroke: var(--muted); }
.vvpb-drop-txt { min-width: 0; display: grid; gap: .2rem; }
.vvpb-drop-txt b { font-size: .84rem; color: var(--heading); }
.vvpb-drop-txt small { font-size: .74rem; color: var(--muted); }
.vvpb-drop-acts { display: flex; flex-wrap: wrap; gap: .4rem; margin-top: .3rem; }

/* Repeatable rows */
.vvpb-rows { display: grid; gap: .55rem; margin: 0 0 .55rem; }
.vvpb-rowline { display: grid; grid-template-columns: minmax(0, 9rem) minmax(0, 1fr) auto; gap: .5rem; align-items: start; }
.vvpb-rowline .vvpb-icon-btn { margin-top: 1.45rem; }
@media (max-width: 560px) { .vvpb-rowline { grid-template-columns: minmax(0, 1fr) auto; } .vvpb-rowline > .vvpb-field:first-child { grid-column: 1 / -1; } }
.vvpb-icon-btn { padding: .5rem; }
.vvpb-icon-btn .vv-mono-ic { margin: 0; }

/* Social networks */
.vvpb-nets { display: grid; grid-template-columns: repeat(auto-fill, minmax(7.2rem, 1fr)); gap: .4rem; margin: 0 0 .9rem; }
.vvpb-net { appearance: none; display: flex; align-items: center; gap: .45rem; padding: .45rem .55rem; border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--surface); color: var(--text); font: 600 .74rem/1.2 var(--font-sans); cursor: pointer; text-align: left; min-width: 0; transition: border-color .2s ease-out; }
.vvpb-net:hover:not(:disabled) { border-color: var(--accent-line); }
.vvpb-net:disabled { opacity: .5; cursor: not-allowed; }
.vvpb-net span { min-width: 0; overflow-wrap: anywhere; }
.vvpb-brand { width: 18px; height: 18px; flex: 0 0 auto; color: var(--heading); }
.vvpb-socials { display: grid; gap: .6rem; }
.vvpb-social { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: .7rem; align-items: start; border: 1px solid var(--border); border-radius: var(--radius-sm); padding: .7rem; }
.vvpb-social-ic { width: 2.2rem; height: 2.2rem; border: 1px solid var(--border); border-radius: var(--radius-sm); display: grid; place-items: center; }
.vvpb-social-fields { display: grid; gap: .45rem; min-width: 0; }
.vvpb-social-fields > b { font-size: .84rem; color: var(--heading); }
.vvpb-social-acts { display: flex; flex-direction: column; gap: .3rem; }
@media (max-width: 480px) { .vvpb-social { grid-template-columns: auto minmax(0, 1fr); } .vvpb-social-acts { grid-column: 1 / -1; flex-direction: row; } }

/* Fonts */
.vvpb-fonts { display: grid; grid-template-columns: repeat(auto-fill, minmax(9rem, 1fr)); gap: .5rem; }
.vvpb-font { position: relative; display: grid; gap: .15rem; padding: .7rem .75rem; border: 1px solid var(--border); border-radius: var(--radius-sm); cursor: pointer; transition: border-color .2s ease-out, background-color .2s ease-out; }
.vvpb-font input { position: absolute; opacity: 0; width: 1px; height: 1px; margin: 0; }
.vvpb-font span { font-size: .95rem; color: var(--heading); }
.vvpb-font small { font-size: .78rem; color: var(--muted); }
.vvpb-font.is-on { border-color: var(--vv-blue); background: var(--accent-tint); }
.vvpb-font:has(input:focus-visible) { outline: 2px solid var(--vv-blue); outline-offset: 2px; }

/* Password */
.vvpb-pwrow { display: flex; gap: .5rem; align-items: start; }
.vvpb-pwrow > .vvqr-btn { margin-top: 1.45rem; }
.vvpb-pw-on { display: flex; align-items: center; gap: .45rem; font-size: .84rem; color: var(--vvqr-ok); font-weight: 600; margin: 0 0 .6rem; }
.vvpb-pw-on .vv-mono-ic { width: 16px; height: 16px; }

/* Step 4 */
.vvpb-status { display: flex; flex-wrap: wrap; gap: .4rem; margin: 0 0 .8rem; }
.vvpb-badge { display: inline-flex; align-items: center; gap: .25rem; font-size: .66rem; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; border: 1px solid var(--border); border-radius: 999px; padding: .12rem .5rem; color: var(--muted); vertical-align: middle; }
.vvpb-badge .vv-mono-ic { width: 11px; height: 11px; }
.vvpb-badge--published { color: var(--vvqr-ok); border-color: currentColor; }
.vvpb-badge--disabled { color: var(--vvqr-err); border-color: currentColor; }
.vvpb-pub { display: flex; flex-wrap: wrap; gap: .5rem; margin: 0 0 1rem; }
.vvpb-pub .vvqr-note { margin: 0; }
.vvpb-linkrow { display: flex; gap: .5rem; }
.vvpb-linkrow .vvqr-input { flex: 1 1 auto; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: .8rem; }
@media (max-width: 480px) { .vvpb-linkrow { flex-direction: column; } }
.vvpb-saved { margin: 0 0 1.4rem; }

/* Sticky bottom bar (a floating overlay, so it keeps a shadow) */
/* bottom offset keeps it clear of the fixed "Cookie Settings" link */
.vvpb-bar { position: sticky; bottom: 2.25rem; z-index: 30; margin: 1rem 0 0; }
.vvpb-bar-in { display: flex; align-items: center; gap: .5rem; padding: .65rem .8rem; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: 0 -6px 18px rgba(10, 37, 64, .08); }
.vvpb-bar-status { flex: 1 1 auto; min-width: 0; margin: 0; font-size: .78rem; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.vvpb-prevbtn { display: none; }

/* ≤ 900px: the phone preview becomes a bottom sheet */
@media (max-width: 900px) {
    .vvpb-grid { grid-template-columns: minmax(0, 1fr); }
    .vvpb-side { display: none; }
    .vvpb-side.is-sheet {
        display: block; position: fixed; left: 0; right: 0; bottom: 0; top: auto; z-index: 95; max-height: 92vh; overflow-y: auto;
        background: var(--surface); border-top: 1px solid var(--border); border-radius: var(--radius) var(--radius) 0 0;
        padding: .8rem 1rem 1rem; box-shadow: 0 -12px 32px rgba(0, 0, 0, .2);
    }
    .vvpb-side.is-sheet .vvpb-side-close { display: inline-flex; margin-left: auto; }
    .vvpb-side.is-sheet .vvpg-phone-screen { height: min(560px, 62vh); }
    .vvpb-prevbtn { display: inline-flex; }
    .vvpb-bar-status { display: none; }
    .vvpb-bar-in { flex-wrap: wrap; justify-content: space-between; }
}
@media (max-width: 480px) {
    .vvpb-bar-in { flex-wrap: nowrap; gap: .35rem; padding: .5rem; }
    .vvpb-bar-in .vvqr-btn { padding: .5rem .65rem; font-size: .78rem; }
    .vvpb-lbl { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
    .vvpb-bar-in [data-act="next"] { margin-left: auto; }
}
@media (prefers-reduced-motion: reduce) {
    .vvpb *, .vvpb-stepper * { transition: none !important; animation: none !important; }
}
/* Keep toasts above the sticky step bar while the builder is open. */
.vvpb-on .vvqr-toast { bottom: 6.75rem; }
.vvpb-lock-note { border-left-color: var(--vvqr-err); }
.vvpb-lock-note .vvqr-btn { margin-top: .5rem; }
