/* Sign-in shell: login, two-step code, forgot/reset password, email confirmation.
   Layout restored from the original BodaERP sign-in page; colours come from the logo (navy, blue, red)
   via --brand / --accent / --brand-dark, which public-head.php sets from Super Admin → Site Text & Branding. */
:root {
    --role-super: #056CFE;
    --role-city: #15803d;
    --role-stage: #b45309;
    --role-rider: #0e7490;
    --role-gov: #E2262F;
}

body.auth-page {
    margin: 0;
    font-family: 'Outfit Variable', 'Outfit', system-ui, -apple-system, 'Segoe UI', Roboto, Arial, sans-serif;
    color: var(--ink);
    background: #e6ecf5;
    -webkit-font-smoothing: antialiased;
}
body.auth-page a { color: var(--brand-ink, #0459d4); text-decoration: none; }
body.auth-page a:hover { color: var(--brand-ink); text-decoration: underline; }
body.auth-page :focus-visible { outline: 3px solid color-mix(in srgb, var(--brand) 45%, transparent); outline-offset: 2px; }

.login-page {
    min-height: 100vh;
    min-height: 100dvh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: clamp(16px, 4vw, 40px);
    position: relative;
    overflow: hidden;
    background: #eef2f8;
}
.login-page::before,
.login-page::after { content: ''; position: absolute; pointer-events: none; border-radius: 50%; }
.login-page::before { top: -30%; right: -20%; width: min(70vw, 900px); aspect-ratio: 1; background: color-mix(in srgb, var(--brand) 7%, transparent); }
.login-page::after { bottom: -35%; left: -15%; width: min(60vw, 760px); aspect-ratio: 1; background: color-mix(in srgb, var(--brand-dark) 5%, transparent); }

.login-container { width: 100%; max-width: 480px; position: relative; z-index: 1; animation: login-rise .5s ease both; }
.login-container:has(.is-wide) { max-width: 520px; }
@keyframes login-rise { from { opacity: 0; transform: translateY(16px); } to { opacity: 1; transform: none; } }

.login-card {
    background: #fff;
    border-radius: 20px;
    padding: 40px 36px 28px;
    box-shadow: 0 1px 2px rgba(0, 23, 64, .06), 0 20px 50px rgba(0, 23, 64, .10);
    position: relative;
    overflow: hidden;
}
.login-card::before {
    content: '';
    position: absolute;
    inset: 0 0 auto 0;
    height: 4px;
    background: linear-gradient(90deg, var(--brand-dark) 0 40%, var(--brand) 40% 80%, var(--accent) 80% 100%);
}

.logo-section { display: flex; flex-direction: column; align-items: center; text-align: center; margin-bottom: 28px; color: inherit; }
body.auth-page a.logo-section:hover { text-decoration: none; }
.logo-section .logo-icon { width: 64px; height: 64px; object-fit: contain; margin-bottom: 10px; }
.logo-section .brand-name { font-weight: 900; font-size: 1.8rem; line-height: 1.1; letter-spacing: -.5px; }
.logo-section .b1 { color: var(--brand-dark); }
.logo-section .b2 { color: var(--accent); }

.login-card h1 { font-size: 1.25rem; font-weight: 800; color: var(--brand-dark); text-align: center; margin: 0 0 6px; letter-spacing: -.2px; }
.login-card .sub { color: #5b6478; font-size: .9rem; text-align: center; margin: 0 0 20px; }

.role-label-text { display: block; font-size: .8rem; font-weight: 600; color: #5b6478; margin-bottom: 8px; }
.role-selector { display: grid; grid-template-columns: repeat(5, 1fr); gap: 8px; margin-bottom: 22px; }
.role-btn {
    --role: var(--role-super);
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
    padding: 12px 4px 10px;
    border: 2px solid #e3e8f0;
    border-radius: 14px;
    background: #fff;
    color: #5b6478;
    cursor: pointer;
    font: inherit;
    transition: border-color .15s ease, background-color .15s ease, transform .15s ease;
}
.role-btn i { font-size: 1.35rem; color: var(--role); margin-bottom: 2px; }
.role-btn .role-name { font-size: .7rem; font-weight: 700; line-height: 1.2; }
.role-btn .role-badge { font-size: .58rem; font-weight: 600; padding: 1px 6px; border-radius: 999px; background: #f1f4f9; }
.role-btn:hover { border-color: var(--role); transform: translateY(-2px); }
.role-btn[aria-pressed="true"] { border-color: var(--role); background: color-mix(in srgb, var(--role) 8%, #fff); color: var(--role); }
.role-btn[aria-pressed="true"] .role-badge { background: var(--role); color: #fff; }
.role-btn .check { position: absolute; top: -7px; right: -7px; width: 20px; height: 20px; border-radius: 50%; background: var(--role); color: #fff; font-size: 10px; display: none; place-items: center; }
.role-btn[aria-pressed="true"] .check { display: grid; }
.role-btn.r-city, .demo-row.r-city { --role: var(--role-city); }
.role-btn.r-stage, .demo-row.r-stage { --role: var(--role-stage); }
.role-btn.r-rider, .demo-row.r-rider { --role: var(--role-rider); }
.role-btn.r-gov, .demo-row.r-gov { --role: var(--role-gov); }

.login-field { margin-bottom: 14px; }
.login-field > label { display: block; font-size: .82rem; font-weight: 600; color: #3a4357; margin-bottom: 6px; }
.input-box { display: flex; align-items: center; border: 2px solid #e3e8f0; border-radius: 12px; background: #fff; transition: border-color .15s ease, box-shadow .15s ease; }
.input-box:focus-within { border-color: var(--brand); box-shadow: 0 0 0 4px color-mix(in srgb, var(--brand) 12%, transparent); }
.input-box > i { color: #8a93a6; padding-left: 14px; width: 34px; }
.input-box input:focus-visible { outline: none; }
.input-box input { flex: 1; min-width: 0; border: 0; outline: 0; background: transparent; padding: 12px 14px 12px 6px; font-size: 1rem; color: var(--ink); }
.input-box .reveal { border: 0; background: none; color: #8a93a6; padding: 0 14px; align-self: stretch; cursor: pointer; border-radius: 0 10px 10px 0; }
.input-box .reveal:hover { color: var(--brand); }
.input-box.code input { text-align: center; font-size: 1.6rem; font-weight: 700; letter-spacing: 10px; padding-left: 14px; }
.field-hint { font-size: .78rem; color: #566074; margin-top: 6px; }
.strength { height: 4px; background: #e3e8f0; border-radius: 2px; margin-top: 8px; overflow: hidden; }
.strength span { display: block; height: 100%; width: 0; transition: width .2s ease; }

.form-options { display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap; margin: 4px 0 20px; font-size: .86rem; }
.form-options label { display: inline-flex; align-items: center; gap: 8px; color: #3a4357; cursor: pointer; }
.form-options input[type="checkbox"] { width: 16px; height: 16px; accent-color: var(--brand); }
.form-options a { font-weight: 600; }

.btn-login {
    width: 100%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 13px 16px;
    border: 0;
    border-radius: 12px;
    background: var(--login-btn, var(--brand));
    color: #fff;
    font-size: 1rem;
    font-weight: 700;
    cursor: pointer;
    text-decoration: none;
    transition: filter .15s ease, transform .15s ease, box-shadow .15s ease;
}
body.auth-page a.btn-login { color: #fff; }
.btn-login:hover { filter: brightness(.92); transform: translateY(-1px); box-shadow: 0 8px 22px color-mix(in srgb, var(--login-btn, var(--brand)) 30%, transparent); color: #fff; text-decoration: none; }
.btn-login.is-loading, .btn-login:disabled { opacity: .75; pointer-events: none; }
.btn-plain { display: inline; border: 0; background: none; padding: 0; color: var(--brand); font: inherit; font-weight: 600; cursor: pointer; }
.btn-plain:hover { text-decoration: underline; }

.notice { border-radius: 10px; padding: 10px 14px; margin-bottom: 16px; font-size: .88rem; }
.notice-success { background: #ecfdf3; color: #166534; border: 1px solid #bbf7d0; }
.notice-error { background: #fef2f2; color: #991b1b; border: 1px solid #fecaca; }
.notice-info { background: #eff6ff; color: #1e3a8a; border: 1px solid #bfdbfe; }

.auth-help { text-align: center; font-size: .84rem; color: #5b6478; margin: 16px 0 0; }
.auth-links { text-align: center; font-size: .86rem; margin-top: 16px; }

.demo-credentials { margin-top: 18px; padding: 12px 14px; background: #f5f7fb; border: 1px solid #e3e8f0; border-radius: 12px; font-size: .74rem; max-height: 220px; overflow-y: auto; }
.demo-credentials .demo-title { font-weight: 700; color: #3a4357; margin-bottom: 6px; display: flex; align-items: center; gap: 6px; }
.demo-credentials .demo-title i { color: var(--accent); }
.demo-row {
    --role: var(--role-super);
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 10px;
    width: 100%;
    padding: 4px 6px;
    border: 0;
    border-radius: 6px;
    background: none;
    text-align: left;
    font: inherit;
    cursor: pointer;
}
.demo-row:hover { background: #fff; }
.demo-row .who { font-weight: 700; color: color-mix(in srgb, var(--role) 78%, #001740); white-space: nowrap; }
.demo-row .who::before { content: ''; display: inline-block; width: 7px; height: 7px; border-radius: 50%; background: var(--role); margin-right: 6px; vertical-align: 1px; }
.demo-row code { background: #fff; color: #3a4357; padding: 1px 8px; border-radius: 4px; font-weight: 600; font-size: .7rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.demo-credentials .demo-keys { color: #566074; margin-top: 6px; }

.login-footer { text-align: center; margin: 22px 0 0; color: #566074; font-size: .74rem; }

@media (max-width: 575.98px) {
    .login-card { padding: 30px 20px 22px; border-radius: 16px; }
    .logo-section { margin-bottom: 22px; }
    .logo-section .brand-name { font-size: 1.55rem; }
    .role-selector { grid-template-columns: repeat(6, 1fr); gap: 6px; }
    .role-btn { grid-column: span 2; }
    .role-btn:nth-child(4) { grid-column: 2 / span 2; }
    .demo-row { flex-direction: column; align-items: flex-start; gap: 2px; }
    .demo-row code { max-width: 100%; white-space: normal; overflow-wrap: anywhere; }
}
@media (max-width: 359.98px) {
    .role-selector { grid-template-columns: repeat(2, 1fr); }
    .role-btn, .role-btn:nth-child(4) { grid-column: auto; }
    .role-btn:last-child { grid-column: 1 / -1; }
}
@media (min-width: 1600px) {
    .login-container { max-width: 520px; }
    .login-container:has(.is-wide) { max-width: 560px; }
}
@media (prefers-reduced-motion: reduce) {
    .login-container { animation: none; }
    .role-btn, .btn-login { transition: none; }
}

.login-links { display: flex; flex-wrap: wrap; justify-content: center; gap: 6px 18px; margin-top: 22px; font-size: .88rem; }
.login-links a { color: var(--brand-ink, #0450c0); text-decoration: none; font-weight: 500; }
.login-links a:hover { text-decoration: underline; text-underline-offset: 3px; }
