/*
(c) Spacehubs Africa. All rights reserved.
Licensed under the Proprietary License found in the LICENSE file
in the root directory of this source tree.
*/

/* Shared auth/form page styles */

.form-stack {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.field-stack {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.form-title {
    color: var(--text-primary);
    font-size: 1.875rem;
    font-weight: 700;
    line-height: 1.2;
}

.form-support-copy {
    color: var(--text-muted);
    font-size: 0.875rem;
    line-height: 1.5;
}

.form-link {
    color: var(--color-sha-indigo);
    font-weight: 500;
    transition: color 0.2s ease;
}

.form-link:hover {
    color: var(--color-sha-indigo-text);
}

.form-alert {
    border-radius: 0.75rem;
    border-inline-start: 4px solid transparent;
    padding: 0.875rem 1rem;
}

.form-alert p,
.form-alert ul {
    margin: 0;
}

.form-alert ul {
    padding-inline-start: 1rem;
}

.form-alert-error {
    background: var(--color-sha-red-bg);
    border-color: var(--color-sha-red-border);
    color: var(--color-sha-red-text);
}

.field-error {
    color: var(--color-sha-red-text);
    font-size: 0.75rem;
    line-height: 1.4;
}

.form-input,
.form-select {
    color: var(--text-primary);
    width: 100%;
    border: 1px solid var(--border-input);
    border-radius: 0.75rem;
    background: var(--surface);
    transition: border-color 0.2s ease, box-shadow 0.2s ease, background-color 0.2s ease;
}

.form-input {
    display: block;
    padding: 0.875rem 0.75rem 0.875rem 2.5rem;
    font-size: 0.875rem;
    font-weight: 300;
}

.form-select {
    appearance: none;
    display: block;
    padding: 0.875rem 2.5rem 0.875rem 2.5rem;
    font-size: 0.875rem;
    font-weight: 300;
}

.form-input::placeholder {
    color: var(--text-subtle);
}

.floating-field {
    position: relative;
}

.floating-input::placeholder {
    color: transparent;
}

.floating-label {
    position: absolute;
    inset-inline-start: 2.5rem;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-subtle);
    font-size: 0.875rem;
    font-weight: 400;
    line-height: 1;
    pointer-events: none;
    background: var(--surface);
    padding: 0 0.25rem;
    transition:
        top 0.18s ease,
        transform 0.18s ease,
        color 0.18s ease,
        font-size 0.18s ease;
}

.floating-field.is-active .floating-label,
.floating-input:focus + .floating-label,
.floating-select:focus + .floating-label {
    top: 0.7rem;
    transform: translateY(0);
    color: var(--text-muted);
    font-size: 0.6875rem;
}

.floating-field .toggle-visibility {
    top: 58%;
}

.form-input:focus,
.form-select:focus {
    outline: none;
    border-color: var(--color-sha-indigo-border);
    box-shadow: 0 0 0 3px color-mix(in srgb, var(--color-sha-indigo) 16%, transparent);
}

.form-input.has-error,
.form-select.has-error {
    border-color: var(--color-sha-red-border);
    background: color-mix(in srgb, var(--color-sha-red-bg) 45%, var(--surface));
}

.form-checkbox {
    height: 1rem;
    width: 1rem;
    border-radius: 0.25rem;
    border: 1px solid var(--border-strong);
    color: var(--color-sha-indigo);
}

.form-checkbox-label {
    color: var(--text-muted);
    font-size: 0.875rem;
    line-height: 1.5;
}

.form-submit-btn {
    width: 100%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    border: 1px solid transparent;
    border-radius: 0.75rem;
    background: var(--color-sha-indigo);
    color: var(--text-inverse);
    padding: 0.875rem 1rem;
    font-size: 0.875rem;
    font-weight: 600;
    line-height: 1.2;
    box-shadow: 0 10px 25px -18px color-mix(in srgb, var(--color-sha-indigo-text) 90%, transparent);
    transition: background-color 0.2s ease, box-shadow 0.2s ease, opacity 0.2s ease;
}

.form-submit-btn:hover {
    background: var(--color-sha-indigo-text);
}

.form-submit-btn:focus {
    outline: none;
    box-shadow: 0 0 0 3px var(--focus-ring);
}

.form-submit-btn:disabled {
    opacity: 0.75;
    cursor: not-allowed;
}

.form-divider {
    position: relative;
}

.form-divider::before {
    content: "";
    position: absolute;
    inset: 50% 0 auto;
    border-top: 1px solid var(--border-input);
}

.form-divider-label {
    position: relative;
    display: inline-flex;
    justify-content: center;
    padding: 0 0.5rem;
    background: var(--surface);
    color: var(--text-subtle);
    font-size: 0.875rem;
}

.input-field:focus {
    box-shadow: 0 0 0 3px var(--focus-ring);
}

.card-shadow {
    box-shadow:
        0 8px 16px -5px var(--shadow-md),
        0 10px 10px -5px var(--shadow-sm);
}

/* ── Split auth layout: form column + branded panel ──────────────────────────
   Shared by all auth pages via base_form.html. Pre-auth / login-flow pages get
   the brand panel (.has-brand); post-login settings pages omit it and collapse
   to a single centred column. */
.auth-shell {
    margin-top: 4rem; /* clear the fixed h-16 header */
    min-height: calc(100vh - 4rem);
    display: grid;
    grid-template-columns: 1fr;
}

.auth-form-col {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 3rem 1.5rem;
}

@media (min-width: 1024px) {
    .auth-form-col {
        padding: 3rem 3.5rem;
    }
}

.auth-brand-panel {
    display: none; /* hidden on mobile; the form is the hero */
}

@media (min-width: 1024px) {
    .auth-shell.has-brand {
        grid-template-columns: 1.05fr minmax(0, 1fr);
    }

    .auth-brand-panel {
        position: relative;
        overflow: hidden;
        display: flex;
        flex-direction: column;
        justify-content: center;
        gap: 1.5rem;
        padding: 4rem;
        color: var(--text-inverse);
        /* Richer, deeper gradient: indigo glow top-left, warm gold horizon
           glow bottom-right, anchored on a near-navy base derived from the
           palette (no hardcoded brand colours). */
        background:
            radial-gradient(1100px circle at 8% -8%,
                color-mix(in srgb, var(--color-sha-indigo-border) 55%, transparent), transparent 50%),
            radial-gradient(900px circle at 92% 112%,
                color-mix(in srgb, var(--color-sha-gold) 20%, transparent), transparent 46%),
            linear-gradient(155deg,
                color-mix(in srgb, var(--color-sha-indigo-text) 82%, var(--surface-inverse)) 0%,
                var(--color-sha-indigo-text) 38%,
                var(--color-sha-indigo) 100%);
    }

    /* Decorative layers sit behind the content. */
    .auth-brand-panel > * {
        position: relative;
        z-index: 1;
    }

    /* Africa-centric globe (with network arcs) sitting in the lower-right
       corner. Blended into the gradient and radial-masked to a circle so the
       source image's white corners are cut away, leaving just the planet. */
    .auth-brand-panel::before {
        content: "";
        position: absolute;
        inset: 0;
        z-index: 0;
        pointer-events: none;
        background-image: url("../images/earth.db3f2f5ae1bb.png");
        background-repeat: no-repeat;
        background-position: center right -60px;
        background-size: 900px auto;
        opacity: 0.20;
        mix-blend-mode: screen;
        -webkit-mask-image: radial-gradient(circle at 60% 50%, #000 0 40%, transparent 72%);
                mask-image: radial-gradient(circle at 60% 50%, #000 0 40%, transparent 72%);
    }

    /* Subtle film grain to kill gradient banding and add a premium finish. */
    .auth-brand-panel::after {
        content: "";
        position: absolute;
        inset: 0;
        z-index: 0;
        opacity: 0.06;
        pointer-events: none;
        mix-blend-mode: overlay;
        background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='180' height='180'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
    }
}

.auth-brand-eyebrow {
    font-size: 0.75rem;
    font-weight: 600;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: color-mix(in srgb, var(--text-inverse) 75%, transparent);
}

.auth-brand-title {
    margin-top: 0.75rem;
    font-size: 2.25rem;
    line-height: 1.15;
    font-weight: 700;
}

.auth-brand-lede {
    margin-top: 1rem;
    max-width: 26rem;
    font-size: 0.95rem;
    line-height: 1.6;
    color: color-mix(in srgb, var(--text-inverse) 82%, transparent);
}

.auth-brand-list {
    margin-top: 2rem;
    display: flex;
    flex-direction: column;
    gap: 1rem;
    list-style: none;
    padding: 0;
}

.auth-brand-item {
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
    font-size: 0.9rem;
    color: color-mix(in srgb, var(--text-inverse) 88%, transparent);
}

.auth-brand-item i {
    margin-top: 0.15rem;
    color: var(--color-sha-gold-border);
}

.auth-brand-footer {
    font-size: 0.75rem;
    line-height: 1.5;
    color: color-mix(in srgb, var(--text-inverse) 62%, transparent);
}

/* Prevent browser autofill from tinting form fields */
input:-webkit-autofill,
input:-webkit-autofill:hover,
input:-webkit-autofill:focus,
input:-webkit-autofill:active {
    -webkit-box-shadow: 0 0 0 1000px var(--surface) inset;
    -webkit-text-fill-color: var(--text-primary);
    transition: background-color 9999s ease-in-out 0s;
}

/* Password field with show/hide toggle */
.password-field { position: relative; }
.password-field input { padding-inline-end: 3rem; }
.toggle-visibility {
    position: absolute;
    inset-inline-end: 0.75rem;
    top: 50%;
    transform: translateY(-50%);
    background: transparent;
    border: none;
    cursor: pointer;
    color: var(--text-subtle);
}
.toggle-visibility:focus { outline: none; }

/* Password strength bar */
.strength-bar {
    height: 5px;
    border-radius: 9999px;
    background: var(--border);
    overflow: hidden;
}
.strength-bar > span {
    display: block;
    height: 100%;
    width: 0;
    transition: width 250ms ease-in-out, background 250ms ease-in-out;
}
