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

:root {
  --bg-base: #050c1a;
  --bg-card: rgba(10, 18, 35, 0.85);
  --border: rgba(74, 158, 255, 0.15);
  --border-hover: rgba(74, 158, 255, 0.35);
  --accent: #4a9eff;
  --accent-dark: #1d6fd8;
  --text-primary: #e8f0fe;
  --text-secondary: #7a94c1;
  --text-muted: #4a6080;
  --input-bg: rgba(255, 255, 255, 0.04);
  --input-border: rgba(74, 158, 255, 0.2);
  --input-focus: rgba(74, 158, 255, 0.5);
  --error-bg: rgba(239, 68, 68, 0.1);
  --error-border: rgba(239, 68, 68, 0.4);
  --error-text: #fca5a5;
  --radius: 10px;
  --radius-sm: 6px;
}

html, body {
  height: 100%;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Inter', system-ui, sans-serif;
  font-size: 15px;
  background-color: var(--bg-base);
  color: var(--text-primary);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* Animated background */

.background {
  position: fixed;
  inset: 0;
  overflow: hidden;
  z-index: 0;
  background: radial-gradient(ellipse at 20% 50%, #0d1f4a 0%, transparent 60%),
              radial-gradient(ellipse at 80% 20%, #0a1a3e 0%, transparent 55%),
              linear-gradient(180deg, #060e20 0%, #050c1a 100%);
}

.bg-orb {
  position: absolute;
  border-radius: 50%;
  filter: blur(80px);
  opacity: 0.25;
  animation: drift 18s ease-in-out infinite alternate;
}

.bg-orb-1 {
  width: 600px;
  height: 600px;
  top: -150px;
  left: -100px;
  background: radial-gradient(circle, #1e40af 0%, transparent 70%);
  animation-duration: 20s;
}

.bg-orb-2 {
  width: 500px;
  height: 500px;
  bottom: -100px;
  right: -80px;
  background: radial-gradient(circle, #1d4ed8 0%, transparent 70%);
  animation-duration: 15s;
  animation-delay: -7s;
}

@keyframes drift {
  from { transform: translate(0, 0) scale(1); }
  to   { transform: translate(30px, 20px) scale(1.08); }
}

/* Layout */

.container {
  position: relative;
  z-index: 1;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 24px 16px 48px;
}

/* Card */

.card {
  width: 100%;
  max-width: 420px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 40px 36px 32px;
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
  box-shadow: 0 0 0 1px rgba(255,255,255,0.03),
              0 24px 64px rgba(0, 0, 0, 0.5),
              0 0 80px rgba(74, 158, 255, 0.04);
}

/* Logo */

.logo-wrap {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 28px;
}

.logo-icon {
  width: 40px;
  height: 46px;
  flex-shrink: 0;
  filter: drop-shadow(0 0 12px rgba(74, 158, 255, 0.4));
}

.logo-text {
  display: flex;
  flex-direction: column;
}

.logo-name {
  font-size: 20px;
  font-weight: 700;
  letter-spacing: -0.3px;
  color: var(--text-primary);
  line-height: 1.2;
}

.logo-sub {
  font-size: 11px;
  font-weight: 500;
  color: var(--text-muted);
  letter-spacing: 0.5px;
  text-transform: uppercase;
  margin-top: 2px;
}

/* Headings */

.heading {
  font-size: 21px;
  font-weight: 600;
  color: var(--text-primary);
  letter-spacing: -0.3px;
  line-height: 1.3;
  margin-bottom: 6px;
}

.subheading {
  font-size: 13.5px;
  color: var(--text-secondary);
  margin-bottom: 24px;
}

/* Banners (error / warning / success / info) */

.banner {
  display: flex;
  align-items: center;
  gap: 8px;
  border-radius: var(--radius-sm);
  font-size: 13.5px;
  padding: 10px 14px;
  margin-bottom: 18px;
  animation: slide-in 0.2s ease;
}

.banner[hidden] { display: none; }

.banner.error {
  background: var(--error-bg);
  border: 1px solid var(--error-border);
  color: var(--error-text);
}

.banner.warning {
  background: rgba(234, 179, 8, 0.1);
  border: 1px solid rgba(234, 179, 8, 0.35);
  color: #fde68a;
}

.banner.success {
  background: rgba(34, 197, 94, 0.1);
  border: 1px solid rgba(34, 197, 94, 0.3);
  color: #86efac;
}

@keyframes slide-in {
  from { opacity: 0; transform: translateY(-6px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* Form fields */

.field {
  margin-bottom: 18px;
}

.field label {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-secondary);
  margin-bottom: 6px;
}

.forgot-link,
.label-link {
  font-size: 12.5px;
  font-weight: 400;
  color: var(--accent);
  text-decoration: none;
  opacity: 0.8;
  transition: opacity 0.15s;
}

.forgot-link:hover,
.label-link:hover {
  opacity: 1;
}

input[type="text"],
input[type="password"] {
  width: 100%;
  background: var(--input-bg);
  border: 1px solid var(--input-border);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  font-size: 14.5px;
  font-family: inherit;
  padding: 10px 14px;
  outline: none;
  transition: border-color 0.15s, box-shadow 0.15s;
}

input[type="text"]::placeholder,
input[type="password"]::placeholder {
  color: var(--text-muted);
}

input[type="text"]:focus,
input[type="password"]:focus {
  border-color: var(--input-focus);
  box-shadow: 0 0 0 3px rgba(74, 158, 255, 0.12);
}

input[type="text"].error,
input[type="password"].error {
  border-color: var(--error-border);
}

/* Input with suffix button */

.input-wrap {
  position: relative;
}

.input-wrap input {
  padding-right: 44px;
}

/* password-wrap kept for backward compat */
.password-wrap { position: relative; }
.password-wrap input { padding-right: 44px; }

.toggle-pw {
  position: absolute;
  right: 10px;
  top: 50%;
  transform: translateY(-50%);
  background: none;
  border: none;
  cursor: pointer;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  padding: 4px;
  transition: color 0.15s;
}

.toggle-pw:hover {
  color: var(--text-secondary);
}

/* Remember me */

.field-row {
  margin-bottom: 22px;
}

.checkbox-label {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: var(--text-secondary);
  cursor: pointer;
  user-select: none;
}

.checkbox-label input[type="checkbox"] {
  width: 15px;
  height: 15px;
  accent-color: var(--accent);
  cursor: pointer;
}

/* Submit button */

.btn-primary {
  width: 100%;
  background: linear-gradient(135deg, #1e40af 0%, #1d6fd8 100%);
  border: 1px solid rgba(74, 158, 255, 0.3);
  border-radius: var(--radius-sm);
  color: #fff;
  font-size: 15px;
  font-weight: 600;
  font-family: inherit;
  padding: 11px 20px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition: transform 0.15s, box-shadow 0.15s, opacity 0.15s;
  box-shadow: 0 4px 16px rgba(29, 111, 216, 0.35);
  letter-spacing: 0.1px;
}

.btn-primary:hover:not(:disabled) {
  transform: translateY(-1px);
  box-shadow: 0 6px 24px rgba(29, 111, 216, 0.45);
}

.btn-primary:active:not(:disabled) {
  transform: translateY(0);
}

.btn-primary:disabled {
  opacity: 0.65;
  cursor: not-allowed;
}

/* Spinner */

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

.spinner[hidden] {
  display: none;
}

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

/* Secondary button (SSO) */

.btn-secondary {
  width: 100%;
  background: transparent;
  border: 1px solid var(--input-border);
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  font-size: 14px;
  font-weight: 500;
  font-family: inherit;
  padding: 10px 20px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition: border-color 0.15s, color 0.15s, background 0.15s;
}

.btn-secondary:hover {
  border-color: var(--border-hover);
  color: var(--text-primary);
  background: rgba(74, 158, 255, 0.04);
}

/* Divider */

.divider {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 18px 0;
  color: var(--text-muted);
  font-size: 12px;
}

.divider::before,
.divider::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--border);
}

/* Back link */

.back-link-wrap {
  margin-top: 20px;
  text-align: center;
}

.back-link {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 13px;
  color: var(--text-secondary);
  text-decoration: none;
  transition: color 0.15s;
}

.back-link:hover {
  color: var(--accent);
}

/* Field hint */

.field-hint {
  margin-top: 6px;
  font-size: 12px;
  color: var(--text-muted);
}

.field-hint a {
  color: var(--accent);
  text-decoration: none;
  opacity: 0.8;
}

.field-hint a:hover { opacity: 1; }

/* MFA icon */

.mfa-icon {
  display: flex;
  justify-content: center;
  margin-bottom: 16px;
  filter: drop-shadow(0 0 12px rgba(74, 158, 255, 0.25));
}

/* User display */

.user-display {
  color: var(--text-primary);
  font-weight: 600;
}

/* Help text */

.help-text {
  margin-top: 20px;
  font-size: 12.5px;
  color: var(--text-muted);
  text-align: center;
}

.help-text a {
  color: var(--accent);
  text-decoration: none;
  opacity: 0.8;
}

.help-text a:hover {
  opacity: 1;
}

/* Footer */

.footer {
  margin-top: 28px;
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 12px;
  color: var(--text-muted);
}

.footer a {
  color: var(--text-muted);
  text-decoration: none;
  transition: color 0.15s;
}

.footer a:hover {
  color: var(--text-secondary);
}

@media (max-width: 480px) {
  .card {
    padding: 28px 20px 24px;
  }
}
