* { box-sizing: border-box; }

:root {
    --bg: #eef3f8;
    --card: #ffffff;
    --text: #1f2937;
    --muted: #6b7280;
    --primary: #1d4ed8;
    --primary-dark: #1e40af;
    --border: #d1d5db;
    --danger: #b91c1c;
    --success: #166534;
    --shadow: 0 20px 45px rgba(0, 0, 0, 0.14);
    --radius: 22px;
}

body {
    margin: 0;
    min-height: 100vh;
    font-family: Arial, Helvetica, sans-serif;
    color: var(--text);
    background:
        linear-gradient(135deg, rgba(29, 78, 216, 0.09), rgba(255,255,255,0.4)),
        var(--bg);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
}

.shell {
    width: 100%;
    max-width: 980px;
    display: grid;
    grid-template-columns: 1.05fr 0.95fr;
    background: var(--card);
    border-radius: 26px;
    overflow: hidden;
    box-shadow: var(--shadow);
}

/* Make the shell smaller for the MFA screen */
.shell.mfa-shell {
    max-width: 500px;
    display: block;
    padding: 42px 34px;
}

.hero {
    background: linear-gradient(160deg, #0f172a 0%, #1d4ed8 100%);
    color: #fff;
    padding: 48px;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.hero-badge {
    display: inline-block;
    width: fit-content;
    padding: 8px 14px;
    border-radius: 999px;
    border: 1px solid rgba(255,255,255,0.24);
    background: rgba(255,255,255,0.12);
    font-size: 12px;
    font-weight: 700;
    letter-spacing: .08em;
    text-transform: uppercase;
    margin-bottom: 18px;
}

.hero h1 { margin: 0 0 14px; font-size: 36px; line-height: 1.15; }
.hero p { margin: 0 0 18px; font-size: 15px; line-height: 1.7; color: rgba(255,255,255,0.9); }
.hero ul { margin: 8px 0 0; padding-left: 18px; line-height: 1.8; color: rgba(255,255,255,0.94); font-size: 14px; }

.panel {
    padding: 42px 34px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #fff;
}

.card { width: 100%; max-width: 370px; }
.card h2, .mfa-shell h2 { margin: 0 0 8px; font-size: 30px; }
.mfa-shell h2 { text-align: center; }

.subtext { margin: 0 0 24px; color: var(--muted); font-size: 14px; line-height: 1.6; }
.mfa-shell .subtext { text-align: center; }

.message {
    display: none;
    margin-bottom: 16px;
    padding: 12px 14px;
    border-radius: 12px;
    font-size: 14px;
    line-height: 1.5;
}
.mfa-shell .message { text-align: center; }

.message.error { display: block; background: #fef2f2; color: var(--danger); border: 1px solid #fecaca; }
.message.success { display: block; background: #f0fdf4; color: var(--success); border: 1px solid #bbf7d0; }

.field { margin-bottom: 16px; }
.mfa-shell .field { margin-bottom: 24px; }

.field label { display: block; font-size: 14px; font-weight: 700; margin-bottom: 8px; }

input, select {
    width: 100%;
    padding: 12px 14px;
    border: 1px solid var(--border);
    border-radius: 12px;
    font-size: 14px;
    outline: none;
    background: #fff;
    transition: border-color .2s ease, box-shadow .2s ease;
}

.mfa-shell input {
    padding: 16px;
    font-size: 24px;
    text-align: center;
    letter-spacing: 5px;
    font-weight: bold;
    background: #f8fafc;
}

input:focus, select:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 4px rgba(29, 78, 216, 0.12);
}

.is-invalid {
    border-color: var(--danger) !important;
    background-color: #fff8f8 !important;
    box-shadow: 0 0 0 4px rgba(220, 53, 69, 0.12) !important;
}

.password-wrap {
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 8px;
}

.toggle-btn {
    border: 1px solid var(--border);
    background: #fff;
    padding: 0 14px;
    border-radius: 12px;
    cursor: pointer;
    font-weight: 700;
    color: var(--primary);
}

.toggle-btn:hover { background: #f8fafc; }

.login-btn {
    width: 100%;
    border: 0;
    border-radius: 12px;
    padding: 13px 16px;
    background: var(--primary);
    color: #fff;
    font-size: 15px;
    font-weight: 700;
    cursor: pointer;
    transition: background .2s ease, transform .05s ease;
}
.mfa-shell .login-btn { padding: 14px; font-size: 16px; }

.login-btn:hover { background: var(--primary-dark); }
.login-btn:active { transform: translateY(1px); }
.login-btn:disabled { opacity: 0.72; cursor: wait; }

.back-link { display: block; text-align: center; margin-top: 16px; color: var(--primary); font-size: 14px; text-decoration: none; font-weight: bold; }
.resend-container { text-align: center; margin-top: 20px; font-size: 14px; }
.resend-btn { color: var(--primary); cursor: pointer; text-decoration: none; font-weight: bold; border: none; background: none; padding: 0; }
.resend-btn:hover { text-decoration: underline; }
.resend-btn:disabled { color: var(--muted); cursor: not-allowed; text-decoration: none; }

@media (max-width: 860px) {
    .shell:not(.mfa-shell) { grid-template-columns: 1fr; }
    .hero { padding: 34px 28px; }
    .panel { padding: 28px 20px 34px; }
}

/* Forgot Password Link styling */
.forgot-link {
    font-size: 13px;
    color: var(--primary);
    text-decoration: none;
    font-weight: bold;
    transition: color 0.2s ease;
}
.forgot-link:hover {
    color: var(--primary-dark);
    text-decoration: underline;
}

/* Modal Overlay (blurred background) */
.modal-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(15, 23, 42, 0.4);
    backdrop-filter: blur(4px);
    z-index: 1000;
    align-items: center;
    justify-content: center;
}

/* Modal Box */
.modal-content {
    background: #ffffff;
    padding: 24px;
    border-radius: 16px;
    width: 90%;
    max-width: 420px;
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
    animation: modalFadeIn 0.3s ease;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
    border-bottom: 1px solid #f1f5f9;
    padding-bottom: 12px;
}

.modal-header h3 {
    margin: 0;
    color: #0f172a;
    font-size: 18px;
}

.close-btn {
    font-size: 24px;
    color: #94a3b8;
    cursor: pointer;
    font-weight: bold;
    line-height: 1;
    transition: color 0.2s;
}
.close-btn:hover {
    color: #475569;
}

.modal-body p {
    color: #334155;
    font-size: 14px;
    line-height: 1.5;
    margin: 0 0 16px 0;
}

.instruction-box {
    background: #f8fafc;
    border-left: 4px solid var(--primary);
    padding: 12px 16px;
    border-radius: 6px;
    color: #475569;
    font-size: 13.5px;
    line-height: 1.5;
}

.modal-footer {
    display: flex;
    justify-content: flex-end;
    margin-top: 24px;
}

.confirm-btn {
    background: var(--primary);
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 10px;
    cursor: pointer;
    font-weight: 700;
    font-size: 14px;
    transition: background 0.2s;
}
.confirm-btn:hover {
    background: var(--primary-dark);
}

@keyframes modalFadeIn {
    from { transform: scale(0.95); opacity: 0; }
    to { transform: scale(1); opacity: 1; }
}