/* ==========================================================================
   TopTech School - Student login
   Shares the portal homepage design language: warm monochrome, navy accent,
   Hanken Grotesk / Instrument Serif / JetBrains Mono. Self-contained page.
   ========================================================================== */

:root {
    --bg: #f3f1ea;
    --surface: #ffffff;
    --ink: #1a1b16;
    --ink-2: #34352d;
    --muted: #7c7b70;
    --line: rgba(26, 24, 18, 0.14);
    --line-soft: rgba(26, 24, 18, 0.07);

    --navy: #24406e;
    --navy-deep: #1c3253;

    --ok: #2e7d54;
    --bad: #a33a2c;
    --warn: #a06a1d;

    --radius-lg: 22px;
    --radius: 14px;
    --radius-sm: 10px;

    --ease: cubic-bezier(0.16, 1, 0.3, 1);

    --serif: 'Instrument Serif', Georgia, 'Times New Roman', serif;
    --sans: 'Hanken Grotesk', system-ui, -apple-system, 'Segoe UI', sans-serif;
    --mono: 'JetBrains Mono', ui-monospace, 'Cascadia Code', monospace;
}

* { box-sizing: border-box; }

body.tt-login {
    margin: 0;
    min-height: 100dvh;
    background: var(--bg);
    color: var(--ink-2);
    font-family: var(--sans);
    font-size: 16px;
    line-height: 1.6;
    letter-spacing: -0.006em;
    -webkit-font-smoothing: antialiased;
    text-rendering: optimizeLegibility;
}

.tt-login a { color: inherit; text-decoration: none; }
.tt-login img { display: block; max-width: 100%; }

/* ---------- Two-panel shell ---------- */
.lg-shell {
    display: grid;
    grid-template-columns: minmax(380px, 44%) 1fr;
    min-height: 100dvh;
}

/* ---------- Brand panel ---------- */
.lg-brand {
    position: relative;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    padding: clamp(28px, 4vw, 52px);
    background:
        radial-gradient(60vw 60vw at 85% -10%, rgba(255, 255, 255, 0.08), transparent 55%),
        radial-gradient(50vw 50vw at 0% 110%, rgba(180, 113, 42, 0.16), transparent 60%),
        linear-gradient(160deg, var(--navy) 0%, var(--navy-deep) 100%);
    color: rgba(255, 255, 255, 0.92);
    overflow: hidden;
}

/* Fine grid texture so the panel isn't a flat fill */
.lg-brand::before {
    content: "";
    position: absolute;
    inset: 0;
    background-image:
        linear-gradient(rgba(255, 255, 255, 0.045) 1px, transparent 1px),
        linear-gradient(90deg, rgba(255, 255, 255, 0.045) 1px, transparent 1px);
    background-size: 56px 56px;
    mask-image: radial-gradient(120% 90% at 30% 20%, black 30%, transparent 75%);
    -webkit-mask-image: radial-gradient(120% 90% at 30% 20%, black 30%, transparent 75%);
    pointer-events: none;
}

.lg-brand > * { position: relative; }

.lg-brand-logo img { width: 168px; }

.lg-brand-copy { max-width: 34ch; }

.lg-kicker {
    font-family: var(--mono);
    font-size: 11px;
    letter-spacing: 0.24em;
    text-transform: uppercase;
    color: rgba(255, 255, 255, 0.55);
    font-weight: 500;
    margin: 0 0 18px;
}

.lg-brand-copy h2 {
    font-family: var(--serif);
    font-weight: 400;
    font-size: clamp(34px, 3.4vw, 46px);
    line-height: 1.08;
    letter-spacing: -0.02em;
    color: #fff;
    margin: 0 0 16px;
    text-wrap: balance;
}

.lg-brand-copy h2 em { font-style: italic; color: #e8c98f; }

.lg-brand-copy p {
    margin: 0;
    font-size: 15.5px;
    color: rgba(255, 255, 255, 0.66);
    max-width: 40ch;
}

.lg-brand-foot {
    display: flex;
    align-items: center;
    gap: 14px;
    font-family: var(--mono);
    font-size: 11.5px;
    letter-spacing: 0.06em;
    color: rgba(255, 255, 255, 0.45);
}

.lg-brand-foot .dot {
    width: 5px;
    height: 5px;
    border-radius: 50%;
    background: #7fae8e;
    box-shadow: 0 0 0 4px rgba(127, 174, 142, 0.16);
}

/* ---------- Form panel ---------- */
.lg-main {
    display: flex;
    flex-direction: column;
    padding: clamp(24px, 4vw, 52px);
}

.lg-top {
    display: flex;
    justify-content: flex-end;
    font-size: 14.5px;
    color: var(--muted);
}

.lg-top a {
    color: var(--navy);
    font-weight: 600;
    border-bottom: 1px solid transparent;
    transition: border-color 0.25s var(--ease);
}

.lg-top a:hover { border-color: var(--navy); }

.lg-form-wrap {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 40px 0 64px;
}

.lg-form {
    width: 100%;
    max-width: 392px;
}

/* Logo shown only when the brand panel is hidden (mobile) */
.lg-form-logo { display: none; margin-bottom: 30px; }
.lg-form-logo img { width: 150px; }

.lg-form h1 {
    font-family: var(--serif);
    font-weight: 400;
    font-size: 34px;
    line-height: 1.1;
    letter-spacing: -0.02em;
    color: var(--ink);
    margin: 0 0 8px;
}

.lg-sub {
    margin: 0 0 34px;
    font-size: 15.5px;
    color: var(--muted);
}

.lg-field { margin-bottom: 18px; }

.lg-field label {
    display: block;
    font-size: 13.5px;
    font-weight: 600;
    color: var(--ink-2);
    margin-bottom: 7px;
    letter-spacing: 0.01em;
}

.lg-input-wrap { position: relative; }

.lg-input {
    width: 100%;
    height: 50px;
    padding: 0 16px;
    font-family: var(--sans);
    font-size: 15.5px;
    color: var(--ink);
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius-sm);
    outline: none;
    transition: border-color 0.25s var(--ease), box-shadow 0.25s var(--ease);
    appearance: none;
}

.lg-input::placeholder { color: #b3b1a6; }

.lg-input:hover { border-color: rgba(26, 24, 18, 0.26); }

.lg-input:focus {
    border-color: var(--navy);
    box-shadow: 0 0 0 3.5px rgba(36, 64, 110, 0.14);
}

/* Show/hide password */
.lg-eye {
    position: absolute;
    top: 50%;
    right: 7px;
    transform: translateY(-50%);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    padding: 0;
    border: 0;
    border-radius: 8px;
    background: transparent;
    color: var(--muted);
    cursor: pointer;
    transition: color 0.2s var(--ease), background 0.2s var(--ease);
}

.lg-eye:hover { color: var(--ink); background: rgba(26, 24, 18, 0.05); }

.lg-eye:focus-visible {
    outline: 2px solid var(--navy);
    outline-offset: 1px;
}

.lg-eye .i-eye-off { display: none; }
.lg-eye.is-on .i-eye { display: none; }
.lg-eye.is-on .i-eye-off { display: block; }

.lg-input-wrap .lg-input { padding-right: 48px; }

/* ---------- Submit ---------- */
.lg-submit {
    width: 100%;
    height: 52px;
    margin-top: 10px;
    border: 0;
    border-radius: var(--radius-sm);
    background: var(--navy);
    color: #fff;
    font-family: var(--sans);
    font-size: 15.5px;
    font-weight: 600;
    letter-spacing: 0.01em;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    box-shadow: 0 14px 26px -16px rgba(28, 50, 83, 0.55);
    transition: background 0.25s var(--ease), transform 0.15s var(--ease), box-shadow 0.25s var(--ease);
}

.lg-submit:hover {
    background: var(--navy-deep);
    box-shadow: 0 18px 30px -16px rgba(28, 50, 83, 0.6);
}

.lg-submit:active { transform: scale(0.985); }

.lg-submit:focus-visible {
    outline: 2px solid var(--ink);
    outline-offset: 2px;
}

.lg-submit .arrow { transition: transform 0.25s var(--ease); }
.lg-submit:hover .arrow { transform: translateX(3px); }

.lg-submit[data-busy="1"] { pointer-events: none; opacity: 0.75; }

.lg-spinner {
    width: 16px;
    height: 16px;
    border-radius: 50%;
    border: 2px solid rgba(255, 255, 255, 0.35);
    border-top-color: #fff;
    animation: lg-spin 0.7s linear infinite;
    display: none;
}

.lg-submit[data-busy="1"] .lg-spinner { display: inline-block; }
.lg-submit[data-busy="1"] .arrow { display: none; }

@keyframes lg-spin { to { transform: rotate(360deg); } }

/* ---------- Below the form ---------- */
.lg-help {
    margin-top: 26px;
    padding-top: 22px;
    border-top: 1px solid var(--line-soft);
    font-size: 14.5px;
    color: var(--muted);
}

.lg-help a {
    color: var(--navy);
    font-weight: 600;
    border-bottom: 1px solid transparent;
    transition: border-color 0.25s var(--ease);
}

.lg-help a:hover { border-color: var(--navy); }

.lg-foot {
    display: flex;
    justify-content: space-between;
    gap: 16px;
    font-size: 13px;
    color: var(--muted);
}

.lg-foot a { transition: color 0.2s var(--ease); }
.lg-foot a:hover { color: var(--ink); }

/* ---------- Flash messages (PHP session toasts) ---------- */
.error-box {
    position: fixed;
    bottom: 20px;
    right: 20px;
    z-index: 100;
    display: flex;
    flex-direction: column;
    gap: 10px;
    max-width: min(400px, calc(100vw - 40px));
}

.error-box .err,
.error-box .suc,
.error-box .war {
    position: relative;
    padding: 14px 18px 14px 38px;
    background: var(--surface);
    border: 1px solid var(--line-soft);
    border-radius: var(--radius-sm);
    box-shadow: 0 20px 44px -22px rgba(26, 26, 23, 0.35);
    font-size: 14.5px;
    line-height: 1.45;
    color: var(--ink-2);
    animation: lg-toast-in 0.45s var(--ease) backwards, lg-toast-out 0.6s var(--ease) forwards;
    animation-delay: 0s, 6s;
}

/* Status dot instead of a side-tab border */
.error-box .err::before,
.error-box .suc::before,
.error-box .war::before {
    content: "";
    position: absolute;
    left: 17px;
    top: 21px;
    width: 7px;
    height: 7px;
    border-radius: 50%;
}

.error-box .err::before { background: var(--bad); box-shadow: 0 0 0 3px rgba(163, 58, 44, 0.15); }
.error-box .suc::before { background: var(--ok); box-shadow: 0 0 0 3px rgba(46, 125, 84, 0.15); }
.error-box .war::before { background: var(--warn); box-shadow: 0 0 0 3px rgba(160, 106, 29, 0.15); }

@keyframes lg-toast-in {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

@keyframes lg-toast-out {
    to { opacity: 0; transform: translateY(6px); visibility: hidden; }
}

/* ---------- Responsive ---------- */
@media (max-width: 900px) {
    .lg-shell { grid-template-columns: 1fr; }
    .lg-brand { display: none; }
    .lg-form-logo { display: block; }
    .lg-form-wrap { padding: 24px 0 48px; align-items: flex-start; }
    .lg-form { margin-top: 4vh; }
}

@media (prefers-reduced-motion: reduce) {
    .tt-login *, .tt-login *::before, .tt-login *::after {
        animation-duration: 0.01ms !important;
        transition-duration: 0.01ms !important;
    }
}
