/* =============================================================================
 * NIZU Onboarding — public wizard UI  ·  Framework7 styling layer
 * -----------------------------------------------------------------------------
 * The look comes from Framework7 8 (iOS theme), vendored at
 *   assets/vendor/framework7/framework7.min.css
 * and activated by onboarding-theme.js adding `.ios` (+ `.dark` for dark mode)
 * on <html>, which switches Framework7's --f7-* design tokens. This file maps
 * the wizard's own .ob-* hooks (kept stable for wizard.js) onto that F7 look,
 * sets the accent, and handles layout glue + microanimations. Tailwind (loaded
 * in wizard.php) still provides layout utilities; a few !important rules below
 * win over its colour utilities so Framework7 owns the component surfaces.
 * ========================================================================== */

:root {
    /* Accent — onboarding-theme.js sets --f7-theme-color(+ -rgb) and --ob-primary
       from the flow's colour; these fall back to the iOS system blue. */
    --ob-primary: var(--f7-theme-color, #007aff);
    --ob-primary-soft: rgba(var(--f7-theme-color-rgb, 0, 122, 255), .14);
    --ob-ease: cubic-bezier(.32, .72, 0, 1);
    --ob-dur: .5s;
}

/* Framework7's Material (MD) theme normally receives its colours from F7's JS
   (Material dynamic colour engine). We run Framework7 CSS-only, so Android —
   which uses the .md theme — would render colourless. Define a neutral Material
   palette here (primary follows the flow accent) so .md works without that JS. */
.md {
    --f7-md-primary: var(--f7-theme-color, #007aff);
    --f7-md-on-primary: #ffffff;
    --f7-md-surface: #f6f7f9;
    --f7-md-surface-1: #ffffff;
    --f7-md-surface-2: #eef1f4;
    --f7-md-surface-2-rgb: 238, 241, 244;
    --f7-md-surface-variant: #e5e7eb;
    --f7-md-on-surface: #1b1c1e;
    --f7-md-on-surface-variant: #6b7280;
    --f7-md-outline: #c4c7cc;
    --f7-md-secondary-container: #e6e9ef;
    --f7-md-on-secondary-container: #1b1c1e;
}
.md.dark {
    --f7-md-surface: #121316;
    --f7-md-surface-1: #1e1f24;
    --f7-md-surface-2: #26272d;
    --f7-md-surface-2-rgb: 38, 39, 45;
    --f7-md-surface-variant: #44464f;
    --f7-md-on-surface: #e6e1e5;
    --f7-md-on-surface-variant: #c4c7cc;
    --f7-md-outline: #8b8e96;
    --f7-md-secondary-container: #3a3b41;
    --f7-md-on-secondary-container: #e6e1e5;
}

/* Material cards are a touch less rounded than iOS. */
.md .ob-glass {
    border-radius: 16px;
}

* {
    -webkit-tap-highlight-color: transparent;
}

body {
    font-family: var(--f7-font-family);
    color: var(--f7-text-color);
    background: var(--f7-page-bg-color);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    transition: background-color .3s ease, color .3s ease;
}

/* Framework7's reset forces EVERY <button> to width:100%. Undo that globally so
   inline buttons (coupon apply, VAT lookup) and the theme toggle size to their
   content; the full-width CTA/subscribe buttons keep it via .ob-btn / w-full. */
button {
    width: auto;
}

/* ---- card (an F7 "strong block" surface) --------------------------------- */
/* iOS 26 "Liquid Glass" card: translucent + backdrop blur so the ambient
   background shows through, with a luminous edge and a lit top highlight. */
.ob-glass {
    background: rgba(255, 255, 255, .6);
    color: var(--f7-text-color);
    border: 1px solid rgba(255, 255, 255, .55);
    border-radius: 22px;
    box-shadow:
        0 1px 2px rgba(0, 0, 0, .04),
        0 18px 44px -16px rgba(0, 0, 0, .28),
        inset 0 1px 1px rgba(255, 255, 255, .65);
    -webkit-backdrop-filter: blur(30px) saturate(1.9);
    backdrop-filter: blur(30px) saturate(1.9);
    transition: background .3s ease, box-shadow .3s ease;
}
html.dark .ob-glass {
    background: rgba(30, 32, 40, .5);
    border-color: rgba(255, 255, 255, .12);
    box-shadow:
        0 1px 2px rgba(0, 0, 0, .5),
        0 18px 44px -16px rgba(0, 0, 0, .7),
        inset 0 1px 0 rgba(255, 255, 255, .12);
}

/* ---- primary button (F7 large fill, round) ------------------------------- */
.ob-btn {
    width: 100%;
    background: var(--f7-theme-color, #007aff) !important;
    color: var(--f7-button-fill-text-color, #fff) !important;
    border: none;
    border-radius: 9999px;
    font-weight: 600;
    min-height: 50px;
    box-shadow: none;
    transition: transform .15s var(--ob-ease), filter .2s ease, opacity .15s;
}
.ob-btn:hover {
    filter: brightness(1.05);
}
.ob-btn:active {
    transform: scale(.97);
    opacity: .85;
}
.ob-btn.is-busy {
    opacity: .7;
    cursor: progress;
}
.ob-btn.is-busy:hover {
    filter: none;
}
.ob-btn[disabled] {
    cursor: not-allowed;
}

/* In-button spinner. */
.ob-spin {
    display: inline-block;
    width: 1.05em;
    height: 1.05em;
    border: 2px solid currentColor;
    border-right-color: transparent;
    border-radius: 50%;
    vertical-align: -.15em;
    animation: obSpin .6s linear infinite;
}
@keyframes obSpin {
    to { transform: rotate(360deg); }
}
/* Larger spinner for the auto-running REST block loader. */
.ob-spin-lg {
    width: 2.2em;
    height: 2.2em;
    border-width: 3px;
}
/* Message block: the FontAwesome icon, tinted with the flow's primary colour
   and dropped in with a gentle pop so it draws the eye. */
.ob-msg-icon i {
    font-size: 3rem;
    line-height: 1;
    color: var(--ob-primary);
    animation: obMsgPop .4s cubic-bezier(.34, 1.56, .64, 1) both;
}
@keyframes obMsgPop {
    from { transform: scale(.6); opacity: 0; }
    to   { transform: scale(1); opacity: 1; }
}

/* ---- inputs (iOS filled field) ------------------------------------------- */
/* !important beats the wizard markup's Tailwind bg/border colour utilities
   (incl. their dark: variants) so Framework7's field look wins in both modes. */
.ob-input {
    background: rgba(118, 118, 128, .12) !important;
    color: var(--f7-text-color) !important;
    border: 1px solid transparent !important;
    border-radius: 12px;
    box-shadow: none;
    transition: background .2s, border-color .15s, box-shadow .2s;
}
html.dark .ob-input {
    background: rgba(118, 118, 128, .24) !important;
}
.ob-input:focus {
    outline: none;
    border-color: var(--f7-theme-color) !important;
    box-shadow: 0 0 0 3px var(--ob-primary-soft);
}
.ob-input::placeholder {
    color: var(--f7-input-placeholder-color, #a1a1a6);
    opacity: 1;
}

/* ---- password reveal (show/hide) toggle ---------------------------------- */
.ob-pw-wrap {
    position: relative;
}
/* leave room for the eye button so the dots never sit under it */
.ob-pw-input {
    padding-right: 44px !important;
}
.ob-pw-toggle {
    position: absolute;
    top: 50%;
    right: 8px;
    transform: translateY(-50%);
    width: 32px;
    height: 32px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    border: 0;
    background: transparent;
    color: var(--f7-input-placeholder-color, #8a8a8e);
    cursor: pointer;
    border-radius: 8px;
    transition: color .15s ease, background .15s ease;
}
.ob-pw-toggle:hover {
    color: var(--f7-text-color);
    background: rgba(120, 120, 120, .14);
}
.ob-pw-toggle.is-on {
    color: var(--ob-primary);
}
.ob-pw-toggle svg {
    width: 18px;
    height: 18px;
    display: block;
}

/* ---- password strength meter --------------------------------------------- */
.ob-pw-meter {
    margin: -8px 0 14px;
}
.ob-pw-bars {
    display: flex;
    gap: 5px;
}
.ob-pw-bars span {
    flex: 1;
    height: 4px;
    border-radius: 2px;
    background: rgba(120, 120, 120, .22);
    transition: background .25s ease;
}
.ob-pw-meter.lvl-weak   .ob-pw-bars span.is-on { background: #ff3b30; }
.ob-pw-meter.lvl-fair   .ob-pw-bars span.is-on { background: #ff9500; }
.ob-pw-meter.lvl-good   .ob-pw-bars span.is-on { background: #ffcc00; }
.ob-pw-meter.lvl-strong .ob-pw-bars span.is-on { background: #34c759; }
.ob-pw-meter-label {
    font-size: 12px;
    margin-top: 5px;
    color: var(--f7-input-placeholder-color, #8a8a8e);
}
.ob-pw-meter.lvl-weak   .ob-pw-meter-label { color: #ff3b30; }
.ob-pw-meter.lvl-fair   .ob-pw-meter-label { color: #ff9500; }
.ob-pw-meter.lvl-good   .ob-pw-meter-label { color: #c79200; }
.ob-pw-meter.lvl-strong .ob-pw-meter-label { color: #34c759; }

/* ---- international phone input (intl-tel-input) --------------------------- */
/* The library wraps the tel input in .iti; make it fill the field like every
   other input, and theme its country dropdown to the glass surface + dark mode
   (loaded AFTER intlTelInput.min.css, so these single-class rules win). */
.iti {
    width: 100%;
    display: block;
}
.iti__selected-dial-code {
    color: var(--f7-text-color);
}
.iti__dropdown-content {
    z-index: 70;
    background: var(--f7-block-strong-bg-color, #fff);
    color: var(--f7-text-color);
    border: 1px solid var(--f7-list-item-border-color, rgba(0, 0, 0, .12));
    border-radius: 12px;
    box-shadow: 0 1px 2px rgba(0, 0, 0, .06), 0 18px 40px -14px rgba(0, 0, 0, .32);
}
.iti__search-input {
    background: transparent;
    color: var(--f7-text-color);
    border: 0;
    border-bottom: 1px solid var(--f7-list-item-border-color, rgba(0, 0, 0, .1));
}
.iti__country {
    color: var(--f7-text-color);
}
.iti__country:hover,
.iti__country.iti__highlight {
    background: var(--ob-primary-soft);
}
.iti__dial-code {
    color: var(--f7-input-placeholder-color, #8a8a8e);
}

/* ---- country select ------------------------------------------------------ */
/* Native <select> styled to match .ob-input, with a custom chevron (the native
   arrow is hidden via appearance:none). The open option list stays OS-rendered
   — good, it's native + accessible on mobile. */
.ob-select-wrap {
    position: relative;
}
.ob-select {
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
    padding-right: 40px !important;
    cursor: pointer;
}
.ob-select-wrap::after {
    content: "";
    position: absolute;
    top: 50%;
    right: 16px;
    width: 9px;
    height: 9px;
    transform: translateY(-65%) rotate(45deg);
    border-right: 2px solid var(--f7-input-placeholder-color, #8a8a8e);
    border-bottom: 2px solid var(--f7-input-placeholder-color, #8a8a8e);
    pointer-events: none;
}

/* =============================================================================
 * WorkSpace-setup block — subdomain chooser + graphic option toggle cards.
 * ========================================================================== */
.ob-subdomain {
    display: flex;
    align-items: center;
    background: rgba(118, 118, 128, .12);
    border: 1px solid transparent;
    border-radius: 12px;
    padding: 0 12px;
    transition: border-color .15s, box-shadow .2s;
}
html.dark .ob-subdomain {
    background: rgba(118, 118, 128, .24);
}
.ob-subdomain:focus-within {
    border-color: var(--f7-theme-color);
    box-shadow: 0 0 0 3px var(--ob-primary-soft);
}
.ob-subdomain-icon {
    flex: none;
    display: inline-flex;
    width: 18px;
    height: 18px;
    margin-right: 8px;
    color: var(--f7-input-placeholder-color, #8a8a8e);
}
.ob-subdomain-icon svg { width: 18px; height: 18px; }
.ob-subdomain-input {
    flex: 1 1 auto;
    min-width: 0;
    background: transparent !important;
    border: 0 !important;
    box-shadow: none !important;
    border-radius: 0;
    padding: 12px 4px !important;
}
.ob-subdomain-suffix {
    flex: none;
    color: var(--f7-input-placeholder-color, #8a8a8e);
    font-weight: 600;
    white-space: nowrap;
}
.ob-subdomain-msg {
    font-size: 13px;
    margin-top: 6px;
    min-height: 1em;
}
.ob-subdomain-msg.is-taken { color: #ff3b30; }
.ob-subdomain-msg.is-free { color: #34c759; }

.ob-ws-options {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-top: 8px;
}
.ob-ws-card {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 14px;
    border-radius: 16px;
    cursor: pointer;
    background: rgba(118, 118, 128, .08);
    border: 1.5px solid transparent;
    transition: background .18s, border-color .18s, transform .1s;
}
html.dark .ob-ws-card { background: rgba(118, 118, 128, .14); }
.ob-ws-card:active { transform: scale(.99); }
.ob-ws-card.is-on {
    background: var(--ob-primary-soft);
    border-color: var(--f7-theme-color);
}
.ob-ws-icon {
    flex: none;
    width: 40px;
    height: 40px;
    border-radius: 12px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: rgba(255, 255, 255, .7);
    color: var(--ob-primary);
    box-shadow: 0 1px 2px rgba(0, 0, 0, .06);
}
html.dark .ob-ws-icon { background: rgba(255, 255, 255, .1); }
.ob-ws-icon.is-plain { background: #fff; }
.ob-ws-icon svg { width: 22px; height: 22px; }
.ob-ws-text {
    flex: 1 1 auto;
    min-width: 0;
    display: flex;
    flex-direction: column;
}
.ob-ws-title { font-weight: 600; font-size: 15px; }
.ob-ws-desc {
    font-size: 12.5px;
    color: var(--f7-input-placeholder-color, #8a8a8e);
    margin-top: 2px;
}
.ob-ws-switch {
    flex: none;
    position: relative;
    width: 46px;
    height: 28px;
}
.ob-ws-switch input {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    margin: 0;
    opacity: 0;
    cursor: pointer;
}
.ob-ws-knob {
    position: absolute;
    inset: 0;
    border-radius: 9999px;
    background: rgba(120, 120, 120, .35);
    transition: background .22s;
}
.ob-ws-knob::after {
    content: "";
    position: absolute;
    top: 2px;
    left: 2px;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: #fff;
    box-shadow: 0 1px 3px rgba(0, 0, 0, .3);
    transition: transform .22s;
}
/* Active = iOS/Framework7 system green, NOT the flow accent (which may be a dark
   grey like #454545 and would make an "on" toggle look inert/grey). */
.ob-ws-switch input:checked ~ .ob-ws-knob { background: #34c759; }
.ob-ws-switch input:checked ~ .ob-ws-knob::after { transform: translateX(18px); }

/* ---- step / field motion (iOS spring rise) ------------------------------- */
.ob-step {
    animation: obIn var(--ob-dur) var(--ob-ease);
}
@keyframes obIn {
    from { opacity: 0; transform: translateY(16px) scale(.985); }
    to   { opacity: 1; transform: none; }
}

.ob-field.error input {
    border-color: #ff3b30 !important;
    animation: obShake .3s;
}
@keyframes obShake {
    0%, 100% { transform: translateX(0); }
    25%      { transform: translateX(-5px); }
    75%      { transform: translateX(5px); }
}

/* Progress dots are sized/coloured inline by wizard.js (accent = --ob-primary). */
.ob-dot {
    transition: all .3s var(--ob-ease);
}

/* ---- brand logo: show the light or dark variant for the active theme ------ */
.ob-logo-dark { display: none; }
html.dark .ob-logo-light { display: none; }
html.dark .ob-logo-dark { display: inline; }

/* =============================================================================
 * Light/dark toggle — a small iOS "bar" pill, top-right on every device.
 * ========================================================================== */
.ob-theme-toggle {
    position: fixed;
    top: 16px;
    right: 16px;
    z-index: 50;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    height: 40px;
    padding: 0 14px;
    border-radius: 9999px;
    border: 1px solid var(--f7-list-item-border-color, rgba(0, 0, 0, .12));
    background: var(--f7-block-strong-bg-color, #fff);
    color: var(--f7-text-color);
    font: inherit;
    font-size: 14px;
    cursor: pointer;
    box-shadow: 0 6px 20px -8px rgba(0, 0, 0, .3);
    transition: transform .15s var(--ob-ease), background .3s ease, border-color .3s ease;
}
.ob-theme-toggle:hover {
    transform: translateY(-1px);
}
.ob-theme-toggle:active {
    transform: scale(.96);
}
.ob-theme-toggle .ob-theme-icon {
    display: inline-flex;
    width: 18px;
    height: 18px;
    transition: transform .5s var(--ob-ease);
}
.ob-theme-toggle:hover .ob-theme-icon {
    transform: rotate(25deg);
}

/* =============================================================================
 * Address autocomplete — a dropdown of suggestions under the address input.
 * Markup built by onboarding-address.js (.ob-ac-*). Sits above the glass card
 * on its own near-opaque surface so suggestions stay readable over any ambient
 * background, and follows the accent + dark mode like the rest of the wizard.
 * ========================================================================== */
.ob-ac-wrap {
    position: relative;
}
.ob-ac-menu {
    position: absolute;
    z-index: 60;
    top: 100%;
    left: 0;
    right: 0;
    margin-top: 6px;
    max-height: 264px;
    overflow-y: auto;
    padding: 6px;
    border-radius: 14px;
    background: rgba(255, 255, 255, .98);
    border: 1px solid var(--f7-list-item-border-color, rgba(0, 0, 0, .1));
    box-shadow: 0 1px 2px rgba(0, 0, 0, .06), 0 18px 40px -14px rgba(0, 0, 0, .3);
    -webkit-backdrop-filter: blur(18px) saturate(1.6);
    backdrop-filter: blur(18px) saturate(1.6);
    -webkit-overflow-scrolling: touch;
    animation: obAcIn .18s var(--ob-ease);
}
html.dark .ob-ac-menu {
    background: rgba(30, 32, 40, .98);
    border-color: rgba(255, 255, 255, .12);
    box-shadow: 0 1px 2px rgba(0, 0, 0, .5), 0 18px 40px -14px rgba(0, 0, 0, .7);
}
@keyframes obAcIn {
    from { opacity: 0; transform: translateY(-6px); }
    to   { opacity: 1; transform: none; }
}
.ob-ac-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    border-radius: 10px;
    cursor: pointer;
    font-size: 14px;
    line-height: 1.35;
    color: var(--f7-text-color);
    transition: background .12s ease;
}
.ob-ac-item.is-active,
.ob-ac-item:hover {
    background: var(--ob-primary-soft);
}
.ob-ac-text {
    flex: 1;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
/* Accent-tinted location pin, drawn from an inline SVG mask (no image request). */
.ob-ac-pin {
    flex: none;
    width: 16px;
    height: 16px;
    background-color: var(--ob-primary);
    -webkit-mask: var(--ob-ac-pin) center / contain no-repeat;
    mask: var(--ob-ac-pin) center / contain no-repeat;
    opacity: .85;
}
:root {
    --ob-ac-pin: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M12 2C8.13 2 5 5.13 5 9c0 5.25 7 13 7 13s7-7.75 7-13c0-3.87-3.13-7-7-7zm0 9.5a2.5 2.5 0 1 1 0-5 2.5 2.5 0 0 1 0 5z'/%3E%3C/svg%3E");
}
.ob-ac-note {
    padding: 10px 12px;
    font-size: 13px;
    color: var(--f7-input-placeholder-color, #8a8a8e);
}

/* ---- accessibility: respect reduced motion ------------------------------- */
@media (prefers-reduced-motion: reduce) {
    .ob-step,
    .ob-field.error input,
    .ob-btn,
    .ob-theme-toggle,
    .ob-theme-icon,
    .ob-ac-menu {
        animation: none !important;
        transition: none !important;
    }
    .ob-spin {
        animation-duration: 1.4s;
    }
}
