/**
 * Auth screens — centered single column (matches mobile app)
 */

*, *::before, *::after {
    box-sizing: border-box;
}

html, body {
    margin: 0;
    padding: 0;
    width: 100%;
    min-height: 100%;
}

.hidden {
    display: none !important;
}

/* Top-aligned column (matches mobile signup / OTP screens) */
.auth-page {
    min-height: 100dvh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;
    padding: 16px 16px 32px;
    padding-top: max(16px, env(safe-area-inset-top, 0px));
    background: #ffffff;
}

.auth-page-inner {
    width: min(400px, 100%);
    display: flex;
    flex-direction: column;
    align-items: stretch;
    padding-top: 4px;
}

/* Uniform vertical rhythm */
.auth-form {
    display: flex;
    flex-direction: column;
    gap: 16px;
    width: 100%;
    margin: 0;
    padding: 0;
}

.auth-form .form-group,
.auth-form .phone-field {
    margin: 0;
    width: 100%;
}

/* Login brand */
.auth-brand-row {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 24px;
    width: 100%;
}

.auth-brand-icon {
    width: 40px;
    height: 40px;
    object-fit: contain;
    flex-shrink: 0;
}

.auth-brand-logo {
    max-height: 80px;
    width: auto;
    max-width: min(360px, 92vw);
    object-fit: contain;
    flex-shrink: 0;
}

.auth-brand-name {
    font-size: 20px;
    font-weight: 800;
    color: #1a1a1a;
    letter-spacing: -0.5px;
}

/* Signup header */
.signup-step-label {
    font-size: 14px;
    font-weight: 500;
    color: #1a1a1a;
    margin: 0 0 10px;
}

.signup-step-bars {
    display: flex;
    gap: 6px;
    margin: 0 0 16px;
    width: 100%;
}

.signup-step-bar {
    flex: 1;
    height: 4px;
    border-radius: 2px;
    background: #f0f0f2;
}

.signup-step-bar.active {
    background: var(--brand-color);
}

.auth-back-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    margin: 0 0 12px;
    color: #1a1a1a;
    text-decoration: none;
    border-radius: 50%;
}

.auth-back-link:hover {
    background: #f5f5f7;
}

.auth-page-title {
    font-size: 26px;
    font-weight: 800;
    color: #1a1a1a;
    letter-spacing: -0.5px;
    margin: 0 0 6px;
    line-height: 1.2;
}

.auth-page-subtitle {
    font-size: 14px;
    color: rgba(0, 0, 0, 0.45);
    margin: 0 0 24px;
    line-height: 1.45;
}

.auth-page-subtitle.tight {
    margin-bottom: 20px;
}

/* Name row */
.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
    width: 100%;
}

@media (max-width: 440px) {
    .form-row {
        grid-template-columns: 1fr;
    }
}

.form-label {
    display: block;
    font-size: 13px;
    font-weight: 600;
    color: rgba(0, 0, 0, 0.75);
    margin: 0 0 6px;
}

.form-input {
    display: block;
    width: 100%;
    padding: 14px 16px;
    font-size: 15px;
    border: 1px solid #e8e8e8;
    border-radius: 12px;
    background: #fafafa;
    color: #1a1a1a;
    outline: none;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.form-input::placeholder {
    color: #aaa;
}

.form-input:focus {
    border-color: var(--brand-color);
    background: #fff;
    box-shadow: 0 0 0 3px color-mix(in srgb, var(--brand-color) 10%, transparent);
}

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

.form-input-wrapper .form-input {
    padding-right: 48px;
}

.password-toggle {
    position: absolute;
    right: 14px;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    color: var(--brand-color);
    cursor: pointer;
    padding: 4px;
    font-size: 16px;
    line-height: 1;
}

.form-forgot {
    display: block;
    text-align: right;
    margin-top: 8px;
    font-size: 13px;
    font-weight: 600;
    color: var(--brand-color);
    text-decoration: none;
}

/* Phone field */
.phone-field {
    width: 100%;
}

.phone-input-wrap {
    display: flex;
    align-items: stretch;
    width: 100%;
    border: 1px solid #e8e8e8;
    border-radius: 12px;
    background: #fafafa;
    overflow: hidden;
}

.phone-input-wrap:focus-within {
    border-color: var(--brand-color);
    background: #fff;
    box-shadow: 0 0 0 3px color-mix(in srgb, var(--brand-color) 10%, transparent);
}

.phone-input-prefix {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 0 10px 0 14px;
    flex-shrink: 0;
}

.phone-flag {
    width: 21px;
    height: 21px;
    object-fit: contain;
}

.phone-dial {
    font-size: 15px;
    color: #1a1a1a;
    white-space: nowrap;
}

.phone-sep {
    width: 1px;
    height: 18px;
    background: rgba(0, 0, 0, 0.16);
}

.phone-input-field {
    flex: 1;
    min-width: 0;
    width: 100%;
    border: none;
    outline: none;
    padding: 14px 16px 14px 8px;
    font-size: 15px;
    background: transparent;
    color: #1a1a1a;
}

.phone-input-field::placeholder {
    color: #aaa;
}

/* Alerts */
.alert-box {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 12px 14px;
    border-radius: 12px;
    margin-bottom: 16px;
    font-size: 13px;
    line-height: 1.45;
    width: 100%;
}

.alert-box.error {
    background: #fef2f2;
    border: 1px solid #fecaca;
    color: #991b1b;
}

.alert-box.success {
    background: #f0fdf4;
    border: 1px solid #bbf7d0;
    color: #166534;
}

.alert-box.warning {
    background: #fffbeb;
    border: 1px solid #fde68a;
    color: #92400e;
}

.auth-password-requirements {
    padding: 12px 14px;
    border-radius: 12px;
    background: #f5f5f7;
    border: 1px solid #e8e8e8;
    font-size: 12px;
    color: rgba(0, 0, 0, 0.55);
}

.auth-password-requirements-title {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    font-weight: 600;
    color: rgba(0, 0, 0, 0.75);
    margin: 0 0 8px;
}

.auth-password-requirements-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 6px 12px;
}

.auth-password-requirements-grid span {
    display: flex;
    align-items: center;
    gap: 6px;
}

.auth-password-requirements-grid span.met {
    color: #16a34a;
}

.auth-password-requirements-grid span i {
    font-size: 8px;
}

.password-strength-wrap {
    margin-top: 8px;
}

.password-strength-bars {
    display: flex;
    gap: 4px;
    margin-bottom: 4px;
}

.password-strength-bar {
    height: 4px;
    flex: 1;
    background: #e8e8e8;
    border-radius: 2px;
    transition: background 0.2s;
}

.password-strength-bar.weak { background: #ef4444; }
.password-strength-bar.medium { background: #f59e0b; }
.password-strength-bar.strong { background: #22c55e; }

.password-strength-label {
    font-size: 12px;
    font-weight: 600;
}

.form-hint {
    margin-top: 6px;
    font-size: 12px;
}

.form-hint.match { color: #16a34a; }
.form-hint.mismatch { color: #dc2626; }

/* Button */
.btn-auth {
    width: 100%;
    padding: 16px 24px;
    font-size: 15px;
    font-weight: 600;
    color: #fff;
    background: var(--brand-color, #530567);
    border: none;
    border-radius: 12px;
    cursor: pointer;
    margin: 8px 0 0;
}

.btn-auth:hover:not(:disabled) {
    opacity: 0.92;
}

.btn-auth:disabled {
    opacity: 0.45;
    cursor: not-allowed;
}

.auth-footer {
    text-align: center;
    margin: 24px 0 0;
    padding: 0;
    font-size: 14px;
    color: rgba(0, 0, 0, 0.5);
    width: 100%;
}

.auth-footer a {
    color: var(--brand-color);
    font-weight: 700;
    text-decoration: none;
}

.form-error {
    margin-top: 6px;
    font-size: 12px;
    color: #dc2626;
}

/* OTP boxes — full width grid (signup / reset / 2FA) */
.otp-boxes {
    display: grid;
    grid-template-columns: repeat(6, 1fr);
    gap: 8px;
    width: 100%;
}

.otp-box {
    width: 100%;
    min-width: 0;
    height: 52px;
    padding: 0;
    font-size: 20px;
    font-weight: 700;
    text-align: center;
    border: 1px solid #e8e8e8;
    border-radius: 12px;
    background: #fafafa;
    color: #1a1a1a;
    outline: none;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.otp-box:focus {
    border-color: var(--brand-color);
    background: #fff;
    box-shadow: 0 0 0 3px color-mix(in srgb, var(--brand-color) 10%, transparent);
}

.otp-box.filled {
    border-color: color-mix(in srgb, var(--brand-color) 60%, #e8e8e8);
}

.otp-resend-row {
    margin-top: 16px;
    font-size: 14px;
    color: rgba(0, 0, 0, 0.55);
    line-height: 1.45;
}

.otp-resend-row a,
.otp-resend-row .resend-active {
    color: var(--brand-color);
    font-weight: 600;
    text-decoration: none;
}

.otp-resend-row a:hover {
    opacity: 0.85;
}

.otp-hidden-input {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    border: 0;
}

.auth-totp-hint {
    margin: 12px 0 0;
    font-size: 13px;
    color: rgba(0, 0, 0, 0.45);
    line-height: 1.45;
}

/* ─────────────────────────────────────────────────────────────────────────────
   Phone / tablet  (< 900 px)
   Tighter edges, left-aligned logo on login, no logo on signup.
   ───────────────────────────────────────────────────────────────────────────── */
@media (max-width: 899px) {
    body.auth-page {
        align-items: stretch;
        padding: 8px 12px 16px;
        padding-top: max(8px, env(safe-area-inset-top, 0px));
        padding-left: max(12px, env(safe-area-inset-left, 0px));
        padding-right: max(12px, env(safe-area-inset-right, 0px));
        padding-bottom: max(16px, env(safe-area-inset-bottom, 0px));
    }

    .auth-split,
    .auth-split-right {
        width: 100%;
    }

    .auth-page-inner {
        width: 100%;
        max-width: none;
        padding-top: 0;
    }

    .auth-brand-row {
        justify-content: flex-start;
        margin-bottom: 12px;
    }

    .auth-brand-logo {
        height: 40px;
        max-height: 40px;
        width: auto;
        max-width: 180px;
        object-fit: contain;
        object-position: left center;
    }

    .auth-signup .auth-brand-row {
        display: none;
    }

    .auth-signup .auth-back-link {
        margin-bottom: 8px;
    }

    .auth-page-subtitle {
        margin-bottom: 16px;
    }

    .auth-footer {
        margin-top: 16px;
    }
}

/* ─────────────────────────────────────────────────────────────────────────────
   Desktop split layout  (≥ 900 px)
   Left:  branded panel (~40 %)
   Right: form panel    (~60 %)
   Mobile: left panel hidden, form stays as-is
   ───────────────────────────────────────────────────────────────────────────── */

/* Mobile defaults — left panel and desktop header are invisible */
.auth-split-left { display: none; }
.auth-split-right-header { display: none; }

@media (min-width: 900px) {

    /* Replace the centred-column page layout with a side-by-side one */
    body.auth-page {
        display: block;
        padding: 0;
        background: #fff;
        min-height: 100dvh;
    }

    /* Full-viewport row */
    .auth-split {
        display: flex;
        flex-direction: row;
        min-height: 100dvh;
        width: 100%;
    }

    /* ── Left branding panel ─────────────────────────────────────────────── */
    .auth-split-left {
        display: flex;
        flex-direction: column;
        width: 40%;
        flex-shrink: 0;
        background: var(--brand-50, #faf5fc);
        position: relative;
        overflow: hidden;
        padding: 44px 48px 48px;
    }

    /* Logo row */
    .auth-split-left-logo {
        display: flex;
        align-items: center;
        gap: 10px;
        margin-bottom: 0;
    }

    .auth-split-logo-img {
        width: auto;
        max-width: 340px;
        height: auto;
        max-height: 96px;
        object-fit: contain;
        flex-shrink: 0;
    }

    .auth-split-logo-name {
        font-size: 18px;
        font-weight: 800;
        color: var(--brand-dark, #2a0135);
        letter-spacing: -0.4px;
    }

    /* Hero content */
    .auth-split-left-body {
        margin-top: auto;
        margin-bottom: auto;
        padding: 40px 0;
        position: relative;
        z-index: 1;
    }

    .auth-split-headline {
        font-size: clamp(26px, 2.6vw, 36px);
        font-weight: 800;
        color: #1a1a1a;
        line-height: 1.2;
        letter-spacing: -0.5px;
        margin: 0 0 28px;
    }

    .auth-split-headline-brand {
        color: var(--brand-color, #530567);
    }

    /* Feature list */
    .auth-split-features {
        list-style: none;
        margin: 0;
        padding: 0;
        display: flex;
        flex-direction: column;
        gap: 14px;
    }

    .auth-split-features li {
        display: flex;
        align-items: flex-start;
        gap: 10px;
        font-size: 14px;
        color: #333;
        line-height: 1.4;
    }

    .auth-split-check {
        display: flex;
        align-items: center;
        justify-content: center;
        width: 22px;
        height: 22px;
        min-width: 22px;
        border-radius: 6px;
        background: var(--brand-color, #530567);
        flex-shrink: 0;
        margin-top: 1px;
    }

    .auth-split-check i {
        color: #fff;
        font-size: 11px;
    }

    /* Decorative diagonal shapes */
    .auth-split-deco {
        position: absolute;
        border-radius: 16px;
        opacity: 0.18;
        pointer-events: none;
        background: var(--brand-color, #530567);
    }

    .auth-split-deco-1 {
        width: 260px;
        height: 260px;
        top: -80px;
        right: -80px;
        transform: rotate(25deg);
        border-radius: 32px;
    }

    .auth-split-deco-2 {
        width: 180px;
        height: 180px;
        bottom: 60px;
        right: -50px;
        transform: rotate(18deg);
        border-radius: 24px;
    }

    .auth-split-deco-3 {
        width: 120px;
        height: 120px;
        top: 45%;
        left: -40px;
        transform: rotate(-12deg);
        border-radius: 20px;
        opacity: 0.10;
    }

    /* ── Right form panel ────────────────────────────────────────────────── */
    .auth-split-right {
        flex: 1;
        display: flex;
        flex-direction: column;
        align-items: center;
        justify-content: center;
        padding: 32px 48px;
        position: relative;
        background: #fff;
    }

    /* Top-right nav link (e.g. "Already have an account? Log In") */
    .auth-split-right-header {
        display: block;
        position: absolute;
        top: 24px;
        right: 36px;
        font-size: 14px;
        color: rgba(0, 0, 0, 0.50);
        white-space: nowrap;
    }

    .auth-split-right-header a {
        color: var(--brand-color, #530567);
        font-weight: 700;
        text-decoration: none;
    }

    .auth-split-right-header a:hover {
        opacity: 0.8;
    }

    /* auth-page-inner already constrains to 400 px — keep on desktop */
    .auth-split-right .auth-page-inner {
        padding-top: 0;
        width: min(440px, 100%);
    }

    /* Hide mobile footer link — it's replaced by top-right header on desktop */
    .auth-split-right .auth-footer {
        display: none;
    }

    /* Brand row (used on login) is redundant when logo is in left panel */
    .auth-split-right .auth-brand-row {
        display: none;
    }
}

