:root {
  --login-accent: #335577;
  --login-accent-hover: #3d668f;
  --login-accent-soft: rgba(51, 85, 119, 0.14);
  --login-ink: #0f172a;
  --login-muted: #64748b;
  --login-border: #e2e8f0;
  --login-surface: #ffffff;
  --login-ease: cubic-bezier(0.22, 1, 0.36, 1);
}

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

html {
  width: 100%;
  height: 100%;
}

body.login-page {
  margin: 0;
  min-height: 100%;
  min-height: 100dvh;
  font-family: "Outfit", "Segoe UI", sans-serif;
  color: var(--login-ink);
  background: #e8eef4;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}

/* ---------- Bright QR background ---------- */
.login-bg {
  position: fixed;
  inset: 0;
  z-index: 0;
  overflow: hidden;
  background:
    linear-gradient(160deg, rgba(232, 238, 244, 0.28) 0%, rgba(51, 85, 119, 0.18) 55%, rgba(51, 85, 119, 0.28) 100%),
    url("../img/login-bg.jpg") center center / cover no-repeat fixed;
}

.login-bg::after {
  content: none;
}

.login-grid {
  display: none;
}

.login-orb {
  position: absolute;
  z-index: 1;
  border-radius: 50%;
  filter: blur(56px);
  opacity: 0.22;
  animation: loginFloat 14s var(--login-ease) infinite alternate;
  pointer-events: none;
}

.login-orb--a {
  width: min(42vw, 420px);
  height: min(42vw, 420px);
  top: -8%;
  right: -6%;
  background: rgba(51, 85, 119, 0.35);
}

.login-orb--b {
  width: min(48vw, 480px);
  height: min(48vw, 480px);
  bottom: -16%;
  left: -10%;
  background: rgba(148, 163, 184, 0.35);
  animation-delay: -4s;
  animation-duration: 18s;
}

@keyframes loginFloat {
  from { transform: translate3d(0, 0, 0) scale(1); }
  to { transform: translate3d(18px, -22px, 0) scale(1.06); }
}

/* ---------- Center shell ---------- */
.login-shell {
  position: relative;
  z-index: 1;
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 28px 16px;
}

.login-card {
  position: relative;
  width: 100%;
  max-width: 420px;
  background: var(--login-surface);
  border-radius: 20px;
  padding: 36px 32px 32px;
  box-shadow:
    0 1px 0 rgba(255, 255, 255, 0.65) inset,
    0 24px 60px rgba(2, 8, 23, 0.35);
  overflow: hidden;
  animation: loginCardIn 0.55s var(--login-ease) both;
}

.login-card__accent {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 4px;
  background: linear-gradient(90deg, #274560, var(--login-accent), #4a7aa8);
}

@keyframes loginCardIn {
  from {
    opacity: 0;
    transform: translate3d(0, 18px, 0);
  }
  to {
    opacity: 1;
    transform: translate3d(0, 0, 0);
  }
}

.login-header {
  text-align: center;
  margin-bottom: 28px;
}

.login-kicker {
  margin: 0 0 10px;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--login-accent);
}

.login-title {
  margin: 0 0 8px;
  font-size: clamp(1.65rem, 4vw, 1.9rem);
  font-weight: 700;
  letter-spacing: -0.03em;
  color: var(--login-ink);
  line-height: 1.15;
}

.login-subtitle {
  margin: 0;
  font-size: 0.95rem;
  color: var(--login-muted);
  line-height: 1.45;
}

.login-msg {
  margin-bottom: 12px;
}

.login-msg:empty {
  display: none;
}

.login-form .field {
  margin-bottom: 16px;
}

.login-form label {
  display: block;
  margin-bottom: 7px;
  font-size: 0.8rem;
  font-weight: 600;
  color: #475569;
  letter-spacing: 0.02em;
}

.login-form .form-control {
  display: block;
  width: 100%;
  height: 48px;
  border-radius: 12px;
  border: 1px solid var(--login-border);
  background: #f8fafc;
  color: var(--login-ink);
  font-family: inherit;
  font-size: 0.95rem;
  padding: 0 14px;
  outline: none;
  box-shadow: none;
  transition: border-color 0.18s ease, box-shadow 0.18s ease, background 0.18s ease;
}

.login-form .form-control::placeholder {
  color: #94a3b8;
}

.login-form .form-control:hover {
  border-color: #cbd5e1;
}

.login-form .form-control:focus {
  background: #fff;
  border-color: var(--login-accent);
  box-shadow: 0 0 0 4px var(--login-accent-soft);
}

.btn-login {
  width: 100%;
  margin-top: 8px;
  height: 50px;
  border: none;
  border-radius: 12px;
  background: var(--login-accent);
  color: #fff;
  font-family: inherit;
  font-size: 0.95rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  cursor: pointer;
  box-shadow: 0 10px 24px rgba(51, 85, 119, 0.28);
  transition: background 0.18s ease, transform 0.18s ease, box-shadow 0.18s ease;
}

.btn-login:hover,
.btn-login:focus {
  background: var(--login-accent-hover);
  color: #fff;
  transform: translateY(-1px);
  box-shadow: 0 14px 28px rgba(51, 85, 119, 0.34);
}

.btn-login:active {
  transform: translateY(0);
}

span.error {
  display: block;
  margin-top: 6px;
  font-size: 12px;
  color: #dc2626;
}

.form-control.error {
  border-color: #dc2626 !important;
}

.notify,
.alert {
  border-radius: 10px;
  font-size: 0.88rem;
}

/* Button loading spinner (used by base.js) */
.btn .loading { display: none; }
.btn.loading .loading {
  border: 2px solid rgba(255, 255, 255, 0.35);
  width: 18px;
  height: 18px;
  display: block;
  border-radius: 50%;
  margin: 0;
  border-top-color: #fff;
  animation: cw-spin 1.2s linear infinite;
  position: absolute;
  left: 18px;
  top: 50%;
  margin-top: -9px;
}
.btn.loading {
  position: relative;
  padding-left: 48px;
}

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

/* ---------- Mobile ---------- */
@media (max-width: 480px) {
  .login-bg {
    background-attachment: scroll;
  }

  .login-shell {
    padding: 20px 14px;
    align-items: flex-start;
    padding-top: max(28px, env(safe-area-inset-top));
  }

  .login-card {
    padding: 28px 20px 24px;
    border-radius: 16px;
    max-width: 100%;
  }

  .login-header {
    margin-bottom: 22px;
  }

  .login-form .form-control,
  .btn-login {
    height: 48px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .login-orb,
  .login-card,
  .btn-login {
    animation: none !important;
    transition: none !important;
  }
}
