/*
 * Login page (redesign), also loaded by the register page for the shared auth layout,
 * card and form fields (register extras live in css/auth/register.css).
 * Shared base, header, footer, buttons and the schedule mockup come from css/site.css.
 */

/* ---------- Layout ---------- */
.auth {
    background: var(--bg-subtle);
    padding-block: 32px 56px;
}
.auth__row { display: flex; flex-direction: column; align-items: center; gap: 64px; }
/* The decorative schedule only appears where there is room for it next to the form. */
.auth__visual { display: none; }

@media (min-width: 768px) {
    .auth { padding-block: 64px 96px; }
}
@media (min-width: 1024px) {
    .auth {
        display: flex;
        align-items: center;
        /* Fill the first screen below the sticky header. */
        min-height: calc(100dvh - 89px);
        padding-block: 64px;
    }
    .auth__row { flex-direction: row; justify-content: space-between; gap: 80px; }
    .auth__visual {
        display: block;
        flex: 0 1 540px;
        padding-left: 40px;
        transform: perspective(1400px) rotateY(-8deg) rotateX(4deg);
    }
}

/* ---------- Card ---------- */
.auth-card {
    width: 100%;
    max-width: 480px;
    display: flex;
    flex-direction: column;
    gap: 24px;
    padding: 28px 20px;
    border-radius: 24px;
    background: var(--bg-page);
    box-shadow: var(--shadow-float);
}
.auth-card__head { display: flex; flex-direction: column; gap: 8px; }
.auth-card__title {
    color: var(--text-primary);
    font-weight: var(--font-weight-extrabold);
    font-size: 32px;
    line-height: 1.15;
    letter-spacing: -0.02em;
}
.auth-card__lead { color: var(--text-secondary); font-size: 15px; line-height: 1.6; }
.auth-card__switch {
    padding-top: 20px;
    border-top: 1px solid var(--border-default);
    text-align: center;
    color: var(--text-secondary);
    font-size: 15px;
}
.auth-card__switch a, .field__link {
    color: var(--text-brand);
    font-weight: var(--font-weight-semibold);
    text-decoration: underline;
    text-decoration-color: transparent;
    text-underline-offset: 3px;
    transition: text-decoration-color .15s ease;
}
.auth-card__switch a:hover, .field__link:hover { text-decoration-color: currentColor; }

@media (min-width: 768px) {
    .auth-card { padding: 40px; border-radius: 28px; gap: 28px; }
    .auth-card__title { font-size: 40px; }
    .auth-card__lead { font-size: 16px; }
}
@media (min-width: 1024px) {
    .auth-card { flex: 0 0 480px; }
}

/* ---------- Messages ---------- */
.auth-alerts { display: flex; flex-direction: column; gap: 8px; }
.auth-alert {
    padding: 12px 16px!important;
    border-radius: 12px;
    border-left: 4px solid currentColor;
    font-weight: var(--font-weight-medium);
    font-size: 14px;
    line-height: 1.45;
}
/* Django message tags: error/warning are shown as errors, success/info in green. */
.auth-alert--error, .auth-alert--warning, .auth-alert--debug { background: var(--bg-subtle); color: var(--text-brand); }
.auth-alert--success, .auth-alert--info { background: var(--support-green-100); color: var(--support-green-700); }

/* ---------- Form ---------- */
.auth-form { display: flex; flex-direction: column; gap: 20px; }
.field { display: flex; flex-direction: column; gap: 8px; }
.field__label-row { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; }
.field__label { color: var(--text-primary); font-weight: var(--font-weight-semibold); font-size: 14px; }
.field__link { font-size: 13px; }
.field__control { position: relative; }
.field__input {
    width: 100%;
    height: 52px;
    padding: 0 16px;
    border: 1.5px solid var(--border-default);
    border-radius: 14px;
    background: var(--bg-page);
    color: var(--text-primary);
    font: inherit;
    font-size: 16px; /* 16px stops iOS from zooming into the field. */
    transition: border-color .15s ease, box-shadow .15s ease;
}
.field__input:hover { border-color: var(--border-brand); }
.field__input:focus {
    outline: none;
    border-color: var(--bg-brand);
    box-shadow: 0 0 0 4px var(--bg-brand-subtle);
}
.field__control .field__input { padding-right: 76px; }
.field__toggle {
    position: absolute;
    top: 50%;
    right: 8px;
    translate: 0 -50%;
    min-width: 56px;
    height: 36px;
    padding: 0 12px;
    border: 0;
    border-radius: 10px;
    background: transparent;
    color: var(--text-secondary);
    font-weight: var(--font-weight-semibold);
    font-size: 13px;
    cursor: pointer;
}
.field__toggle:hover { background: var(--bg-muted); color: var(--text-primary); }

.auth-form__submit { position: relative; margin-top: 4px; min-height: 52px; }
.spinner {
    display: none;
    width: 18px;
    height: 18px;
    border: 2.5px solid currentColor;
    border-right-color: transparent;
    border-radius: 50%;
}
.auth-form.is-submitting .auth-form__submit { pointer-events: none; opacity: .85; }
.auth-form.is-submitting .spinner { display: inline-block; animation: spin .7s linear infinite; }
@keyframes spin { to { rotate: 360deg; } }

/* ---------- Entrance ---------- */
@media (prefers-reduced-motion: no-preference) {
    .auth-card { animation: auth-rise .7s cubic-bezier(.22, 1, .36, 1) both; }
    .auth__visual .schedule { animation: auth-rise .9s cubic-bezier(.22, 1, .36, 1) .15s both; }
    .auth__visual .toast { animation: auth-pop .6s cubic-bezier(.34, 1.56, .64, 1) .7s both; }
    @keyframes auth-rise { from { opacity: 0; translate: 0 24px; } to { opacity: 1; translate: 0 0; } }
    @keyframes auth-pop  { from { opacity: 0; scale: .85; } to { opacity: 1; scale: 1; } }
}
