/* Login & registration — Apple Account layout, project colors */

.main-container:has(.auth-container) {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;
    min-height: calc(100dvh - var(--header-height) - 4rem);
    padding-top: calc(var(--header-height) + clamp(1.5rem, 4vh, 2.25rem));
    padding-bottom: clamp(2rem, 6vh, 3rem);
    box-sizing: border-box;
}

.auth-container {
    width: 100%;
    max-width: 20rem;
    margin: 0 auto;
    padding: 0 0.25rem 1.25rem;
    background: transparent;
    border: none;
    border-radius: 0;
    box-shadow: none;
    font-family: var(--font-family);
    font-size: 0.875rem;
    line-height: 1.45;
    letter-spacing: normal;
    text-transform: none;
    color: var(--text);
    text-align: left;
    box-sizing: border-box;
}

.auth-back {
    display: inline-flex;
    align-items: center;
    margin: 0 0 1.25rem;
    padding: 0;
    color: var(--text-tertiary);
    text-decoration: none;
    font-size: 0.875rem;
    font-weight: 400;
    transition: color 0.2s ease;
}

.auth-back:hover {
    color: var(--text);
}

.auth-container h1,
.auth-container .auth-title {
    margin: 0 0 1.15rem;
    font-size: clamp(1.25rem, 3.5vw, 1.5rem);
    font-weight: 600;
    line-height: 1.2;
    letter-spacing: -0.02em;
    color: var(--text);
    text-align: center;
}

.auth-container form {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    width: 100%;
}

.auth-field {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 0.4rem;
    width: 100%;
    max-width: none;
    margin: 0 0 0.85rem;
    --field-input-ch: 100%;
}

.auth-field label,
.auth-label-wrap {
    display: block;
    margin: 0;
    color: var(--text-tertiary);
    font-size: 0.8125rem;
    font-weight: 400;
    line-height: 1.3;
}

.auth-label-text::after {
    content: none;
}

.auth-field input[type="text"],
.auth-field input[type="email"],
.auth-field input[type="password"],
.auth-field input[type="number"],
.auth-field select {
    width: 100%;
    max-width: none;
    flex: none;
    box-sizing: border-box;
    min-height: 2.5rem;
    padding: 0.55rem 0.75rem;
    border: 1px solid var(--input-border);
    border-radius: 10px;
    background: var(--input-bg);
    color: var(--text);
    font-family: inherit;
    font-size: 1rem;
    letter-spacing: normal;
    text-transform: none;
    text-align: left;
    box-shadow: none;
    outline: none;
    -webkit-appearance: none;
    appearance: none;
    transition:
        border-color 0.2s ease,
        background-color 0.2s ease,
        box-shadow 0.2s ease;
}

.auth-field input:focus,
.auth-field select:focus {
    border-color: var(--input-border-focus);
    background: var(--input-bg-focus);
    box-shadow: 0 0 0 3px color-mix(in srgb, var(--border-hover) 28%, transparent);
}

.auth-field input::placeholder {
    color: var(--text-muted);
    opacity: 0.55;
    font-weight: 400;
    text-transform: none;
    text-align: left;
}

.auth-field.is-invalid input,
.auth-field.is-invalid select {
    border-color: #d93025;
    box-shadow: 0 0 0 3px color-mix(in srgb, #d93025 18%, transparent);
}

.auth-field .form-errors,
.auth-field + .form-errors {
    margin: 0.25rem 0 0;
    font-size: 0.8125rem;
    color: #d93025;
    text-transform: none;
    letter-spacing: normal;
    text-align: left;
}

.auth-container .form-group {
    width: 100%;
    display: block;
    margin: 0;
}

.form-group {
    margin-bottom: 0;
}

.form-group label {
    display: block;
}

.role-select {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    margin-top: 0.15rem;
    width: 100%;
}

.role-select input[type="radio"] {
    position: absolute;
    opacity: 0;
    width: 0;
    height: 0;
    margin: 0;
}

.role-select label {
    display: flex;
    align-items: center;
    justify-content: flex-start;
    min-height: 2.5rem;
    padding: 0 0.875rem;
    margin: 0;
    border: 1px solid var(--input-border);
    border-radius: 10px;
    background: var(--input-bg);
    text-align: left;
    cursor: pointer;
    color: var(--text-secondary);
    font-weight: 400;
    font-size: 0.9375rem;
    transition:
        border-color 0.2s ease,
        background-color 0.2s ease,
        color 0.2s ease;
}

.role-select label:hover {
    border-color: var(--input-border-focus);
    color: var(--text);
}

.role-select input[type="radio"]:checked + label {
    border-color: var(--text);
    background: color-mix(in srgb, var(--card) 40%, var(--input-bg));
    color: var(--text);
    text-decoration: none;
    font-weight: 500;
}

.role-select.is-invalid label {
    border-color: #d93025;
    color: #d93025;
}

.auth-field-role {
    flex-direction: column;
    align-items: stretch;
    gap: 0.4rem;
    width: 100%;
}

.auth-field-role .auth-role-heading {
    width: auto;
    color: var(--text-tertiary);
}

.form-buttons {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 0.625rem;
    margin-top: 0.5rem;
}

#reg-step2 .form-buttons {
    flex-direction: row;
    flex-wrap: wrap;
}

#reg-step2 .form-buttons .auth-btn {
    flex: 1 1 calc(50% - 0.3125rem);
    min-width: 7.5rem;
}

.auth-btn {
    width: 100%;
    max-width: none;
    min-height: 2.5rem;
    margin: 0;
    padding: 0.65rem 1.25rem;
    border: none;
    border-radius: 999px;
    background: var(--button-primary-bg);
    color: var(--button-primary-text);
    font-family: inherit;
    font-size: 1rem;
    font-weight: 500;
    letter-spacing: normal;
    text-transform: none;
    cursor: pointer;
    text-align: center;
    text-decoration: none;
    transition: opacity 0.2s ease, transform 0.15s ease;
    box-shadow: none;
    outline: none;
}

.auth-btn:hover {
    opacity: 0.88;
    color: var(--button-primary-text);
    background: var(--button-primary-bg);
    border: none;
}

.auth-btn:focus-visible {
    outline: 2px solid var(--text);
    outline-offset: 2px;
}

#reg-back-to-step1.auth-btn {
    background: var(--button-secondary-bg);
    color: var(--button-secondary-text);
    border: 1px solid var(--border);
}

#reg-back-to-step1.auth-btn:hover {
    background: var(--button-hover-bg);
    color: var(--button-secondary-text);
    opacity: 1;
}

.google-btn {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    max-width: none;
    min-height: 2.5rem;
    margin: 1rem 0 0;
    padding: 0.65rem 1rem;
    background: var(--input-bg);
    color: var(--text);
    border: 1px solid var(--input-border);
    border-radius: 999px;
    font-family: inherit;
    font-size: 0.9375rem;
    font-weight: 500;
    letter-spacing: normal;
    text-transform: none;
    text-decoration: none;
    box-shadow: none;
    gap: 0.625rem;
    box-sizing: border-box;
    transition:
        border-color 0.2s ease,
        background-color 0.2s ease;
}

.google-btn::before {
    content: '';
    position: absolute;
    top: -0.625rem;
    left: 0;
    right: 0;
    height: 1px;
    background: color-mix(in srgb, var(--border) 70%, transparent);
}

.google-btn:hover {
    color: var(--text);
    background: var(--input-bg-focus);
    border-color: var(--input-border-focus);
}

.google-btn svg {
    flex-shrink: 0;
    width: 1.25rem;
    height: 1.25rem;
}

.auth-switch {
    text-align: center;
    margin-top: 1.5rem;
    padding-top: 1.25rem;
    border-top: 1px solid color-mix(in srgb, var(--border) 55%, transparent);
}

.auth-switch > p + p {
    margin-top: 0.75rem;
}

.auth-grey-text {
    color: var(--text-muted);
    margin: 0;
    font-size: 0.875rem;
    text-transform: none;
    letter-spacing: normal;
    line-height: 1.5;
}

.auth-grey-text a,
.auth-switch a {
    color: var(--text);
    font-weight: 500;
    text-decoration: none;
}

.auth-grey-text a:hover,
.auth-switch a:hover {
    text-decoration: underline;
    text-underline-offset: 2px;
}

.auth-bw-link {
    color: var(--text) !important;
    font-weight: 500;
    text-decoration: none !important;
    filter: none;
}

.auth-bw-link:hover {
    color: var(--text-secondary) !important;
    text-decoration: underline !important;
    text-underline-offset: 2px;
}

.consent-group {
    display: flex;
    align-items: flex-start;
    gap: 0.625rem;
    margin: 0.25rem 0 1rem;
    max-width: none;
    font-size: 0.8125rem;
    line-height: 1.5;
    text-align: left;
    text-transform: none;
    letter-spacing: normal;
    color: var(--text-muted);
}

.consent-checkbox {
    width: 1rem;
    height: 1rem;
    margin: 0.15rem 0 0;
    flex-shrink: 0;
    accent-color: var(--button-primary-bg);
}

.consent-label {
    color: inherit;
}

.consent-label a {
    color: var(--text);
    font-weight: 500;
    text-decoration: none;
}

.consent-label a:hover {
    text-decoration: underline;
    text-underline-offset: 2px;
}

.auth-steps {
    display: flex;
    flex-direction: row;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    margin-bottom: 1.5rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid color-mix(in srgb, var(--border) 55%, transparent);
}

.step-indicator {
    color: var(--text-muted);
    font-weight: 400;
    font-size: 0.8125rem;
    letter-spacing: normal;
    text-transform: none;
}

.step-indicator.active {
    color: var(--text);
    font-weight: 600;
    text-decoration: none;
}

.register-steps {
    margin: 0;
    width: 100%;
}

.step-block {
    margin: 0;
    width: 100%;
}

ul.errorlist,
.form-group ul.errorlist {
    list-style: none;
    padding: 0;
    margin: 0 0 1rem;
    color: #d93025;
    font-size: 0.8125rem;
    text-align: left;
    text-transform: none;
    letter-spacing: normal;
}

ul.errorlist li,
.form-group ul.errorlist li {
    list-style: none;
    margin: 0.25rem 0 0;
    color: #d93025;
}

.auth-container form > ul.errorlist {
    margin-bottom: 1rem;
    padding: 0.75rem 0.875rem;
    border-radius: 10px;
    background: color-mix(in srgb, #d93025 8%, var(--bg));
    border: 1px solid color-mix(in srgb, #d93025 25%, transparent);
}

.ml-2 {
    margin-left: 0;
}

@media (max-width: 480px) {
    .main-container:has(.auth-container) {
        padding-top: calc(var(--header-height) + 1.25rem);
    }

    .auth-container {
        max-width: min(20rem, 100%);
        padding-left: 0.5rem;
        padding-right: 0.5rem;
    }

    .auth-container h1,
    .auth-container .auth-title {
        font-size: 1.25rem;
    }

    #reg-step2 .form-buttons {
        flex-direction: column;
    }

    #reg-step2 .form-buttons .auth-btn {
        flex: 1 1 auto;
        width: 100%;
    }
}
