/* =====================================================================
   EDU ERP — shared styles for every login / role-select page
   Used by: Login, Logind, Accountant/AccountantLogin, Casher/CLogin,
            Principal/PrincipalLogin, teacher/TeacherLogin,
            Management/ManagmantLogin, Result/ResultLogin,
            Staff/StaffLogin, Extras/Login
   Role colour is picked with a class on <body>: role-admin, role-accountant ...
   ===================================================================== */

:root {
    --navy-900: #0f1b33;
    --navy-800: #16264a;
    --navy-700: #1e3563;
    --ink: #1c2539;
    --ink-soft: #4a5670;
    --muted: #7d889e;
    --line: #dde3ed;
    --field: #f6f8fb;
    --surface: #ffffff;
    --page: #eef2f7;
    --danger: #d64545;
    --danger-bg: #fdeeee;

    /* role accent — overridden per role below */
    --accent: #2f6fd6;
    --accent-dark: #1f55ad;
    --accent-soft: rgba(47, 111, 214, .12);
}

body.role-admin      { --accent: #e0533f; --accent-dark: #b93b29; --accent-soft: rgba(224, 83, 63, .12); }
body.role-principal  { --accent: #1597b8; --accent-dark: #0e7590; --accent-soft: rgba(21, 151, 184, .12); }
body.role-teacher    { --accent: #2f6fd6; --accent-dark: #1f55ad; --accent-soft: rgba(47, 111, 214, .12); }
body.role-accountant { --accent: #1f9d63; --accent-dark: #157a4b; --accent-soft: rgba(31, 157, 99, .12); }
body.role-cashier    { --accent: #5a67d8; --accent-dark: #4450b8; --accent-soft: rgba(90, 103, 216, .12); }
body.role-management { --accent: #c7801a; --accent-dark: #9e6412; --accent-soft: rgba(199, 128, 26, .13); }
body.role-result     { --accent: #8b4fc4; --accent-dark: #6d3a9f; --accent-soft: rgba(139, 79, 196, .12); }
body.role-staff      { --accent: #0f8f86; --accent-dark: #0b6f68; --accent-soft: rgba(15, 143, 134, .12); }
body.role-dev        { --accent: #3b4a6b; --accent-dark: #27324b; --accent-soft: rgba(59, 74, 107, .12); }

*, *::before, *::after { box-sizing: border-box; }

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

body.auth {
    font-family: 'Plus Jakarta Sans', 'Source Sans Pro', 'Segoe UI', Arial, sans-serif;
    font-size: 15px;
    line-height: 1.5;
    color: var(--ink);
    background: var(--page);
    -webkit-font-smoothing: antialiased;
}

.auth a { color: var(--accent); }

/* ---------- Split layout ---------- */
.auth-shell {
    display: grid;
    grid-template-columns: minmax(0, 1.05fr) minmax(0, 1fr);
    min-height: 100vh;
}

/* ---------- Brand panel (left) ---------- */
.auth-brand {
    position: relative;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    padding: 48px 56px;
    color: #fff;
    overflow: hidden;
    background:
        linear-gradient(155deg, rgba(15, 27, 51, .94) 0%, rgba(22, 38, 74, .88) 55%, rgba(30, 53, 99, .80) 100%),
        url('../dist/img/eduagent.png') center / cover no-repeat,
        var(--navy-900);
}

/* soft accent glow tied to the role colour */
.auth-brand::after {
    content: "";
    position: absolute;
    width: 520px;
    height: 520px;
    right: -180px;
    bottom: -200px;
    border-radius: 50%;
    background: radial-gradient(circle, var(--accent) 0%, transparent 65%);
    opacity: .35;
    pointer-events: none;
}

.auth-brand > * { position: relative; z-index: 1; }

.brand-top {
    display: flex;
    align-items: center;
    gap: 16px;
}

.brand-logo {
    flex: 0 0 auto;
    width: 76px;
    height: 76px;
    border-radius: 18px;
    background: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 8px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, .25);
}

.brand-logo img { max-width: 100%; max-height: 100%; object-fit: contain; }

.brand-logo .fa { font-size: 32px; color: var(--navy-700); }

.brand-name {
    margin: 0;
    font-size: 22px;
    font-weight: 700;
    line-height: 1.25;
    letter-spacing: .1px;
}

.brand-sub {
    margin: 2px 0 0;
    font-size: 13px;
    color: rgba(255, 255, 255, .65);
    letter-spacing: .4px;
}

.brand-hero { max-width: 460px; }

.brand-hero h2 {
    margin: 0 0 14px;
    font-size: 34px;
    line-height: 1.2;
    font-weight: 700;
    letter-spacing: -.3px;
}

.brand-hero p {
    margin: 0 0 28px;
    font-size: 15.5px;
    color: rgba(255, 255, 255, .72);
}

.brand-points { list-style: none; margin: 0; padding: 0; display: grid; gap: 14px; }

.brand-points li {
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 14.5px;
    color: rgba(255, 255, 255, .88);
}

.brand-points .fa {
    width: 34px;
    height: 34px;
    border-radius: 10px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 15px;
    background: rgba(255, 255, 255, .10);
    border: 1px solid rgba(255, 255, 255, .14);
}

.brand-foot {
    font-size: 12.5px;
    color: rgba(255, 255, 255, .55);
}

.brand-foot a { color: rgba(255, 255, 255, .8); text-decoration: none; }
.brand-foot a:hover { color: #fff; text-decoration: underline; }

/* ---------- Form panel (right) ---------- */
.auth-panel {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 48px 28px;
    background: var(--surface);
}

.auth-card {
    width: 100%;
    max-width: 400px;
    animation: auth-rise .4s ease both;
}

@keyframes auth-rise {
    from { opacity: 0; transform: translateY(10px); }
    to   { opacity: 1; transform: none; }
}

.role-chip {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    padding: 6px 14px 6px 6px;
    border-radius: 999px;
    background: var(--accent-soft);
    color: var(--accent-dark);
    font-size: 12.5px;
    font-weight: 700;
    letter-spacing: .6px;
    text-transform: uppercase;
    margin-bottom: 18px;
}

.role-chip .fa {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: var(--accent);
    color: #fff;
    font-size: 13px;
}

.auth-title {
    margin: 0 0 6px;
    font-size: 28px;
    font-weight: 700;
    letter-spacing: -.3px;
    color: var(--ink);
}

.auth-lead {
    margin: 0 0 28px;
    color: var(--muted);
    font-size: 14.5px;
}

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

.field-label {
    display: block;
    margin-bottom: 7px;
    font-size: 13px;
    font-weight: 600;
    color: var(--ink-soft);
}

.field-control { position: relative; }

.field-control > .fa {
    position: absolute;
    left: 15px;
    top: 50%;
    transform: translateY(-50%);
    color: #9aa5b8;
    font-size: 15px;
    pointer-events: none;
    transition: color .15s ease;
}

.auth-input {
    display: block;
    width: 100%;
    height: 50px;
    padding: 0 46px 0 44px;
    font: inherit;
    font-size: 15px;
    color: var(--ink);
    background: var(--field);
    border: 1.5px solid var(--line);
    border-radius: 12px;
    outline: none;
    transition: border-color .15s ease, box-shadow .15s ease, background .15s ease;
}

.auth-input::placeholder { color: #a6afc0; }

.auth-input:focus {
    background: #fff;
    border-color: var(--accent);
    box-shadow: 0 0 0 4px var(--accent-soft);
}

.field-control:focus-within > .fa { color: var(--accent); }

.pw-toggle {
    position: absolute;
    right: 6px;
    top: 50%;
    transform: translateY(-50%);
    width: 38px;
    height: 38px;
    border: 0;
    border-radius: 10px;
    background: transparent;
    color: #8793a8;
    font-size: 16px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}

.pw-toggle:hover { color: var(--accent); background: var(--accent-soft); }
.pw-toggle:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }

/* ---------- Captcha ---------- */
.captcha-row {
    display: grid;
    grid-template-columns: 42% 1fr;
    gap: 10px;
}

.captcha-code {
    display: block;
    width: 100%;
    height: 50px;
    padding: 0 10px;
    border: 1.5px dashed #c5cfdd;
    border-radius: 12px;
    background: repeating-linear-gradient(-45deg, #f1f4f9, #f1f4f9 7px, #e8edf5 7px, #e8edf5 14px);
    font-family: 'Courier New', Consolas, monospace;
    font-size: 20px;
    font-weight: 700;
    letter-spacing: 5px;
    text-align: center;
    text-transform: none; /* show the code exactly as generated */
    color: var(--navy-700);
    cursor: default;
    user-select: none;
    -webkit-user-select: none;
    outline: none;
}

.captcha-row .auth-input { padding-left: 16px; padding-right: 16px; }

/* ---------- Message ---------- */
.auth-alert {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    margin: 0 0 18px;
    padding: 11px 14px;
    border-radius: 10px;
    background: var(--danger-bg);
    border: 1px solid rgba(214, 69, 69, .25);
    color: var(--danger);
    font-size: 14px;
    font-weight: 600;
}

.auth-alert .fa { margin-top: 3px; }

/* ---------- Submit ---------- */
.auth-submit {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    width: 100%;
    height: 52px;
    margin-top: 6px;
    border: 0;
    border-radius: 12px;
    background: var(--accent);
    color: #fff;
    font: inherit;
    font-size: 15.5px;
    font-weight: 700;
    letter-spacing: .3px;
    cursor: pointer;
    box-shadow: 0 10px 22px -8px var(--accent);
    transition: background .15s ease, transform .15s ease, box-shadow .15s ease;
}

.auth-submit:hover { background: var(--accent-dark); transform: translateY(-1px); }
.auth-submit:active { transform: none; }
.auth-submit:focus-visible { outline: 3px solid var(--accent-soft); outline-offset: 2px; }
.auth-submit .fa { transition: transform .15s ease; }
.auth-submit:hover .fa { transform: translateX(3px); }

.auth-aux {
    margin-top: 22px;
    text-align: center;
    font-size: 13.5px;
    color: var(--muted);
}

.auth-aux a { font-weight: 600; text-decoration: none; }
.auth-aux a:hover { text-decoration: underline; }

.auth-secure {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    margin-top: 28px;
    padding-top: 18px;
    border-top: 1px solid #edf0f5;
    font-size: 12.5px;
    color: var(--muted);
}

/* ---------- Role picker (Logind) ---------- */
.role-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
}

.role-tile {
    --tile: #2f6fd6;
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 12px;
    width: 100%;
    padding: 16px;
    border: 1.5px solid var(--line);
    border-radius: 14px;
    background: #fff;
    font: inherit;
    color: var(--ink);
    text-align: left;
    text-decoration: none;
    cursor: pointer;
    transition: border-color .15s ease, box-shadow .15s ease, transform .15s ease;
}

.role-tile:hover,
.role-tile:focus-visible {
    border-color: var(--tile);
    box-shadow: 0 14px 28px -14px var(--tile);
    transform: translateY(-2px);
    color: var(--ink);
    text-decoration: none;
    outline: none;
}

.role-tile__icon {
    width: 42px;
    height: 42px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--tile);
    color: #fff;
    font-size: 18px;
}

.role-tile__name { font-size: 14.5px; font-weight: 700; line-height: 1.25; }
.role-tile__desc { display: block; margin-top: 2px; font-size: 12.5px; font-weight: 500; color: var(--muted); }

.role-tile__go {
    position: absolute;
    top: 16px;
    right: 16px;
    color: #c0c8d6;
    transition: color .15s ease, transform .15s ease;
}

.role-tile:hover .role-tile__go { color: var(--tile); transform: translateX(3px); }

.role-tile--admin      { --tile: #e0533f; }
.role-tile--principal  { --tile: #1597b8; }
.role-tile--teacher    { --tile: #2f6fd6; }
.role-tile--accountant { --tile: #1f9d63; }
.role-tile--cashier    { --tile: #5a67d8; }
.role-tile--parent     { --tile: #d88a12; }
.role-tile--result     { --tile: #8b4fc4; }

/* ---------- Responsive ---------- */
@media (max-width: 1100px) {
    .auth-brand { padding: 40px; }
    .brand-hero h2 { font-size: 28px; }
}

@media (max-width: 900px) {
    .auth-shell { grid-template-columns: 1fr; }

    .auth-brand {
        padding: 22px 20px 26px;
        gap: 0;
    }

    .brand-hero,
    .brand-foot { display: none; }

    .brand-top { gap: 12px; }
    .brand-logo { width: 56px; height: 56px; border-radius: 14px; }
    .brand-name { font-size: 17px; }

    .auth-panel {
        justify-content: flex-start;
        padding: 0 16px 32px;
        background: var(--page);
    }

    .auth-card {
        margin-top: -14px;
        padding: 26px 20px;
        background: #fff;
        border-radius: 18px;
        box-shadow: 0 14px 40px -18px rgba(15, 27, 51, .35);
    }

    .auth-title { font-size: 24px; }
    .auth-lead { margin-bottom: 22px; }

    .auth-mobile-foot {
        display: block !important;
        margin-top: 18px;
        text-align: center;
        font-size: 12px;
        color: var(--muted);
    }
}

@media (max-width: 380px) {
    .role-grid { grid-template-columns: 1fr; }
    .captcha-row { grid-template-columns: 1fr 1fr; }
    .captcha-code { letter-spacing: 3px; font-size: 18px; }
}

.auth-mobile-foot { display: none; }
.auth-mobile-foot a { color: var(--ink-soft); }

@media (prefers-reduced-motion: reduce) {
    .auth-card { animation: none; }
    .auth-submit, .role-tile, .role-tile__go { transition: none; }
}
