/*
   Login, registration, OTP verification and PIN reset (users/templates/users/login.html, register.html,
   verify_otp.html, password/*.html)
   Uses the site's palette and type (profile.css, vehiclespage.css); input classes are set in users/forms.py.
 */

.container_body.auth-main {
    padding-top: 0;
    background: #f7f5f2;
}

.auth-page {
    --auth-bg: #f7f5f2;
    --auth-card: #fff;
    --auth-border: #ebe8e3;
    --auth-input-border: #e0ddd8;
    --auth-text: #1a1a1a;
    --auth-body: #555;
    --auth-muted: #6b645b;
    --auth-eyebrow: #b0a89c;
    --auth-soft: #faf9f7;
    --auth-hover: #f0ede8;
    --auth-error: #c23b3b;
    --auth-error-bg: #fdf3f3;
    --auth-error-border: #f0c8c8;
    --auth-success: #2d6a47;
    --auth-success-bg: #f0faf4;
    --auth-success-border: #c6e9d4;

    display: flex;
    justify-content: center;
    align-items: flex-start;
    min-height: calc(100vh - 64px);
    padding: 48px 16px 72px;
    background: var(--auth-bg);
    color: var(--auth-text);
    font-family: 'DM Sans', sans-serif;
}

/* Card */

.auth-card {
    width: 100%;
    max-width: 440px;
    padding: 36px 32px 32px;
    border: 1px solid var(--auth-border);
    border-radius: 14px;
    background: var(--auth-card);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
}

.auth-card-header { margin-bottom: 24px; }

.auth-eyebrow {
    margin: 0 0 8px;
    color: var(--auth-eyebrow);
    font-family: 'Syne', sans-serif;
    font-size: 0.72rem;
    font-weight: 600;
    letter-spacing: 0.12em;
    text-transform: uppercase;
}

.auth-title {
    margin: 0 0 8px;
    color: var(--auth-text);
    font-family: 'Syne', sans-serif;
    font-size: 1.75rem;
    font-weight: 700;
    letter-spacing: -0.02em;
    line-height: 1.15;
}

.auth-subtitle {
    margin: 0;
    color: var(--auth-body);
    font-size: 0.95rem;
    line-height: 1.55;
    overflow-wrap: anywhere;
}

.auth-subtitle strong { color: var(--auth-text); font-weight: 500; }

/* Fields */

.auth-field { margin-bottom: 20px; }

.auth-label {
    display: block;
    margin-bottom: 6px;
    color: var(--auth-muted);
    font-family: 'Syne', sans-serif;
    font-size: 0.72rem;
    font-weight: 600;
    letter-spacing: 0.1em;
    text-transform: uppercase;
}

.auth-optional {
    font-family: 'DM Sans', sans-serif;
    font-weight: 400;
    letter-spacing: 0;
    text-transform: none;
}

.auth-input {
    display: block;
    width: 100%;
    min-height: 48px;
    padding: 0 14px;
    border: 1px solid var(--auth-input-border);
    border-radius: 8px;
    background: #fff;
    color: var(--auth-text);
    font: 400 16px/1.2 'DM Sans', sans-serif;  /* 16px stops iOS zooming in on focus */
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.auth-input::placeholder { color: #a39a8f; opacity: 1; }

.auth-input:hover { border-color: #c0b8b0; }

.auth-input:focus {
    outline: none;
    border-color: var(--auth-text);
    box-shadow: 0 0 0 3px rgba(26, 26, 26, 0.1);
}

.auth-input[aria-invalid="true"] { border-color: var(--auth-error); }
.auth-input[aria-invalid="true"]:focus { box-shadow: 0 0 0 3px rgba(194, 59, 59, 0.15); }

/* PIN: masked, wide-spaced digits */
.auth-pin {
    font-size: 22px;
    font-variant-numeric: tabular-nums;
    letter-spacing: 0.5em;
}

.auth-pin::placeholder { font-size: 16px; letter-spacing: normal; }

/* Leading icon (email, PIN) and trailing show/hide button */
.auth-input-wrap { position: relative; }
.auth-input-wrap.has-icon .auth-input { padding-left: 44px; }
.auth-input-wrap.has-toggle .auth-input { padding-right: 52px; }

.auth-input-icon {
    position: absolute;
    top: 50%;
    left: 14px;
    width: 18px;
    color: var(--auth-muted);
    font-size: 16px;
    text-align: center;
    transform: translateY(-50%);
    pointer-events: none;
    transition: color 0.15s ease;
}

.auth-input-wrap:focus-within .auth-input-icon { color: var(--auth-text); }
.has-error .auth-input-wrap .auth-input-icon,
.has-error .auth-input-wrap:focus-within .auth-input-icon { color: var(--auth-error); }

.auth-pin-toggle {
    position: absolute;
    top: 2px;
    right: 2px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    border: 0;
    border-radius: 8px;
    background: transparent;
    color: var(--auth-muted);
    font-size: 17px;
    cursor: pointer;
}

.auth-pin-toggle:hover { color: var(--auth-text); background: var(--auth-hover); }

.auth-hint {
    margin: 6px 0 0;
    color: var(--auth-muted);
    font-size: 13px;
    line-height: 1.45;
}

.auth-error p {
    margin: 6px 0 0;
    color: var(--auth-error);
    font-size: 13px;
    line-height: 1.45;
}

/* Checkbox rows */

.auth-row {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 8px 16px;
    margin: 4px 0 24px;
}

.auth-check {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    min-height: 44px;
    color: var(--auth-body);
    font-size: 15px;
    font-weight: 400;
    cursor: pointer;
}

.auth-check-input {
    flex-shrink: 0;
    width: 20px;
    height: 20px;
    margin: 0;
    accent-color: var(--auth-text);
    cursor: pointer;
}

/* Links and buttons */

.auth-link,
.auth-link-button {
    color: var(--auth-text);
    font-weight: 500;
    text-decoration: underline;
    text-decoration-color: #c0b8b0;
    text-underline-offset: 3px;
}

.auth-link:hover,
.auth-link-button:hover { color: var(--auth-text); text-decoration-color: var(--auth-text); }

/* Stand-alone links (Forgot PIN?) get a full-height tap target */
.auth-row .auth-link {
    display: inline-flex;
    align-items: center;
    min-height: 44px;
}

.auth-link-button {
    display: inline-flex;
    align-items: center;
    min-height: 44px;
    padding: 0;
    border: 0;
    background: none;
    font: inherit;
    font-weight: 500;
    cursor: pointer;
}

.auth-link-button:disabled {
    color: var(--auth-muted);
    text-decoration: none;
    cursor: default;
}

.auth-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    min-height: 48px;
    padding: 0 22px;
    border: 1px solid var(--auth-text);
    border-radius: 8px;
    background: var(--auth-text);
    color: #fff;
    font-family: 'Syne', sans-serif;
    font-size: 0.82rem;
    font-weight: 600;
    letter-spacing: 0.07em;
    text-transform: uppercase;
    cursor: pointer;
    transition: opacity 0.18s ease, background 0.18s ease;
}

.auth-button:hover { opacity: 0.85; }

a.auth-button,
a.auth-button:hover { color: #fff; text-decoration: none; }

/* Round icon above the title on result pages (PIN updated, expired link) */
.auth-status-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 48px;
    height: 48px;
    margin-bottom: 16px;
    border-radius: 50%;
    background: var(--auth-success-bg);
    color: var(--auth-success);
    font-size: 20px;
}

.auth-status-icon-warning { background: #fdf8ec; color: #7a5a12; }

/* styles.css colours every .fa-check red */
.auth-status-icon i { color: inherit; }

.auth-button-secondary {
    border-color: #e4e0da;
    background: var(--auth-soft);
    color: var(--auth-body);
}

.auth-button-secondary:hover { opacity: 1; background: var(--auth-hover); color: var(--auth-text); }

.auth-link:focus-visible,
.auth-link-button:focus-visible,
.auth-button:focus-visible,
.auth-pin-toggle:focus-visible,
.auth-check-input:focus-visible {
    outline: 2px solid var(--auth-text);
    outline-offset: 2px;
}

.auth-switch {
    margin: 24px 0 0;
    padding-top: 20px;
    border-top: 1px solid #f2f0ec;
    color: var(--auth-body);
    font-size: 15px;
    text-align: center;
}

/* Messages and form-wide errors */

.auth-messages { margin-bottom: 20px; }

.auth-message {
    margin: 0 0 8px;
    padding: 12px 14px;
    border: 1px solid;
    border-radius: 8px;
    font-size: 14px;
    line-height: 1.5;
}

.auth-message-success { border-color: var(--auth-success-border); background: var(--auth-success-bg); color: var(--auth-success); }
.auth-message-error,
.auth-message-danger { border-color: var(--auth-error-border); background: var(--auth-error-bg); color: var(--auth-error); }
.auth-message-warning { border-color: #f1dfb4; background: #fdf8ec; color: #7a5a12; }
.auth-message-info,
.auth-message-debug { border-color: #e4e0da; background: var(--auth-soft); color: var(--auth-text); }

/* Registration and OTP verification: the form beside a dark panel; the panel moves below the form under 992px */

.auth-card.auth-card-split {
    display: grid;
    grid-template-columns: minmax(0, 1fr);  /* stops wide content (the OTP boxes) stretching the card */
    max-width: 560px;
    padding: 0;
    overflow: hidden;
}

.auth-card-main { padding: 40px 44px 36px; }

.auth-aside {
    position: relative;
    overflow: hidden;
    padding: 32px 44px 36px;
    background: var(--auth-text);
    color: #fff;
}

.auth-aside > :not(.auth-aside-art) { position: relative; z-index: 1; }

.auth-aside-badge {
    display: inline-flex;
    align-self: flex-start;
    align-items: center;
    gap: 8px;
    margin: 0 0 16px;
    padding: 6px 12px;
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 999px;
    font-family: 'Syne', sans-serif;
    font-size: 0.7rem;
    font-weight: 600;
    letter-spacing: 0.1em;
    text-transform: uppercase;
}

.auth-aside-badge i { color: #8fd3a9; }

.auth-aside-title {
    margin: 0 0 24px;
    color: #fff;
    font-family: 'Syne', sans-serif;
    font-size: 1.35rem;
    font-weight: 700;
    letter-spacing: -0.02em;
    line-height: 1.2;
}

.auth-benefits {
    display: grid;
    gap: 18px;
    margin: 0;
    padding: 0;
    list-style: none;
}

.auth-benefits li {
    display: flex;
    align-items: flex-start;
    gap: 14px;
    color: #c9c3bb;
    font-size: 14px;
    line-height: 1.5;
}

.auth-benefit-title {
    margin: 0 0 2px;
    color: #fff;
    font-family: 'DM Sans', sans-serif;
    font-size: 15px;
    font-weight: 600;
    line-height: 1.4;
}

.auth-benefit-text { margin: 0; }

.auth-benefit-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    width: 40px;
    height: 40px;
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.08);
    color: #fff;
    font-size: 16px;
}

.auth-aside-art {
    position: absolute;
    right: -20px;
    bottom: -22px;
    color: rgba(255, 255, 255, 0.05);
    font-size: 132px;
    pointer-events: none;
}

@media (min-width: 992px) {
    .auth-card.auth-card-split {
        grid-template-columns: minmax(0, 5fr) minmax(0, 7fr);
        max-width: 960px;
    }

    .auth-aside {
        order: -1;
        display: flex;
        flex-direction: column;
        justify-content: center;
        padding: 48px 40px;
    }

    .auth-aside-title { font-size: 1.75rem; }
    .auth-aside-art { right: -28px; bottom: -30px; font-size: 200px; }
}

/* Two fields side by side once each can be at least ~200px wide */
.auth-grid {
    display: grid;
    gap: 0 16px;
    align-items: start;
}

@media (min-width: 480px) {
    .auth-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

/* OTP verification: six code boxes */

.otp-fieldset {
    min-width: 0;
    margin: 0 0 8px;
    padding: 0;
    border: 0;
}

.otp-digit-row {
    display: flex;
    justify-content: space-between;
    gap: 8px;
}

.otp-digit {
    flex: 1 1 0;
    min-width: 0;
    max-width: 64px;
    height: 60px;
    padding: 0;
    border: 1px solid var(--auth-input-border);
    border-radius: 8px;
    background: #fff;
    color: var(--auth-text);
    font: 600 22px/1 'DM Sans', sans-serif;
    font-variant-numeric: tabular-nums;
    text-align: center;
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.otp-digit:focus {
    outline: none;
    border-color: var(--auth-text);
    box-shadow: 0 0 0 3px rgba(26, 26, 26, 0.1);
}

.otp-digit[aria-invalid="true"] { border-color: var(--auth-error); }

.otp-form .auth-button { margin-top: 20px; }

/* Phones: full-width card with a small gutter */

@media (max-width: 575.98px) {
    .auth-page { padding: 20px 12px 48px; }

    .auth-card { padding: 26px 18px 24px; }
    .auth-card-main { padding: 26px 18px 24px; }
    .auth-aside { padding: 26px 18px 28px; }

    .auth-title { font-size: 1.5rem; }

    .otp-digit-row { gap: 6px; }
    .otp-digit { height: 52px; font-size: 20px; }
}
