/*!
 * Login Page - CBT System
 * Modern redesign
 */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&family=Saira+Extra+Condensed:wght@700&display=swap');

/* ─── Reset & Base ───────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; }

body {
    margin: 0;
    min-height: 100vh;
    min-height: 100dvh; /* accounts for mobile browser address-bar chrome; ignored where unsupported */
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    font-size: 15px;
    color: #1e293b;
    background: url(../img/bg5.jpg) center center / cover no-repeat fixed;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

/* `background-attachment: fixed` is unreliable on mobile Safari/Chrome
   (repaints on every address-bar show/hide, sometimes fails to cover).
   Scroll it with the page on touch-sized viewports instead. */
@media (max-width: 768px) {
    body { background-attachment: scroll; }
}

/* Overlay */
body::before {
    content: '';
    position: fixed;
    inset: 0;
    background: linear-gradient(135deg, rgba(15, 23, 55, 0.82) 0%, rgba(30, 58, 138, 0.72) 100%);
    z-index: 0;
}

/* ─── Main Wrapper ───────────────────────────────────────── */
.login-wrapper {
    position: relative;
    z-index: 1;
    width: 100%;
    min-height: 100vh;
    min-height: 100dvh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 2rem 1rem;
    /* Keep the card clear of notches / home-indicator on full-bleed mobile screens */
    padding-top: max(2rem, env(safe-area-inset-top));
    padding-bottom: max(2rem, env(safe-area-inset-bottom));
    padding-left: max(1rem, env(safe-area-inset-left));
    padding-right: max(1rem, env(safe-area-inset-right));
}

/* ─── Card ───────────────────────────────────────────────── */
.login-card {
    background: rgba(255, 255, 255, 0.97);
    backdrop-filter: blur(12px);
    border-radius: 20px;
    box-shadow: 0 25px 60px rgba(0, 0, 0, 0.35), 0 0 0 1px rgba(255,255,255,0.15);
    padding: 2.8rem 2.5rem 2.2rem;
    width: 100%;
    max-width: 420px;
    text-align: center;
}

/* ─── Logo ───────────────────────────────────────────────── */
.login-logo {
    width: 110px;
    height: 110px;
    object-fit: contain;
    border-radius: 50%;
    border: 4px solid #e2e8f0;
    box-shadow: 0 4px 16px rgba(0,0,0,0.12);
    margin-bottom: 1.1rem;
    background: #fff;
}

/* ─── Headings ───────────────────────────────────────────── */
.login-school-name {
    font-family: 'Saira Extra Condensed', sans-serif;
    font-size: 1.45rem;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: #1e293b;
    line-height: 1.25;
    margin: 0 0 0.3rem;
}

.login-subtitle {
    font-size: 0.82rem;
    font-weight: 500;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: #64748b;
    margin: 0 0 1.8rem;
}

/* ─── Divider ────────────────────────────────────────────── */
.login-divider {
    border: none;
    border-top: 1px solid #e2e8f0;
    margin: 0 0 1.8rem;
}

/* ─── Form ───────────────────────────────────────────────── */
.login-form .form-group {
    margin-bottom: 1rem;
    text-align: left;
}

.login-form label {
    display: block;
    font-size: 0.75rem;
    font-weight: 600;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: #475569;
    margin-bottom: 0.4rem;
}

.login-form .form-control {
    height: 52px;
    border: 2px solid #e2e8f0;
    border-radius: 10px;
    padding: 0 1rem;
    font-size: 1rem;
    font-family: inherit;
    color: #1e293b;
    background: #f8fafc;
    transition: border-color 0.2s, box-shadow 0.2s, background 0.2s;
    width: 100%;
}

.login-form .form-control::placeholder {
    color: #94a3b8;
}

.login-form .form-control:focus {
    outline: none;
    border-color: #3b82f6;
    background: #fff;
    box-shadow: 0 0 0 4px rgba(59, 130, 246, 0.12);
}

/* ─── Button ─────────────────────────────────────────────── */
.login-form .btn-login {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    width: 100%;
    height: 52px;
    margin-top: 0.5rem;
    border: none;
    border-radius: 10px;
    font-size: 1rem;
    font-weight: 600;
    font-family: inherit;
    letter-spacing: 0.02em;
    cursor: pointer;
    background: linear-gradient(135deg, #1d4ed8 0%, #3b82f6 100%);
    color: #fff;
    box-shadow: 0 4px 14px rgba(59, 130, 246, 0.4);
    transition: transform 0.15s, box-shadow 0.15s, filter 0.15s;
}

.login-form .btn-login:hover {
    filter: brightness(1.08);
    box-shadow: 0 6px 20px rgba(59, 130, 246, 0.5);
    transform: translateY(-1px);
}

.login-form .btn-login:active {
    transform: translateY(0);
    box-shadow: 0 2px 8px rgba(59, 130, 246, 0.35);
}

/* ─── Flash Message ──────────────────────────────────────── */
.login-message {
    width: 100%;
    max-width: 420px;
    margin-bottom: 1rem;
    position: relative;
    z-index: 1;
}

.login-message:empty { display: none; }

.login-message p,
.login-message div {
    border-radius: 10px;
    padding: 0.85rem 1.1rem;
    font-size: 0.9rem;
    font-weight: 500;
    margin: 0;
    box-shadow: 0 4px 14px rgba(0,0,0,0.15);
}

/* success / failure colour coding */
.login-message .success {
    background: #f0fdf4;
    color: #15803d;
    border-left: 4px solid #22c55e;
}

.login-message .failure,
.login-message .error {
    background: #fef2f2;
    color: #b91c1c;
    border-left: 4px solid #ef4444;
}

/* Generic fallback (white text on dark bg for inline use) */
.message { color: #fff; font-weight: 500; font-size: 0.92rem; }

/* ─── Footer Meta (IP / Date) ────────────────────────────── */
.login-meta {
    margin-top: 1.4rem;
    position: relative;
    z-index: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.25rem;
}

.login-meta .logo-text {
    color: rgba(255,255,255,0.6);
    font-size: 0.78rem;
    font-weight: 400;
    letter-spacing: 0.03em;
}

.login-meta .logo-text i {
    margin-right: 0.3em;
    opacity: 0.8;
}

/* ─── Responsive ─────────────────────────────────────────── */
@media (max-width: 600px) {
    .login-wrapper { padding-left: max(.75rem, env(safe-area-inset-left)); padding-right: max(.75rem, env(safe-area-inset-right)); }
    .login-card {
        padding: 1.8rem 1.3rem 1.5rem;
        border-radius: 16px;
    }
    .login-logo { width: 84px; height: 84px; margin-bottom: .85rem; }
    .login-school-name { font-size: 1.15rem; }
    .login-subtitle { font-size: .74rem; margin-bottom: 1.3rem; }
    .login-divider { margin-bottom: 1.3rem; }
    .login-form .form-control,
    .login-form .btn-login { height: 48px; }
    .login-meta { margin-top: 1.1rem; }
}

/* Short/landscape phones — vertical space is the constraint, not width */
@media (max-height: 480px) and (orientation: landscape) {
    .login-wrapper { padding-top: 1rem; padding-bottom: 1rem; justify-content: flex-start; }
    .login-logo { width: 56px; height: 56px; margin-bottom: .5rem; }
    .login-card { padding: 1.2rem 1.5rem; }
    .login-divider { margin-bottom: 1rem; }
    .login-meta { margin-top: .75rem; }
}

/* ─── Legacy class support ───────────────────────────────── */
.center { text-align: center; margin-left: auto; margin-right: auto; }
.logo-text { color: rgba(255,255,255,0.7); }
.resume-content { overflow-x: auto; overflow-wrap: break-word; }
.bg-primary { background-color: #1d4ed8 !important; }
.text-primary { color: #1d4ed8 !important; }
.answered { background: #30bdff; color: #fff; padding: 2px; border-radius: 70%; }
.word-wrap { white-space: pre-wrap; word-wrap: break-word; }
