/* Onboarding "Experimente agora" - the /demo/ funnel page (views/onboarding.inc)
   and its signup/login wizard dialog. Loaded via <link>; tokens and the
   .btn / .dialog-* primitives come from design-system.css; everything here is
   namespaced .onb-*. Mobile-first: the page always runs under the device-width
   viewport, so the 760px block below is the phone layout. */

/* funnel page: the wizard dialog is the whole page - the body just paints the
   login brand gradient behind the scrim */
body.onb-page {
    margin: 0;
    min-height: 100vh;
    min-height: 100dvh;
    font-family: 'ADDLOG', -apple-system, 'Segoe UI', Roboto, sans-serif;
    -webkit-font-smoothing: antialiased;
    background:
        radial-gradient(100% 90% at 8% 6%, rgba(235, 105, 39, .5), rgba(235, 105, 39, 0) 46%),
        linear-gradient(158deg, #313D48 0%, var(--brand-navy) 58%, #1E252C 100%);
}
body.onb-page::before {
    content: "";
    position: fixed;
    width: 420px; height: 420px; right: -150px; bottom: -160px;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(255, 255, 255, .12), rgba(255, 255, 255, 0) 68%);
}

/* wizard dialog -------------------------------------------------------------*/
.dialog-card.onb-dialog {
    width: min(460px, 94vw);
}

.onb-tabs {
    display: flex;
    gap: 6px;
    padding: 3px;
    background: var(--c-surface-2);
    border-radius: var(--radius-lg, 10px);
}

.onb-tab {
    flex: 1 1 0;
    padding: 8px 10px;
    font: inherit;
    font-size: 12.5px;
    font-weight: 700;
    color: var(--c-text-dim);
    background: transparent;
    border: 0;
    border-radius: calc(var(--radius-lg, 10px) - 3px);
    cursor: pointer;
    transition: background-color .12s, color .12s;
}

.onb-tab.is-active {
    background: var(--c-surface);
    color: var(--c-text);
    box-shadow: 0 1px 3px rgba(0, 0, 0, .12);
}

.onb-steps {
    display: flex;
    flex-direction: column;
}

.onb-step {
    display: flex;
    flex-direction: column;
    gap: 12px;
    padding-top: 4px;
}

.onb-lead {
    margin: 0;
    font-size: 13px;
    font-weight: 600;
    line-height: 1.5;
    color: var(--c-text);
}

.onb-hint {
    margin: 0;
    font-size: 12px;
    color: var(--c-text-dim);
}

.onb-note {
    margin: 0;
    font-size: 11.5px;
    font-weight: 600;
    color: var(--c-text-muted);
}

.onb-field {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.onb-label {
    font-size: 12px;
    font-weight: 700;
    color: var(--c-text-dim);
}

.onb-input {
    height: 42px;
    padding: 0 12px;
    font: inherit;
    font-size: 16px;                   /* >=16px: iOS must not auto-zoom on focus */
    color: var(--c-text);
    background: var(--c-surface);
    border: 1px solid var(--c-border);
    border-radius: var(--radius-lg, 10px);
    outline: none;
    transition: border-color .15s, box-shadow .15s;
}

.onb-input:focus {
    border-color: var(--c-accent);
    box-shadow: 0 0 0 3px var(--c-accent-glow);
}

/* password field: the show/hide toggle sits inside the input's right edge.
   Flex column mirrors .onb-field so the nested input stretches full width
   (the page has no border-box reset, so width:100% would overflow). */
.onb-pass-wrap {
    position: relative;
    display: flex;
    flex-direction: column;
}

.onb-pass-wrap .onb-input {
    padding-right: 84px;
}

.onb-pass-toggle {
    position: absolute;
    top: 50%;
    right: 10px;
    transform: translateY(-50%);
    padding: 4px 6px;
    font: inherit;
    font-size: 12.5px;
    font-weight: 700;
    color: var(--c-primary-ink);
    background: transparent;
    border: 0;
    cursor: pointer;
}

.onb-pass-toggle:hover { text-decoration: underline; }

.onb-field-error,
.onb-error {
    font-size: 12px;
    font-weight: 600;
    line-height: 1.45;
    color: var(--c-danger, #E5484D);
}

.onb-identity-echo {
    font-size: 15px;
    font-weight: 700;
    color: var(--c-text);
    overflow-wrap: anywhere;
}

/* 6-digit code boxes --------------------------------------------------------*/
.onb-code-row {
    display: flex;
    gap: 8px;
    justify-content: center;
}

.onb-code-box {
    width: 44px;
    height: 52px;
    text-align: center;
    font: inherit;
    font-size: 22px;
    font-weight: 700;
    color: var(--c-text);
    background: var(--c-surface);
    border: 1px solid var(--c-border);
    border-radius: var(--radius-lg, 10px);
    outline: none;
    transition: border-color .15s, box-shadow .15s;
}

.onb-code-box:focus {
    border-color: var(--c-accent);
    box-shadow: 0 0 0 3px var(--c-accent-glow);
}

.onb-code-links {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
}

.onb-link {
    padding: 6px 2px;
    font: inherit;
    font-size: 12.5px;
    font-weight: 700;
    color: var(--c-primary-ink);
    background: transparent;
    border: 0;
    cursor: pointer;
}

.onb-link:hover { text-decoration: underline; }

.onb-link:disabled {
    color: var(--c-text-muted);
    cursor: default;
    text-decoration: none;
}

/* resend feedback line: "Enviando…" (muted, pulsing) then a green confirmation */
.onb-resend-status {
    display: flex;
    align-items: center;
    gap: 7px;
    margin-top: 2px;
    font-size: 12.5px;
    font-weight: 600;
    line-height: 1.4;
}
.onb-resend-status.is-sending {
    color: var(--c-text-muted);
}
.onb-resend-status.is-sending::before {
    content: "";
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--c-text-muted);
    animation: onb-pulse 1s ease-in-out infinite;
}
.onb-resend-status.is-ok {
    color: var(--c-success-ink);
}

@keyframes onb-pulse {
    0%, 100% { opacity: 1; transform: scale(1); }
    50%      { opacity: 0.35; transform: scale(0.7); }
}

/* slug row ------------------------------------------------------------------*/
.onb-slug-row {
    display: flex;
    align-items: center;
    gap: 0;
    min-width: 0;
}

.onb-slug-prefix {
    flex: 0 0 auto;
    height: 42px;
    display: inline-flex;
    align-items: center;
    padding: 0 8px 0 12px;
    font-size: 13px;
    font-weight: 600;
    color: var(--c-text-dim);
    background: var(--c-surface-2);
    border: 1px solid var(--c-border);
    border-right: 0;
    border-radius: var(--radius-lg, 10px) 0 0 var(--radius-lg, 10px);
    white-space: nowrap;
}

.onb-slug-input {
    flex: 1 1 auto;
    min-width: 0;
    border-radius: 0 var(--radius-lg, 10px) var(--radius-lg, 10px) 0;
}

.onb-slug-status {
    min-height: 16px;
    font-size: 12px;
    font-weight: 700;
}

.onb-slug-status.is-ok       { color: var(--c-success-ink); }
.onb-slug-status.is-bad      { color: var(--c-danger, #E5484D); }
.onb-slug-status.is-checking { color: var(--c-text-muted); }

/* provisioning spinner ------------------------------------------------------*/
.onb-step-provision {
    align-items: center;
    padding: 26px 0 18px;
    text-align: center;
}

.onb-spinner {
    width: 34px;
    height: 34px;
    border: 3px solid var(--c-primary-tint);
    border-top-color: var(--c-primary);
    border-radius: 50%;
    animation: onb-spin .8s linear infinite;
}

.onb-provision {
    font-size: 14px;
    font-weight: 700;
    color: var(--c-text);
}

@keyframes onb-spin { to { transform: rotate(360deg); } }

/* NARROW VIEWPORTS: the funnel page always runs device-width, so this is the
   phone experience (references.css conventions: safe areas, finger targets,
   no hover-only affordances). //////////////////////////////////////////////// */
@media (max-width: 760px) {
    /* keep the dialog vertically centered (not a bottom sheet); just give it a
       little more height on small screens. Footer buttons become finger-sized
       full-width rows below. */
    .dialog-card.onb-dialog {
        max-height: calc(100dvh - 32px);
    }
    .onb-dialog .dialog-footer {
        flex-wrap: wrap;
        padding-bottom: calc(12px + env(safe-area-inset-bottom));
    }
    .onb-dialog .dialog-footer > .btn {
        flex: 1 1 auto;
        justify-content: center;
        min-height: 44px;
    }

    .onb-code-row { gap: 6px; }
    .onb-code-box {
        flex: 0 1 46px;
        width: auto;
        min-width: 38px;
    }
}

@media (prefers-reduced-motion: reduce) {
    .onb-spinner { animation-duration: 1.6s; }
    .onb-input, .onb-code-box, .onb-tab { transition: none; }
    .onb-resend-status.is-sending::before { animation: none; opacity: 0.6; }
}
