/* ==========================================================================
   Signic — Registration UI
   Redesigned to mirror the Signic App (app.signic.ir/login) on desktop:
     • black stage, the app column (max-width 430px) centered on desktop and
       full-bleed on phones,
     • the very same design tokens, colors, logo and composition as the app.
   Pure HTML/CSS redesign. NO logic changes:
     • app.js is untouched.
     • every element id / class / data-* used by the JavaScript is preserved.
   ========================================================================== */

/* ------------------------------ Design tokens ---------------------------- */
:root {
    /* brand (Signic blue) */
    --primary-50: #e6f0ff;
    --primary-100: #b2d0ff;
    --primary-200: #8db9ff;
    --primary-300: #5a99ff;
    --primary-400: #3985ff;
    --primary-500: #0867ff;
    --primary-600: #075ee8;
    --primary-700: #0649b5;
    --primary-800: #04398c;
    --primary-900: #032d6b;

    /* oxford (dark navy) */
    --oxford-500: #002147;
    --oxford-600: #001e41;
    --oxford-700: #001732;
    --oxford-800: #001227;
    --oxford-900: #000e1e;

    /* ink + surfaces */
    --ink: #0b1633;
    --ink-2: #42526e;
    --ink-3: #7a8aa3;
    --line: #e6ecf5;
    --surface: #f4f7fc;
    --surface-2: #f9fbfe;

    /* status */
    --success-50: #e9f9ee;
    --success-100: #d2f3dd;
    --success-500: #34c759;
    --success-600: #27b551;
    --danger-50: #ffebec;
    --danger-500: #ff383c;
    --warning-500: #ffcc00;

    /* gradients */
    --grad-brand: linear-gradient(135deg, #0a63f4 0%, #2f8dff 55%, #6ec3ff 100%);
    --grad-deep: linear-gradient(160deg, #001a3f 0%, #032d6b 45%, #0867ff 130%);
    --grad-soft: linear-gradient(135deg, #e9f2ff 0%, #f3f8ff 100%);
    --grad-app: linear-gradient(180deg, #ffffff 0%, #f1f7ff 100%);

    /* radii */
    --r-sm: 10px;
    --r-md: 16px;
    --r-lg: 22px;
    --r-xl: 28px;
    --r-full: 999px;

    /* elevation (identical to the app) */
    --card-shadow: 0 1px 2px rgba(11, 22, 51, .04), 0 12px 32px -12px rgba(11, 22, 51, .14);
    --card-shadow-lg: 0 2px 4px rgba(11, 22, 51, .05), 0 24px 60px -20px rgba(11, 22, 51, .28);

    /* the app stage */
    --page-bg: #000;
    --app-w: 430px;

    /* arrow used inside the primary button (masked so its color can change) */
    --icon-arrow: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='2.4' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M4 12h16'/%3E%3Cpath d='m14 6 6 6-6 6'/%3E%3C/svg%3E");

    /* ---------------- legacy aliases (older rules of this sheet) --------- */
    --primary: var(--primary-500);
    --muted: var(--ink-3);
    --muted-2: #9caabf;
    --ink-soft: var(--ink-2);
    --field: var(--surface-2);
    --border: var(--line);
    --track: rgba(11, 22, 51, .07);
    --border-focus: var(--primary-400);
    --success: var(--success-500);
    --error: var(--danger-500);
    --text-primary: var(--ink);
    --text-secondary: var(--ink-2);
    --radius-sm: var(--r-sm);
    --radius: var(--r-md);
    --radius-lg: var(--r-lg);
    --radius-xl: var(--r-xl);
    --shadow-sm: var(--card-shadow);
    --shadow-md: var(--card-shadow);
    --shadow-lg: var(--card-shadow-lg);
}

/* RTL points forward (left), LTR points forward (right) */
[dir="rtl"] {
    --icon-arrow: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='2.4' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M20 12H4'/%3E%3Cpath d='m10 6 -6 6 6 6'/%3E%3C/svg%3E");
}

/* --------------------------------- Reset -------------------------------- */
*,
*::before,
*::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Vazir', 'Vazirmatn', system-ui, -apple-system, 'Segoe UI', sans-serif;
}

[dir="ltr"] {
    font-family: system-ui, -apple-system, 'Segoe UI', Arial, sans-serif;
}

html {
    -webkit-text-size-adjust: 100%;
}

body {
    min-height: 100vh;
    min-height: 100dvh;
    background: var(--page-bg);
    color: var(--ink);
    overflow: hidden;
    -webkit-font-smoothing: antialiased;
    text-rendering: optimizeLegibility;
}

/* ===================== Stage + app column (app-like) ==================== */
.signic-stage {
    position: fixed;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    background: var(--page-bg);
}

.signic-app-column {
    position: relative;
    display: flex;
    flex-direction: column;
    width: 100%;
    max-width: var(--app-w);
    height: 100%;
    background: var(--grad-app);
    overflow: hidden;
    isolation: isolate;
    overscroll-behavior-y: none;
    touch-action: pan-y;
    animation: app-column-in .5s ease both;
    /* subtle blue halo so the column reads as a device on the black stage */
    box-shadow: 0 0 140px -30px rgba(8, 103, 255, .35);
    /* makes this element the containing block for the overlays inside, so the
       splash / modal always cover the app (not the whole desktop) */
    transform: translateZ(0);
}

/* ------------------------------- Orbs ---------------------------------- */
.orb {
    position: absolute;
    z-index: 0;
    border-radius: 50%;
    pointer-events: none;
    will-change: transform;
    transform: translateZ(0);
    animation: orb-drift 7s ease-in-out infinite;
}

.orb-reverse {
    animation-direction: reverse;
}

.orb-delayed {
    animation-delay: 1.3s;
}

.orb-a {
    top: -80px;
    right: -64px;
    width: 288px;
    height: 288px;
    background: radial-gradient(circle, rgba(46, 141, 255, .16), transparent 70%);
}

.orb-b {
    bottom: -24px;
    left: -96px;
    width: 384px;
    height: 384px;
    background: radial-gradient(circle, rgba(110, 195, 255, .14), transparent 70%);
}

/* ------------------------------ Top bar -------------------------------- */
.app-topbar {
    position: relative;
    z-index: 10;
    flex: 0 0 auto;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 22px 28px 0;
}

.brand-pill {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 8px 14px;
    background: #fff;
    border-radius: var(--r-full);
    box-shadow: var(--card-shadow);
}

.brand-pill img {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    object-fit: cover;
}

.brand-pill span {
    font-size: .875rem;
    font-weight: 800;
    letter-spacing: .2px;
    color: var(--ink);
}

/* --------------------------- App container ----------------------------- */
.auth-container {
    position: relative;
    z-index: 5;
    display: flex;
    flex: 1 1 auto;
    flex-direction: column;
    width: 100%;
    min-height: 0;
    overflow: hidden;
}

/* hide the duplicate watermark placed directly under the container */
.auth-container > .copyright-notice {
    display: none;
}

/* ------------------------------ Progress ------------------------------- */
.progress-bar {
    position: relative;
    flex: 0 0 auto;
    height: 4px;
    margin: 16px 28px 0;
    background: var(--track);
    border-radius: var(--r-full);
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    width: 25%;
    border-radius: inherit;
    background: var(--grad-brand);
    transition: width 0.5s cubic-bezier(0.4, 0, 0.2, 1);
}

/* --------------------------- Step indicator ---------------------------- */
.step-indicator {
    flex: 0 0 auto;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 7px;
    padding: 12px 28px 0;
}

.step-dot {
    width: 7px;
    height: 7px;
    border-radius: var(--r-full);
    background: rgba(11, 22, 51, .12);
    transition: all 0.3s ease;
}

.step-dot.completed {
    background: var(--primary-200);
}

.step-dot.active {
    width: 22px;
    background: var(--grad-brand);
}

/* --------------------------- Step containers --------------------------- */
.form-step {
    display: none;
    position: relative;
    flex: 1 1 auto;
    min-height: 0;
    flex-direction: column;
    padding: 20px 28px calc(28px + env(safe-area-inset-bottom, 0px));
    overflow-y: auto;
    overscroll-behavior: contain;
    scrollbar-width: thin;
    scrollbar-color: var(--line) transparent;
}

.form-step::-webkit-scrollbar {
    width: 5px;
}

.form-step::-webkit-scrollbar-thumb {
    background: var(--line);
    border-radius: var(--r-full);
}

.form-step.active {
    display: flex;
    animation: fadeIn 0.4s cubic-bezier(0.2, 0.8, 0.3, 1) both;
}

/* The app vertically centers its login block; steps 1 & 2 do the same
   ("safe" keeps tall content scrollable instead of clipping the top). */
#step1,
#step2 {
    justify-content: safe center;
}

#step1 .copyright-notice,
#step2 .copyright-notice {
    margin-top: 0;
}

/* Security footer — same idea as the note under the app login form */
.form-step .copyright-notice {
    order: 99;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    margin-top: auto;
    padding-top: 28px;
    font-size: .75rem;
    font-weight: 300;
    line-height: 1.6;
    text-align: center;
    color: var(--ink-3);
}

.form-step .copyright-notice i {
    font-size: 1rem;
    color: var(--primary-300);
}

/* ------------------------------- Header -------------------------------- */
.auth-header {
    text-align: center;
    margin-bottom: 24px;
}

.auth-logo {
    margin-bottom: 18px;
    display: flex;
    justify-content: center;
}

.auth-logo img {
    height: 132px;
    width: auto;
    max-width: 70%;
    object-fit: contain;
    filter: drop-shadow(0 16px 32px rgba(8, 103, 255, .22));
    animation: float-slow 6s ease-in-out infinite;
}

/* steps without a real logo render an empty <img>; hide it cleanly */
.auth-logo img:not([src]),
.auth-logo img[src=""] {
    display: none;
}

/* the app's login hero is a 148px logo (h-36 w-36) with a soft brand glow */
#step2 .auth-logo img {
    height: 148px;
}

.step-title {
    font-size: 1.75rem;
    font-weight: 900;
    line-height: 1.45;
    letter-spacing: -.2px;
    color: var(--ink);
}

.step-title.welcome-title {
    font-size: 1.3rem;
    font-weight: 800;
    line-height: 1.95;
    color: var(--ink);
}

.step-subtitle {
    margin-top: 10px;
    font-size: .95rem;
    font-weight: 300;
    line-height: 2;
    color: var(--ink-2);
}

/* -------------------------- Language selection ------------------------- */
.welcome-actions {
    margin-top: 4px;
}

.language-selection {
    width: 100%;
}

.language-label-container {
    width: 100%;
    text-align: center;
}

.form-label {
    display: block;
    margin-bottom: 10px;
    font-size: .85rem;
    font-weight: 600;
    color: var(--ink-2);
}

.language-label {
    color: var(--ink-3);
    font-weight: 400;
    margin-bottom: 2px;
}

/* two big cards side by side */
.language-selection .option-group {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
    margin-top: 20px;
}

/* --------------------------- Form controls ----------------------------- */
.form-group {
    margin-bottom: 16px;
}

.input-container {
    position: relative;
    width: 100%;
}

.form-input {
    width: 100%;
    height: 58px;
    padding: 0 50px;
    font-size: 1rem;
    font-weight: 600;
    color: var(--ink);
    background: var(--surface-2);
    border: 1px solid var(--line);
    border-radius: var(--r-md);
    outline: none;
    transition: border-color 0.2s ease, background 0.2s ease, box-shadow 0.2s ease;
}

.form-input::placeholder {
    color: var(--ink-3);
    opacity: .75;
    font-weight: 400;
}

.form-input:focus {
    background: #fff;
    border-color: var(--primary-300);
    box-shadow: 0 0 0 4px rgba(8, 103, 255, .12);
}

.form-input:disabled {
    opacity: 0.6;
}

/* leading icon */
.input-icon {
    position: absolute;
    top: 50%;
    right: 18px;
    transform: translateY(-50%);
    color: var(--ink-3);
    font-size: 1.15rem;
    pointer-events: none;
    display: inline-flex;
}

/* trailing actions (clear button) */
.input-actions {
    position: absolute;
    top: 50%;
    left: 12px;
    transform: translateY(-50%);
    display: inline-flex;
    align-items: center;
}

.btn-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border: none;
    border-radius: 50%;
    background: transparent;
    color: var(--ink-3);
    font-size: 1.2rem;
    cursor: pointer;
    transition: background 0.2s ease, color 0.2s ease;
}

.btn-icon:hover {
    background: var(--surface);
    color: var(--ink-2);
}

/* LTR direction swaps icon / action sides */
[dir="ltr"] .input-icon {
    right: auto;
    left: 18px;
}

[dir="ltr"] .input-actions {
    left: auto;
    right: 12px;
}

/* -------------------------- Native selects ----------------------------- */
.custom-select {
    width: 100%;
    height: 58px;
    padding: 0 16px;
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--ink);
    background-color: var(--surface-2);
    border: 1px solid var(--line);
    border-radius: var(--r-md);
    outline: none;
    appearance: none;
    -webkit-appearance: none;
    cursor: pointer;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' fill='%237a8aa3' viewBox='0 0 16 16'%3E%3Cpath d='M8 11 3 5h10z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: left 16px center;
    background-size: 14px;
    transition: border-color 0.2s ease, background 0.2s ease, box-shadow 0.2s ease;
}

[dir="ltr"] .custom-select {
    background-position: right 16px center;
}

.custom-select:focus {
    background-color: #fff;
    border-color: var(--primary-300);
    box-shadow: 0 0 0 4px rgba(8, 103, 255, .12);
}

.date-selectors {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;
}

/* ---------------------------- Option groups ---------------------------- */
.option-group {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-top: 16px;
}

.option-item {
    position: relative;
    display: flex;
    align-items: center;
    gap: 13px;
    padding: 15px 16px;
    background: #fff;
    border: 1px solid var(--line);
    border-radius: var(--r-lg);
    box-shadow: var(--card-shadow);
    cursor: pointer;
    transition: border-color 0.2s ease, background 0.2s ease, box-shadow 0.2s ease, transform 0.12s ease;
}

.option-item:hover {
    border-color: var(--primary-200);
    background: var(--primary-50);
}

.option-item:active {
    transform: scale(0.995);
}

.option-item.selected {
    border-color: var(--primary-400);
    background: var(--primary-50);
    box-shadow: 0 0 0 3px rgba(8, 103, 255, .14), var(--card-shadow);
}

.option-icon {
    flex: 0 0 auto;
    display: grid;
    place-items: center;
    width: 44px;
    height: 44px;
    border-radius: var(--r-md);
    background: var(--primary-50);
    color: var(--primary-500);
    font-size: 1.15rem;
}

.option-item.selected .option-icon {
    background: var(--grad-brand);
    color: #fff;
    box-shadow: 0 10px 22px -10px rgba(8, 103, 255, .75);
}

.option-text {
    flex: 1;
    font-weight: 700;
    color: var(--ink);
}

/* language cards: stacked & centered */
.option-item.language-option {
    flex-direction: column;
    justify-content: center;
    text-align: center;
    gap: 6px;
    padding: 24px 12px;
}

.option-item.language-option .option-text {
    flex: none;
    font-size: 1rem;
    font-weight: 700;
}

/* multi-select check badge */
.multiple-selection .option-item.selected::after {
    content: '✓';
    position: absolute;
    top: -8px;
    inset-inline-start: -8px;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 24px;
    height: 24px;
    font-size: 0.72rem;
    font-weight: 700;
    color: #fff;
    background: var(--grad-brand);
    border: 2px solid #fff;
    border-radius: 50%;
    box-shadow: 0 6px 14px -6px rgba(8, 103, 255, .8);
}

/* -------------------------------- OTP ---------------------------------- */
/* the app's verification screen: four 68×68 boxes, brand/danger states,
   a quiet "edit number" link, a 2:00 resend countdown and the inline error. */
.otp-container {
    display: flex;
    justify-content: center;
    gap: 12px;
    margin: 36px 0 0;
    direction: ltr;
}

.otp-input {
    width: 68px;
    height: 68px;
    padding: 0;
    text-align: center;
    font-size: 1.875rem;
    font-weight: 900;
    color: var(--ink-3);
    background: var(--surface-2);
    border: 2px solid var(--line);
    border-radius: var(--r-md);
    box-shadow: none;
    outline: none;
    caret-color: var(--primary-500);
    transition: transform .15s ease, color .2s ease, background .2s ease, border-color .2s ease;
}

/* the app scales the focused box a touch (whileFocus: scale 1.06) */
.otp-input:focus {
    transform: scale(1.06);
}

/* filled (app: border-primary-400 + bg-primary-50 + ink) */
.otp-input.is-filled {
    color: var(--ink);
    background: var(--primary-50);
    border-color: var(--primary-400);
}

/* wrong code (app: border-danger-500 + bg-danger-50 + danger text) */
.otp-input.is-error {
    color: var(--danger-500);
    background: var(--danger-50);
    border-color: var(--danger-500);
}

/* boxes after the first empty one are not reachable (app: cursor-not-allowed) */
.otp-input.is-locked {
    cursor: not-allowed;
}

.otp-edit {
    margin-top: 16px;
    text-align: center;
}

.otp-edit .btn-edit-number {
    display: inline-block;
    width: 100%;
    padding: 0;
    font-family: inherit;
    font-size: .875rem;
    font-weight: 500;
    text-align: center;
    color: var(--primary-500);
    background: none;
    border: 0;
    cursor: pointer;
    transition: color .2s ease;
}

.otp-edit .btn-edit-number i {
    margin-inline-end: 5px;
    vertical-align: -1px;
}

.otp-edit .btn-edit-number:hover {
    color: var(--primary-600);
}

/* the reserved message slot under the boxes (app: mt-5 h-6) */
.otp-msg {
    min-height: 24px;
    margin-top: 20px;
    text-align: center;
    font-size: .72rem;
    font-weight: 500;
    line-height: 1.5;
    color: var(--danger-500);
}

.otp-msg.is-success {
    font-size: .875rem;
    font-weight: 800;
    color: var(--success-600);
}

.otp-msg.is-busy {
    color: var(--ink-3);
}

.otp-resend {
    display: flex;
    flex-direction: column;
    align-items: center;
    margin-top: 16px;
}

.otp-timer {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-size: .875rem;
    font-weight: 500;
    color: var(--ink-3);
}

.otp-timer b {
    font-weight: 800;
    font-variant-numeric: tabular-nums;
    color: var(--ink);
}

.btn-resend {
    padding: 10px 24px;
    font-family: inherit;
    font-size: .875rem;
    font-weight: 800;
    color: #fff;
    background: var(--grad-brand);
    border: 0;
    border-radius: var(--r-full);
    box-shadow: var(--card-shadow);
    cursor: pointer;
    transition: transform .15s ease;
}

.btn-resend:active {
    transform: scale(.95);
}

/* the app confirms automatically on the 4th digit — the manual CTA only
   stays in the DOM for compatibility with the existing flow */
#step3 .nav-buttons.is-hidden {
    display: none;
}

.is-hidden {
    display: none !important;
}

/* the wrong-code shake (the app shakes the row of boxes) */
.otp-container.shake {
    animation: shake 0.5s ease;
}

/* ---------------------------- Navigation ------------------------------- */
.nav-buttons {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-top: 24px;
}

.btn-primary,
.btn-secondary {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    width: 100%;
    min-height: 58px;
    padding: 15px 58px;
    font-family: inherit;
    font-size: 1.05rem;
    font-weight: 800;
    border-radius: var(--r-lg);
    cursor: pointer;
    outline: none;
    transition: transform 0.15s ease, box-shadow 0.2s ease, background 0.2s ease,
        color 0.2s ease, border-color 0.2s ease;
}

/* primary — the app's gradient CTA with the round arrow badge */
.btn-primary {
    color: #fff;
    border: 1px solid transparent;
    background: var(--grad-brand);
    box-shadow: 0 14px 28px -12px rgba(8, 103, 255, .75);
}

.btn-primary::before {
    content: '';
    position: absolute;
    inset-inline-end: 12px;
    top: 50%;
    width: 38px;
    height: 38px;
    transform: translateY(-50%);
    border-radius: 50%;
    background: rgba(255, 255, 255, .22);
    transition: background 0.2s ease;
}

.btn-primary::after {
    content: '';
    position: absolute;
    inset-inline-end: 24px;
    top: 50%;
    width: 15px;
    height: 15px;
    transform: translateY(-50%);
    background: #fff;
    -webkit-mask: var(--icon-arrow) center / contain no-repeat;
    mask: var(--icon-arrow) center / contain no-repeat;
    transition: background 0.2s ease;
}

.btn-primary:hover {
    transform: translateY(-1px);
    box-shadow: 0 18px 34px -12px rgba(8, 103, 255, .85);
}

.btn-primary:hover::before {
    background: rgba(255, 255, 255, .32);
}

.btn-primary:active {
    transform: translateY(0) scale(0.99);
}

.btn-primary:disabled {
    color: var(--ink-3);
    background: #fff;
    border-color: var(--line);
    box-shadow: none;
    cursor: not-allowed;
    transform: none;
}

.btn-primary:disabled::before {
    background: var(--surface);
}

.btn-primary:disabled::after {
    background: var(--ink-3);
}

/* the app's CTA stays clickable in its idle look (white card + ink-3 + surface arrow) */
.btn-primary.is-inactive {
    color: var(--ink-3);
    background: #fff;
    border-color: var(--line);
    box-shadow: none;
}

.btn-primary.is-inactive::before {
    background: var(--surface);
}

.btn-primary.is-inactive::after {
    background: var(--ink-3);
}

.btn-primary.is-inactive:hover {
    transform: none;
    background: #fff;
    box-shadow: none;
}

.btn-primary.is-inactive:hover::before {
    background: var(--surface);
}

/* secondary — ghost button (the app keeps those quiet) */
.btn-secondary {
    min-height: 52px;
    font-size: .95rem;
    font-weight: 700;
    color: var(--ink-2);
    background: #fff;
    border: 1px solid var(--line);
}

.btn-secondary:hover {
    color: var(--primary-600);
    border-color: var(--primary-200);
    background: var(--primary-50);
}

.btn-secondary:active {
    transform: scale(0.99);
}

/* success state for the "print card" button */
.btn-primary.print-success {
    background: var(--success-500) !important;
    box-shadow: none !important;
    cursor: not-allowed;
    opacity: 0.95;
}

.btn-primary.print-success:hover {
    transform: none !important;
    background: var(--success-500) !important;
}

.btn-primary.print-success::after {
    background: #fff;
}

/* ======================================================================
   Step 2 — the exact "login card" of the app:
   a white card holding the country badge (+۹۸) and the big centered input.
   ====================================================================== */
#step2 .form-group {
    padding: 16px;
    background: #fff;
    border: 1px solid var(--line);
    border-radius: var(--r-lg);
    box-shadow: var(--card-shadow);
}

#step2 .form-label {
    margin-bottom: 12px;
    font-size: .8rem;
    font-weight: 700;
    color: var(--ink-3);
}

/* the app's login card carries no inner label — the placeholder does the job */
[dir="rtl"] #step2 .form-label {
    display: none;
}

/* the card keeps its neutral border while typing —
   no blue "focus" border on the phone field */
#step2 .form-group:focus-within {
    border-color: var(--line);
}

#step2 .input-container {
    display: flex;
    align-items: center;
    gap: 12px;
    direction: ltr;
    padding: 4px;
    background: var(--surface-2);
    border: 1px solid var(--line);
    border-radius: var(--r-md);
    transition: border-color 0.2s ease, background 0.2s ease, box-shadow 0.2s ease;
}

#step2 .input-container:focus-within {
    background: #fff;
    border-color: var(--primary-300);
    box-shadow: 0 0 0 4px rgba(8, 103, 255, .1);
}

/* the app's row has no chrome of its own: only the card is a surface, the badge
   is a box and the input sits bare in between */
[dir="rtl"] #step2 .input-container,
[dir="rtl"] #step2 .input-container:focus-within {
    padding: 0;
    background: transparent;
    border: 0;
    border-radius: 0;
    box-shadow: none;
}

/* the app's country badge (fa / phone mode only) */
[dir="rtl"] #step2 .input-container::before {
    content: '+۹۸';
    flex: 0 0 auto;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 64px;
    height: 48px;
    font-size: 1.05rem;
    font-weight: 800;
    color: var(--ink-2);
    background: #fff;
    border: 1px solid var(--line);
    border-radius: var(--r-md);
}

[dir="rtl"] #step2 .input-container .input-icon {
    display: none;
}

/* the badge turns into the brand gradient while focused / filled (exactly like the app) */
[dir="rtl"] #step2 .input-container:focus-within::before,
[dir="rtl"] #step2 .input-container:has(input:not(:placeholder-shown))::before {
    color: #fff;
    background: var(--grad-brand);
    border-color: transparent;
}

#step2 .form-input {
    flex: 1 1 auto;
    width: auto;
    height: 56px;
    padding: 0 48px;
    font-size: 1.5rem;
    font-weight: 800;
    letter-spacing: .06em;
    text-align: center;
    color: var(--ink);
    background: transparent;
    border: 0;
    border-radius: var(--r-sm);
    box-shadow: none;
}

#step2 .form-input:focus {
    background: transparent;
    border: 0;
    box-shadow: none;
}

/* no blue :focus-visible ring on the phone field (the app keeps it flat) */
#step2 .form-input:focus-visible {
    outline: none;
    outline-offset: 0;
}

#step2 .form-input::placeholder {
    font-size: 1rem;
    font-weight: 400;
    letter-spacing: 0;
}

/* the number sits bare and centred in the row (like the app, no clear button) */
[dir="rtl"] #step2 .form-input,
[dir="rtl"] #step2 .form-input:focus {
    padding: 0 6px;
}

#step2 .input-actions {
    left: auto;
    right: 10px;
}

/* the clear button only shows once the field has a value (pure CSS, no JS) */
#step2 .input-container .input-actions {
    display: none;
}

#step2 .input-container input:not(:placeholder-shown) ~ .input-actions {
    display: inline-flex;
}

/* the thin brand line the app expands under the row while focused */
#step2 .focus-line {
    height: 1px;
    margin-top: 16px;
    overflow: hidden;
    background: var(--line);
}

#step2 .focus-line > i {
    display: block;
    width: 0;
    height: 100%;
    background: var(--grad-brand);
    transition: width .35s cubic-bezier(.22, 1, .36, 1);
}

#step2 .form-group:focus-within .focus-line > i {
    width: 100%;
}

/* the reserved helper / error line under the card (app: h-5 + pt-1.5) */
#step2 .field-hint {
    min-height: 20px;
    padding-top: 6px;
    font-size: .72rem;
    font-weight: 500;
    line-height: 1.45;
    color: var(--ink-3);
}

#step2 .field-hint.is-error {
    color: var(--danger-500);
}

/* the app's screen titles (login + OTP) are 32px / black */
#step2 .step-title,
#step3 .step-title {
    font-size: 2rem;
    font-weight: 900;
    line-height: 1.35;
    letter-spacing: -.3px;
}

#step2 .step-subtitle,
#step3 .step-subtitle {
    margin-top: 12px;
    font-size: .94rem;
    line-height: 1.75;
}

/* the number echoed inside the OTP subtitle (app: ltr + brand-600 + bold) */
.otp-phone {
    margin: 0 4px;
    font-weight: 800;
    letter-spacing: .04em;
    color: var(--primary-600);
}

/* email mode (english) keeps a normal sized, start-aligned field */
[dir="ltr"] #step2 .input-container .input-icon {
    left: auto;
    right: 14px;
}

[dir="ltr"] #step2 .form-input {
    padding: 0 46px;
    font-size: 1.05rem;
    font-weight: 600;
    letter-spacing: 0;
    text-align: left;
}

/* ------------------------------ Questions ------------------------------ */
.question-step {
    display: none;
    flex-direction: column;
}

.question-step.active {
    display: flex;
    animation: fadeIn 0.4s cubic-bezier(0.2, 0.8, 0.3, 1) both;
}

.question-progress {
    align-self: center;
    margin-bottom: 16px;
    padding: 6px 16px;
    font-size: .78rem;
    font-weight: 700;
    color: var(--primary-600);
    background: var(--primary-50);
    border: 1px solid var(--primary-100);
    border-radius: var(--r-full);
}

.question-title {
    margin-bottom: 8px;
    font-size: 1.35rem;
    font-weight: 900;
    line-height: 1.7;
    text-align: center;
    color: var(--ink);
}

.question-subtitle {
    margin-bottom: 18px;
    font-size: .92rem;
    font-weight: 300;
    line-height: 1.9;
    text-align: center;
    color: var(--ink-2);
}

/* ------------------------- Welcome / final step ------------------------ */
.welcome-content {
    margin-top: 4px;
}

.welcome-card {
    padding: 24px 18px;
    text-align: center;
    background: #fff;
    border: 1px solid var(--line);
    border-radius: var(--r-xl);
    box-shadow: var(--card-shadow);
}

.welcome-icon {
    display: grid;
    place-items: center;
    width: 66px;
    height: 66px;
    margin: 0 auto 16px;
    font-size: 1.8rem;
    color: #fff;
    background: var(--grad-brand);
    border-radius: 50%;
    box-shadow: 0 16px 30px -12px rgba(8, 103, 255, .8);
}

.welcome-card h3 {
    margin-bottom: 16px;
    font-size: 1.15rem;
    font-weight: 900;
    color: var(--ink);
}

.event-details {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.detail-item {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    font-size: .9rem;
    color: var(--ink-2);
}

.detail-item i {
    color: var(--primary-500);
    font-size: 1.05rem;
}

.user-info {
    margin-top: 16px;
    padding: 6px 18px;
    background: #fff;
    border: 1px solid var(--line);
    border-radius: var(--r-xl);
    box-shadow: var(--card-shadow);
}

.user-info h4 {
    margin: 14px 0 4px;
    font-size: .95rem;
    font-weight: 800;
    text-align: center;
    color: var(--ink);
}

.info-grid {
    display: flex;
    flex-direction: column;
}

.info-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 14px 0;
    border-bottom: 1px dashed var(--line);
}

.info-item:last-child {
    border-bottom: none;
}

.info-label {
    font-size: .9rem;
    font-weight: 400;
    color: var(--ink-2);
}

.info-value {
    font-size: .95rem;
    font-weight: 800;
    color: var(--ink);
}

#welcomePhoneNumber {
    direction: ltr;
    unicode-bidi: embed;
    text-align: inherit;
}

[dir="rtl"] #welcomePhoneNumber {
    text-align: right;
}

/* ------------------------------- Splash -------------------------------- */
.splash-screen {
    position: absolute;
    inset: 0;
    z-index: 9999;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 32px;
    text-align: center;
    background: var(--grad-app);
    transition: opacity 0.7s ease, visibility 0.7s ease;
}

.splash-screen::before,
.splash-screen::after {
    content: '';
    position: absolute;
    border-radius: 50%;
    pointer-events: none;
}

.splash-screen::before {
    top: -90px;
    right: -70px;
    width: 300px;
    height: 300px;
    background: radial-gradient(circle, rgba(46, 141, 255, .18), transparent 70%);
}

.splash-screen::after {
    bottom: -100px;
    left: -90px;
    width: 340px;
    height: 340px;
    background: radial-gradient(circle, rgba(110, 195, 255, .16), transparent 70%);
}

.splash-screen.hidden {
    opacity: 0;
    visibility: hidden;
}

.splash-logo {
    position: relative;
    width: 104px;
    height: auto;
    margin-bottom: 26px;
    filter: drop-shadow(0 16px 32px rgba(8, 103, 255, .25));
    animation: float-slow 6s ease-in-out infinite;
}

.splash-title {
    position: relative;
    font-size: 2.1rem;
    font-weight: 900;
    letter-spacing: -.5px;
    color: var(--ink);
}

.splash-subtitle {
    position: relative;
    margin-top: 8px;
    font-size: 1rem;
    font-weight: 300;
    color: var(--ink-2);
}

.loader-container {
    position: relative;
    margin-top: 46px;
}

.dots-loader {
    display: flex;
    justify-content: center;
    gap: 10px;
}

.dot {
    position: relative;
    width: 10px;
    height: 10px;
    overflow: hidden;
    background: rgba(8, 103, 255, .18);
    border-radius: 50%;
}

.dot::after {
    content: '';
    position: absolute;
    inset: 0;
    background: var(--primary-500);
    border-radius: 50%;
    transform: scale(0);
    animation: dotPulse 1.4s ease-in-out infinite;
}

.dot-1::after {
    animation-delay: 0s;
}

.dot-2::after {
    animation-delay: 0.2s;
}

.dot-3::after {
    animation-delay: 0.4s;
}

/* --------------------------- Popups / modals --------------------------- */
.alert-overlay {
    position: absolute;
    inset: 0;
    z-index: 9998;
    background: rgba(11, 22, 51, .45);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
}

.alert-overlay.show {
    opacity: 1;
    visibility: visible;
}

.registration-popup {
    position: absolute;
    top: 50%;
    left: 50%;
    z-index: 10000;
    width: min(86%, 336px);
    padding: 30px 24px;
    text-align: center;
    background: #fff;
    border: 1px solid var(--line);
    border-radius: var(--r-xl);
    box-shadow: var(--card-shadow-lg);
    transform: translate(-50%, -50%);
    display: none;
}

.registration-popup.show {
    display: block;
    animation: popIn 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.popup-icon {
    font-size: 3.6rem;
    line-height: 1;
    margin-bottom: 16px;
}

.popup-icon.success {
    color: var(--success-500);
    animation: checkmark 0.35s ease;
}

.popup-icon.error {
    color: var(--danger-500);
    animation: shake 0.5s ease;
}

.popup-title {
    margin-bottom: 10px;
    font-size: 1.25rem;
    font-weight: 900;
    color: var(--ink);
}

.popup-message {
    font-size: .92rem;
    font-weight: 300;
    line-height: 1.95;
    color: var(--ink-2);
}

/* registration loader is appended to <body> by app.js */
.registration-loading {
    position: fixed;
    top: 50%;
    left: 50%;
    z-index: 10000;
    width: min(88vw, 320px);
    padding: 28px 22px;
    text-align: center;
    background: #fff;
    border: 1px solid var(--line);
    border-radius: var(--r-xl);
    box-shadow: var(--card-shadow-lg);
    transform: translate(-50%, -50%);
    display: none;
}

.registration-loading.show {
    display: block;
    animation: popIn 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.registration-loading h3 {
    margin-bottom: 6px;
    font-size: 1.05rem;
    color: var(--ink);
}

.registration-loading p {
    font-size: .88rem;
    font-weight: 300;
    color: var(--ink-2);
}

.loading-spinner-large {
    width: 44px;
    height: 44px;
    margin: 0 auto 18px;
    border: 4px solid rgba(8, 103, 255, .15);
    border-top-color: var(--primary-500);
    border-radius: 50%;
    animation: spin 0.9s linear infinite;
}

.loading-spinner {
    display: inline-block;
    width: 16px;
    height: 16px;
    vertical-align: -2px;
    border: 2px solid rgba(255, 255, 255, 0.45);
    border-top-color: #fff;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

/* Alert / loading cards created by app.js.
   They carry their own inline styles, so their width is normalised here with
   !important so they always match the app column instead of the viewport. */
.success-alert,
.error-alert,
.print-loading {
    position: absolute;
    width: 0;
    height: 0;
    overflow: visible;
}

.success-alert > div,
.error-alert > div,
.print-loading > div {
    width: min(88vw, 340px) !important;
    max-width: 340px !important;
    padding: 24px !important;
    border: 1px solid var(--line) !important;
    border-radius: var(--r-xl) !important;
    box-shadow: var(--card-shadow-lg) !important;
}

.success-alert > div h3,
.error-alert > div h3 {
    font-size: 1.1rem;
    font-weight: 900;
}

.success-alert > div p,
.error-alert > div p {
    font-size: .92rem;
    font-weight: 300;
    line-height: 1.9;
    color: var(--ink-2);
}

.success-alert > div .btn-primary,
.error-alert > div .btn-primary,
.print-loading > div .btn-primary {
    margin-top: 18px;
}

/* Actually center those cards on the app column (not the whole viewport) */
.error-alert > div,
.success-alert > div,
.print-loading > div {
    left: 50% !important;
    top: 50% !important;
}

/* ------------------------------ Animations ----------------------------- */
@keyframes app-column-in {
    0% {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

@keyframes orb-drift {
    0%,
    to {
        transform: translate(0);
    }
    50% {
        transform: translateY(-18px);
    }
}

@keyframes float-slow {
    0%,
    to {
        transform: translate(0) scale(1);
    }
    50% {
        transform: translateY(-14px) scale(1.04);
    }
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(14px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes popIn {
    from {
        opacity: 0;
        transform: translate(-50%, -50%) scale(0.85);
    }
    to {
        opacity: 1;
        transform: translate(-50%, -50%) scale(1);
    }
}

@keyframes pulse {
    0%,
    100% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.06);
    }
}

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

@keyframes dotPulse {
    0%,
    60%,
    100% {
        transform: scale(0);
    }
    30% {
        transform: scale(1);
    }
}

@keyframes shake {
    0%,
    100% {
        transform: translateX(0);
    }
    10%,
    30%,
    50%,
    70%,
    90% {
        transform: translateX(-8px);
    }
    20%,
    40%,
    60%,
    80% {
        transform: translateX(8px);
    }
}

.shake {
    animation: shake 0.5s ease;
}

@keyframes checkmark {
    0% {
        transform: scale(0);
    }
    50% {
        transform: scale(1.2);
    }
    100% {
        transform: scale(1);
    }
}

/* ----------------------------- Focus states ---------------------------- */
.btn-primary:focus-visible,
.btn-secondary:focus-visible,
.btn-icon:focus-visible,
.custom-select:focus-visible,
.form-input:focus-visible {
    outline: 2px solid var(--primary-400);
    outline-offset: 2px;
}

/* the app's OTP boxes have no ring — they scale a little while focused */
.otp-input:focus-visible {
    outline: none;
}

::selection {
    background: var(--primary-100);
    color: var(--primary-900);
}

/* --------------------------- Responsive --------------------------------- */
/* phones: the app fills the whole screen, no black side bars */
@media (max-width: 767px) {
    .signic-app-column {
        max-width: 100%;
        box-shadow: none;
    }
}

@media (max-width: 400px) {
    .app-topbar {
        padding: 18px 20px 0;
    }

    .progress-bar {
        margin: 14px 20px 0;
    }

    .step-indicator {
        padding: 10px 20px 0;
    }

    .form-step {
        padding-left: 20px;
        padding-right: 20px;
    }

    .auth-logo img {
        height: 92px;
    }

    #step2 .auth-logo img {
        height: 120px;
    }

    .step-title {
        font-size: 1.4rem;
    }

    .btn-primary,
    .btn-secondary {
        padding-inline: 46px;
    }

    .otp-container {
        gap: 10px;
    }

    .otp-input {
        width: 62px;
        height: 62px;
        font-size: 1.6rem;
    }

    .date-selectors {
        grid-template-columns: 1fr 1fr;
    }
}

/* short screens: keep the hero compact */
@media (max-height: 700px) {
    .auth-logo img {
        height: 88px;
    }

    #step2 .auth-logo img {
        height: 104px;
    }

    .auth-header {
        margin-bottom: 16px;
    }

    .form-step {
        padding-top: 14px;
    }

    .loader-container {
        margin-top: 30px;
    }
}

@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.001ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.001ms !important;
    }

    /* keep the loading dots visible when animations are disabled */
    .dot::after {
        transform: scale(1);
    }
}

