/* ============================================================
   Trang đăng nhập — pages/auth/login.blade.php
   Panel nhận diện màu xanh navy (cùng màu thẻ học sinh) + biểu mẫu.
   Điện thoại: panel thành dải tiêu đề phía trên, thẻ biểu mẫu nằm đè lên.
   ============================================================ */

.login-page {
    --lg-navy: #0d3b78;
    --lg-navy-2: #0a2c5c;
    --lg-navy-3: #123f86;
    --lg-gold: #f5c84c;
    --lg-page: #eef3f9;
    --lg-card: #fff;
    --lg-focus: #0d3b78;
    background: var(--lg-page);
    margin: 0;
}
@media (prefers-color-scheme: dark) {
    :root:not([data-theme="light"]) .login-page {
        --lg-page: #0e1520;
        --lg-card: #18222f;
        --lg-focus: #8fb4ef;
    }
}
:root[data-theme="dark"] .login-page {
    --lg-page: #0e1520;
    --lg-card: #18222f;
    --lg-focus: #8fb4ef;
}

.lg-page {
    display: grid;
    grid-template-columns: 1fr;
    grid-template-rows: auto 1fr;
    min-height: 100vh;
    min-height: 100dvh;
}

/* ─── Panel nhận diện ─── */
.lg-brand {
    position: relative;
    overflow: hidden;
    color: #fff;
    background:
        radial-gradient(120% 80% at 100% 0%, rgba(22, 120, 77, .38) 0%, transparent 55%),
        linear-gradient(160deg, var(--lg-navy-3) 0%, var(--lg-navy) 45%, var(--lg-navy-2) 100%);
    padding: calc(2rem + env(safe-area-inset-top)) 1.25rem 4.5rem;
    text-align: center;
}
/* Họa tiết vòng tròn mờ */
.lg-brand::before,
.lg-brand::after {
    content: "";
    position: absolute;
    border-radius: 50%;
    border: 1px solid rgba(255, 255, 255, .1);
    pointer-events: none;
}
.lg-brand::before { width: 26rem; height: 26rem; right: -9rem; top: -11rem; }
.lg-brand::after  { width: 18rem; height: 18rem; left: -7rem; bottom: -9rem; background: rgba(255, 255, 255, .03); }

.lg-brand-inner {
    position: relative;
    z-index: 1;
    width: 100%;
    max-width: 38rem;
    margin: 0 auto;
}

.lg-emblem {
    display: grid;
    place-items: center;
    width: 4rem;
    height: 4rem;
    margin: 0 auto 1rem;
    border-radius: 50%;
    color: var(--lg-navy);
    background: #fff;
    box-shadow: 0 0 0 5px rgba(255, 255, 255, .16), 0 10px 26px rgba(0, 0, 0, .22);
}
.lg-emblem svg { width: 58%; height: 58%; }

.lg-system {
    margin: 0;
    color: #fff;
    font-size: 1.3rem;
    font-weight: 800;
    line-height: 1.3;
    letter-spacing: .01em;
    text-transform: uppercase;
    text-wrap: balance;
}
.lg-system > span { display: block; }
.lg-system-accent { color: var(--lg-gold); }

.lg-school {
    margin: .75rem auto 0;
    padding-top: .75rem;
    max-width: 22rem;
    border-top: 1px solid rgba(255, 255, 255, .22);
    font-size: .95rem;
    font-weight: 700;
    letter-spacing: .04em;
    text-transform: uppercase;
    color: rgba(255, 255, 255, .94);
}

.lg-internal {
    display: inline-flex;
    align-items: center;
    gap: .4rem;
    margin: .85rem 0 0;
    padding: .3rem .85rem;
    border-radius: 999px;
    font-size: .85rem;
    font-weight: 700;
    color: #fff;
    background: rgba(255, 255, 255, .12);
    border: 1px solid rgba(255, 255, 255, .28);
}

.lg-features { display: none; }

/* ─── Biểu mẫu ─── */
.lg-main {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 0 1rem calc(1.5rem + env(safe-area-inset-bottom));
}

.lg-card {
    position: relative;
    z-index: 2;
    width: 100%;
    max-width: 30rem;
    margin-top: -3rem;
    padding: 1.75rem 1.35rem 1.5rem;
    border-radius: 1.25rem;
    background: var(--lg-card);
    border: 1px solid var(--line);
    box-shadow: 0 18px 40px rgba(13, 59, 120, .14);
}

.lg-title {
    margin: 0;
    font-size: 1.5rem;
    font-weight: 800;
    letter-spacing: -.02em;
    color: var(--heading);
}
.lg-sub {
    margin: .4rem 0 1.4rem;
    font-size: .9rem;
    line-height: 1.55;
    color: var(--muted);
}

.lg-form {
    display: flex;
    flex-direction: column;
    gap: 1.1rem;
}
/* 16px trên ô nhập để iPhone không tự phóng to khi chạm */
.lg-form .input-icon .ui-field { font-size: 1rem; }
.lg-form .input-icon .ui-field:focus { border-color: var(--lg-focus); box-shadow: 0 0 0 3px color-mix(in srgb, var(--lg-focus) 18%, transparent); }
.lg-form .input-icon:focus-within > svg { color: var(--lg-focus); }

.lg-has-toggle { padding-right: 3rem !important; }
.lg-eye {
    position: absolute;
    right: .4rem;
    top: 50%;
    transform: translateY(-50%);
    display: grid;
    place-items: center;
    width: 2.5rem;
    height: 2.5rem;
    border: 0;
    border-radius: .65rem;
    background: transparent;
    color: var(--disabled);
    cursor: pointer;
}
.lg-eye:hover { color: var(--foreground); background: var(--section); }
.lg-eye:focus-visible { outline: 2px solid var(--lg-focus); outline-offset: 1px; }
.lg-eye .lg-eye-hide { display: none; }
.lg-eye[aria-pressed="true"] .lg-eye-show { display: none; }
.lg-eye[aria-pressed="true"] .lg-eye-hide { display: block; }

.lg-row {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: .5rem;
}
.lg-help { font-size: .8125rem; color: var(--muted); }

.lg-submit {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: .5rem;
    width: 100%;
    min-height: 3.25rem;
    margin-top: .25rem;
    border: 0;
    border-radius: .875rem;
    font: inherit;
    font-size: 1rem;
    font-weight: 700;
    color: #fff;
    background: linear-gradient(135deg, var(--lg-navy-3), var(--lg-navy));
    box-shadow: 0 8px 18px rgba(13, 59, 120, .28);
    cursor: pointer;
    transition: transform .15s ease, box-shadow .15s ease, filter .15s ease;
}
.lg-submit:hover { filter: brightness(1.08); box-shadow: 0 10px 22px rgba(13, 59, 120, .34); }
.lg-submit:active { transform: translateY(1px); }
.lg-submit:focus-visible { outline: 3px solid var(--lg-gold); outline-offset: 2px; }

.lg-notice {
    display: flex;
    align-items: flex-start;
    gap: .5rem;
    margin: 1.4rem 0 0;
    padding: .7rem .85rem;
    border-radius: .75rem;
    font-size: .8125rem;
    line-height: 1.5;
    color: var(--info-ink);
    background: var(--info-bg);
}
.lg-notice svg { flex: none; margin-top: .15rem; }

.lg-foot {
    margin: 1.25rem 0 0;
    text-align: center;
    font-size: .8125rem;
    color: var(--disabled);
}

/* Màn hình nhỏ hẹp (iPhone SE…) */
@media (max-width: 360px) {
    .lg-system { font-size: 1.12rem; }
    .lg-school { font-size: .85rem; }
    .lg-card { padding: 1.5rem 1.1rem 1.25rem; }
}

/* ─── Máy tính bảng ngang / máy tính: hai cột ─── */
@media (min-width: 900px) {
    .lg-page { grid-template-columns: 1.1fr 1fr; grid-template-rows: 1fr; }

    .lg-brand {
        display: flex;
        align-items: center;
        justify-content: center;
        padding: 3.5rem 3rem;
    }
    .lg-brand::before { width: 40rem; height: 40rem; right: -16rem; top: -18rem; }
    .lg-brand::after  { width: 28rem; height: 28rem; left: -10rem; bottom: -12rem; }

    .lg-emblem { width: 5.5rem; height: 5.5rem; margin-bottom: 1.75rem; }
    .lg-system { font-size: 2.05rem; line-height: 1.25; }
    .lg-school { margin-top: 1.25rem; padding-top: 1.25rem; font-size: 1.15rem; max-width: 26rem; }
    .lg-internal { margin-top: 1.1rem; font-size: .95rem; padding: .35rem 1rem; }

    .lg-features {
        display: grid;
        grid-template-columns: 1fr 1fr;
        gap: .6rem;
        margin: 2.25rem 0 0;
        padding: 0;
        list-style: none;
        text-align: left;
    }
    .lg-features li {
        position: relative;
        padding: .7rem .8rem .7rem 2.1rem;
        border-radius: .8rem;
        font-size: .875rem;
        line-height: 1.4;
        color: rgba(255, 255, 255, .92);
        background: rgba(255, 255, 255, .08);
        border: 1px solid rgba(255, 255, 255, .14);
    }
    .lg-features li::before {
        content: "";
        position: absolute;
        left: .85rem;
        top: 1.05rem;
        width: .5rem;
        height: .5rem;
        border-radius: 50%;
        background: var(--lg-gold);
    }

    .lg-main {
        justify-content: center;
        padding: 3rem 2.5rem;
    }
    .lg-card {
        margin-top: 0;
        padding: 2.5rem 2.25rem 2rem;
        box-shadow: 0 24px 60px rgba(13, 59, 120, .12);
    }
    .lg-title { font-size: 1.85rem; }
}

@media (min-width: 1280px) {
    .lg-system { font-size: 2.35rem; }
}

/* ─── Nút đăng nhập Microsoft 365 ─── */
.lg-sso {
    display: flex;
    align-items: center;
    gap: .85rem;
    width: 100%;
    min-height: 3.5rem;
    padding: .65rem 1rem;
    box-sizing: border-box;
    border: 1px solid var(--line);
    border-radius: .875rem;
    background: var(--surface-bg);
    color: var(--heading);
    text-decoration: none;
    transition: border-color .15s ease, box-shadow .15s ease, background .15s ease;
}
a.lg-sso:hover { border-color: var(--lg-focus); box-shadow: 0 6px 16px rgba(13, 59, 120, .12); }
a.lg-sso:focus-visible { outline: 3px solid var(--lg-focus); outline-offset: 2px; }
.lg-sso.is-disabled { opacity: .55; cursor: not-allowed; }
.lg-sso-text { display: flex; flex-direction: column; gap: .1rem; min-width: 0; text-align: left; }
.lg-sso-text strong { font-size: .95rem; font-weight: 700; }
.lg-sso-text small { font-size: .78rem; color: var(--muted); }
.lg-ms-logo {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 2px;
    flex: none;
    width: 1.35rem;
    height: 1.35rem;
}
.lg-ms-logo span:nth-child(1) { background: #f25022; }
.lg-ms-logo span:nth-child(2) { background: #7fba00; }
.lg-ms-logo span:nth-child(3) { background: #00a4ef; }
.lg-ms-logo span:nth-child(4) { background: #ffb900; }
.lg-sso-note { margin: .5rem 0 0; font-size: .8rem; color: var(--muted); }

.lg-divider {
    display: flex;
    align-items: center;
    gap: .75rem;
    margin: 1.25rem 0;
    font-size: .8rem;
    color: var(--muted);
}
.lg-divider::before,
.lg-divider::after { content: ""; flex: 1; height: 1px; background: var(--line); }

/* ─── Microsoft 365 là cách đăng nhập chính: nút nổi hơn ─── */
a.lg-sso {
    min-height: 3.75rem;
    border: 2px solid var(--lg-focus);
    box-shadow: 0 8px 20px rgba(13, 59, 120, .12);
}
a.lg-sso .lg-sso-text strong { font-size: 1rem; }

/* ─── Khung đăng nhập quản trị (thu gọn) ─── */
.lg-admin {
    margin-top: 1.25rem;
    border-top: 1px dashed var(--line);
    padding-top: .9rem;
}
.lg-admin-toggle {
    display: flex;
    align-items: center;
    gap: .5rem;
    padding: .55rem .25rem;
    border-radius: .6rem;
    font-size: .875rem;
    font-weight: 600;
    color: var(--muted);
    cursor: pointer;
    list-style: none;
    user-select: none;
    -webkit-user-select: none;
}
.lg-admin-toggle::-webkit-details-marker { display: none; }
.lg-admin-toggle::marker { content: ""; }
.lg-admin-toggle small { font-weight: 500; color: var(--disabled); }
.lg-admin-toggle:hover { color: var(--heading); }
.lg-admin-toggle:focus-visible { outline: 2px solid var(--lg-focus); outline-offset: 2px; }
.lg-admin-chev { margin-left: auto; transition: transform .2s ease; }
.lg-admin[open] .lg-admin-chev { transform: rotate(180deg); }
.lg-admin[open] .lg-admin-toggle { color: var(--heading); }
.lg-admin-body { padding-top: .75rem; }

/* CSS chung gạch chân mọi liên kết khi rê chuột — nút Microsoft thì không */
a.lg-sso,
a.lg-sso:hover,
a.lg-sso:focus,
a.lg-sso:active,
a.lg-sso * { text-decoration: none !important; }
a.lg-sso:hover {
    background: color-mix(in srgb, var(--lg-focus) 6%, var(--surface-bg));
    transform: translateY(-1px);
}
a.lg-sso:active { transform: translateY(0); }
a.lg-sso { transition: border-color .15s ease, box-shadow .15s ease, background .15s ease, transform .15s ease; }

/* ─── Trang chờ đăng nhập Microsoft 365 (chế độ SPA) ─── */
.lg-page--single { grid-template-columns: 1fr !important; grid-template-rows: 1fr !important; }
.lg-page--single .lg-main { justify-content: center; padding-top: 2rem; }
.lg-wait { margin-top: 0; text-align: center; }
.lg-wait-logo { width: 2.5rem; height: 2.5rem; margin: 0 auto 1rem; gap: 3px; }
.lg-spinner {
    display: block;
    width: 2rem;
    height: 2rem;
    margin: .5rem auto 0;
    border-radius: 50%;
    border: 3px solid var(--line);
    border-top-color: var(--lg-focus);
    animation: lg-spin .8s linear infinite;
}
@keyframes lg-spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .lg-spinner { animation-duration: 2.4s; } }
.lg-wait-back { margin: 1.5rem 0 0; font-size: .875rem; }
