/* Components: auth forms / login modal */

.auth-panel {
    width: 100%;
    color: var(--color-text-secondary);
}

.auth-panel--modal {
    padding: 0.25rem 0.5rem 0.75rem;
}

.auth-panel--page {
    padding: 0.5rem 0;
}

.auth-panel__header {
    margin-bottom: 1.25rem;
    text-align: center;
}

.auth-panel__title {
    margin: 0 0 0.4rem;
    font-size: 1.35rem;
    font-weight: 700;
    line-height: 1.25;
    color: var(--color-text);
}

.auth-panel__subtitle {
    margin: 0;
    font-size: 0.9rem;
    line-height: 1.4;
    color: var(--color-text-muted);
}

.auth-panel__providers {
    display: flex;
    flex-direction: column;
    gap: 0.6rem;
    margin-bottom: 1rem;
}

.auth-panel__provider {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.65rem;
    width: 100%;
    min-height: 2.75rem;
    padding: 0.65rem 1rem;
    border: 0;
    border-radius: 0.5rem;
    font-size: 0.95rem;
    font-weight: 600;
    line-height: 1.2;
    cursor: pointer;
    transition: background-color 0.2s ease, opacity 0.2s ease, transform 0.15s ease;
}

.auth-panel__provider:disabled {
    opacity: 0.65;
    cursor: not-allowed;
}

.auth-panel__provider:not(:disabled):active {
    transform: scale(0.985);
}

.auth-panel__provider-icon {
    width: 24px;
    height: 24px;
    flex-shrink: 0;
}

.auth-panel__divider {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin: 0.25rem 0 1.1rem;
    color: var(--color-text-muted);
    font-size: 0.8rem;
    text-transform: lowercase;
}

.auth-panel__divider::before,
.auth-panel__divider::after {
    content: '';
    flex: 1;
    height: 1px;
    background: var(--color-border-strong);
    opacity: 0.7;
}

.auth-panel__form {
    display: flex;
    flex-direction: column;
    gap: 0.85rem;
}

.auth-panel__field {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
}

.auth-panel__label {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--color-text);
}

.auth-panel__input {
    width: 100%;
    min-height: 2.75rem;
    padding: 0.65rem 0.85rem;
    border: 1px solid var(--color-border-strong);
    border-radius: 0.5rem;
    background: var(--color-surface, #fff);
    color: var(--color-text);
    font-size: 1rem;
    line-height: 1.3;
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.auth-panel__input:focus {
    outline: none;
    border-color: var(--color-info);
    box-shadow: 0 0 0 3px color-mix(in srgb, var(--color-info) 22%, transparent);
}

.auth-panel__input:disabled {
    opacity: 0.7;
    cursor: not-allowed;
}

.auth-panel__input[aria-invalid="true"] {
    border-color: var(--color-danger, var(--color-accent-magenta));
}

.auth-panel__input--code {
    letter-spacing: 0.28em;
    text-align: center;
    font-size: 1.25rem;
    font-weight: 600;
}

.auth-panel__remember {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.9rem;
    color: var(--color-text-secondary);
    cursor: pointer;
    user-select: none;
}

.auth-panel__remember input {
    width: 1rem;
    height: 1rem;
    accent-color: var(--color-info);
}

.auth-panel__error {
    margin: 0;
    padding: 0.55rem 0.7rem;
    border-radius: 0.4rem;
    background: color-mix(in srgb, var(--color-accent-magenta) 12%, transparent);
    color: var(--color-accent-magenta);
    font-size: 0.875rem;
    line-height: 1.35;
}

.auth-panel__submit {
    width: 100%;
    min-height: 2.85rem;
    margin-top: 0.15rem;
    padding: 0.75rem 1rem;
    border: 0;
    border-radius: 0.5rem;
    background: var(--color-info);
    color: var(--color-inverse-text);
    font-size: 1rem;
    font-weight: 700;
    cursor: pointer;
    transition: background-color 0.2s ease, opacity 0.2s ease;
}

.auth-panel__submit:hover:not(:disabled),
.auth-panel__submit:focus-visible:not(:disabled) {
    filter: brightness(0.95);
}

.auth-panel__submit:disabled {
    opacity: 0.65;
    cursor: not-allowed;
}

.auth-panel__links {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    gap: 0.5rem 1rem;
    margin-top: 0.35rem;
}

.auth-panel__link {
    padding: 0;
    border: 0;
    background: none;
    color: var(--color-text-secondary);
    font-size: 0.9rem;
    text-decoration: underline;
    text-underline-offset: 0.15em;
    cursor: pointer;
}

.auth-panel__link:hover:not(:disabled),
.auth-panel__link:focus-visible:not(:disabled) {
    color: var(--color-info);
}

.auth-panel__link--accent {
    color: var(--color-text);
    font-weight: 600;
    text-decoration: none;
}

.auth-panel__link--accent:hover:not(:disabled),
.auth-panel__link--accent:focus-visible:not(:disabled) {
    color: var(--color-info);
    text-decoration: underline;
}

.auth-panel__link:disabled {
    opacity: 0.55;
    cursor: not-allowed;
}

.auth-panel__back {
    align-self: flex-start;
    margin: 0 0 0.15rem -0.25rem;
    padding: 0.25rem 0.4rem;
    border: 0;
    background: none;
    color: var(--color-text-muted);
    font-size: 0.9rem;
    cursor: pointer;
}

.auth-panel__back:hover:not(:disabled),
.auth-panel__back:focus-visible:not(:disabled) {
    color: var(--color-text);
}

.auth-panel__hint {
    margin: 0;
    font-size: 0.9rem;
    line-height: 1.4;
    color: var(--color-text-secondary);
}

.auth-panel__hint strong {
    color: var(--color-text);
    word-break: break-all;
}

.auth-panel__note {
    margin: 0.85rem 0 0;
    font-size: 0.8rem;
    line-height: 1.35;
    color: var(--color-text-muted);
    text-align: center;
}

/* Modal chrome */
.login-form__modal.auth-modal .modal-content,
.auth-modal__content {
    position: relative;
    border: 1px solid var(--color-border, transparent);
    border-radius: 0.75rem;
    background: var(--color-surface, #fff);
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.18);
    padding: 1.25rem 1.35rem 1.1rem;
}

.auth-modal__close {
    position: absolute;
    top: 0.65rem;
    right: 0.65rem;
    z-index: 2;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 2rem;
    height: 2rem;
    padding: 0;
    border: 0;
    border-radius: 999px;
    background: transparent;
    color: var(--color-text-muted);
    font-size: 1.5rem;
    line-height: 1;
    cursor: pointer;
    transition: background-color 0.15s ease, color 0.15s ease;
}

.auth-modal__close:hover,
.auth-modal__close:focus-visible {
    background: var(--color-surface-2, rgba(0, 0, 0, 0.06));
    color: var(--color-text);
}

.auth-page {
    max-width: 420px;
    margin: 0 auto;
}

.auth-page__card {
    padding: 1.5rem 1.35rem 1.25rem;
    border: 1px solid var(--color-border-strong);
    border-radius: 0.75rem;
    background: var(--color-surface, #fff);
    box-shadow: 0 4px 18px rgba(0, 0, 0, 0.06);
}

.auth-page__alert {
    margin: 0 0 1rem;
    padding: 0.75rem 0.85rem;
    border-radius: 0.5rem;
    border: 1px solid var(--color-danger, #c0392b);
    background: color-mix(in srgb, var(--color-danger, #c0392b) 10%, transparent);
    color: var(--color-danger, #c0392b);
    font-size: 0.9rem;
    line-height: 1.4;
}

/* Legacy hooks still referenced elsewhere */
.modal-login__wrap {
    overflow: hidden;
    border-radius: 0.3rem;
}

.wrong-value {
    border-color: var(--color-danger);
}

/* Brand-colored Bootstrap switches — reusable site-wide */
.form-switch.form-switch--brand .form-check-input:focus {
    border-color: var(--color-brand-soft-border);
    box-shadow: 0 0 0 0.25rem var(--color-brand-alpha);
}

.form-switch.form-switch--brand .form-check-input:focus:not(:checked) {
    --bs-form-switch-bg: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='-4 -4 8 8'%3e%3ccircle r='3' fill='%23862cfd'/%3e%3c/svg%3e");
}

.form-switch.form-switch--brand .form-check-input:checked {
    background-color: var(--color-brand);
    border-color: var(--color-brand);
}

.form-switch.form-switch--brand .form-check-input:checked:focus {
    box-shadow: 0 0 0 0.25rem var(--color-brand-alpha);
}

[data-theme="dark"] .form-switch.form-switch--brand .form-check-input:focus:not(:checked) {
    --bs-form-switch-bg: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='-4 -4 8 8'%3e%3ccircle r='3' fill='%239b5cff'/%3e%3c/svg%3e");
}
