/* Shared styles for the auth pages: login, signup, reset password. */

:root {
    color-scheme: dark;
    --accent: #19c98b;
    --accent-bright: #25dfa0;
    --surface: rgb(17 23 24 / 0.96);
    --surface-deep: #080d0d;
    --line: rgb(103 126 123 / 0.34);
    font-family:
        Inter,
        ui-sans-serif,
        system-ui,
        -apple-system,
        BlinkMacSystemFont,
        "Segoe UI",
        sans-serif;
}

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

body {
    min-height: 100svh;
    margin: 0;
    display: grid;
    place-items: center;
    overflow-x: hidden;
    background:
        radial-gradient(
            circle at 50% 52%,
            rgb(17 99 70 / 0.16),
            transparent 31rem
        ),
        linear-gradient(145deg, #070b0b 0%, #030606 100%);
    color: #f4f4f5;
    padding: 2rem 1rem max(2rem, env(safe-area-inset-bottom));
}

main {
    position: relative;
    z-index: 1;
    width: 100%;
    max-width: 26.5rem;
    border: 1px solid var(--line);
    border-radius: 1.85rem;
    background: var(--surface);
    box-shadow:
        0 2rem 5rem rgb(0 0 0 / 0.55),
        inset 0 1px 0 rgb(255 255 255 / 0.025);
    padding: 2.65rem 1.85rem 2.25rem;
    backdrop-filter: blur(20px);
}

main::before {
    position: absolute;
    z-index: -1;
    inset: -1px;
    border-radius: inherit;
    background: linear-gradient(
        145deg,
        rgb(255 255 255 / 0.05),
        transparent 36%
    );
    content: "";
    pointer-events: none;
}

.auth-locale-switch {
    position: absolute;
    top: 1rem;
    right: 1.2rem;
    color: var(--accent-bright);
    font-size: 0.8rem;
    font-weight: 700;
    text-decoration: none;
    padding: 0.35rem;
}

.auth-locale-switch:hover,
.auth-locale-switch:focus-visible {
    text-decoration: underline;
}

.brand {
    display: grid;
    width: 100%;
    grid-template-columns: 1fr auto 1fr;
    align-items: baseline;
    gap: 0.48rem;
    margin: 0;
    font-size: clamp(1.75rem, 7vw, 2.15rem);
    font-weight: 760;
    letter-spacing: 0.16em;
    color: #fff;
    text-align: center;
}

.brand-prefix {
    justify-self: end;
    color: rgb(170 180 178);
    font-size: 0.46em;
    font-weight: 560;
    letter-spacing: 0;
    text-transform: lowercase;
}

.subtitle {
    margin: 0.45rem 0 0;
    font-size: 0.98rem;
    line-height: 1.45;
    color: rgb(170 180 178);
    text-align: center;
}

.message {
    display: none;
    margin-top: 1rem;
    border: 1px solid rgb(63 63 70);
    border-radius: 0.75rem;
    padding: 0.7rem 0.9rem;
    font-size: 0.83rem;
    line-height: 1.45;
    color: rgb(212 212 216);
    background: rgb(9 9 11);
}

.message-error {
    border-color: rgb(239 68 68 / 0.6);
    color: rgb(254 202 202);
    background: rgb(127 29 29 / 0.22);
}

.message-ok {
    border-color: rgb(16 185 129 / 0.55);
    color: rgb(187 247 208);
    background: rgb(20 83 45 / 0.22);
}

.message-visible {
    display: block;
}

/* ── Form layout ── */

.form {
    display: flex;
    flex-direction: column;
    gap: 1.1rem;
    margin-top: 2rem;
}

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

.field-header {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 0.5rem;
}

.field-label {
    font-size: 0.96rem;
    font-weight: 650;
    color: rgb(236 240 239);
}

.forgot-btn {
    border: none;
    background: none;
    padding: 0;
    font: inherit;
    font-size: 0.9rem;
    font-weight: 550;
    color: var(--accent);
    cursor: pointer;
    flex-shrink: 0;
    transition: color 140ms ease;
}

.forgot-btn:hover {
    color: var(--accent-bright);
}

input[type="text"],
input[type="email"],
input[type="password"] {
    width: 100%;
    min-height: 4rem;
    appearance: none;
    border: 1px solid rgb(87 103 101 / 0.38);
    border-radius: 1rem;
    background: var(--surface-deep);
    color: #fafafa;
    font: inherit;
    font-size: 1rem;
    padding: 0.9rem 1rem;
    outline: none;
    transition:
        border-color 160ms ease,
        box-shadow 160ms ease,
        background 160ms ease;
}

input[type="text"]:focus,
input[type="email"]:focus,
input[type="password"]:focus {
    border-color: var(--accent);
    background: #07100d;
    box-shadow: 0 0 0 4px rgb(25 201 139 / 0.13);
}

/* ── Buttons ── */

.btn-primary {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.72rem;
    width: 100%;
    border: none;
    min-height: 4.15rem;
    border-radius: 1rem;
    background: var(--accent);
    color: #031b13;
    font: inherit;
    font-size: 1.05rem;
    font-weight: 750;
    padding: 0.9rem 1rem;
    cursor: pointer;
    transition:
        background-color 160ms ease,
        transform 160ms ease,
        box-shadow 160ms ease;
    margin-top: 0.15rem;
}

.btn-primary:hover {
    background: var(--accent-bright);
    box-shadow: 0 0.8rem 2rem rgb(25 201 139 / 0.18);
    transform: translateY(-1px);
}

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

.btn-icon {
    width: 1.15rem;
    height: 1.15rem;
    stroke-width: 2;
}

.btn-secondary {
    display: block;
    width: 100%;
    border: 1px solid transparent;
    border-radius: 1rem;
    background: transparent;
    color: rgb(161 161 170);
    font: inherit;
    font-size: 0.98rem;
    font-weight: 600;
    padding: 0.9rem 1rem;
    text-align: center;
    text-decoration: none;
    cursor: pointer;
    margin-top: 0.75rem;
    transition:
        border-color 140ms ease,
        background-color 140ms ease;
}

.btn-secondary:hover {
    border-color: rgb(63 63 70);
    background: rgb(39 39 42 / 0.6);
    color: rgb(228 228 231);
}

/* ── Google OAuth button ── */

.oauth-button {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.6rem;
    width: 100%;
    min-height: 4.1rem;
    margin-top: 0.45rem;
    border: 1px solid #dadce0;
    border-radius: 1rem;
    background: #fff;
    box-shadow: 0 1px 2px rgb(0 0 0 / 0.24);
    color: #3c4043;
    font: inherit;
    font-size: 1rem;
    font-weight: 650;
    text-decoration: none;
    cursor: pointer;
    transition:
        background 160ms ease,
        border-color 160ms ease;
}

.oauth-button:hover {
    border-color: #d2e3fc;
    background: #f8faff;
    color: #202124;
}

.oauth-button:active {
    transform: scale(0.99);
}

.oauth-icon {
    width: 1.1rem;
    height: 1.1rem;
    flex-shrink: 0;
}

/* ── Password reset section ── */

.form.form-flush {
    margin-top: 0;
}

.reset-section {
    overflow: hidden;
    max-height: 0;
    transition: max-height 260ms cubic-bezier(0.32, 0.72, 0, 1);
}

.reset-section.is-open {
    max-height: 14rem;
}

.reset-inner {
    padding-top: 1rem;
    margin-top: 1rem;
    border-top: 1px solid rgb(39 39 42);
}

.reset-title {
    margin: 0 0 0.75rem;
    font-size: 0.82rem;
    font-weight: 600;
    color: rgb(161 161 170);
}

#bgCanvas {
    position: fixed;
    inset: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 0;
}

@media (max-width: 32rem) {
    body {
        padding: 1rem 0.7rem max(1rem, env(safe-area-inset-bottom));
    }

    main {
        width: calc(100% - 2.5rem);
        max-width: 19.5rem;
        border-radius: 1.25rem;
        padding: 1.35rem 1rem 1rem;
    }

    .brand {
        font-size: 1.35rem;
    }

    .subtitle {
        margin-top: 0.25rem;
        font-size: 0.76rem;
    }

    .form {
        gap: 0.65rem;
        margin-top: 1.05rem;
    }

    .field {
        gap: 0.3rem;
    }

    .field-label {
        font-size: 0.8rem;
    }

    .forgot-btn {
        font-size: 0.74rem;
    }

    input[type="text"],
    input[type="email"],
    input[type="password"] {
        min-height: 2.75rem;
        border-radius: 0.75rem;
        font-size: 0.86rem;
        padding: 0.58rem 0.75rem;
    }

    .btn-primary {
        min-height: 2.85rem;
        border-radius: 0.75rem;
        font-size: 0.9rem;
        padding: 0.58rem 0.75rem;
    }

    .btn-secondary {
        margin-top: 0.25rem;
        padding: 0.42rem 0.75rem;
        font-size: 0.82rem;
    }

    .oauth-button {
        min-height: 2.9rem;
        margin-top: 0.15rem;
        border-radius: 0.75rem;
        font-size: 0.84rem;
    }

    .btn-icon,
    .oauth-icon {
        width: 1rem;
        height: 1rem;
    }

    .reset-inner {
        padding-top: 0.7rem;
        margin-top: 0.7rem;
    }
}

@media (max-width: 32rem) and (max-height: 45rem) {
    main {
        padding-block: 1rem 0.8rem;
    }

    .subtitle {
        display: none;
    }

    .form {
        margin-top: 0.8rem;
    }
}

/* ── Signup / reset extras ── */

.field-hint {
    margin: 0;
    font-size: 0.82rem;
    line-height: 1.4;
    color: rgb(148 163 160);
}

.invite-banner {
    border-color: rgb(16 185 129 / 0.45);
    color: rgb(187 247 208);
    background: rgb(20 83 45 / 0.22);
}

@media (max-width: 32rem) {
    .field-hint {
        font-size: 0.72rem;
    }
}

@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        scroll-behavior: auto !important;
        transition-duration: 0.01ms !important;
    }
}
