/* Giao dien web SSO — responsive 3 dang: dien thoai dung (mac dinh), dien thoai ngang (man thap), may tinh (>= 56.25em = 900 px).
   Don vi: rem cho chu / khoang cach / do rong (theo co chu nguoi dung dat trong trinh duyet), em cho media query (phong to chu
   thi tu chuyen bo cuc hep); px chi cho vien / bong (luon manh). 1rem = 16px mac dinh. */

:root {
    --bg: #eef1f6;
    --card: #ffffff;
    --field: #f6f8fb;
    --text: #1d2330;
    --muted: #5d6677;
    --accent: #2f6fed;
    --accent-text: #ffffff;
    --border: #d5dae3;
    --error: #b42318;
    --notice: #1f7a3f;
    --hero-from: #2f6fed;
    --hero-to: #1b3f8f;
    --gap: 1rem;
    color-scheme: light;
}

@media (prefers-color-scheme: dark) {
    :root {
        --bg: #12151c;
        --card: #1c212b;
        --field: #151920;
        --text: #e6e9ef;
        --muted: #9aa3b2;
        --accent: #5b8cff;
        --accent-text: #0d1117;
        --border: #333a47;
        --error: #ff7b72;
        --notice: #56d38a;
        --hero-from: #22324f;
        --hero-to: #151c2b;
        color-scheme: dark;
    }
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
    margin: 0;
    min-height: 100vh;
    min-height: 100dvh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    /* Chua vung tai tho / thanh dieu huong (viewport-fit=cover). */
    padding: max(var(--gap), env(safe-area-inset-top)) max(var(--gap), env(safe-area-inset-right))
             max(var(--gap), env(safe-area-inset-bottom)) max(var(--gap), env(safe-area-inset-left));
    background: var(--bg);
    color: var(--text);
    font: 100%/1.5 "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

/* ---------- Dien thoai dung (mac dinh, 1 cot) ---------- */

.shell {
    width: 100%;
    max-width: 27.5rem;
}

.hero { display: none; }

.card {
    width: 100%;
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: 0.875rem;
    padding: 1.5rem 1.25rem;
}

.brand { font-weight: 700; color: var(--accent); letter-spacing: .02em; }
.brand-inline { margin-bottom: 0.5rem; }
h1 { font-size: 1.4rem; line-height: 1.3; margin: 0 0 0.75rem; }
p { margin: 0.5rem 0; overflow-wrap: anywhere; }

.card form { display: grid; grid-template-columns: 1fr; column-gap: 1rem; }
.field { min-width: 0; }
label { display: block; margin: 0.75rem 0 0.25rem; font-weight: 600; }

/* 1rem (16 px): iOS khong tu phong to khi cham vao o nhap. Cao >= 44 px cho ngon tay. */
input[type=email], input[type=password], input[type=text], input:not([type]) {
    display: block;
    width: 100%;
    min-height: 2.75rem;
    margin-top: 0.25rem;
    padding: 0.625rem 0.75rem;
    font: inherit;
    font-size: 1rem;
    font-weight: 400;
    color: var(--text);
    background: var(--field);
    border: 1px solid var(--border);
    border-radius: 0.5rem;
}

input:focus-visible, button:focus-visible, a:focus-visible {
    outline: 3px solid color-mix(in srgb, var(--accent) 45%, transparent);
    outline-offset: 2px;
}

button, .button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    min-height: 2.75rem;
    margin-top: 1rem;
    padding: 0.625rem 1rem;
    font: inherit;
    font-weight: 600;
    text-decoration: none;
    color: var(--accent-text);
    background: var(--accent);
    border: 0;
    border-radius: 0.5rem;
    cursor: pointer;
    touch-action: manipulation;
}

.card form button { grid-column: 1 / -1; }
button.secondary { background: transparent; color: var(--accent); border: 1px solid var(--border); margin-top: 0.5rem; }

a { color: var(--accent); }
.links { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 0.5rem 1rem; margin-top: 1rem; }
.links a { display: inline-flex; align-items: center; min-height: 2.75rem; }
.actions { display: flex; flex-direction: column; gap: 0.5rem; }

/* Nut Google theo huong dan thuong hieu (nen trang / toi, vien xam, logo G nguyen mau). */
.external button.google {
    gap: 0.75rem;
    margin-top: 0.5rem;
    color: #1f1f1f;
    background: #ffffff;
    border: 1px solid #747775;
}
.google-g { width: 1.25rem; height: 1.25rem; flex: none; }

.divider {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin: 1rem 0 0.25rem;
    color: var(--muted);
    font-size: .85rem;
}
.divider::before, .divider::after { content: ""; flex: 1; border-top: 1px solid var(--border); }

.error, .validation-message { color: var(--error); font-size: .95rem; }
.validation-message { margin-top: 0.25rem; }
.notice { color: var(--notice); }

footer { margin-top: var(--gap); color: var(--muted); font-size: .85rem; text-align: center; }

/* Man rat hep (dien thoai nho < 360 px): form sat mep, bo khung. */
@media (max-width: 22.4375em) {
    :root { --gap: 0.5rem; }
    .card { padding: 1.25rem 0.875rem; border-radius: 0.625rem; }
    h1 { font-size: 1.25rem; }
}

/* ---------- Dien thoai ngang / man thap: khong can giua doc (ban phim ao che), gon khoang cach, o nhap 2 cot ---------- */

@media (max-height: 33.75em) and (orientation: landscape) {
    :root { --gap: 0.625rem; }
    body { justify-content: flex-start; }
    .shell { max-width: 45rem; }
    .card { padding: 0.875rem 1.25rem; }
    .brand-inline { margin-bottom: 2px; }
    h1 { font-size: 1.2rem; margin-bottom: 0.25rem; }
    p { margin: 0.25rem 0; }
    label { margin: 0.5rem 0 2px; }
    .card form { grid-template-columns: repeat(auto-fit, minmax(13.75rem, 1fr)); }
    button, .button { margin-top: 0.75rem; }
    .links { margin-top: 0.5rem; }
    .links a { min-height: 2.25rem; }
    footer { display: none; }
}

/* ---------- May tinh / tablet ngang: 2 cot, gioi thieu ben trai ---------- */

@media (min-width: 56.25em) and (min-height: 33.8125em) {
    .shell {
        max-width: 57.5rem;
        display: grid;
        grid-template-columns: 1fr 27.5rem;
        border: 1px solid var(--border);
        border-radius: 1.125rem;
        overflow: hidden;
        background: var(--card);
        box-shadow: 0 12px 40px rgb(0 0 0 / .08);
    }

    .hero {
        display: flex;
        flex-direction: column;
        justify-content: center;
        gap: 0.75rem;
        padding: 3rem 2.5rem;
        color: #fff;
        background: linear-gradient(150deg, var(--hero-from), var(--hero-to));
    }

    .hero .brand { color: #fff; font-size: 2rem; }
    .hero .tagline { font-size: 1.1rem; line-height: 1.6; opacity: .92; max-width: 34ch; }

    .card { border: 0; border-radius: 0; padding: 3rem 2.5rem; }
    .brand-inline { display: none; }
    h1 { font-size: 1.6rem; }
}

@media (prefers-color-scheme: dark) {
    .external button.google { color: #e3e3e3; background: #131314; border-color: #8e918f; }
}

@media (prefers-reduced-motion: no-preference) {
    button, .button, input { transition: border-color .15s, background-color .15s; }
}

.account { font-size: 1.1rem; overflow-wrap: anywhere; }
