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

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

:root {
  --primary: #4f46e5;
  --primary-hover: #4338ca;
  --bg: #f1f5f9;
  --card-bg: #ffffff;
  --text: #1e293b;
  --muted: #64748b;
  --border: #e2e8f0;
  --input-bg: #f8fafc;
  --error: #ef4444;
  --error-bg: #fef2f2;
  --error-border: #fecaca;
  --radius: 0.75rem;
  --shadow: 0 10px 40px rgba(0, 0, 0, 0.08);
}

body {
  font-family: 'Inter', sans-serif;
  background: linear-gradient(135deg, #0f172a 0%, #1e1b4b 40%, #312e81 75%, #4338ca 100%);
  background-attachment: fixed;
  color: var(--text);
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
}

.wrapper {
  width: 100%;
  padding: 2rem;
  display: flex;
  justify-content: center;
  align-items: center;
}

@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(24px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.login-card {
  background: var(--card-bg);
  border-radius: var(--radius);
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.3);
  padding: clamp(2rem, 4vw, 3rem);
  width: 100%;
  max-width: 460px;
  border: 1px solid var(--border);
  animation: fadeInUp 2.0s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

.login-header {
  text-align: center;
  margin-bottom: 2rem;
}

.login-logo {
  max-width: 300px;
  height: auto;
  margin: 0 auto 0 auto;
  display: block;
}

.login-header p {
  font-size: 0.875rem;
  color: var(--muted);
}

.alert.error {
  background: var(--error-bg);
  border: 1px solid var(--error-border);
  color: var(--error);
  border-radius: 0.5rem;
  padding: 0.75rem 1rem;
  font-size: 0.875rem;
  margin-bottom: 1.25rem;
  text-align: center;
}

.alert.success {
  background: #ecfdf5;
  border: 1px solid #a7f3d0;
  color: #065f46;
  border-radius: 0.5rem;
  padding: 0.75rem 1rem;
  font-size: 0.875rem;
  margin-bottom: 1.25rem;
  text-align: center;
  font-weight: 500;
}

.alert.error .attempts-subtext {
  display: block;
  font-size: 0.78rem;
  margin-top: 0.25rem;
  opacity: 0.85;
  font-weight: 500;
}

.input-group {
  display: flex;
  flex-direction: column;
  gap: 0.375rem;
  margin-bottom: 1.1rem;
}

.input-group label {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.input-wrapper,
.select-wrapper {
  position: relative;
  display: flex;
  align-items: center;
}

.input-wrapper>i:first-child,
.select-wrapper>i:first-child {
  position: absolute;
  left: 0.875rem;
  font-size: 1.1rem;
  color: var(--muted);
  pointer-events: none;
}

.input-wrapper input,
.select-wrapper select {
  width: 100%;
  padding: 0.7rem 2.5rem 0.7rem 2.5rem;
  background: var(--input-bg);
  border: 1.5px solid var(--border);
  border-radius: 0.5rem;
  font-family: inherit;
  font-size: 0.9375rem;
  color: var(--text);
  transition: border-color 0.2s, box-shadow 0.2s;
  outline: none;
  appearance: none;
}

.input-wrapper input::placeholder {
  color: #94a3b8;
}

input[type="password"]::-ms-reveal,
input[type="password"]::-webkit-contacts-auto-fill-button {
  display: none;
}

.input-wrapper input:focus,
.select-wrapper select:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.1);
  background: #fff;
}

.input-wrapper input.invalid,
.select-wrapper select.invalid {
  border-color: var(--error);
  box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.08);
}

.select-wrapper .chevron {
  position: absolute;
  right: 0.875rem;
  font-size: 1.1rem;
  color: var(--muted);
  pointer-events: none;
}

.toggle-password {
  position: absolute;
  right: 0.875rem;
  background: none;
  border: none;
  cursor: pointer;
  color: var(--muted);
  font-size: 1.1rem;
  display: flex;
  align-items: center;
  padding: 0;
  transition: color 0.2s;
}

.toggle-password:hover {
  color: var(--primary);
}

.field-error {
  font-size: 0.78rem;
  color: var(--error);
  min-height: 1rem;
}

.btn-login {
  width: 100%;
  padding: 0.8rem;
  background: linear-gradient(135deg, #4338ca 0%, #4f46e5 50%, #6366f1 100%);
  background-size: 200% 200%;
  background-position: 0% 0%;
  color: #fff;
  font-family: inherit;
  font-size: 1rem;
  font-weight: 600;
  border: none;
  border-radius: 0.5rem;
  cursor: pointer;
  margin-top: 0.5rem;
  transition: background-position 0.4s ease, box-shadow 0.3s ease, transform 0.1s ease;
  letter-spacing: 0.02em;
}

.btn-login:hover {
  background-position: 100% 100%;
  box-shadow: 0 6px 20px rgba(79, 70, 229, 0.4);
}

.btn-login:active {
  transform: scale(0.98);
}


@media (min-width: 768px) {
  .login-card {
    padding: 3rem;
  }
}


@media (max-width: 767px) {
  .wrapper {
    padding: 1rem;
  }

  .login-card {
    max-width: 100%;
  }
}

/* ── Adaptive 2FA Verification Card & Elements ── */
.verification-header {
  text-align: center;
  margin-bottom: 1.5rem;
}

.verification-icon {
  width: 68px;
  height: 68px;
  margin: 0 auto 1rem;
  border-radius: 50%;
  background: rgba(79, 70, 229, 0.1);
  color: var(--primary);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2.25rem;
  border: 2px solid rgba(79, 70, 229, 0.2);
}

.verification-title {
  font-size: 1.35rem;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 0.5rem;
}

.verification-subtext {
  font-size: 0.875rem;
  color: var(--muted);
  line-height: 1.5;
}

.verification-subtext strong {
  color: var(--text);
  font-weight: 600;
}

.test-fallback-banner {
  background: #eff6ff;
  border: 1px solid #bfdbfe;
  color: #1e40af;
  border-radius: 0.5rem;
  padding: 0.75rem 1rem;
  font-size: 0.85rem;
  margin-bottom: 1.25rem;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  text-align: left;
}

.test-fallback-banner i {
  font-size: 1.4rem;
  flex-shrink: 0;
  color: #3b82f6;
}

.test-otp-code {
  display: inline-block;
  background: #1e1b4b;
  color: #fbbf24;
  font-weight: 700;
  font-size: 1.1rem;
  letter-spacing: 3px;
  padding: 2px 8px;
  border-radius: 4px;
  margin-left: 4px;
}

.trust-device-group {
  margin: 1rem 0 1.25rem;
}

.trust-device-label {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.85rem;
  color: var(--muted);
  cursor: pointer;
  user-select: none;
}

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

.btn-verify {
  margin-top: 0.25rem;
}

.verification-actions {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 1.5rem;
  padding-top: 1.25rem;
  border-top: 1px solid var(--border);
  gap: 0.75rem;
}

.btn-resend, .btn-cancel {
  background: none;
  border: none;
  font-size: 0.85rem;
  color: var(--muted);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  transition: color 0.15s ease;
  padding: 0.25rem 0.5rem;
}

.btn-resend:hover:not(:disabled) {
  color: var(--primary);
}

.btn-resend:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.btn-cancel:hover {
  color: var(--text);
}