/* ============================================================
   AURELIA — Login
   Palette: deep indigo/navy night sky + warm champagne-gold accent
   Type: Poppins (display) / Inter (body & UI)
   ============================================================ */

:root {
  /* Core palette */
  --navy-950: #0a0e1c;
  --navy-900: #0f1428;
  --indigo-900: #171b3a;
  --indigo-800: #232752;
  --violet-700: #3d3a7a;

  --gold-400: #e8c977;
  --gold-500: #d4af6a;
  --gold-600: #b8935a;

  --ink-0: #ffffff;
  --ink-100: #eef0f8;
  --ink-300: #b7bcd6;
  --ink-500: #838aad;

  --danger: #ff6b6b;
  --danger-bg: rgba(255, 107, 107, 0.12);

  /* Glass */
  --glass-bg: rgba(255, 255, 255, 0.06);
  --glass-bg-strong: rgba(255, 255, 255, 0.09);
  --glass-border: rgba(255, 255, 255, 0.14);
  --glass-highlight: rgba(255, 255, 255, 0.35);

  /* Motion */
  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
  --ease-spring: cubic-bezier(0.34, 1.56, 0.64, 1);
}

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

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  min-height: 100vh;
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  color: var(--ink-100);
  background: var(--navy-950);
  overflow-x: hidden;
}

/* ---------------- Background scene ---------------- */

.bg-scene {
  position: fixed;
  inset: 0;
  z-index: 0;
  overflow: hidden;
}

.bg-gradient {
  position: absolute;
  inset: -10%;
  background:
    radial-gradient(circle at 15% 20%, rgba(61, 58, 122, 0.55), transparent 45%),
    radial-gradient(circle at 85% 15%, rgba(212, 175, 106, 0.16), transparent 40%),
    radial-gradient(circle at 50% 90%, rgba(35, 39, 82, 0.7), transparent 55%),
    linear-gradient(160deg, var(--navy-950) 0%, var(--navy-900) 40%, var(--indigo-900) 75%, var(--navy-950) 100%);
  background-size: 140% 140%;
  animation: driftGradient 22s ease-in-out infinite alternate;
}

@keyframes driftGradient {
  0%   { background-position: 0% 0%; }
  100% { background-position: 20% 15%; }
}

.orb {
  position: absolute;
  border-radius: 50%;
  filter: blur(60px);
  opacity: 0.55;
  will-change: transform;
}

.orb-1 {
  width: 480px; height: 480px;
  top: -140px; left: -120px;
  background: radial-gradient(circle, var(--violet-700), transparent 70%);
  animation: floatA 18s var(--ease-out) infinite alternate;
}

.orb-2 {
  width: 420px; height: 420px;
  bottom: -160px; right: -100px;
  background: radial-gradient(circle, var(--gold-500), transparent 72%);
  opacity: 0.22;
  animation: floatB 24s var(--ease-out) infinite alternate;
}

.orb-3 {
  width: 320px; height: 320px;
  top: 45%; right: 12%;
  background: radial-gradient(circle, var(--indigo-800), transparent 70%);
  opacity: 0.5;
  animation: floatC 20s var(--ease-out) infinite alternate;
}

@keyframes floatA {
  0%   { transform: translate(0, 0) scale(1); }
  100% { transform: translate(60px, 80px) scale(1.12); }
}
@keyframes floatB {
  0%   { transform: translate(0, 0) scale(1); }
  100% { transform: translate(-50px, -60px) scale(1.08); }
}
@keyframes floatC {
  0%   { transform: translate(0, 0) scale(1); }
  100% { transform: translate(-40px, 50px) scale(0.94); }
}

/* Floating particles */
.particles {
  position: absolute;
  inset: 0;
}

.particle {
  position: absolute;
  border-radius: 50%;
  background: var(--gold-400);
  opacity: 0.5;
  animation: particleFloat linear infinite;
}

@keyframes particleFloat {
  0%   { transform: translateY(0) translateX(0); opacity: 0; }
  10%  { opacity: 0.6; }
  90%  { opacity: 0.4; }
  100% { transform: translateY(-110vh) translateX(20px); opacity: 0; }
}

.grain {
  position: absolute;
  inset: 0;
  background-image: radial-gradient(rgba(255,255,255,0.035) 1px, transparent 1px);
  background-size: 3px 3px;
  mix-blend-mode: overlay;
  opacity: 0.5;
}

/* ---------------- Layout ---------------- */

.stage {
  position: relative;
  z-index: 1;
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 32px 20px;
}

/* ---------------- Glass card ---------------- */

.login-card {
  position: relative;
  width: 100%;
  max-width: 400px;
  padding: 44px 36px 32px;
  border-radius: 24px;
  background: var(--glass-bg);
  border: 1px solid var(--glass-border);
  backdrop-filter: blur(22px) saturate(140%);
  -webkit-backdrop-filter: blur(22px) saturate(140%);
  box-shadow:
    0 30px 60px -20px rgba(0, 0, 0, 0.55),
    0 0 0 1px rgba(255, 255, 255, 0.04) inset,
    0 1px 0 rgba(255, 255, 255, 0.12) inset;
  animation: cardEnter 0.75s var(--ease-out) both;
}

.login-card::before {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: 24px;
  background: linear-gradient(135deg, var(--glass-highlight), transparent 30%);
  opacity: 0.08;
  pointer-events: none;
}

@keyframes cardEnter {
  0%   { opacity: 0; transform: translateY(28px) scale(0.97); }
  100% { opacity: 1; transform: translateY(0) scale(1); }
}

/* Logo */

.logo-wrap {
  display: flex;
  justify-content: center;
  margin-bottom: 18px;
  animation: fadeUp 0.7s var(--ease-out) 0.1s both;
}

.logo-mark {
  width: 56px;
  height: 56px;
  border-radius: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--gold-400);
  background: linear-gradient(145deg, rgba(212,175,106,0.18), rgba(212,175,106,0.02));
  border: 1px solid rgba(212, 175, 106, 0.35);
  box-shadow: 0 0 0 1px rgba(255,255,255,0.03) inset, 0 8px 24px -8px rgba(212, 175, 106, 0.35);
}

/* Headings */

.title {
  font-family: 'Poppins', sans-serif;
  font-weight: 600;
  font-size: 26px;
  letter-spacing: -0.01em;
  text-align: center;
  margin: 0 0 6px;
  color: var(--ink-0);
  animation: fadeUp 0.7s var(--ease-out) 0.15s both;
}

.subtitle {
  text-align: center;
  font-size: 13.5px;
  color: var(--ink-500);
  margin: 0 0 28px;
  animation: fadeUp 0.7s var(--ease-out) 0.2s both;
}

@keyframes fadeUp {
  0%   { opacity: 0; transform: translateY(10px); }
  100% { opacity: 1; transform: translateY(0); }
}

/* Fields */

.field {
  margin-bottom: 18px;
  animation: fadeUp 0.7s var(--ease-out) 0.25s both;
}

.field-label {
  display: block;
  font-size: 12.5px;
  font-weight: 500;
  color: var(--ink-300);
  margin-bottom: 7px;
  letter-spacing: 0.01em;
}

.input-shell {
  position: relative;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 14px;
  height: 48px;
  border-radius: 13px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.1);
  transition: border-color 0.25s var(--ease-out), background 0.25s var(--ease-out), box-shadow 0.25s var(--ease-out);
}

.input-shell:hover {
  border-color: rgba(255, 255, 255, 0.18);
}

.input-shell:focus-within {
  border-color: rgba(212, 175, 106, 0.55);
  background: rgba(255, 255, 255, 0.06);
  box-shadow: 0 0 0 4px rgba(212, 175, 106, 0.1), 0 0 22px -4px rgba(212, 175, 106, 0.35);
}

.input-shell.shell-error {
  border-color: rgba(255, 107, 107, 0.55);
  animation: shake 0.4s ease;
}

@keyframes shake {
  0%, 100% { transform: translateX(0); }
  20% { transform: translateX(-6px); }
  40% { transform: translateX(5px); }
  60% { transform: translateX(-4px); }
  80% { transform: translateX(3px); }
}

.field-icon {
  flex: none;
  color: var(--ink-500);
  transition: color 0.25s var(--ease-out);
}

.input-shell:focus-within .field-icon {
  color: var(--gold-400);
}

.input-shell input {
  flex: 1;
  height: 100%;
  border: none;
  outline: none;
  background: transparent;
  color: var(--ink-0);
  font-family: 'Inter', sans-serif;
  font-size: 14.5px;
  min-width: 0;
}

.input-shell input::placeholder {
  color: var(--ink-500);
}

.toggle-visibility {
  flex: none;
  display: flex;
  align-items: center;
  justify-content: center;
  background: none;
  border: none;
  cursor: pointer;
  color: var(--ink-500);
  padding: 4px;
  transition: color 0.2s var(--ease-out);
}

.toggle-visibility:hover {
  color: var(--gold-400);
}

/* Remember me / forgot password row */

.row-between {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin: 4px 0 20px;
  animation: fadeUp 0.7s var(--ease-out) 0.3s both;
}

.checkbox-wrap {
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  user-select: none;
}

.checkbox-wrap input {
  display: none;
}

.checkbox-box {
  width: 18px;
  height: 18px;
  border-radius: 6px;
  border: 1px solid rgba(255, 255, 255, 0.25);
  background: rgba(255, 255, 255, 0.03);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--navy-950);
  transition: all 0.2s var(--ease-spring);
}

.checkbox-wrap input:checked + .checkbox-box {
  background: linear-gradient(145deg, var(--gold-400), var(--gold-600));
  border-color: var(--gold-500);
  box-shadow: 0 0 12px -2px rgba(212, 175, 106, 0.6);
}

.checkbox-wrap input:checked + .checkbox-box svg {
  animation: popIn 0.25s var(--ease-spring);
}

@keyframes popIn {
  0%   { transform: scale(0); }
  100% { transform: scale(1); }
}

.checkbox-label {
  font-size: 13px;
  color: var(--ink-300);
}

.forgot-link {
  font-size: 13px;
  color: var(--gold-400);
  text-decoration: none;
  transition: color 0.2s var(--ease-out);
  position: relative;
}

.forgot-link:hover {
  color: var(--gold-500);
}

.forgot-link::after {
  content: "";
  position: absolute;
  left: 0; right: 0; bottom: -3px;
  height: 1px;
  background: currentColor;
  transform: scaleX(0);
  transform-origin: right;
  transition: transform 0.25s var(--ease-out);
}

.forgot-link:hover::after {
  transform: scaleX(1);
  transform-origin: left;
}

/* Error message */

.error-message {
  display: none;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: var(--danger);
  background: var(--danger-bg);
  border: 1px solid rgba(255, 107, 107, 0.25);
  border-radius: 10px;
  padding: 10px 12px;
  margin-bottom: 16px;
}

.error-message.visible {
  display: flex;
  animation: errorIn 0.35s var(--ease-out);
}

@keyframes errorIn {
  0%   { opacity: 0; transform: translateY(-6px); }
  100% { opacity: 1; transform: translateY(0); }
}

/* Sign in button */

.btn-signin {
  width: 100%;
  height: 48px;
  border-radius: 13px;
  border: none;
  cursor: pointer;
  position: relative;
  font-family: 'Poppins', sans-serif;
  font-weight: 600;
  font-size: 14.5px;
  letter-spacing: 0.02em;
  color: var(--navy-950);
  background: linear-gradient(135deg, var(--gold-400), var(--gold-600));
  box-shadow: 0 12px 28px -10px rgba(212, 175, 106, 0.55);
  transition: transform 0.2s var(--ease-spring), box-shadow 0.25s var(--ease-out), filter 0.2s var(--ease-out);
  animation: fadeUp 0.7s var(--ease-out) 0.35s both;
  display: flex;
  align-items: center;
  justify-content: center;
}

.btn-signin:hover {
  filter: brightness(1.08);
  box-shadow: 0 16px 32px -8px rgba(212, 175, 106, 0.65);
  transform: translateY(-1px);
}

.btn-signin:active {
  transform: translateY(1px) scale(0.985);
}

.btn-signin.is-loading .btn-label {
  opacity: 0;
}

.btn-spinner {
  position: absolute;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  border: 2px solid rgba(10, 14, 28, 0.25);
  border-top-color: var(--navy-950);
  opacity: 0;
}

.btn-signin.is-loading .btn-spinner {
  opacity: 1;
  animation: spin 0.7s linear infinite;
}

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

.btn-signin.shake {
  animation: shake 0.4s ease;
}

/* Hint */

.hint {
  text-align: center;
  font-size: 11.5px;
  color: var(--ink-500);
  margin: 20px 0 0;
  animation: fadeUp 0.7s var(--ease-out) 0.4s both;
}

.hint code {
  color: var(--gold-400);
  background: rgba(212, 175, 106, 0.1);
  padding: 1px 6px;
  border-radius: 5px;
  font-family: 'Inter', monospace;
}

/* ---------------- Responsive ---------------- */

@media (max-width: 480px) {
  .login-card {
    padding: 36px 24px 26px;
    border-radius: 20px;
  }
  .title { font-size: 23px; }
  .orb-1, .orb-2, .orb-3 { filter: blur(40px); }
}

@media (min-width: 900px) {
  .login-card { max-width: 420px; }
}

/* Keyboard focus visibility */
a:focus-visible,
button:focus-visible,
input:focus-visible {
  outline: 2px solid var(--gold-400);
  outline-offset: 2px;
}
