/* ============================================================================
 * VajraPulse — sign-in screen
 *
 * Builds on the tokens and the .btn / .input / .field-label components in
 * index.css; only the page shell and the few controls unique to this screen
 * live here, so the login form looks like the rest of the dashboard without
 * restating any of it.
 * ========================================================================= */

.login-body {
  min-height: 100vh;
  /* A quiet wash rather than a flat field: enough depth that the card reads as
     a sheet on a surface, not a box drawn on paper. */
  background:
    radial-gradient(1100px 520px at 50% -10%, var(--primary-subtle) 0%, transparent 62%),
    var(--surface-page);
}

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

.login-card {
  width: 100%;
  max-width: 400px;
  padding: var(--space-8);
  background: var(--surface-card);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-md);
}

/* ---- Header --------------------------------------------------------------- */

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

.login-brand-icon {
  width: 44px;
  height: 44px;
  margin: 0 auto var(--space-4);
  border-radius: var(--radius-md);
  font-size: 19px;
}

.login-title {
  margin: 0;
  font-size: var(--text-xl);
  font-weight: 700;
  letter-spacing: -0.025em;
  color: var(--text-primary);
}

.login-subtitle {
  margin: var(--space-2) 0 0;
  font-size: var(--text-sm);
  color: var(--text-secondary);
  line-height: 1.5;
}

/* ---- Error banner --------------------------------------------------------- */

.login-alert {
  display: flex;
  align-items: flex-start;
  gap: var(--space-2);
  margin-bottom: var(--space-5);
  padding: var(--space-3) var(--space-4);
  background: var(--danger-subtle);
  border: 1px solid var(--danger-border);
  border-radius: var(--radius-sm);
  color: var(--danger-text);
  font-size: var(--text-sm);
  line-height: 1.45;
}

.login-alert i { margin-top: 2px; flex-shrink: 0; }

/* ---- Form ----------------------------------------------------------------- */

.login-form {
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
}

.login-field { min-width: 0; }

.password-wrap { position: relative; }

/* Room for the reveal button, so a long password never runs underneath it. */
.password-wrap .input { padding-right: 40px; }

.password-toggle {
  position: absolute;
  top: 50%;
  right: 4px;
  transform: translateY(-50%);
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: none;
  border: none;
  border-radius: var(--radius-xs);
  color: var(--text-tertiary);
  font-size: var(--text-base);
  cursor: pointer;
  transition: var(--transition-colors);
}

.password-toggle:hover { color: var(--text-secondary); background: var(--surface-hover); }
.password-toggle:focus-visible {
  outline: none;
  box-shadow: 0 0 0 3px var(--focus-ring);
  color: var(--text-secondary);
}

.login-submit {
  width: 100%;
  margin-top: var(--space-2);
  gap: var(--space-2);
}

.login-spinner { font-size: var(--text-sm); }

/* ---- Footer --------------------------------------------------------------- */

.login-footer {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  margin-top: var(--space-6);
  padding-top: var(--space-5);
  border-top: 1px solid var(--border-subtle);
  font-size: var(--text-xs);
  color: var(--text-tertiary);
  text-align: center;
}

@media (max-width: 420px) {
  .login-card {
    padding: var(--space-6) var(--space-5);
    border-radius: var(--radius-md);
  }
}

/* ============================================================================
 * Touch targets — sign-in screen
 *
 * The reveal button is a 32px circle sitting inside the password field. The
 * pseudo-element gives it a 44px target on any pointer without changing what
 * is drawn; on a touch screen it grows properly, and the field's right-hand
 * padding grows with it so a long password still cannot run underneath.
 * ========================================================================= */

.password-toggle {
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}

.password-toggle::after {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  width: 44px;
  height: 44px;
  transform: translate(-50%, -50%);
}

@media (pointer: coarse) {
  .login-card { max-width: 440px; padding: var(--space-8) var(--space-6); }

  .password-toggle { width: 44px; height: 44px; font-size: var(--text-md); }
  .password-wrap .input { padding-right: 52px; }

  /* Sign in is the only action on the screen; give it the full 48. */
  .login-submit { height: 48px; font-size: var(--text-md); }
}
