/* Login page (login.html): linked right after components.css. */

/* Colour tokens only this stylesheet uses; the shared ones are in components.css (docs/DESIGN_GUIDE.md). */
:root {
  /* Page backdrops (dashboard, login, help and blog): a warm glow, a teal glow and three
     gradient stops each. */
  --color-login-glow-warm: rgba(240, 162, 58, 0.2);
  --color-login-glow-teal: rgba(23, 138, 122, 0.18);
  --color-login-backdrop-start: #f1f5f9;
  --color-login-backdrop-mid: #e2e8f0;
  --color-login-backdrop-end: #dbeafe;
}
html[data-theme="dark"] {
  /* Page backdrops. */
  --color-login-glow-warm: rgba(240, 162, 58, 0.08);
  --color-login-glow-teal: rgba(44, 185, 164, 0.1);
  --color-login-backdrop-start: #101722;
  --color-login-backdrop-mid: #0d131d;
  --color-login-backdrop-end: #0b1017;
}

body {
  margin: 0;
  padding: 0;
  font-family: var(--font-ui);
  background: radial-gradient(circle at top left, var(--color-login-glow-warm), transparent 40%),
    radial-gradient(circle at 80% 10%, var(--color-login-glow-teal), transparent 45%),
    linear-gradient(160deg, var(--color-login-backdrop-start) 0%, var(--color-login-backdrop-mid) 45%, var(--color-login-backdrop-end) 100%);
  height: 100vh;
  display: flex;
  justify-content: center;
  align-items: center;
  overflow: hidden;
  color: var(--color-ink);
}

.bg-orb {
  position: absolute;
  width: 340px;
  height: 340px;
  border-radius: 50%;
  opacity: 0.45;
  z-index: 0;
}
.orb-1 {
  background: radial-gradient(circle at 30% 30%, rgba(240, 162, 58, 0.8), rgba(240, 162, 58, 0.05));
  top: -80px;
  left: -40px;
}
.orb-2 {
  background: radial-gradient(circle at 70% 30%, rgba(45, 108, 223, 0.75), rgba(45, 108, 223, 0.05));
  bottom: -120px;
  right: -60px;
}

.login-container {
  background: var(--color-glass-strong);
  box-shadow: 0 20px 45px rgba(2, 6, 23, 0.35);
  border-radius: var(--radius-lg);
  padding: 36px 40px;
  width: 100%;
  max-width: 260px; /* just over the 240 px logo */
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  opacity: 0;
  transform: translateY(30px);
  animation: fadeInUp 0.6s ease forwards;
  position: relative;
  z-index: 1;
}

@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(30px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes fadeOutDown {
  from {
    opacity: 1;
    transform: translateY(0);
  }
  to {
    opacity: 0;
    transform: translateY(30px);
  }
}

.logo {
  width: 240px;
  height: auto;
  margin-bottom: 18px;
}

h2 {
  color: var(--color-ink);
  margin-bottom: 8px;
  font-weight: 700;
  font-family: var(--font-display);
  letter-spacing: 0.02em;
}

.login-subtitle {
  color: var(--color-ink-muted);
  font-size: 0.9em;
  margin-bottom: 24px;
}

/* The form takes the Extra wide field width; fields and the Login button fill it. Without a
   width of its own the centred form shrinks to its widest text line. */
#loginForm {
  width: var(--input-w-xwide);
}

/* A wrapped line splits evenly instead of leaving one word on the second line. */
.login-subtitle,
.links-note {
  text-wrap: balance;
}

.input-group {
  width: 100%;
  margin-bottom: 18px;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
}

.input-group label {
  font-weight: 500;
  color: var(--color-ink-muted);
  margin-bottom: 6px;
  font-size: var(--font-control);
}

/* The field and the button are the components' (field baseline, .btn-primary
   .btn-block); these rules only place and size them. */
.input-group input {
  width: 100%;
}

.login-button {
  margin-top: 10px;
}

.links {
  display: flex;
  justify-content: space-between;
  width: 100%;
  font-size: 0.85em;
  margin-top: 10px;
}

.links-note {
  color: var(--color-ink-soft);
  font-size: 0.85em;
}

.login-error {
  text-align: center;
  margin-top: 10px;
}

.footer {
  margin-top: 25px;
  font-size: 0.85em;
  color: var(--color-ink-soft);
}

.footer a {
  color: var(--color-accent);
  text-decoration: none;
}

.footer a:hover {
  text-decoration: underline;
}

/* ── Dark theme (set from the Account panel on any page). Text, fields, the button and
   the backdrop recolour through their tokens; the card shadow, logo and orbs need rules. ── */
html[data-theme="dark"] .login-container {
  box-shadow: 0 20px 45px rgba(0, 0, 0, 0.6);
}
html[data-theme="dark"] .logo { content: url("/static/logo_dark.png"); }
html[data-theme="dark"] .bg-orb { opacity: 0.18; }

@media (max-width: 540px) {
  .login-container {
    padding: 32px 28px;
    margin: 0 16px;
  }
  .logo {
    width: 220px;
  }
}
