/**
 * Portal sign-in and account access pages (login, reset, recover, activate, account chooser) and the
 * site's error documents, which reuse the same card.
 * Printed by portal_auth_stylesheet(): from header.php when PORTAL_AUTH_PAGE is defined (portal/index.php,
 * route() in inc/site.data.php), or from inc/error.document.php when a page calls route('404') itself
 * Company: Wits Technologies Ltd
 * @author Sammy Mwaura Waweru <sammy@witstechnologies.co.ke>
 */
.auth-page {
 --auth-brand: #00759a; /* WCAG AA with white text (site.css --ui-primary); #0085af is 4.2:1 */
 --auth-brand-dark: #005d7a;
 --auth-accent: #f8971b;
 --auth-text: #1d2b36;
 --auth-muted: #5b6b76;
 --auth-border: #d5dde3;
 --auth-field: #f7f9fb;
 --auth-radius: 10px;
 padding: 48px 0 64px;
 background:
  radial-gradient(circle at 12% 0%, rgba(0, 133, 175, .10), transparent 45%),
  radial-gradient(circle at 92% 100%, rgba(248, 151, 27, .10), transparent 40%),
  #f3f6f8;
 color: var(--auth-text);
}

.auth-card {
 display: flex;
 max-width: 980px;
 margin: 0 auto;
 background: #fff;
 border-radius: 18px;
 overflow: hidden;
 box-shadow: 0 24px 60px -24px rgba(19, 99, 123, .35), 0 2px 6px rgba(16, 24, 40, .05);
}

.auth-card.auth-card-narrow {
 max-width: 520px;
}

/* Brand / context panel */
.auth-aside {
 position: relative;
 flex: 0 0 42%;
 padding: 48px 40px;
 overflow: hidden;
 color: #fff;
 background: linear-gradient(155deg, var(--auth-brand) 0%, var(--auth-brand-dark) 100%);
}

.auth-aside::before, .auth-aside::after {
 content: "";
 position: absolute;
 border-radius: 50%;
 pointer-events: none;
}

.auth-aside::before {
 width: 320px;
 height: 320px;
 right: -140px;
 top: -120px;
 background: rgba(255, 255, 255, .08);
}

.auth-aside::after {
 width: 220px;
 height: 220px;
 left: -90px;
 bottom: -110px;
 background: rgba(248, 151, 27, .22);
}

.auth-aside-inner {
 position: relative;
 z-index: 1;
}

.auth-eyebrow {
 display: inline-block;
 margin-bottom: 18px;
 padding: 4px 12px;
 border-radius: 999px;
 background: rgba(255, 255, 255, .15);
 font-size: 12px;
 font-weight: 600;
 letter-spacing: .06em;
 text-transform: uppercase;
}

.auth-eyebrow .bi {
 color: var(--auth-accent);
 margin-right: 4px;
}

.auth-aside h2 {
 margin: 0 0 12px;
 color: #fff;
 font-size: 28px;
 font-weight: 600;
 line-height: 1.25;
}

.auth-aside p {
 color: rgba(255, 255, 255, .85);
 font-size: 15px;
 line-height: 1.6;
}

.auth-aside a {
 color: #fff;
 font-weight: 600;
 text-decoration: underline;
}

.auth-aside a:hover, .auth-aside a:focus {
 color: var(--auth-accent);
}

.auth-points {
 margin: 28px 0 0;
 padding: 0;
 list-style: none;
}

.auth-points li {
 display: flex;
 gap: 14px;
 margin-bottom: 18px;
 font-size: 14px;
 line-height: 1.5;
 color: rgba(255, 255, 255, .9);
}

.auth-points li strong {
 display: block;
 color: #fff;
 font-size: 15px;
}

.auth-points .auth-point-icon {
 flex: 0 0 38px;
 display: flex;
 align-items: center;
 justify-content: center;
 width: 38px;
 height: 38px;
 border-radius: 10px;
 background: rgba(255, 255, 255, .14);
 color: var(--auth-accent);
 font-size: 18px;
}

/* Numbered steps (reset) */
.auth-points.auth-steps {
 counter-reset: auth-step;
}

.auth-steps .auth-point-icon::before {
 counter-increment: auth-step;
 content: counter(auth-step);
 font-weight: 700;
 font-size: 16px;
}

/* Form panel */
.auth-main {
 flex: 1;
 min-width: 0;
 padding: 48px 48px 40px;
}

.auth-badge {
 display: flex;
 align-items: center;
 justify-content: center;
 width: 52px;
 height: 52px;
 margin-bottom: 18px;
 border-radius: 14px;
 background: rgba(0, 133, 175, .1);
 color: var(--auth-brand);
 font-size: 24px;
}

.auth-badge.auth-badge-success {
 background: rgba(46, 160, 67, .12);
 color: #2ea043;
}

.auth-badge.auth-badge-danger {
 background: rgba(207, 34, 46, .1);
 color: #cf222e;
}

.auth-main h1 {
 margin: 0 0 6px;
 color: var(--auth-text);
 font-size: 26px;
 font-weight: 600;
}

.auth-subtitle {
 margin-bottom: 24px;
 color: var(--auth-muted);
 font-size: 15px;
}

.auth-subtitle strong {
 color: var(--auth-text);
}

.auth-messages .alert {
 margin-bottom: 20px;
 border: 0;
 border-radius: var(--auth-radius);
 background-image: none;
 box-shadow: none;
 font-size: 14px;
 text-shadow: none;
}

.auth-messages .alert .bi {
 margin-right: 4px;
}

.auth-page .text-danger:empty {
 display: none;
}

/* Fields */
.auth-field {
 margin-bottom: 18px;
}

.auth-field > label {
 display: block;
 margin-bottom: 6px;
 color: var(--auth-text);
 font-size: 14px;
 font-weight: 600;
}

.auth-field > label .text-danger {
 font-weight: 400;
}

.auth-input {
 position: relative;
}

.auth-input-icon {
 position: absolute;
 z-index: 3;
 top: 0;
 left: 0;
 display: flex;
 align-items: center;
 justify-content: center;
 width: 44px;
 height: 48px;
 color: #8a99a4;
 font-size: 17px;
 pointer-events: none;
}

.auth-page .auth-input .form-control {
 height: 48px;
 padding: 10px 14px 10px 44px;
 border: 1px solid var(--auth-border);
 border-radius: var(--auth-radius);
 background-color: var(--auth-field);
 box-shadow: none;
 color: var(--auth-text);
 font-size: 15px;
 transition: border-color .15s ease, box-shadow .15s ease, background-color .15s ease;
}

.auth-page .auth-input.has-action .form-control {
 padding-right: 48px;
}

.auth-page .auth-input select.form-control {
 -webkit-appearance: none;
 -moz-appearance: none;
 appearance: none;
 padding-right: 40px;
 background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 16 16' fill='%235b6b76'%3E%3Cpath d='M1.6 4.6a.75.75 0 0 1 1.06 0L8 9.94l5.34-5.34a.75.75 0 1 1 1.06 1.06l-5.87 5.87a.75.75 0 0 1-1.06 0L1.6 5.66a.75.75 0 0 1 0-1.06z'/%3E%3C/svg%3E");
 background-repeat: no-repeat;
 background-position: right 16px center;
}

.auth-page .auth-input .form-control:focus {
 border-color: var(--auth-brand);
 background-color: #fff;
 box-shadow: 0 0 0 3px rgba(0, 133, 175, .15);
 outline: 0;
}

.auth-input .form-control:focus ~ .auth-input-icon,
.auth-input .form-control:focus + .auth-input-icon {
 color: var(--auth-brand);
}

.auth-page .auth-input .form-control.error,
.auth-page .auth-input .form-control.is-invalid {
 border-color: #cf222e;
}

.auth-page .auth-input .form-control.error:focus,
.auth-page .auth-input .form-control.is-invalid:focus {
 box-shadow: 0 0 0 3px rgba(207, 34, 46, .12);
}

.auth-input-action {
 position: absolute;
 z-index: 3;
 top: 0;
 right: 0;
 width: 48px;
 height: 48px;
 padding: 0;
 border: 0;
 border-radius: 0 var(--auth-radius) var(--auth-radius) 0;
 background: transparent;
 color: #8a99a4;
 font-size: 18px;
}

.auth-input-action:hover, .auth-input-action:focus {
 color: var(--auth-brand);
}

.auth-input-action:focus-visible {
 outline: 2px solid var(--auth-brand);
 outline-offset: -4px;
}

/* jQuery Validate messages and server-side field errors */
.auth-page label.error, .auth-page .invalid-feedback, .auth-field-error {
 display: block;
 margin: 6px 0 0;
 color: #cf222e;
 font-size: 13px;
 font-weight: 400;
}

.auth-help {
 display: block;
 margin: 6px 0 0;
 color: var(--auth-muted);
 font-size: 13px;
}

.auth-capslock {
 display: none;
 margin: 6px 0 0;
 color: #9a6700;
 font-size: 13px;
}

.auth-capslock.is-visible {
 display: block;
}

.auth-row {
 display: flex;
 flex-wrap: wrap;
 align-items: center;
 justify-content: space-between;
 gap: 8px;
 margin: 4px 0 22px;
 font-size: 14px;
}

.auth-check {
 display: inline-flex;
 align-items: center;
 gap: 8px;
 margin: 0;
 color: var(--auth-muted);
 font-weight: 400;
 cursor: pointer;
}

.auth-check input {
 width: 16px;
 height: 16px;
 margin: 0;
 accent-color: var(--auth-brand);
}

.auth-page a.auth-link {
 color: var(--auth-brand);
 font-weight: 600;
}

.auth-page a.auth-link:hover, .auth-page a.auth-link:focus {
 color: var(--auth-brand-dark);
}

/* Password checklist (activate) */
.auth-checklist {
 margin: 0 0 20px;
 padding: 12px 14px;
 border-radius: var(--auth-radius);
 background: var(--auth-field);
 list-style: none;
 font-size: 13px;
}

.auth-checklist li {
 display: flex;
 align-items: center;
 gap: 8px;
 padding: 2px 0;
 color: var(--auth-muted);
}

.auth-checklist li::before {
 content: "\F28A"; /* bi-circle */
 font-family: "bootstrap-icons";
 color: #a9b6bf;
}

.auth-checklist li.is-met {
 color: #1a7f37;
}

.auth-checklist li.is-met::before {
 content: "\F26A"; /* bi-check-circle-fill */
 color: #2ea043;
}

/* Buttons */
.auth-page .btn.auth-submit {
 position: relative;
 height: 50px;
 border: 0;
 border-radius: var(--auth-radius);
 background: var(--auth-brand);
 background-image: none;
 box-shadow: 0 8px 18px -10px rgba(0, 133, 175, .9);
 color: #fff;
 font-size: 16px;
 font-weight: 600;
 text-shadow: none;
 transition: background-color .15s ease, transform .15s ease;
}

.auth-page .btn.auth-submit:hover, .auth-page .btn.auth-submit:focus {
 background: var(--auth-brand-dark);
 color: #fff;
}

.auth-page .btn.auth-submit:active {
 transform: translateY(1px);
}

.auth-page .btn.auth-submit:focus-visible {
 outline: 3px solid rgba(0, 133, 175, .35);
 outline-offset: 2px;
}

.auth-submit .bi {
 margin-left: 6px;
 transition: transform .15s ease;
}

.auth-submit:hover .bi {
 transform: translateX(3px);
}

.auth-submit.is-loading {
 color: transparent !important;
 pointer-events: none;
}

.auth-submit.is-loading::after {
 content: "";
 position: absolute;
 top: 50%;
 left: 50%;
 width: 22px;
 height: 22px;
 margin: -11px 0 0 -11px;
 border: 3px solid rgba(255, 255, 255, .4);
 border-top-color: #fff;
 border-radius: 50%;
 animation: auth-spin .7s linear infinite;
}

@keyframes auth-spin {
 to {
  transform: rotate(360deg);
 }
}

.auth-page .btn.auth-secondary {
 height: 48px;
 padding-top: 13px;
 border: 1px solid var(--auth-border);
 border-radius: var(--auth-radius);
 background: #fff;
 background-image: none;
 box-shadow: none;
 color: var(--auth-text);
 font-weight: 600;
 text-shadow: none;
}

.auth-page .btn.auth-secondary:hover, .auth-page .btn.auth-secondary:focus {
 border-color: var(--auth-brand);
 color: var(--auth-brand);
}

.auth-divider {
 display: flex;
 align-items: center;
 gap: 12px;
 margin: 26px 0 16px;
 color: var(--auth-muted);
 font-size: 13px;
}

.auth-divider::before, .auth-divider::after {
 content: "";
 flex: 1;
 height: 1px;
 background: #e5eaee;
}

.auth-footnote {
 margin: 18px 0 0;
 color: var(--auth-muted);
 font-size: 13px;
 text-align: center;
}

.auth-back {
 display: inline-flex;
 align-items: center;
 gap: 6px;
 margin-top: 18px;
 font-size: 14px;
}

/* Account type chooser (/new/) */
.auth-roles {
 display: grid;
 gap: 12px;
 margin: 0 0 8px;
}

.auth-page a.auth-role {
 display: flex;
 align-items: center;
 gap: 16px;
 padding: 16px 18px;
 border: 1px solid var(--auth-border);
 border-radius: 12px;
 background: #fff;
 color: var(--auth-text);
 text-decoration: none;
 transition: border-color .15s ease, box-shadow .15s ease, transform .15s ease;
}

.auth-page a.auth-role:hover, .auth-page a.auth-role:focus {
 border-color: var(--auth-brand);
 box-shadow: 0 10px 24px -16px rgba(0, 133, 175, .8);
 transform: translateY(-1px);
}

.auth-page a.auth-role:focus-visible {
 outline: 3px solid rgba(0, 133, 175, .35);
 outline-offset: 2px;
}

.auth-role-icon {
 flex: 0 0 46px;
 display: flex;
 align-items: center;
 justify-content: center;
 width: 46px;
 height: 46px;
 border-radius: 12px;
 background: rgba(0, 133, 175, .1);
 color: var(--auth-brand);
 font-size: 21px;
}

.auth-role-text {
 flex: 1;
 min-width: 0;
 color: var(--auth-muted);
 font-size: 14px;
 line-height: 1.45;
}

.auth-role-text strong {
 display: block;
 margin-bottom: 2px;
 color: var(--auth-text);
 font-size: 16px;
}

.auth-role-arrow {
 color: #a9b6bf;
 font-size: 16px;
 transition: transform .15s ease, color .15s ease;
}

.auth-role:hover .auth-role-arrow, .auth-role:focus .auth-role-arrow {
 color: var(--auth-brand);
 transform: translateX(3px);
}

/* Error documents (400, 401, 403, 404, 500) */
.auth-error .auth-main {
 padding: 44px 44px 36px;
 text-align: center;
}

.auth-error-code {
 margin: 0 0 4px;
 background: linear-gradient(135deg, var(--auth-brand) 0%, var(--auth-brand-dark) 60%, var(--auth-accent) 100%);
 -webkit-background-clip: text;
 background-clip: text;
 color: transparent;
 font-size: 96px;
 font-weight: 800;
 letter-spacing: -.04em;
 line-height: 1;
}

.auth-error .auth-subtitle {
 margin-bottom: 28px;
}

.auth-error .auth-subtitle code {
 padding: 2px 6px;
 border-radius: 6px;
 background: var(--auth-field);
 color: var(--auth-text);
 font-size: 13px;
 word-break: break-all;
}

.auth-error .btn.auth-secondary {
 margin-top: 10px;
}

.auth-links {
 display: flex;
 flex-wrap: wrap;
 justify-content: center;
 gap: 6px 18px;
 margin: 24px 0 0;
 padding: 18px 0 0;
 border-top: 1px solid #e5eaee;
 list-style: none;
 font-size: 14px;
}

@media (prefers-reduced-motion: reduce) {
 .auth-page *, .auth-page *::before, .auth-page *::after {
  transition: none !important;
  animation-duration: 1.5s !important;
 }
}

/* Tablets and phones: the form comes first, the context panel follows */
@media (max-width: 991px) {
 .auth-aside {
  flex-basis: 40%;
  padding: 40px 28px;
 }

 .auth-main {
  padding: 40px 32px 32px;
 }
}

@media (max-width: 767px) {
 .auth-page {
  padding: 20px 0 36px;
 }

 .auth-card {
  flex-direction: column;
  border-radius: 14px;
 }

 .auth-main {
  order: 1;
  padding: 28px 20px 24px;
 }

 .auth-aside {
  order: 2;
  flex-basis: auto;
  padding: 28px 20px;
 }

 .auth-aside h2 {
  font-size: 22px;
 }

 .auth-main h1 {
  font-size: 22px;
 }

 .auth-error .auth-main {
  padding: 32px 20px 28px;
 }

 .auth-error-code {
  font-size: 72px;
 }

 .auth-page .auth-input .form-control {
  font-size: 16px; /* stops iOS zooming into the field */
 }
}
