/* TMIS auth pages: login, forgot password, reset password
   Glassmorphism over the MATI background photo.
   Background image path is relative to this file (assets/css/ -> assets/img/). */

:root {
    --navy: #0B1F44;
    --blue: #2F6FDB;
    --blue-dark: #2459B8;
    --gold: #E0A93B;
    --text: #FFFFFF;
    --text-soft: rgba(255, 255, 255, 0.80);
    --glass: rgba(255, 255, 255, 0.12);
    --glass-strong: rgba(255, 255, 255, 0.18);
    --glass-border: rgba(255, 255, 255, 0.28);
    --overlay-top: rgba(6, 16, 40, 0.50);     /* raise these if the photo is bright */
    --overlay-bottom: rgba(6, 16, 40, 0.70);
    --font-body: "Segoe UI", system-ui, -apple-system, "Helvetica Neue", Arial, sans-serif;
    --font-head: Georgia, "Times New Roman", serif;
}

* { box-sizing: border-box; }

html, body { margin: 0; padding: 0; }

body.tm-body {
    min-height: 100vh;
    font-family: var(--font-body);
    font-size: 15px;
    line-height: 1.5;
    color: var(--text);
    background-color: var(--navy);
    user-select: none;
}

/* Photo + dark tint, fixed behind everything */
body.tm-body::before {
    content: "";
    position: fixed;
    inset: 0;
    z-index: 0;
    background-image:
        linear-gradient(var(--overlay-top), var(--overlay-bottom)),
        url('../img/intro-bg4.JPG');
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
}

.tm-shell { position: relative; z-index: 1; min-height: 100vh; }

.tm-main {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 32px 20px;
}

.tm-panel { width: 100%; max-width: 440px; }

/* ---------- Brand header (fragment) ---------- */
.tm-brand-head {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    margin-bottom: 18px;
    text-align: center;
}

.tm-logo {
    background: #fff;
    border-radius: 14px;
    padding: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.30);
}

.tm-logo img { display: block; width: 60px; height: auto; }

.tm-system-name {
    font-family: var(--font-head);
    font-size: 20px;
    font-weight: 700;
    line-height: 1.25;
    text-shadow: 0 2px 8px rgba(0, 0, 0, 0.45);
}

/* ---------- Glass card ---------- */
.tm-card {
    background: var(--glass);
    -webkit-backdrop-filter: blur(20px) saturate(150%);
    backdrop-filter: blur(20px) saturate(150%);
    border: 1px solid var(--glass-border);
    border-radius: 22px;
    padding: 32px;
    box-shadow:
        0 12px 40px rgba(0, 0, 0, 0.38),
        inset 0 1px 0 rgba(255, 255, 255, 0.35);
}

@supports not ((backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px))) {
    .tm-card, .tm-link { background: rgba(11, 31, 68, 0.88); }
}

.tm-card h2 {
    margin: 0 0 4px;
    font-family: var(--font-head);
    font-size: 28px;
    line-height: 1.2;
    color: var(--text);
}

.tm-card .tm-sub { margin: 0 0 22px; color: var(--text-soft); }

/* ---------- Alerts ---------- */
.tm-alert {
    border-radius: 12px;
    padding: 12px 14px;
    margin-bottom: 16px;
    font-size: 14px;
}

.tm-alert p { margin: 0; }
.tm-alert.info    { background: rgba(219, 234, 254, 0.94); color: #17407E; }
.tm-alert.success { background: rgba(220, 252, 231, 0.94); color: #14532D; }
.tm-alert.error   { background: rgba(254, 226, 226, 0.95); color: #7F1D1D; }

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

.tm-field label {
    display: block;
    margin-bottom: 6px;
    font-size: 14px;
    font-weight: 600;
    color: var(--text);
}

.tm-label-row {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 6px;
}

.tm-label-row label { margin-bottom: 0; }

.tm-forgot {
    font-size: 13px;
    font-weight: 600;
    color: #C9DCFF;
    text-decoration: none;
}

.tm-forgot:hover { text-decoration: underline; color: #fff; }
.tm-forgot:focus-visible { outline: 2px solid #fff; outline-offset: 3px; border-radius: 4px; }

.tm-hint { margin: 6px 0 0; font-size: 13px; color: var(--text-soft); }

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

.tm-input-wrap .tm-icon {
    position: absolute;
    left: 14px;
    top: 50%;
    transform: translateY(-50%);
    width: 18px;
    height: 18px;
    color: rgba(255, 255, 255, 0.75);
    pointer-events: none;
}

.tm-input {
    width: 100%;
    height: 48px;
    padding: 0 44px 0 42px;
    font: inherit;
    color: #fff;
    caret-color: #fff;
    background: var(--glass);
    border: 1px solid rgba(255, 255, 255, 0.35);
    border-radius: 12px;
    user-select: text;
    transition: border-color .15s, box-shadow .15s, background .15s;
}

.tm-input::placeholder { color: rgba(255, 255, 255, 0.68); }
.tm-input:hover { border-color: rgba(255, 255, 255, 0.55); }

.tm-input:focus {
    outline: none;
    background: var(--glass-strong);
    border-color: #fff;
    box-shadow: 0 0 0 3px rgba(255, 255, 255, 0.25);
}

/* Keep browser autofill readable on glass */
.tm-input:-webkit-autofill,
.tm-input:-webkit-autofill:focus {
    -webkit-text-fill-color: #fff;
    caret-color: #fff;
    box-shadow: 0 0 0 1000px rgba(30, 64, 130, 0.55) inset;
    transition: background-color 9999s ease-out;
}

.tm-toggle {
    position: absolute;
    right: 5px;
    top: 50%;
    transform: translateY(-50%);
    width: 38px;
    height: 38px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: transparent;
    border: 0;
    border-radius: 8px;
    color: rgba(255, 255, 255, 0.80);
    cursor: pointer;
}

.tm-toggle:hover { color: #fff; background: rgba(255, 255, 255, 0.14); }
.tm-toggle:focus-visible { outline: 2px solid #fff; outline-offset: 1px; }
.tm-toggle svg { width: 20px; height: 20px; }
.tm-toggle .eye-off { display: none; }
.tm-toggle.is-visible .eye { display: none; }
.tm-toggle.is-visible .eye-off { display: block; }

/* ---------- Captcha ---------- */
.tm-captcha-row { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; }

.tm-captcha-img {
    flex: 1;
    min-height: 52px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(255, 255, 255, 0.92);
    border: 1px solid rgba(255, 255, 255, 0.55);
    border-radius: 12px;
    padding: 4px;
}

.tm-captcha-img img { display: block; max-width: 100%; height: auto; }

.tm-refresh {
    width: 48px;
    height: 48px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 1px solid rgba(255, 255, 255, 0.35);
    border-radius: 12px;
    color: #fff;
    background: var(--glass);
    text-decoration: none;
    transition: background .15s, border-color .15s;
}

.tm-refresh:hover { background: var(--glass-strong); border-color: #fff; }
.tm-refresh:focus-visible { outline: 2px solid #fff; outline-offset: 2px; }
.tm-refresh svg { width: 20px; height: 20px; }

.tm-captcha-input { padding-left: 16px; padding-right: 16px; letter-spacing: 0.12em; }

/* ---------- Buttons ---------- */
.tm-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 50px;
    margin-top: 8px;
    font: inherit;
    font-weight: 600;
    font-size: 16px;
    color: #fff;
    background: var(--blue);
    border: 0;
    border-radius: 12px;
    cursor: pointer;
    text-decoration: none;
    box-shadow: 0 8px 22px rgba(47, 111, 219, 0.45);
    transition: background .15s, transform .15s, box-shadow .15s;
}

.tm-btn:hover { background: var(--blue-dark); transform: translateY(-1px); }
.tm-btn:active { transform: translateY(0); }
.tm-btn:focus-visible { outline: 3px solid rgba(255, 255, 255, 0.7); outline-offset: 2px; }

/* ---------- Nomination links (compact tiles under the card) ---------- */
.tm-more {
    margin-top: 18px;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}

.tm-more h3 {
    grid-column: 1 / -1;
    margin: 0;
    font-size: 14px;
    font-weight: 600;
    text-align: center;
    color: var(--text-soft);
    text-shadow: 0 1px 6px rgba(0, 0, 0, 0.5);
}

.tm-link {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px;
    background: var(--glass);
    -webkit-backdrop-filter: blur(16px) saturate(140%);
    backdrop-filter: blur(16px) saturate(140%);
    border: 1px solid var(--glass-border);
    border-radius: 14px;
    color: #fff;
    text-decoration: none;
    transition: background .15s, border-color .15s, transform .15s;
}

.tm-link:hover { background: var(--glass-strong); border-color: #fff; transform: translateY(-1px); }
.tm-link:focus-visible { outline: 2px solid #fff; outline-offset: 2px; }

.tm-link .tm-badge {
    flex: none;
    width: 36px;
    height: 36px;
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.18);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
}

.tm-link .tm-badge svg { width: 20px; height: 20px; }
.tm-link strong { display: block; font-size: 13px; line-height: 1.3; font-weight: 600; }
.tm-link small, .tm-link .tm-chev { display: none; }

.tm-home {
    grid-column: 1 / -1;
    display: block;
    text-align: center;
    margin-top: 2px;
    font-size: 14px;
    font-weight: 600;
    color: #fff;
    text-decoration: none;
    text-shadow: 0 1px 6px rgba(0, 0, 0, 0.5);
}

.tm-home:hover { text-decoration: underline; }
.tm-home:focus-visible { outline: 2px solid #fff; outline-offset: 3px; border-radius: 4px; }

/* Home link / buttons used inside a card (forgot + reset pages) */
.tm-card .tm-home { margin-top: 16px; }

/* ---------- Small screens ---------- */
@media (max-width: 480px) {
    .tm-main { padding: 20px 14px 28px; }
    .tm-card { padding: 24px 20px; border-radius: 18px; }
    .tm-more { grid-template-columns: 1fr; }
}

@media (prefers-reduced-motion: reduce) {
    * { transition: none !important; }
}
