@import url("./tokens.css");

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

html, body {
  height: 100%;
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  -webkit-font-smoothing: antialiased;
  touch-action: manipulation;
}

:focus { outline: none; }
:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
}

.login-wrapper {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100dvh;
  padding: 1rem;
  background:
    radial-gradient(ellipse 80% 50% at 50% -20%, rgba(59, 130, 246, 0.12), transparent),
    var(--bg);
}

.login-card {
  width: 100%;
  max-width: 400px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 2.25rem 1.75rem;
  box-shadow: var(--shadow);
}

.login-brand {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 1.75rem;
}

.brand-mark {
  width: 40px;
  height: 40px;
  border-radius: 12px;
  background: linear-gradient(145deg, var(--primary), #1d4ed8);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 1.15rem;
  color: var(--on-primary);
  box-shadow: var(--shadow-sm);
  flex-shrink: 0;
}

.brand-title {
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--text);
  letter-spacing: -0.02em;
}

.brand-sub {
  font-size: 0.75rem;
  color: var(--muted);
  margin-top: 2px;
}

.field {
  display: block;
  margin-bottom: 1.15rem;
}

.field > span {
  display: block;
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--muted);
  margin-bottom: 0.4rem;
}

.field input {
  width: 100%;
  min-height: 44px;
  padding: 0.65rem 0.8rem;
  font-size: 1rem;
  background: var(--input-bg);
  border: 1px solid var(--border-strong);
  border-radius: 10px;
  color: var(--text);
  outline: none;
  transition: border-color 0.18s var(--ease), box-shadow 0.18s var(--ease);
}

.field input:focus {
  border-color: rgba(59, 130, 246, 0.55);
  box-shadow: 0 0 0 3px var(--primary-soft);
}

.password-wrap {
  position: relative;
  display: flex;
  align-items: center;
}

.password-wrap input {
  padding-right: 3rem;
}

.btn-toggle-pw {
  position: absolute;
  right: 0.35rem;
  appearance: none;
  border: 0;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  min-width: 40px;
  min-height: 40px;
  border-radius: 8px;
  display: grid;
  place-items: center;
  font-size: 0.75rem;
  font-weight: 600;
}

.btn-toggle-pw:hover {
  color: var(--text);
  background: rgba(255, 255, 255, 0.05);
}

.error {
  font-size: 0.85rem;
  color: var(--danger);
  margin-bottom: 1rem;
  padding: 0.6rem 0.75rem;
  background: var(--danger-soft);
  border-radius: 8px;
  border: 1px solid rgba(248, 113, 113, 0.25);
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  min-height: 44px;
  padding: 0.65rem 1.25rem;
  font-size: 0.9rem;
  font-weight: 550;
  border-radius: 10px;
  border: 1px solid transparent;
  cursor: pointer;
  transition: background 0.15s var(--ease), opacity 0.15s;
}

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

.btn-primary {
  background: var(--primary);
  color: var(--on-primary);
  border-color: var(--primary);
}

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

.btn-block {
  width: 100%;
  margin-top: 0.35rem;
  font-size: 0.95rem;
}

.btn.is-loading::after {
  content: "";
  width: 0.9rem;
  height: 0.9rem;
  border: 2px solid currentColor;
  border-right-color: transparent;
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}

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

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
  }
}
