/*
 * Auth pages.
 * Shared by every auth page: login, signup + email verification, password reset (registration/*),
 * accept_terms and notification preferences. Include via user/partials/auth_head.html.
 * Builds on the Core Framework tokens (--primary, --bg-surface, --space-*, --text-*, --radius-*) from home/css.
 */

.auth-page {
    --auth-card-bg: hsla(210, 20%, 6%, 1);
    --auth-field-bg: hsla(0, 0%, 100%, 0.03);
    --auth-border: hsla(0, 0%, 100%, 0.12);
    --auth-border-strong: hsla(0, 0%, 100%, 0.24);
    --auth-muted: hsla(0, 0%, 100%, 0.62);
    --auth-faint: hsla(0, 0%, 100%, 0.45);
    --auth-accent: var(--primary, #5AFF67);
    --auth-accent-soft: hsla(125, 100%, 68%, 0.12);
    --auth-danger: hsla(0, 90%, 70%, 1);
    --auth-danger-soft: hsla(0, 90%, 70%, 0.1);

    display: flex;
    flex-direction: column;
    align-items: center;
    padding: var(--space-xl) 16px var(--space-2xl, 4rem);
    font-family: 'Roboto', system-ui, -apple-system, 'Segoe UI', Helvetica, Arial, sans-serif;
    min-height: calc(100vh - 60px - 220px);
    box-sizing: border-box;
}

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

/* ---------- Card ---------- */

.auth-card {
    position: relative;
    width: 100%;
    max-width: 460px;
    background: var(--auth-card-bg);
    border: 1px solid var(--auth-border);
    border-radius: var(--radius-m, 12px);
    box-shadow: 0 24px 60px -24px hsla(0, 0%, 0%, 0.8);
    overflow: hidden;
}

.auth-card::before {
    content: "";
    position: absolute;
    inset: 0 0 auto 0;
    height: 3px;
    background: linear-gradient(90deg, transparent, var(--auth-accent) 20%, var(--auth-accent) 80%, transparent);
}

.auth-card__body {
    padding: var(--space-l) var(--space-l) var(--space-m);
}

.auth-card__footer {
    padding: var(--space-s) var(--space-l);
    border-top: 1px solid var(--auth-border);
    background: hsla(0, 0%, 100%, 0.015);
    text-align: center;
    font-size: var(--text-s);
    color: var(--auth-muted);
}

@media (max-width: 480px) {
    .auth-card__body { padding: var(--space-m) var(--space-m) var(--space-s); }
    .auth-card__footer { padding: var(--space-s) var(--space-m); }
}

/* ---------- Step indicator ---------- */

.auth-steps {
    display: flex;
    list-style: none;
    margin: 0 0 var(--space-m);
    padding: 0;
    counter-reset: auth-step;
}

/* .auth-steps prefix: oxygen.css forces `:is(li, div._important) { display: list-item }` (specificity 0,1,1). */
.auth-steps .auth-step {
    flex: 1;
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    font-size: var(--text-xs);
    font-weight: 500;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--auth-faint);
}

/* connector line to the previous step */
.auth-step + .auth-step::before {
    content: "";
    position: absolute;
    top: 14px;
    right: calc(50% + 20px);
    width: calc(100% - 40px);
    height: 2px;
    border-radius: 1px;
    background: var(--auth-border);
}

.auth-step.is-done + .auth-step::before {
    background: var(--auth-accent);
}

.auth-step__dot {
    position: relative;
    z-index: 1;
    display: grid;
    place-items: center;
    width: 30px;
    height: 30px;
    border-radius: 50%;
    border: 2px solid var(--auth-border-strong);
    font-size: 0.8rem;
    font-weight: 700;
    letter-spacing: 0;
    color: var(--auth-faint);
    background: var(--auth-card-bg);
}

.auth-step.is-current {
    color: hsla(0, 0%, 100%, 0.92);
}

.auth-step.is-current .auth-step__dot {
    border-color: var(--auth-accent);
    color: var(--auth-accent);
    box-shadow: 0 0 0 4px var(--auth-accent-soft);
}

.auth-step.is-done {
    color: var(--auth-muted);
}

.auth-step.is-done .auth-step__dot {
    border-color: var(--auth-accent);
    background: var(--auth-accent);
    color: #06080a;
}

/* ---------- Heading ---------- */

.auth-eyebrow {
    margin: 0 0 6px;
    font-size: var(--text-xs);
    font-weight: 600;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: var(--auth-accent);
}

.auth-title {
    margin: 0 0 var(--space-3xs);
    font-family: 'Montserrat', 'Roboto', system-ui, sans-serif;
    font-weight: 700;
    font-size: var(--text-2xl);
    line-height: 1.2;
    color: #fff;
}

.auth-lead {
    margin: 0 0 var(--space-m);
    font-size: var(--text-s);
    line-height: 1.55;
    color: var(--auth-muted);
}

.auth-lead strong {
    color: #fff;
    font-weight: 500;
    word-break: break-all;
}

.auth-hero-icon {
    display: grid;
    place-items: center;
    width: 64px;
    height: 64px;
    margin: 0 auto var(--space-s);
    border-radius: 50%;
    background: var(--auth-accent-soft);
    color: var(--auth-accent);
    font-size: 1.6rem;
}

.auth-hero-icon.is-danger {
    background: var(--auth-danger-soft);
    color: var(--auth-danger);
}

.auth-center {
    text-align: center;
}

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

.auth-form {
    display: flex;
    flex-direction: column;
    gap: var(--space-s);
    margin: 0;
}

.auth-field {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.auth-label {
    font-size: var(--text-s);
    font-weight: 500;
    color: hsla(0, 0%, 100%, 0.88);
}

.auth-label-row {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 12px;
}

.auth-label-row__link {
    font-size: var(--text-xs);
}

.auth-input-wrap {
    position: relative;
}

.auth-page input.auth-input {
    width: 100%;
    margin: 0;
    padding: 0.75rem 0.9rem;
    font: inherit;
    font-size: 1rem;
    font-weight: 400;
    color: #fff;
    background: var(--auth-field-bg);
    border: 1px solid var(--auth-border-strong);
    border-radius: var(--radius-s, 8px);
    outline: none;
    transition: border-color 0.15s ease, box-shadow 0.15s ease, background-color 0.15s ease;
}

.auth-page input.auth-input::placeholder {
    color: var(--auth-faint);
}

.auth-page input.auth-input:hover {
    border-color: hsla(0, 0%, 100%, 0.36);
}

.auth-page input.auth-input:focus {
    border-color: var(--auth-accent);
    background: hsla(0, 0%, 100%, 0.05);
    box-shadow: 0 0 0 3px var(--auth-accent-soft);
}

.auth-page input.auth-input[aria-invalid="true"] {
    border-color: var(--auth-danger);
}

.auth-page input.auth-input[aria-invalid="true"]:focus {
    box-shadow: 0 0 0 3px var(--auth-danger-soft);
}

/* room for the show/hide button */
.auth-input-wrap input.auth-input {
    padding-right: 3rem;
}

.auth-reveal {
    position: absolute;
    top: 50%;
    right: 6px;
    transform: translateY(-50%);
    display: grid;
    place-items: center;
    width: 36px;
    height: 36px;
    padding: 0;
    border: 0;
    border-radius: var(--radius-xs, 4px);
    background: transparent;
    color: var(--auth-faint);
    cursor: pointer;
}

.auth-reveal:hover,
.auth-reveal:focus-visible {
    color: #fff;
    background: hsla(0, 0%, 100%, 0.06);
    outline: none;
}

.auth-help {
    margin: 0;
    font-size: var(--text-xs);
    line-height: 1.5;
    color: var(--auth-faint);
}

.auth-error {
    display: flex;
    align-items: flex-start;
    gap: 6px;
    margin: 0;
    font-size: var(--text-xs);
    line-height: 1.5;
    color: var(--auth-danger);
}

.auth-error i {
    margin-top: 0.2em;
}

.auth-alert {
    display: flex;
    gap: 10px;
    padding: 0.75rem 0.9rem;
    border: 1px solid hsla(0, 90%, 70%, 0.35);
    border-radius: var(--radius-s, 8px);
    background: var(--auth-danger-soft);
    color: hsla(0, 90%, 82%, 1);
    font-size: var(--text-s);
    line-height: 1.5;
}

.auth-alert i {
    margin-top: 0.2em;
    color: var(--auth-danger);
}

.auth-alert p {
    margin: 0;
}

/* Verified email chip */
.auth-verified {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 0.65rem 0.9rem;
    border: 1px solid hsla(125, 100%, 68%, 0.3);
    border-radius: var(--radius-s, 8px);
    background: var(--auth-accent-soft);
    font-size: var(--text-s);
}

.auth-verified i {
    color: var(--auth-accent);
}

.auth-verified__email {
    flex: 1;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    color: #fff;
}

.auth-verified__tag {
    font-size: var(--text-xs);
    font-weight: 600;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--auth-accent);
}

/* Checkbox */
.auth-check {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 0.85rem 0.9rem;
    border: 1px solid var(--auth-border);
    border-radius: var(--radius-s, 8px);
    background: var(--auth-field-bg);
    cursor: pointer;
    font-size: var(--text-s);
    line-height: 1.5;
    color: hsla(0, 0%, 100%, 0.82);
}

.auth-check.has-error {
    border-color: var(--auth-danger);
}

.auth-check input[type="checkbox"] {
    appearance: none;
    -webkit-appearance: none;
    flex: none;
    display: grid;
    place-items: center;
    width: 20px;
    height: 20px;
    margin: 0.1em 0 0;
    border: 2px solid var(--auth-border-strong);
    border-radius: 5px;
    background: transparent;
    cursor: pointer;
    transition: background-color 0.15s ease, border-color 0.15s ease;
}

.auth-check input[type="checkbox"]::after {
    content: "";
    width: 5px;
    height: 10px;
    margin-top: -2px;
    border: solid #06080a;
    border-width: 0 2.5px 2.5px 0;
    transform: rotate(45deg) scale(0);
    transition: transform 0.12s ease;
}

.auth-check input[type="checkbox"]:checked {
    background: var(--auth-accent);
    border-color: var(--auth-accent);
}

.auth-check input[type="checkbox"]:checked::after {
    transform: rotate(45deg) scale(1);
}

.auth-check input[type="checkbox"]:focus-visible {
    outline: 2px solid var(--auth-accent);
    outline-offset: 2px;
}

.auth-check a {
    color: var(--auth-accent);
    text-decoration: underline;
    text-underline-offset: 2px;
}

/* ---------- Buttons ---------- */

.auth-submit {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    width: 100%;
    margin-top: var(--space-3xs);
    padding: 0.85rem 1rem;
    border: 0;
    border-radius: var(--radius-s, 8px);
    background: var(--auth-accent);
    color: #06080a;
    font: inherit;
    font-size: 1rem;
    font-weight: 700;
    letter-spacing: 0.01em;
    text-decoration: none;
    cursor: pointer;
    transition: filter 0.15s ease, transform 0.15s ease, box-shadow 0.15s ease;
    box-shadow: 0 6px 20px -8px hsla(125, 100%, 68%, 0.6);
}

.auth-submit:hover {
    color: #06080a;
    filter: brightness(1.08);
    transform: translateY(-1px);
}

.auth-submit:focus-visible {
    outline: 2px solid #fff;
    outline-offset: 3px;
}

.auth-submit:disabled {
    opacity: 0.7;
    cursor: progress;
    transform: none;
}

.auth-secondary {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    width: 100%;
    padding: 0.8rem 1rem;
    border: 1px solid var(--auth-border-strong);
    border-radius: var(--radius-s, 8px);
    background: transparent;
    color: #fff;
    font-size: 1rem;
    font-weight: 500;
    text-decoration: none;
    transition: border-color 0.15s ease, background-color 0.15s ease;
}

.auth-secondary:hover {
    color: #fff;
    border-color: hsla(0, 0%, 100%, 0.4);
    background: hsla(0, 0%, 100%, 0.04);
}

.auth-link {
    color: var(--auth-accent);
    font-weight: 500;
    text-decoration: none;
}

.auth-link:hover {
    color: var(--auth-accent);
    text-decoration: underline;
    text-underline-offset: 2px;
}

/* ---------- Checklist on the "check your inbox" screen ---------- */

.auth-tips {
    list-style: none;
    margin: 0 0 var(--space-m);
    padding: var(--space-s);
    border: 1px solid var(--auth-border);
    border-radius: var(--radius-s, 8px);
    background: var(--auth-field-bg);
    text-align: left;
    display: flex;
    flex-direction: column;
    gap: 10px;
    font-size: var(--text-s);
    line-height: 1.5;
    color: var(--auth-muted);
}

.auth-page .auth-tips li {
    display: flex;
    gap: 10px;
}

.auth-tips i {
    width: 1.1em;
    margin-top: 0.25em;
    color: var(--auth-accent);
    text-align: center;
}

/* ---------- Below-the-card assurances ---------- */

.auth-assurances {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 6px 20px;
    max-width: 460px;
    margin: var(--space-s) 0 0;
    padding: 0;
    list-style: none;
    font-size: var(--text-xs);
    color: var(--auth-faint);
}

.auth-page .auth-assurances li {
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.auth-assurances i {
    color: var(--auth-muted);
}

/* Django's password-rules help text (a <ul>) on the reset form */
.auth-help--list ul {
    margin: 0;
    padding-left: 1.1em;
}

.auth-help--list li {
    margin: 2px 0;
}

/* Checkbox rows with a title + description (notification preferences) */
.auth-check__title {
    display: block;
    font-weight: 500;
    color: #fff;
}

.auth-check__desc {
    display: block;
    margin-top: 2px;
    font-size: var(--text-xs);
    color: var(--auth-muted);
}

.auth-secondary + .auth-form {
    margin-top: var(--space-s);
}
