/**
 * FinchBridge login & auth pages — premium split-screen layout
 */

body.auth-page:has(.vds-page--login),
body.auth-page:has(.vds-page--register) {
    background: var(--background);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

body.auth-page:has(.vds-page--login) .site-footer,
body.auth-page:has(.vds-page--register) .site-footer {
    display: none;
}

.vds-page--login .vds-page-container,
.vds-page--register .vds-page-container {
    width: 100%;
    max-width: none;
    padding: 0;
    flex: 1;
    display: flex;
}

.vds-page--login,
.vds-page--register {
    min-height: 100vh;
    flex: 1;
    display: flex;
    width: 100%;
}

.vds-auth {
    --auth-primary: var(--primary);
    --auth-primary-dark: var(--primary-hover);
    --auth-accent: var(--accent);
    --auth-card-radius: var(--radius-xl);
    --auth-input-radius: var(--radius-md);
}

.vds-auth {
    position: relative;
    flex: 1;
    width: 100%;
    min-height: 100vh;
    overflow: hidden;
    animation: vds-auth-fade-in 0.5s ease both;
}

.vds-auth__layout {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

/* ---- Brand panel (left on desktop) ---- */

.vds-auth__brand-panel {
    position: relative;
    display: flex;
    flex-direction: column;
    justify-content: center;
    padding: clamp(2.5rem, 6vw, 4rem);
    background:
        linear-gradient(145deg, var(--primary) 0%, var(--signin-primary-mid) 45%, var(--accent) 100%);
    color: var(--text-inverse);
    overflow: hidden;
}

.vds-auth__brand-panel::before {
    content: "";
    position: absolute;
    inset: 0;
    background:
        radial-gradient(circle at 20% 30%, rgba(255, 255, 255, 0.15) 0%, transparent 45%),
        radial-gradient(circle at 80% 70%, rgba(255, 255, 255, 0.08) 0%, transparent 40%);
    pointer-events: none;
}

.vds-auth__brand-content {
    position: relative;
    z-index: 1;
    max-width: 28rem;
}

.vds-auth__brand-logo {
    display: inline-flex;
    align-items: center;
    gap: 0.625rem;
    margin-bottom: 1.5rem;
    font-size: 1.25rem;
    font-weight: var(--weight-extrabold);
    letter-spacing: -0.02em;
    color: var(--text-inverse);
    text-decoration: none;
}

.vds-auth__brand-logo img {
    width: 2.75rem;
    height: 2.75rem;
    filter: brightness(0) invert(1);
}

.vds-auth__brand-heading {
    margin: 0 0 0.75rem;
    font-size: clamp(1.5rem, 3.5vw, 2rem);
    font-weight: var(--weight-extrabold);
    line-height: 1.15;
    letter-spacing: -0.02em;
}

.vds-auth__brand-text {
    margin: 0 0 2rem;
    font-size: 1.0625rem;
    line-height: 1.65;
    color: rgba(255, 255, 255, 0.88);
}

.vds-auth__brand-illustration {
    width: 100%;
    max-width: 22rem;
    height: auto;
    opacity: 0.95;
}

.vds-auth__brand-features {
    list-style: none;
    margin: 2rem 0 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 0.875rem;
}

.vds-auth__brand-feature {
    display: flex;
    align-items: center;
    gap: 0.625rem;
    font-size: var(--font-body);
    font-weight: var(--weight-medium);
    color: rgba(255, 255, 255, 0.9);
}

/* ---- Form panel (right on desktop) ---- */

.vds-auth__form-panel {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: clamp(1.5rem, 4vw, 3rem);
    background: var(--background);
}

.vds-auth__card {
    width: 100%;
    max-width: 26rem;
    padding: clamp(2rem, 4vw, 2.75rem);
    background: rgba(255, 255, 255, 0.88);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid rgba(255, 255, 255, 0.9);
    border-radius: var(--auth-card-radius);
    box-shadow: var(--shadow-xl);
    animation: vds-auth-card-in 0.6s cubic-bezier(0.22, 1, 0.36, 1) 0.08s both;
}

.vds-auth__card-logo {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 4rem;
    height: 4rem;
    margin: 0 auto 1.25rem;
    border-radius: 50%;
    background: linear-gradient(145deg, rgba(99, 102, 241, 0.14) 0%, rgba(139, 92, 246, 0.08) 100%);
    box-shadow: var(--shadow-sm);
}

.vds-auth__card-logo img {
    width: 2.25rem;
    height: 2.25rem;
}

.vds-auth__card-brand {
    margin: 0 0 0.25rem;
    font-size: 1.25rem;
    font-weight: var(--weight-extrabold);
    text-align: center;
    letter-spacing: -0.02em;
    color: var(--text-primary);
}

.vds-auth__card-title {
    margin: 0 0 0.375rem;
    font-size: clamp(1.375rem, 2.5vw, 1.625rem);
    font-weight: var(--weight-extrabold);
    text-align: center;
    letter-spacing: -0.02em;
    color: var(--text-primary);
}

.vds-auth__card-lead {
    margin: 0 0 1.75rem;
    font-size: 1rem;
    text-align: center;
    color: var(--text-muted);
}

/* ---- Form ---- */

.vds-auth__form {
    display: flex;
    flex-direction: column;
    gap: 1.125rem;
}

.vds-auth__field-wrap {
    position: relative;
}

.vds-auth__field-wrap .vds-field {
    margin-bottom: 0;
}

.vds-auth__field-wrap .vds-label {
    display: block;
    margin-bottom: 0.5rem;
    font-size: 0.875rem;
    font-weight: var(--weight-semibold);
    color: var(--text-primary);
}

.vds-auth__field-icon {
    position: absolute;
    left: 0.875rem;
    top: 1.875rem;
    z-index: 2;
    color: var(--text-muted);
    pointer-events: none;
    transition: color var(--transition);
}

.vds-auth__field-wrap:focus-within .vds-auth__field-icon {
    color: var(--primary);
}

.vds-auth__input {
    width: 100%;
    min-height: 2.375rem;
    padding: 0.5rem 0.875rem 0.5rem 2.5rem;
    font-size: var(--font-body);
    color: var(--text-primary);
    background: var(--surface);
    border: 1.5px solid var(--border);
    border-radius: var(--auth-input-radius);
    transition: border-color var(--transition), box-shadow var(--transition);
}

.vds-auth__input:not(.vds-auth__input--icon) {
    padding-left: 1rem;
}

.vds-auth__input:hover {
    border-color: var(--border-strong);
}

.vds-auth__input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 4px rgba(79, 70, 229, 0.12);
}

.vds-auth__form-row {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: var(--space-3);
}

.vds-auth__form-row .vds-field {
    margin-bottom: 0;
}

.vds-auth__forgot {
    font-size: 0.875rem;
    font-weight: var(--weight-semibold);
    color: var(--primary);
    text-decoration: none;
}

.vds-auth__forgot:hover {
    color: var(--primary-hover);
    text-decoration: underline;
}

.vds-auth__submit {
    min-height: 2.375rem;
    font-size: 0.875rem;
    font-weight: var(--weight-bold);
    border-radius: var(--radius-md);
    border: none;
    background: linear-gradient(135deg, var(--primary) 0%, var(--secondary) 100%);
    box-shadow: 0 10px 24px rgba(79, 70, 229, 0.28);
    transition: transform var(--transition), box-shadow var(--transition);
}

.vds-auth__submit.vds-btn--primary {
    background: linear-gradient(135deg, var(--primary) 0%, var(--secondary) 100%);
    border-color: transparent;
    color: var(--text-inverse);
}

.vds-auth__submit:not(:disabled):hover {
    transform: translateY(-2px);
    box-shadow: 0 14px 32px rgba(79, 70, 229, 0.34);
}

.vds-auth__footer-link {
    margin-top: 1.25rem;
    text-align: center;
    font-size: var(--font-body);
    color: var(--text-muted);
}

.vds-auth__footer-link a {
    font-weight: var(--weight-semibold);
    color: var(--primary);
    text-decoration: none;
}

.vds-auth__footer-link a:hover {
    text-decoration: underline;
}

.vds-auth__trust {
    margin-top: 1.5rem;
    padding-top: 1.25rem;
    border-top: 1px solid var(--border);
}

.vds-auth__trust-text {
    margin: 0 0 0.75rem;
    font-size: var(--font-small);
    font-weight: var(--weight-semibold);
    text-align: center;
    color: var(--text-muted);
}

.vds-auth__trust-badges {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: var(--space-2);
    list-style: none;
    margin: 0;
    padding: 0;
}

.vds-auth__trust-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    padding: 0.375rem 0.75rem;
    font-size: var(--font-label);
    font-weight: var(--weight-bold);
    color: var(--text-primary);
    background: var(--surface-muted);
    border-radius: var(--radius-full);
}

.vds-auth__form .vds-alert {
    border-radius: var(--radius-md);
    margin-bottom: 0;
}

/* Register-specific */

.vds-auth__card--wide {
    max-width: 36rem;
}

.vds-auth__card--wide .vds-form-layout {
    --bs-gutter-x: 1rem;
}

@keyframes vds-auth-fade-in {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes vds-auth-card-in {
    from {
        opacity: 0;
        transform: translateY(1rem) scale(0.99);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

@media (min-width: 992px) {
    .vds-auth__layout {
        flex-direction: row;
    }

    .vds-auth__brand-panel {
        flex: 1 1 50%;
        min-height: 100vh;
    }

    .vds-auth__form-panel {
        flex: 1 1 50%;
        min-height: 100vh;
    }
}

@media (max-width: 991.98px) {
    .vds-auth__layout {
        flex-direction: column-reverse;
    }

    .vds-auth__brand-panel {
        padding: 2rem 1.5rem;
    }

    .vds-auth__brand-illustration {
        display: none;
    }
}

@media (prefers-reduced-motion: reduce) {
    .vds-auth,
    .vds-auth__card {
        animation: none;
    }

    .vds-auth__submit:not(:disabled):hover {
        transform: none;
    }
}

/* ---- Password setup (force change / reset / invite) ---- */

body.auth-page:has(.vds-page--password-setup) {
    background: var(--background);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

body.auth-page:has(.vds-page--password-setup) .site-footer {
    display: none;
}

.vds-page--password-setup .vds-page-container {
    width: 100%;
    max-width: none;
    padding: 0;
    flex: 1;
    display: flex;
}

.vds-page--password-setup {
    min-height: 100vh;
    flex: 1;
    display: flex;
    width: 100%;
}

.vds-auth--password-setup .vds-auth__form-panel {
    background:
        radial-gradient(circle at 12% 18%, rgba(99, 102, 241, 0.08) 0%, transparent 42%),
        radial-gradient(circle at 88% 82%, rgba(14, 165, 233, 0.07) 0%, transparent 40%),
        linear-gradient(180deg, var(--background) 0%, var(--fb-appt-purple-soft) 55%, var(--background) 100%);
}

.vds-auth--password-setup .vds-auth__card--password {
    max-width: 28rem;
    padding: clamp(2.25rem, 4.5vw, 3rem);
    border-radius: var(--radius-2xl);
    box-shadow:
        0 1px 2px rgba(15, 23, 42, 0.04),
        0 18px 48px rgba(79, 70, 229, 0.12);
    border: 1px solid rgba(226, 232, 240, 0.95);
    background: rgba(255, 255, 255, 0.96);
}

.vds-auth__card-support {
    margin: -0.75rem 0 1.5rem;
    font-size: var(--font-body);
    text-align: center;
    color: var(--text-muted);
}

.vds-auth__account-email {
    margin: 0 0 0.25rem;
    padding: 0.75rem 1rem;
    font-size: var(--font-body);
    text-align: center;
    color: var(--text-primary);
    background: rgba(99, 102, 241, 0.06);
    border-radius: var(--radius-md);
}

.vds-auth__input--lg {
    min-height: 3.15rem;
    padding: 0.75rem 4.25rem 0.75rem 1rem;
    font-size: 1.0625rem;
}

.vds-auth__password-control {
    position: relative;
}

.vds-auth__password-toggle {
    position: absolute;
    top: 50%;
    right: 0.5rem;
    transform: translateY(-50%);
    min-height: 2.5rem;
    min-width: 3.5rem;
    padding: 0.35rem 0.75rem;
    border: 0;
    border-radius: var(--radius-md);
    background: transparent;
    color: var(--primary);
    font-size: 0.875rem;
    font-weight: var(--weight-semibold);
    cursor: pointer;
}

.vds-auth__password-toggle:hover,
.vds-auth__password-toggle:focus-visible {
    background: rgba(79, 70, 229, 0.08);
    outline: none;
}

.vds-auth__password-toggle:focus-visible {
    box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.25);
}

.vds-auth__strength {
    margin-top: 0.75rem;
}

.vds-auth__strength-track {
    height: 0.4rem;
    border-radius: var(--radius-full);
    background: var(--border);
    overflow: hidden;
}

.vds-auth__strength-fill {
    display: block;
    height: 100%;
    width: 0;
    border-radius: inherit;
    transition: width 0.2s ease, background-color 0.2s ease;
}

.vds-auth__strength-fill.is-weak { background: var(--danger); }
.vds-auth__strength-fill.is-fair { background: var(--warning); }
.vds-auth__strength-fill.is-good { background: #3b82f6; }
.vds-auth__strength-fill.is-strong { background: var(--success); }

.vds-auth__strength-label {
    margin: 0.35rem 0 0;
    font-size: var(--font-small);
    font-weight: var(--weight-semibold);
}

.vds-auth__strength-label.is-weak { color: #b91c1c; }
.vds-auth__strength-label.is-fair { color: #b45309; }
.vds-auth__strength-label.is-good { color: #1d4ed8; }
.vds-auth__strength-label.is-strong { color: #047857; }

.vds-auth__checklist {
    list-style: none;
    margin: 0.75rem 0 0;
    padding: 0;
    display: grid;
    gap: 0.35rem;
}

.vds-auth__checklist li {
    position: relative;
    padding-left: 1.5rem;
    font-size: 0.875rem;
    color: var(--text-muted);
}

.vds-auth__checklist li::before {
    content: "";
    position: absolute;
    left: 0;
    top: 0.35rem;
    width: 0.85rem;
    height: 0.85rem;
    border-radius: 50%;
    border: 1.5px solid var(--border-strong);
    background: var(--surface);
}

.vds-auth__checklist li.is-met {
    color: #047857;
    font-weight: var(--weight-medium);
}

.vds-auth__checklist li.is-met::before {
    border-color: var(--success);
    background: var(--success);
    box-shadow: inset 0 0 0 2px var(--surface);
}

.vds-auth__match-hint {
    margin: 0.5rem 0 0;
    font-size: 0.875rem;
}

.vds-auth__match-hint.is-ok { color: #047857; }
.vds-auth__match-hint.is-error { color: #b91c1c; }

.vds-auth__success {
    text-align: center;
}

.vds-auth__success-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 3.5rem;
    height: 3.5rem;
    margin: 0 auto 1.25rem;
    border-radius: 50%;
    color: #047857;
    background: rgba(16, 185, 129, 0.12);
    font-size: 1.75rem;
}

.vds-auth__brand-abstract {
    position: absolute;
    right: -3rem;
    bottom: -2rem;
    width: 16rem;
    height: 16rem;
    border-radius: 40% 60% 55% 45%;
    background:
        radial-gradient(circle at 30% 30%, rgba(255, 255, 255, 0.28) 0%, transparent 55%),
        radial-gradient(circle at 70% 70%, rgba(14, 165, 233, 0.22) 0%, transparent 50%);
    opacity: 0.9;
    pointer-events: none;
}

.vds-auth--password-setup .vds-auth__brand-content {
    position: relative;
}

.vds-auth--password-setup .vds-auth__brand-panel {
    background:
        linear-gradient(155deg, #3730a3 0%, var(--primary) 42%, var(--info) 100%);
}

.vds-auth--password-setup .vds-auth__submit {
    min-height: 3.15rem;
    font-size: 1.0625rem;
    margin-top: 0.5rem;
}

@media (max-width: 991.98px) {
    .vds-auth__brand-abstract {
        display: none;
    }
}
