:root {
    --green-900: #0f3d1c;
    --green-800: #14532d;
    --green-700: #1b6b35;
    --green-600: #1f7a3c;
    --green-500: #2e9d4f;
    --green-300: #8fd19e;
    --ink-900: #16231a;
    --ink-700: #34463a;
    --ink-500: #5d6f63;
    --card-bg: rgba(236, 244, 236, 0.86);
    --field-bg: #ffffff;
    --error: #c62828;
    --radius-lg: 22px;
    --radius-md: 10px;
    --font: "Outfit", system-ui, -apple-system, "Segoe UI", Arial, sans-serif;
}

* { box-sizing: border-box; }

html, body { height: 100%; margin: 0; }

body.login-page {
    font-family: var(--font);
    color: var(--ink-900);
    background: var(--green-900);
    -webkit-font-smoothing: antialiased;
}

/* Background image with a soft light wash on the left for readable text */
.login-bg {
    position: fixed;
    inset: 0;
    background:
        linear-gradient(90deg, rgba(250, 247, 226, 0.62) 0%, rgba(250, 247, 226, 0.28) 28%, rgba(255, 255, 255, 0) 48%),
        linear-gradient(180deg, rgba(0, 0, 0, 0) 60%, rgba(10, 40, 18, 0.35) 100%),
        url("../images/login_bg.png") center / cover no-repeat;
    z-index: 0;
}

.login-wrap {
    position: relative;
    z-index: 1;
    min-height: 100vh;
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(360px, 460px);
    gap: 48px;
    padding: 36px clamp(24px, 4vw, 64px);
    max-width: 1440px;
    margin: 0 auto;
}

/* ---------- Left intro ---------- */
.login-intro {
    display: flex;
    flex-direction: column;
    min-height: calc(100vh - 72px);
}

.brand {
    display: inline-flex;
    align-items: center;
    text-decoration: none;
    align-self: flex-start;
}
/* The supplied artwork, shown as one piece - never stretched */
.brand img {
    width: clamp(240px, 26vw, 330px);
    height: auto;
    filter: drop-shadow(0 2px 10px rgba(0, 0, 0, 0.45));
}
.brand-mark { width: 44px; height: 58px; object-fit: contain; filter: drop-shadow(0 2px 6px rgba(0, 0, 0, 0.35)); }
.brand-text { display: flex; flex-direction: column; line-height: 1.1; color: #fff; text-shadow: 0 1px 6px rgba(0, 0, 0, 0.45); }
.brand-text .brand-hi { font-size: 15px; font-weight: 500; margin-bottom: 3px; opacity: 0.95; }
.brand-text strong { font-size: 24px; font-weight: 700; letter-spacing: 0.1px; }

/* Local scrim: keeps the dark text readable whatever the photo does behind it */
.welcome {
    margin-top: clamp(40px, 9vh, 96px);
    margin-left: -24px;
    max-width: 468px;
    padding: 20px clamp(24px, 6vw, 56px) 24px 24px;
    background: linear-gradient(90deg, rgba(253, 251, 238, 0.88) 0%, rgba(253, 251, 238, 0.7) 45%, rgba(253, 251, 238, 0) 100%);
}
.welcome h1 { margin: 0; line-height: 1.1; }
.welcome h1 span { display: block; }
.welcome-small { font-size: 24px; font-weight: 600; color: var(--ink-900); }
/* Hindi above English, in the logo's own green and blue */
.welcome-hi {
    font-family: "Noto Sans Devanagari", "Nirmala UI", system-ui, sans-serif;
    font-size: 26px;
    font-weight: 700;
    color: #027C01;
    margin-top: 10px;
    line-height: 1.35;
}
.welcome-brand { font-size: 38px; font-weight: 700; color: #002B8A; margin-top: 2px; letter-spacing: -0.5px; }
.welcome-title { font-size: 38px; font-weight: 700; color: var(--ink-900); letter-spacing: -0.5px; }
.welcome-bar { display: block; width: 60px; height: 4px; border-radius: 4px; background: var(--green-600); margin: 20px 0 18px; }
.welcome p { margin: 0; max-width: 360px; font-size: 17px; line-height: 1.55; color: var(--ink-700); }

.highlights { list-style: none; padding: 0; margin: 28px 0 0; display: grid; gap: 18px; max-width: 380px; }
.highlights li { display: flex; align-items: center; gap: 14px; }
.hl-icon {
    flex: 0 0 52px;
    height: 52px;
    border-radius: 50%;
    display: grid;
    place-items: center;
    background: rgba(255, 255, 255, 0.92);
    color: var(--green-700);
    font-size: 24px;
    box-shadow: 0 4px 14px rgba(20, 60, 30, 0.12);
}
.highlights li > span:last-child { max-width: 250px; font-size: 14px; line-height: 1.45; color: var(--ink-700); }
.highlights strong { display: block; font-size: 15px; font-weight: 600; color: var(--ink-900); margin-bottom: 2px; }

.modules {
    list-style: none;
    margin: auto 0 0;
    padding: 14px 8px;
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    max-width: 520px;
    background: rgba(20, 83, 45, 0.72);
    border: 1px solid rgba(143, 209, 158, 0.35);
    border-radius: 14px;
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    color: #fff;
}
.modules li {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    padding: 6px 4px;
    text-align: center;
    font-size: 11px;
    font-weight: 500;
    letter-spacing: 0.4px;
    text-transform: uppercase;
    line-height: 1.3;
}
.modules li + li { border-left: 1px solid rgba(255, 255, 255, 0.2); }
.modules i { font-size: 28px; color: #d8f3dc; }

/* ---------- Right card ---------- */
.login-side {
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: stretch;
    gap: 22px;
}

.login-card {
    background: var(--card-bg);
    border: 1px solid rgba(255, 255, 255, 0.6);
    border-radius: var(--radius-lg);
    padding: 36px 34px 26px;
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
    box-shadow: 0 20px 50px rgba(10, 40, 18, 0.25);
    text-align: center;
}

.card-lock {
    width: 72px;
    height: 72px;
    margin: 0 auto 18px;
    border-radius: 50%;
    display: grid;
    place-items: center;
    background: #fff;
    color: var(--green-700);
    font-size: 34px;
    box-shadow: 0 6px 16px rgba(20, 60, 30, 0.12);
}
.login-card h2 { margin: 0; font-size: 26px; font-weight: 700; color: var(--green-700); }
.card-sub { margin: 6px 0 24px; font-size: 15px; color: var(--ink-500); }

.alert {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    text-align: left;
    font-size: 14px;
    padding: 10px 12px;
    border-radius: var(--radius-md);
    margin-bottom: 16px;
}
.alert i { font-size: 18px; line-height: 1.1; }
.alert-error { background: #fdecea; color: var(--error); border: 1px solid #f5c2c0; }
.alert-success { background: #e8f5e9; color: var(--green-700); border: 1px solid #b9e0bf; }

.field {
    position: relative;
    display: flex;
    align-items: center;
    background: var(--field-bg);
    border: 1px solid #e1e8e2;
    border-radius: var(--radius-md);
    margin-bottom: 16px;
    transition: border-color 0.15s, box-shadow 0.15s;
}
.field:focus-within { border-color: var(--green-500); box-shadow: 0 0 0 3px rgba(46, 157, 79, 0.15); }
.field.is-invalid { border-color: var(--error); }
.field-icon { position: absolute; left: 16px; font-size: 20px; color: var(--green-700); pointer-events: none; }
.field input {
    width: 100%;
    border: 0;
    outline: 0;
    background: transparent;
    font: inherit;
    font-size: 16px;
    color: var(--ink-900);
    padding: 15px 48px 15px 50px;
    border-radius: var(--radius-md);
}
.field input::placeholder { color: #6b7a70; }
.toggle-pass {
    position: absolute;
    right: 8px;
    border: 0;
    background: none;
    padding: 6px 8px;
    cursor: pointer;
    color: var(--ink-500);
    font-size: 20px;
    border-radius: 6px;
}
.toggle-pass:hover { color: var(--green-700); }
.toggle-pass:focus-visible { color: var(--green-700); outline: 3px solid var(--green-300); outline-offset: 2px; }

.form-row { display: flex; justify-content: space-between; align-items: center; margin: 4px 0 20px; font-size: 14px; }
.check { display: inline-flex; align-items: center; gap: 8px; cursor: pointer; color: var(--ink-700); }
.check input { width: 18px; height: 18px; accent-color: var(--green-600); margin: 0; }
.forgot { color: var(--green-700); text-decoration: none; font-weight: 500; }
.forgot:hover { text-decoration: underline; }
.forgot-note { margin: -8px 0 16px; font-size: 13px; color: var(--ink-700); text-align: left; display: flex; gap: 6px; }
.forgot-note[hidden] { display: none; }

.btn-login {
    width: 100%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    border: 0;
    border-radius: var(--radius-md);
    padding: 15px 20px;
    font: inherit;
    font-size: 18px;
    font-weight: 600;
    color: #fff;
    cursor: pointer;
    background: linear-gradient(180deg, var(--green-600), var(--green-800));
    box-shadow: 0 8px 18px rgba(20, 83, 45, 0.3);
    transition: transform 0.1s, box-shadow 0.15s, filter 0.15s;
}
.btn-login i { font-size: 22px; }
.btn-login:hover { filter: brightness(1.07); }
.btn-login:active { transform: translateY(1px); }
.btn-login:disabled { opacity: 0.75; cursor: wait; }
.btn-login:focus-visible { outline: 3px solid var(--green-300); outline-offset: 2px; }

.secure { margin-top: 24px; padding-top: 18px; border-top: 1px solid rgba(20, 83, 45, 0.12); display: grid; gap: 6px; }
.secure strong { color: var(--green-700); font-weight: 600; font-size: 16px; display: inline-flex; align-items: center; justify-content: center; gap: 6px; }
.secure strong i { font-size: 20px; }
.secure span { font-size: 13px; color: var(--ink-500); }

.login-footer { display: grid; justify-items: center; gap: 8px; color: #fff; font-size: 14px; text-shadow: 0 1px 4px rgba(0, 0, 0, 0.35); }
.login-footer nav { display: flex; gap: 12px; align-items: center; }
.login-footer a { color: #fff; text-decoration: none; }
.login-footer a:hover { text-decoration: underline; }
.version { display: inline-flex; align-items: center; gap: 6px; }
.version i { color: var(--green-300); font-size: 18px; }

/* ---------- Responsive ---------- */
@media (max-width: 1100px) {
    .login-wrap { grid-template-columns: 1fr minmax(340px, 420px); gap: 32px; }
    .welcome-brand, .welcome-title { font-size: 38px; }
}

/* ---------- Mobile: behave like a native app screen ---------- */
@media (max-width: 860px) {
    html, body { height: 100%; overscroll-behavior-y: none; }
    body.login-page { background: var(--green-800); }

    /* Brand area on top, login sheet slides up from the bottom */
    .login-bg {
        background:
            linear-gradient(180deg, rgba(10, 40, 18, 0.15) 0%, rgba(10, 40, 18, 0.65) 100%),
            url("../images/login_bg.png") 38% top / cover no-repeat;
    }

    .login-wrap {
        display: flex;
        flex-direction: column;
        justify-content: flex-end;
        gap: 0;
        padding: 0;
        min-height: 100svh;
        max-width: none;
    }

    .login-intro {
        min-height: 0;
        flex: 1 1 auto;
        align-items: center;
        justify-content: center;
        padding: max(28px, env(safe-area-inset-top)) 20px 18px;
        text-align: center;
    }
    .brand { align-self: center; flex-direction: column; gap: 10px; }
    .brand-mark { width: 62px; }
    .brand-text { align-items: center; }
    .brand-text strong { font-size: 26px; }
    .welcome, .highlights, .modules { display: none; }

    /* The card becomes a bottom sheet filling the rest of the screen */
    .login-side { justify-content: flex-end; gap: 0; }
    .login-card {
        min-width: 0;
        border-radius: 26px 26px 0 0;
        border: 0;
        border-top: 1px solid rgba(255, 255, 255, 0.55);
        background: rgba(242, 248, 242, 0.96);
        padding: 26px 20px 18px;
        box-shadow: 0 -10px 40px rgba(0, 0, 0, 0.3);
    }
    .card-lock { width: 60px; height: 60px; font-size: 28px; margin-bottom: 14px; }
    .login-card h2 { font-size: 22px; }
    .card-sub { font-size: 14px; margin-bottom: 20px; }

    /* Bigger touch targets; 16px text stops iOS zooming on focus */
    .field { margin-bottom: 14px; }
    .field input { padding: 17px 48px 17px 50px; font-size: 16px; }
    .toggle-pass { padding: 10px 12px; }
    .check input { width: 20px; height: 20px; }
    .btn-login { padding: 17px 20px; border-radius: 14px; }
    .form-row { margin: 2px 0 18px; }

    .secure { margin-top: 18px; padding-top: 14px; }
    .secure span { font-size: 12px; }

    /* Footer sits inside the sheet on mobile */
    .login-footer {
        color: var(--ink-500);
        text-shadow: none;
        font-size: 12px;
        padding: 12px 16px calc(10px + env(safe-area-inset-bottom));
        background: rgba(242, 248, 242, 0.96);
    }
    .login-footer a { color: var(--ink-700); }
    .version i { color: var(--green-600); }
}

/* Short phones in landscape: keep everything reachable */
@media (max-width: 860px) and (max-height: 520px) {
    .login-intro { display: none; }
    .login-card { border-radius: 0; padding-top: 18px; }
}

/* Installed app (home screen): no browser bar, so use the full height */
@media (display-mode: standalone) {
    .login-intro { padding-top: max(36px, env(safe-area-inset-top)); }
}

/* Phone: the brand lockup and the welcome block step down a size */
@media (max-width: 720px) {
    .brand img { width: min(250px, 72vw); }
    .welcome-small { font-size: 19px; }
    .welcome-hi { font-size: 20px; }
    .welcome-brand, .welcome-title { font-size: 28px; }
}
