/* ============================================================= */
/* LOGIN PAGE — PREMIUM DESIGN V3 (Reference Screenshot Match)    */
/* ============================================================= */

:root {
    --lp-font: "Readex Pro", "Segoe UI", Tahoma, Arial, sans-serif;
    --lp-bg: #eef2f9;
    --lp-card: rgba(255, 255, 255, 0.82);
    --lp-card-border: rgba(255, 255, 255, 0.5);
    --lp-primary: #0f3460;
    --lp-primary-hover: #0a2647;
    --lp-accent: #2563eb;
    --lp-accent-soft: #eff6ff;
    --lp-success: #10b981;
    --lp-success-soft: #ecfdf5;
    --lp-warning: #f59e0b;
    --lp-warning-soft: #fffbeb;
    --lp-danger: #ef4444;
    --lp-ink: #0f172a;
    --lp-muted: #64748b;
    --lp-field-bg: #f6f8fb;
    --lp-field-border: #dde3ec;
    --lp-section-bg: #f0f3f9;
    --lp-section-border: #e2e8f0;
    --lp-radius-card: 28px;
    --lp-radius-section: 18px;
    --lp-radius-field: 14px;
    --lp-radius-btn: 16px;
    --lp-shadow: 0 20px 60px rgba(15, 23, 42, 0.08), 0 4px 16px rgba(15, 23, 42, 0.04);
}

*, *::before, *::after { box-sizing: border-box; }

html, body {
    margin: 0;
    padding: 0;
    width: 100%;
    height: 100%;
    overflow: hidden;
}

/* Ambient fluid blobs container and styles */
.login-ambient-blobs {
    position: fixed;
    inset: 0;
    overflow: hidden;
    z-index: -1;
    pointer-events: none;
}

.ambient-blob {
    position: absolute;
    border-radius: 50%;
    filter: blur(80px);
    opacity: 0.3;
    will-change: transform;
}

.blob-1 {
    width: 45vw;
    height: 45vw;
    background: radial-gradient(circle, rgba(99, 102, 241, 0.35) 0%, transparent 85%);
    top: -10vw;
    right: -10vw;
    animation: blobFloat1 25s infinite alternate ease-in-out;
}

.blob-2 {
    width: 40vw;
    height: 40vw;
    background: radial-gradient(circle, rgba(56, 189, 248, 0.3) 0%, transparent 85%);
    bottom: -10vw;
    left: -10vw;
    animation: blobFloat2 30s infinite alternate ease-in-out;
}

.blob-3 {
    width: 35vw;
    height: 35vw;
    background: radial-gradient(circle, rgba(139, 92, 246, 0.25) 0%, transparent 85%);
    top: 50%;
    left: 50%;
    animation: blobFloat3 22s infinite alternate ease-in-out;
}

@keyframes blobFloat1 {
    0% { transform: translate(0, 0) scale(1); }
    100% { transform: translate(-8vw, 6vw) scale(1.15); }
}

@keyframes blobFloat2 {
    0% { transform: translate(0, 0) scale(1.1); }
    100% { transform: translate(6vw, -8vw) scale(0.9); }
}

@keyframes blobFloat3 {
    0% { transform: translate(-50%, -50%) translate(0, 0) scale(0.9); }
    100% { transform: translate(-50%, -50%) translate(-6vw, -6vw) scale(1.1); }
}

body {
    font-family: var(--lp-font);
    color: var(--lp-ink);
    background: var(--lp-bg);
    background-image:
        radial-gradient(ellipse at 20% 30%, rgba(99, 102, 241, 0.05), transparent 50%),
        radial-gradient(ellipse at 80% 70%, rgba(56, 189, 248, 0.04), transparent 50%);
    display: flex;
    align-items: center;
    justify-content: center;
}

a, button, input, select, textarea { font: inherit; }
button { cursor: pointer; }

/* ── Page wrapper ── */
.login-page {
    width: 100%;
    max-width: 520px;
    padding: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    height: 100%;
}

/* ── Main card ── */
.login-card-unified {
    width: 100%;
    background: var(--lp-card);
    border: 1px solid var(--lp-card-border);
    border-radius: var(--lp-radius-card);
    backdrop-filter: blur(40px) saturate(1.4);
    -webkit-backdrop-filter: blur(40px) saturate(1.4);
    box-shadow: var(--lp-shadow), inset 0 1px 0 rgba(255, 255, 255, 0.7);
    padding: 36px 32px 32px;
    display: flex;
    flex-direction: column;
    max-height: calc(100vh - 40px);
    overflow-y: auto;
    animation: cardEnter .65s cubic-bezier(.16,1,.3,1) forwards;
}
.login-card-unified::-webkit-scrollbar { width: 0; display: none; }
.login-card-unified { -ms-overflow-style: none; scrollbar-width: none; }

@keyframes cardEnter {
    from { opacity: 0; transform: translateY(24px) scale(.97); }
    to   { opacity: 1; transform: translateY(0) scale(1); }
}

/* ── Header / Logos ── */
.login-header {
    text-align: center;
    margin-bottom: 20px;
}

.portal-logos-wrapper {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 20px;
    padding: 0 4px;
}

.portal-logo {
    height: 64px;
    max-width: 42%;
    object-fit: contain;
}

.school-logo {
    height: 72px;
    max-width: 42%;
    object-fit: contain;
    /* Original logo is white so we use a warm brown/gold filter to match the screenshot */
    filter: sepia(1) saturate(2) brightness(.75) hue-rotate(-10deg);
}

.login-title {
    margin: 0 0 6px;
    font-size: 1.7rem;
    font-weight: 800;
    color: var(--lp-ink);
    letter-spacing: -.3px;
}

.login-description {
    margin: 0;
    color: var(--lp-muted);
    font-size: .9rem;
    line-height: 1.6;
    font-weight: 400;
}

/* ── Step indicator (segmented pill) ── */
.step-strip {
    display: flex;
    gap: 6px;
    margin-bottom: 4px;
    background: var(--lp-section-bg);
    border: 1px solid var(--lp-section-border);
    border-radius: 99px;
    padding: 5px;
}

.step-pill {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px 14px;
    border-radius: 99px;
    background: transparent;
    color: #94a3b8;
    font-size: .85rem;
    font-weight: 700;
    transition: all .3s cubic-bezier(.4,0,.2,1);
    cursor: default;
}

.step-pill.is-active {
    background: var(--lp-primary);
    color: #fff;
    box-shadow: 0 4px 14px rgba(15, 52, 96, .25);
}

.step-label {
    width: 28px;
    height: 28px;
    display: grid;
    place-items: center;
    border-radius: 50%;
    font-size: .8rem;
    font-weight: 800;
    background: #d1d5db;
    color: #6b7280;
    font-family: 'Outfit', 'Segoe UI', sans-serif;
}

.step-pill.is-active .step-label {
    background: rgba(255, 255, 255, .22);
    color: #fff;
}

.step-number {
    font-size: .9rem;
    font-weight: 800;
    font-family: 'Outfit', 'Segoe UI', sans-serif;
}


/* ── Form section wrapper ── */
.form-stack {
    display: flex;
    flex-direction: column;
    gap: 0;
}

/* Inner sections with borders (matching screenshot's card sections) */
.form-group {
    display: flex;
    flex-direction: column;
    gap: 6px;
    padding: 18px 20px 14px;
    background: var(--lp-section-bg);
    border: 1px solid var(--lp-section-border);
    position: relative;
}

/* First form-group: top rounded, connected to step-strip */
.form-stack .form-group:first-child {
    border-radius: var(--lp-radius-section) var(--lp-radius-section) 0 0;
    margin-top: 0;
}

/* Last form-group gets bottom rounded */
.form-stack .form-group:last-of-type {
    border-radius: 0 0 var(--lp-radius-section) var(--lp-radius-section);
}

/* Merge borders between adjacent form-groups */
.form-stack .form-group + .form-group {
    border-top: none;
}

/* If there's only one form-group */
.form-stack .form-group:first-child:last-of-type {
    border-radius: var(--lp-radius-section);
}

/* ── Labels ── */
.form-label {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    font-size: .88rem;
    font-weight: 700;
    color: var(--lp-ink);
    margin-bottom: 2px;
}

.form-hint {
    font-size: .72rem;
    color: var(--lp-muted);
    font-weight: 400;
}

/* ── Input fields ── */
.field-wrap {
    position: relative;
    display: flex;
    align-items: center;
}

.input-icon-svg {
    position: absolute;
    width: 22px;
    height: 22px;
    color: #94a3b8;
    pointer-events: none;
    z-index: 2;
    transition: color .2s;
}
.input-icon-left { left: 14px; right: auto; }
.input-icon-right { right: 14px; left: auto; }

.input-control {
    width: 100%;
    height: 54px;
    border-radius: var(--lp-radius-field);
    border: 1.5px solid var(--lp-field-border);
    background: #fff;
    color: var(--lp-ink);
    font-size: 1.05rem;
    font-weight: 600;
    transition: all .2s ease;
    box-shadow: 0 1px 3px rgba(0, 0, 0, .03);
}

.input-control:focus {
    outline: none;
    border-color: var(--lp-accent);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, .1);
}

.field-wrap:focus-within .input-icon-svg {
    color: var(--lp-accent);
}

.input-control[readonly] {
    background: #f1f5f9;
    color: #94a3b8;
}

/* LTR input */
.input-ltr {
    direction: ltr;
    text-align: left;
    padding: 0 16px 0 48px;
}

/* ── Lookup row ── */
.lookup-row {
    display: flex;
    align-items: center;
    justify-content: flex-start;
    gap: 6px;
    margin-top: 4px;
    flex-wrap: wrap;
}

.lookup-status { font-size: .78rem; font-weight: 600; }
.lookup-status.is-success { color: var(--lp-success); }
.lookup-status.is-warning { color: #d97706; }

/* ── OTP Input ── */
.otp-input {
    height: 68px;
    text-align: center;
    font-size: 2.2rem;
    letter-spacing: .35em;
    padding: 0;
    font-weight: 800;
}

/* ── Validation ── */
.validation-message {
    color: var(--lp-danger);
    font-size: .78rem;
    min-height: 0;
}
.validation-summary:empty { display: none; }
.validation-summary ul { margin: 0; padding-inline-start: 20px; }

/* ── Notices ── */
.notice, .validation-summary {
    margin: 0 0 14px;
    padding: 12px 16px;
    border-radius: var(--lp-radius-field);
    font-size: .85rem;
    line-height: 1.6;
    font-weight: 500;
}
.notice-info { background: var(--lp-accent-soft); color: #1d4ed8; }
.notice-success { background: var(--lp-success-soft); color: #047857; }
.notice-warning, .validation-summary { background: var(--lp-warning-soft); color: #b45309; }

/* ── Checkbox / Toggle switch ── */
.checkbox-label {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-direction: row-reverse;
    padding: 18px 20px;
    cursor: pointer;
    transition: background .2s;
    gap: 14px;
    margin-top: 18px;
    background: var(--lp-section-bg);
    border: 1px solid var(--lp-section-border);
    border-radius: var(--lp-radius-section);
}
.checkbox-label:hover {
    background: #e8ecf4;
}

/* Actions row spacing */
.form-stack .actions-row {
    margin-top: 18px;
}

.checkbox-copy {
    display: flex;
    flex-direction: column;
    gap: 2px;
    text-align: right;
}
.checkbox-copy span { font-size: .88rem; font-weight: 700; color: var(--lp-ink); }
.checkbox-copy small { font-size: .75rem; color: var(--lp-muted); font-weight: 400; }

.checkbox-input {
    width: 50px;
    height: 28px;
    appearance: none;
    -webkit-appearance: none;
    border-radius: 999px;
    background: #cbd5e1;
    position: relative;
    transition: background .3s cubic-bezier(.4,0,.2,1);
    border: none;
    flex-shrink: 0;
    cursor: pointer;
}
.checkbox-input::after {
    content: '';
    position: absolute;
    top: 3px;
    left: 3px;
    width: 22px;
    height: 22px;
    border-radius: 50%;
    background: #fff;
    transition: transform .3s cubic-bezier(.4,0,.2,1);
    box-shadow: 0 1px 4px rgba(0, 0, 0, .12);
}
.checkbox-input:checked { background: var(--lp-accent); }
.checkbox-input:checked::after { transform: translateX(22px); }

/* ── Buttons ── */
.btn {
    height: 56px;
    border-radius: var(--lp-radius-btn);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0 28px;
    font-weight: 700;
    font-size: 1.05rem;
    border: none;
    transition: all .25s cubic-bezier(.4,0,.2,1);
    text-decoration: none;
    gap: 10px;
    letter-spacing: .2px;
}

.btn-primary {
    background: linear-gradient(135deg, var(--lp-primary) 0%, #1a4a7a 100%);
    color: #fff;
    box-shadow: 0 6px 20px rgba(15, 52, 96, .2);
}
.btn-primary:hover {
    background: linear-gradient(135deg, var(--lp-primary-hover) 0%, #0f3460 100%);
    transform: translateY(-1px);
    box-shadow: 0 8px 24px rgba(15, 52, 96, .28);
}
.btn-primary:active {
    transform: translateY(0);
    box-shadow: 0 4px 12px rgba(15, 52, 96, .2);
}

.btn-outline {
    background: #fff;
    border: 2px solid var(--lp-primary);
    color: var(--lp-primary);
    box-shadow: 0 2px 6px rgba(0, 0, 0, .04);
}
.btn-outline:hover {
    background: rgba(15, 52, 96, .04);
    border-color: var(--lp-primary-hover);
    transform: translateY(-1px);
}

.btn-text {
    background: transparent;
    color: var(--lp-accent);
    padding: 0;
    height: auto;
    font-size: .82rem;
    font-weight: 700;
    border: none;
}
.btn-text:hover { color: var(--lp-primary); text-decoration: underline; }

.btn.is-busy { opacity: .75; cursor: wait; pointer-events: none; }

/* ── Actions row ── */
.actions-row, .otp-actions {
    display: flex;
    gap: 12px;
    margin-top: 4px;
}
.actions-row .btn, .otp-actions .btn { flex: 1; }

/* ── Divider ── */
.divider {
    display: flex;
    align-items: center;
    color: #94a3b8;
    font-size: .82rem;
    font-weight: 500;
    margin: 16px 0 12px;
    gap: 0;
}
.divider::before, .divider::after {
    content: '';
    flex: 1;
    border-bottom: 1px solid #e2e8f0;
}
.divider::before { margin-left: 14px; }
.divider::after  { margin-right: 14px; }

/* ── Passkey / Biometric button ── */
.passkey-block .btn {
    width: 100%;
    height: 56px;
    background: linear-gradient(#fff, #fff) padding-box,
                linear-gradient(135deg, #2563eb, #9334e6, #10b981) border-box !important;
    border: 2px solid transparent !important;
    color: var(--lp-primary);
    font-weight: 700;
    font-size: 1.02rem;
    border-radius: var(--lp-radius-btn);
    box-shadow: 0 4px 16px rgba(37, 99, 235, 0.08);
    position: relative;
    overflow: hidden;
}
.passkey-block .btn::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(
        90deg,
        transparent,
        rgba(37, 99, 235, 0.08),
        transparent
    );
    transform: translateX(-100%) skewX(-20deg);
    will-change: transform;
}
.passkey-block .btn:hover::before {
    transform: translateX(100%) skewX(-20deg);
    transition: transform 0.85s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}
.passkey-block .btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 6px 20px rgba(37, 99, 235, 0.15);
}

.passkey-icon { width: 24px; height: 24px; color: var(--lp-primary); }

/* ── OTP target box ── */
.otp-target-box {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 14px 18px;
    border-radius: var(--lp-radius-field);
    background: var(--lp-accent-soft);
    border: 1px dashed rgba(37, 99, 235, .25);
    color: #1e3a8a;
    font-size: .88rem;
    font-weight: 600;
}
.otp-target-box strong { direction: ltr; font-size: 1.05rem; }

/* ── Active session ── */
.active-session { margin-bottom: 14px; }
.active-session .actions-row { margin-top: 10px; }

/* ── Spinner ── */
.btn-spinner {
    width: 20px;
    height: 20px;
    border: 2px solid rgba(255, 255, 255, .3);
    border-top-color: currentColor;
    border-radius: 50%;
    animation: spin .8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ============================================================= */
/* RESPONSIVE                                                      */
/* ============================================================= */

@media (max-width: 520px) {
    html, body {
        overflow-y: auto;
        overflow-x: hidden;
        height: auto;
        min-height: 100vh;
    }
    body {
        align-items: flex-start;
        padding: env(safe-area-inset-top) 0 env(safe-area-inset-bottom) 0;
    }
    .login-page {
        padding: 12px;
        height: auto;
        min-height: 100vh;
        align-items: flex-start;
        padding-top: max(16px, env(safe-area-inset-top));
        max-width: 100%;
    }
    .login-card-unified {
        padding: 24px 18px 22px;
        border-radius: 22px;
        max-height: none;
        overflow-y: visible;
    }
    .portal-logos-wrapper { margin-bottom: 14px; padding: 0; }
    .school-logo { height: 56px; }
    .portal-logo { height: 44px; }
    .login-title { font-size: 1.4rem; }
    .login-description { font-size: .85rem; }
    .login-header { margin-bottom: 14px; }
    .step-strip { margin-bottom: 2px; }
    .step-pill { padding: 8px 10px; font-size: .8rem; }
    .form-group { padding: 14px 16px 12px; }
    .input-control { height: 50px; font-size: 1rem; }
    .otp-input { height: 62px; font-size: 1.9rem; letter-spacing: .25em; }
    .btn { height: 52px; font-size: 1rem; border-radius: 14px; width: 100%; }
    .btn-primary { height: 54px; font-size: 1.02rem; }
    .passkey-block .btn { height: 52px; font-size: .95rem; width: 100%; }
    .actions-row, .otp-actions { flex-direction: column; gap: 10px; }
    .actions-row .btn, .otp-actions .btn { width: 100%; flex: none; }
    .checkbox-label { padding: 12px 14px; gap: 10px; }
    .checkbox-copy small { font-size: .7rem; }
    .divider { margin: 12px 0 10px; font-size: .78rem; }
    .otp-target-box { padding: 12px 14px; font-size: .82rem; }
    .notice, .validation-summary { padding: 10px 12px; font-size: .82rem; }
}

@media (max-width: 375px) {
    .login-card-unified { padding: 20px 14px 18px; border-radius: 20px; }
    .portal-logo, .school-logo { height: 36px; }
    .login-title { font-size: 1.25rem; }
    .input-control { height: 48px; }
    .btn { height: 50px; }
    .btn-primary { height: 52px; }
}

/* ============================================================= */
/* INSTANT TRANSITION SPLASH                                       */
/* ============================================================= */
.login-transition-splash {
    position: fixed;
    inset: 0;
    z-index: 99999;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--lp-bg, #eef2f9);
    background-image:
        radial-gradient(ellipse at 20% 30%, rgba(99, 102, 241, .08), transparent 50%),
        radial-gradient(ellipse at 80% 70%, rgba(56, 189, 248, .06), transparent 50%);
    animation: splashFadeIn .18s ease-out forwards;
}
.login-transition-splash[hidden] { display: none !important; }

@keyframes splashFadeIn {
    from { opacity: 0; }
    to   { opacity: 1; }
}

.lts-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 24px;
    animation: splashCardEnter .3s cubic-bezier(.16,1,.3,1) forwards;
}
@keyframes splashCardEnter {
    from { opacity: 0; transform: scale(.92) translateY(12px); }
    to   { opacity: 1; transform: scale(1) translateY(0); }
}

.lts-logo {
    width: 200px;
    height: auto;
    object-fit: contain;
    filter: drop-shadow(0 4px 16px rgba(15, 52, 96, .15));
    animation: splashLogoPulse 1.5s ease-in-out infinite;
}
@keyframes splashLogoPulse {
    0%, 100% { transform: scale(1); filter: drop-shadow(0 4px 16px rgba(15, 52, 96, .15)); }
    50%      { transform: scale(1.04); filter: drop-shadow(0 6px 24px rgba(15, 52, 96, .25)); }
}

.lts-progress {
    width: 200px;
    height: 4px;
    border-radius: 4px;
    background: rgba(15, 52, 96, .08);
    overflow: hidden;
}
.lts-progress-bar {
    width: 40%;
    height: 100%;
    border-radius: 4px;
    background: linear-gradient(90deg, var(--lp-primary, #0f3460), var(--lp-accent, #2563eb));
    animation: splashProgress 1.2s ease-in-out infinite;
}
@keyframes splashProgress {
    0%   { transform: translateX(-100%); }
    100% { transform: translateX(350%); }
}

.lts-text {
    font-family: var(--lp-font, 'Readex Pro', sans-serif);
    font-size: .95rem;
    font-weight: 600;
    color: var(--lp-muted, #64748b);
    letter-spacing: .2px;
}

/* Hide login card when splash is active */
body.is-transitioning .login-page {
    opacity: 0;
    pointer-events: none;
    transition: opacity .15s ease;
}

/* Welcome text in splash */
.lts-welcome {
    font-family: var(--lp-font, 'Readex Pro', sans-serif);
    font-size: 1.5rem;
    font-weight: 800;
    color: var(--lp-ink, #0f172a);
    margin: 0;
    letter-spacing: -.3px;
    opacity: 0;
    animation: welcomeFadeUp .5s cubic-bezier(.16,1,.3,1) .15s forwards;
}
.lts-welcome[hidden] { display: none !important; }

@keyframes welcomeFadeUp {
    from { opacity: 0; transform: translateY(10px); }
    to   { opacity: 1; transform: translateY(0); }
}
