/* ══════════════════════════════════════════════
   LEGIO — Login Page
   ══════════════════════════════════════════════ */

.login-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-base);
  padding: var(--space-6);
}

.login-container {
  width: 100%;
  max-width: 400px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-8);
}

/* ── Branding ── */
.login-brand {
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-3);
}

.login-brand-shield {
  width: 32px;
  height: 32px;
  color: var(--accent);
}

.login-brand h1 {
  font-family: var(--font-display);
  font-size: 28px;
  font-weight: 600;
  color: var(--text-primary);
  letter-spacing: -0.02em;
}

.login-brand p {
  font-size: 14px;
  color: var(--text-secondary);
}

/* ── Card ── */
.login-card {
  width: 100%;
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-md);
  padding: var(--space-8);
}

.login-card-header {
  text-align: center;
  margin-bottom: var(--space-6);
}

.login-card-header h2 {
  font-size: 18px;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: var(--space-1);
}

.login-card-header p {
  font-size: 13px;
  color: var(--text-secondary);
}

/* ── Form ── */
.login-form {
  display: flex;
  flex-direction: column;
  gap: var(--space-5);
}

.login-form .form-group {
  position: relative;
}

.login-form .input-icon-wrapper {
  position: relative;
}

.login-form .input-icon {
  position: absolute;
  left: 14px;
  top: 50%;
  transform: translateY(-50%);
  width: 16px;
  height: 16px;
  color: var(--text-muted);
  pointer-events: none;
  transition: color 0.15s;
}

.login-form .input-with-icon {
  padding-left: 40px;
}

.login-form .input-with-icon:focus ~ .input-icon,
.login-form .input-with-icon:focus + .input-icon {
  color: var(--accent);
}

/* Password toggle */
.password-toggle {
  position: absolute;
  right: 12px;
  top: 50%;
  transform: translateY(-50%);
  background: none;
  border: none;
  color: var(--text-muted);
  padding: var(--space-1);
  cursor: pointer;
  transition: color 0.15s;
}
.password-toggle:hover {
  color: var(--text-secondary);
}
.password-toggle svg {
  width: 16px;
  height: 16px;
}

/* ── TOTP Step ── */
.totp-step {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-6);
}

.totp-icon {
  width: 56px;
  height: 56px;
  background: var(--accent-light);
  border-radius: var(--radius-full);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--accent);
}
.totp-icon svg {
  width: 24px;
  height: 24px;
}

.totp-info {
  text-align: center;
}

.totp-info h2 {
  font-size: 18px;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: var(--space-1);
}

.totp-info p {
  font-size: 13px;
  color: var(--text-secondary);
}

/* 6 digit code input group */
.totp-inputs {
  display: flex;
  gap: var(--space-2);
  justify-content: center;
}

.totp-input {
  width: 46px;
  height: 54px;
  text-align: center;
  font-family: var(--font-ui);
  font-size: 22px;
  font-weight: 600;
  color: var(--accent);
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  outline: none;
  transition: border-color 0.15s, box-shadow 0.15s;
  caret-color: var(--accent);
}
.totp-input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-light);
}
.totp-input.filled {
  border-color: var(--accent-border);
  background: var(--accent-light);
}

/* ── Transitions between steps ── */
.login-step {
  animation: fadeIn 0.3s ease both;
}

.login-step.leaving {
  animation: fadeOut 0.2s ease forwards;
}

@keyframes fadeOut {
  from { opacity: 1; transform: translateY(0); }
  to   { opacity: 0; transform: translateY(-8px); }
}

/* ── Footer ── */
.login-footer {
  text-align: center;
  font-size: 12px;
  color: var(--text-muted);
}

/* ── Loading spinner on button ── */
.btn-loading {
  position: relative;
  color: transparent;
  pointer-events: none;
}

.btn-loading::after {
  content: '';
  position: absolute;
  width: 16px;
  height: 16px;
  border: 2px solid var(--text-inverse);
  border-top-color: transparent;
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
}

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