/* ==========================================================================
   Kilimo Makueni 2.0 — auth screens (login, password reset/change/confirm,
   farmer self service). Layered on top of DashLite and matched to the landing
   design: tricolor strip, Outfit display type, forest green and gold.
   ========================================================================== */

/* Self-hosted Inter + Outfit, replacing the Google Fonts stylesheet the back
   office used to pull in. Same files the landing pages use. */
@font-face {
    font-family: "Inter";
    font-style: normal;
    font-weight: 400 700;
    font-display: swap;
    src: url("../../landing/fonts/inter-latin-var.woff2") format("woff2");
}

@font-face {
    font-family: "Outfit";
    font-style: normal;
    font-weight: 400 800;
    font-display: swap;
    src: url("../../landing/fonts/outfit-latin-var.woff2") format("woff2");
}

:root {
    --km-auth-green: #1a7a4a;
    --km-auth-forest: #14603a;
    --km-auth-forest-deep: #0f4a2d;
    --km-auth-gold: #e8b625;
    --km-auth-blue: #0d56a8;
    --km-auth-ink: #1c2b23;
    --km-auth-muted: #5c6d64;
    --km-auth-line: #e3ebe6;
    /* kept: older rules referenced this name */
    --km-auth-amber: #e8b625;
}

/* --- Tricolor strip, as on the landing pages ---------------------------- */
.pg-auth .nk-app-root::before {
    content: "";
    position: fixed;
    inset: 0 0 auto 0;
    height: 4px;
    z-index: 20;
    background: linear-gradient(90deg,
            #1a7a4a 0%, #1a7a4a 40%,
            #fdd102 40%, #fdd102 70%,
            #0d56a8 70%, #0d56a8 100%);
}

/* --- The photo panel ---------------------------------------------------- */
.km-auth-visual {
    position: relative;
    isolation: isolate;
    overflow: hidden;
    background-color: var(--km-auth-forest-deep);
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
    /* let the photograph carry the panel */
    filter: saturate(1.12) contrast(1.06);
}

/* Scrim keeps the caption clear of AA contrast without flattening the photo */
.km-auth-visual::after {
    content: "";
    position: absolute;
    inset: 0;
    z-index: 0;
    background: linear-gradient(180deg,
            rgba(7, 34, 18, .12) 0%,
            rgba(7, 34, 18, .44) 48%,
            rgba(7, 34, 18, .88) 100%);
}

.km-auth-caption {
    position: relative;
    z-index: 1;
    padding: clamp(1.75rem, 1rem + 3vw, 3.25rem);
    color: #fff;
    max-width: 34rem;
}

.km-auth-caption__eyebrow {
    display: inline-flex;
    align-items: center;
    gap: .55rem;
    background: rgba(255, 255, 255, .12);
    border: 1px solid rgba(255, 255, 255, .3);
    border-radius: 999px;
    padding: .4rem .9rem;
    font-size: .7rem;
    font-weight: 700;
    letter-spacing: .12em;
    text-transform: uppercase;
    color: #fff;
    margin-bottom: 1rem;
}
.km-auth-caption__eyebrow::before {
    content: "";
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: var(--km-auth-gold);
}

.km-auth-caption h2 {
    font-family: "Outfit", "Inter", system-ui, sans-serif;
    color: #fff;
    font-size: clamp(1.35rem, 1rem + 1.3vw, 2rem);
    font-weight: 700;
    letter-spacing: -.02em;
    line-height: 1.2;
    margin-bottom: .65rem;
}

.km-auth-caption p {
    color: rgba(255, 255, 255, .88);
    font-size: .95rem;
    line-height: 1.65;
    margin: 0;
}

/* Tricolor rule under the caption, echoing the landing section accent */
.km-auth-caption__rule {
    width: 64px;
    height: 3px;
    border-radius: 2px;
    margin-top: 1.25rem;
    background: linear-gradient(90deg,
            var(--km-auth-green) 0%, var(--km-auth-green) 40%,
            var(--km-auth-gold) 40%, var(--km-auth-gold) 70%,
            var(--km-auth-blue) 70%, var(--km-auth-blue) 100%);
}

/* --- Form side ---------------------------------------------------------- */
/* Matching the landing typography also stops DashLite's four Roboto weights
   (~260KB) from being requested on the auth screens. */
body.pg-auth,
body.pg-auth .form-control,
body.pg-auth .btn,
body.pg-auth a,
body.pg-auth .link,
body.pg-auth label,
body.pg-auth input,
body.pg-auth span,
body.pg-auth p,
body.pg-auth .select2-selection,
body.pg-auth .select2-selection__rendered,
body.pg-auth .select2-results__option {
    font-family: "Inter", system-ui, -apple-system, "Segoe UI", sans-serif;
}

/* Select2 fields on the self-service form, matched to the other inputs */
body.pg-auth .select2-container--default .select2-selection {
    border-radius: 10px;
    border-color: var(--km-auth-line);
    min-height: 46px;
}
body.pg-auth .select2-container--default.select2-container--focus .select2-selection {
    border-color: var(--km-auth-green);
    box-shadow: 0 0 0 3px rgba(26, 122, 74, .15);
}
body.pg-auth h1, body.pg-auth h2, body.pg-auth h3,
body.pg-auth h4, body.pg-auth h5, body.pg-auth h6,
body.pg-auth .nk-block-title {
    font-family: "Outfit", "Inter", system-ui, sans-serif;
    letter-spacing: -.02em;
}

.pg-auth .nk-auth-body { max-width: 26rem; }
/* DashLite pins .logo-img to a fixed height, which squashed the lockup to a
   3:1 box against its true 2.44:1. Let the ratio hold. */
.pg-auth .brand-logo img,
.pg-auth .logo-img,
.pg-auth .logo-img-lg {
    max-width: 180px;
    width: 180px;
    height: auto !important;
    max-height: none !important;
    aspect-ratio: 288 / 118;
    object-fit: contain;
}

.pg-auth .nk-block-title {
    color: var(--km-auth-forest);
    font-weight: 700;
    font-size: 1.45rem;
}
.pg-auth .nk-block-des p { color: var(--km-auth-muted); }

.pg-auth .form-label {
    font-weight: 600;
    color: var(--km-auth-ink);
    font-size: .88rem;
}

.pg-auth .form-control {
    border-radius: 10px;
    border-color: var(--km-auth-line);
    padding-block: .7rem;
}
.pg-auth .form-control:focus {
    border-color: var(--km-auth-green);
    box-shadow: 0 0 0 3px rgba(26, 122, 74, .15);
}

/* Pill buttons, no glow, matching the landing treatment */
.pg-auth .btn {
    border-radius: 999px;
    font-weight: 600;
    box-shadow: none;
    transition: background-color .18s ease, color .18s ease, border-color .18s ease;
}
.pg-auth .btn-primary {
    background-color: var(--km-auth-green);
    border-color: var(--km-auth-green);
}
.pg-auth .btn-primary:hover,
.pg-auth .btn-primary:focus {
    background-color: var(--km-auth-forest);
    border-color: var(--km-auth-forest);
}

.pg-auth .link-primary,
.pg-auth a strong { color: var(--km-auth-green); }
.pg-auth .link-primary:hover,
.pg-auth a:hover strong { color: var(--km-auth-forest); }

/* DashLite's muted grey is 3.1:1 on white; darken it to clear AA */
.pg-auth .text-muted { color: #5b6b7f !important; }

/* Password visibility toggle */
.pg-auth .passcode-switch svg { width: 19px; height: 19px; color: var(--km-auth-muted); }
.pg-auth .passcode-switch:hover svg { color: var(--km-auth-green); }

/* Keyboard focus needs to be obvious on a login screen */
.pg-auth a:focus-visible,
.pg-auth button:focus-visible,
.pg-auth .btn:focus-visible {
    outline: 3px solid var(--km-auth-gold);
    outline-offset: 2px;
}

/* Back-to-site link above the form */
.km-auth-back {
    display: inline-flex;
    align-items: center;
    gap: .4rem;
    font-size: .85rem;
    font-weight: 600;
    color: var(--km-auth-muted);
    text-decoration: none;
    margin-bottom: 1.25rem;
}
.km-auth-back svg { width: 15px; height: 15px; transform: rotate(180deg); }
.km-auth-back:hover { color: var(--km-auth-green); }

@media (max-width: 991.98px) {
    /* DashLite parks this panel off-canvas to the right and slides it in from
       the info toggle. Left unclipped it made the whole page scroll sideways. */
    .pg-auth .nk-split,
    .pg-auth .nk-app-root { overflow-x: hidden; }
    .km-auth-caption { padding: 1.5rem; }
}
