:root {
  --accent: 56, 189, 248;
  --accent-bright: 125, 211, 252;
  --danger: 239, 68, 68;
}

* { box-sizing: border-box; }

html, body { height: 100%; }

body {
  margin: 0;
  padding: 22px;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: rgba(255, 255, 255, 0.96);
  font-feature-settings: "ss01", "cv11";
  font-variant-numeric: tabular-nums;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  background:
    linear-gradient(135deg, rgba(3, 7, 18, 0.88), rgba(15, 23, 42, 0.62)),
    url("/static/images/solar_panel.png") center/cover no-repeat fixed;
  position: relative;
  overflow-x: hidden;
}

/* faint grid lines */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  background-image:
    linear-gradient(rgba(255,255,255,0.025) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255,255,255,0.025) 1px, transparent 1px);
  background-size: 48px 48px;
  mask-image: radial-gradient(ellipse at center, black 30%, transparent 75%);
}

/* noise overlay */
body::after {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 9999;
  opacity: 0.030;
  mix-blend-mode: overlay;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='240' height='240'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2' stitchTiles='stitch'/></filter><rect width='100%25' height='100%25' filter='url(%23n)'/></svg>");
}

/* ================== card ================== */
.login-card {
  position: relative;
  width: 100%;
  max-width: 440px;
  margin: 0 auto;
  padding: 48px 38px 36px;
  border-radius: 26px;
  overflow: hidden;
  z-index: 1;
  background:
    radial-gradient(circle at 1px 1px, rgba(255,255,255,0.05) 1px, transparent 0) 0 0 / 20px 20px,
    linear-gradient(135deg, rgba(11, 28, 48, 0.96), rgba(20, 52, 80, 0.82)),
    radial-gradient(ellipse 90% 70% at top right,   rgba(var(--accent), 0.35), transparent 60%),
    radial-gradient(ellipse 70% 80% at bottom left, rgba(var(--accent), 0.18), transparent 55%);
  border: 1px solid rgba(255, 255, 255, 0.10);
  backdrop-filter: blur(18px) saturate(1.2);
  -webkit-backdrop-filter: blur(18px) saturate(1.2);
  box-shadow:
    0 1px 2px rgba(0, 0, 0, 0.45),
    0 16px 40px rgba(2, 8, 23, 0.45),
    0 48px 100px rgba(2, 8, 23, 0.32),
    inset 0 1px 0 rgba(255, 255, 255, 0.16),
    inset 0 -1px 0 rgba(0, 0, 0, 0.22),
    inset 0 0 0 1px rgba(255, 255, 255, 0.04);
  animation: card-enter 0.6s cubic-bezier(0.16, 1, 0.3, 1) backwards;
  animation-delay: 80ms;
}
@keyframes card-enter {
  from { opacity: 0; transform: translateY(16px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* aurora drift inside card */
.login-card::before {
  content: "";
  position: absolute;
  inset: -30%;
  z-index: 0;
  pointer-events: none;
  background: radial-gradient(ellipse at center,
    rgba(var(--accent), 0.10) 0%,
    rgba(var(--accent), 0.04) 30%,
    transparent 60%);
  animation: aurora-drift 22s ease-in-out infinite;
  will-change: transform;
}
@keyframes aurora-drift {
  0%   { transform: translate(0%, 0%) scale(1) rotate(0deg); }
  33%  { transform: translate(-9%, 5%) scale(1.18) rotate(120deg); }
  66%  { transform: translate(7%, -4%) scale(0.88) rotate(240deg); }
  100% { transform: translate(0%, 0%) scale(1) rotate(360deg); }
}

/* top accent edge */
.login-card::after {
  content: "";
  position: absolute;
  top: 0;
  left: 14%;
  right: 14%;
  height: 1px;
  z-index: 5;
  pointer-events: none;
  background: linear-gradient(90deg,
    transparent 0%,
    rgba(var(--accent), 0.55) 30%,
    rgba(var(--accent-bright), 0.80) 50%,
    rgba(var(--accent), 0.55) 70%,
    transparent 100%);
}

.login-card > * { position: relative; z-index: 2; }

/* ================== header ================== */
.login-header {
  text-align: center;
  margin: 0 auto 30px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
}



.login-title {
  font-family: "Fraunces", Georgia, "Times New Roman", serif;
  font-size: 40px;
  font-weight: 600;
  letter-spacing: -0.028em;
  margin: 0;
  color: white;
  line-height: 1.05;
}

.login-subtitle {
  font-size: 13px;
  font-weight: 500;
  color: rgba(255, 255, 255, 0.55);
  margin: 0;
}

/* ================== form ================== */
.login-form {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.field { display: flex; flex-direction: column; gap: 8px; }

.field label {
  font-size: 10.5px;
  font-weight: 800;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.55);
  padding-left: 2px;
}

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

.input-icon {
  position: absolute;
  left: 14px;
  width: 16px;
  height: 16px;
  stroke: rgba(255, 255, 255, 0.42);
  fill: none;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
  pointer-events: none;
  transition: stroke 240ms ease;
}

.input-wrap input {
  width: 100%;
  padding: 13px 16px 13px 42px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 12px;
  color: white;
  font-family: "Fraunces", Georgia, "Times New Roman", serif;
  font-size: 16px;
  font-weight: 500;
  letter-spacing: -0.005em;
  font-variant-numeric: tabular-nums;
  transition: all 240ms cubic-bezier(0.16, 1, 0.3, 1);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.03);
}
.input-wrap input::placeholder { color: rgba(255, 255, 255, 0.32); }

.input-wrap:focus-within input {
  background: rgba(255, 255, 255, 0.07);
  border-color: rgba(var(--accent), 0.55);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.05),
    0 0 0 4px rgba(var(--accent), 0.12);
}
.input-wrap:focus-within .input-icon {
  stroke: rgb(var(--accent-bright));
}

.show-pw {
  position: absolute;
  right: 6px;
  background: none;
  border: 0;
  padding: 9px;
  cursor: pointer;
  color: rgba(255, 255, 255, 0.4);
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 200ms ease;
}
.show-pw:hover { background: rgba(255, 255, 255, 0.06); color: rgba(255, 255, 255, 0.85); }
.show-pw svg { width: 16px; height: 16px; stroke: currentColor; fill: none; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }

/* ================== caps lock hint ================== */
.caps-hint {
  display: none;
  align-items: center;
  gap: 6px;
  margin-top: 4px;
  padding-left: 2px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.04em;
  color: rgba(250, 204, 21, 0.85);
}
.caps-hint.on { display: inline-flex; }
.caps-hint svg { width: 12px; height: 12px; stroke: currentColor; fill: none; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }

/* ================== error banner ================== */
.error-banner {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 11px 14px;
  background: rgba(var(--danger), 0.10);
  border: 1px solid rgba(var(--danger), 0.32);
  border-radius: 11px;
  color: #fecaca;
  font-size: 13px;
  font-weight: 500;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.04);
}
.error-banner[hidden] { display: none !important; }
.error-banner svg { width: 16px; height: 16px; stroke: currentColor; fill: none; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; flex-shrink: 0; }
.error-banner.shake { animation: shake 0.45s cubic-bezier(0.36, 0.07, 0.19, 0.97); }
@keyframes shake {
  10%, 90% { transform: translateX(-1px); }
  20%, 80% { transform: translateX(2px); }
  30%, 50%, 70% { transform: translateX(-5px); }
  40%, 60% { transform: translateX(5px); }
}

/* ============ security notice ============ */
.notice-box {
  margin-top: 4px;
  padding: 13px 15px 13px 16px;
  background: linear-gradient(135deg, rgba(56,189,248,0.07), rgba(255,255,255,0.025));
  border: 1px solid rgba(255, 255, 255, 0.09);
  border-left: 3px solid rgba(var(--accent), 0.7);
  border-radius: 12px;
  display: flex;
  gap: 11px;
  align-items: flex-start;
}
.notice-box .notice-ico {
  flex: 0 0 auto;
  width: 16px;
  height: 16px;
  margin-top: 1px;
  stroke: rgba(var(--accent-bright), 0.85);
  fill: none;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.notice-text {
  margin: 0;
  font-size: 11.5px;
  line-height: 1.55;
  color: rgba(226, 232, 240, 0.78);
  letter-spacing: 0.005em;
}
.notice-text strong {
  color: rgba(226, 232, 240, 0.96);
  letter-spacing: 0.04em;
}

/* ================== submit button ================== */
.submit-btn {
  position: relative;
  margin-top: 8px;
  padding: 15px 22px;
  background: linear-gradient(135deg, #38BDF8, #0EA5E9);
  border: 0;
  border-radius: 12px;
  color: white;
  font-family: Inter, sans-serif;
  font-size: 13px;
  font-weight: 800;
  letter-spacing: 0.10em;
  text-transform: uppercase;
  cursor: pointer;
  box-shadow:
    0 8px 22px rgba(var(--accent), 0.32),
    inset 0 1px 0 rgba(255, 255, 255, 0.30);
  transition: all 240ms cubic-bezier(0.16, 1, 0.3, 1);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 48px;
}
.submit-btn:hover:not(:disabled) {
  transform: translateY(-1px);
  box-shadow:
    0 14px 30px rgba(var(--accent), 0.42),
    inset 0 1px 0 rgba(255, 255, 255, 0.36);
}
.submit-btn:active:not(:disabled) { transform: translateY(0); }
.submit-btn:disabled { opacity: 0.65; cursor: not-allowed; }
.submit-btn .arrow {
  width: 16px; height: 16px;
  stroke: currentColor; fill: none; stroke-width: 2.5;
  stroke-linecap: round; stroke-linejoin: round;
  transition: transform 240ms ease;
}
.submit-btn:hover:not(:disabled) .arrow { transform: translateX(3px); }
.submit-btn.loading .arrow { display: none; }
.submit-btn .spinner { display: none; width: 16px; height: 16px; }
.submit-btn.loading .spinner { display: inline-block; animation: spin 0.7s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.submit-btn .spinner circle { stroke: currentColor; fill: none; stroke-width: 2.5; stroke-linecap: round; stroke-dasharray: 50.27; stroke-dashoffset: 30; }

/* ================== footer ================== */
.login-footer {
  margin-top: 26px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
}
.version-tag {
  font-size: 11px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: rgba(226, 232, 240, 0.34);
  font-weight: 600;
}

.lock-pill {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 7px 14px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: 999px;
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.42);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.04);
}
.lock-pill svg {
  width: 12px; height: 12px;
  stroke: rgba(var(--accent), 0.85); fill: none;
  stroke-width: 2; stroke-linecap: round; stroke-linejoin: round;
}

@media (max-width: 480px) {
  .login-card { padding: 32px 24px 26px; }
  .login-title { font-size: 28px; }
}

/* === ambient background orbs (float behind the card) === */
.bg-orbs {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  overflow: hidden;
}
.orb {
  position: absolute;
  border-radius: 50%;
  filter: blur(80px);
  will-change: transform;
}
.orb-1 {
  width: 520px; height: 520px;
  top: -120px; left: -120px;
  background: radial-gradient(circle, rgba(56, 189, 248, 0.40), transparent 60%);
  animation: orb-drift-1 24s ease-in-out infinite;
}
.orb-2 {
  width: 620px; height: 620px;
  bottom: -180px; right: -180px;
  background: radial-gradient(circle, rgba(94, 234, 212, 0.32), transparent 60%);
  animation: orb-drift-2 28s ease-in-out infinite reverse;
}
.orb-3 {
  width: 380px; height: 380px;
  top: 32%; right: 18%;
  background: radial-gradient(circle, rgba(125, 211, 252, 0.24), transparent 60%);
  animation: orb-drift-3 32s ease-in-out infinite;
  opacity: 0.85;
}
@keyframes orb-drift-1 {
  0%, 100% { transform: translate(0, 0)      scale(1); }
  33%      { transform: translate(60px, 90px) scale(1.15); }
  66%      { transform: translate(-40px, 50px) scale(0.95); }
}
@keyframes orb-drift-2 {
  0%, 100% { transform: translate(0, 0)      scale(1); }
  50%      { transform: translate(-70px, -50px) scale(1.12); }
}
@keyframes orb-drift-3 {
  0%, 100% { transform: translate(0, 0); }
  50%      { transform: translate(50px, -70px); }
}

/* === staggered entrance for form pieces === */
@media (prefers-reduced-motion: no-preference) {
  .login-header,
  .field,
  .submit-btn,
  .login-footer {
    animation: piece-enter 0.55s cubic-bezier(0.16, 1, 0.3, 1) backwards;
  }
  .login-header                { animation-delay: 220ms; }
  .login-form .field:nth-of-type(1) { animation-delay: 320ms; }
  .login-form .field:nth-of-type(2) { animation-delay: 400ms; }
  .submit-btn                  { animation-delay: 500ms; }
  .login-footer                { animation-delay: 580ms; }
}
@keyframes piece-enter {
  from { opacity: 0; transform: translateY(10px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* === idle pulse on submit button — gently invites the click === */
@media (prefers-reduced-motion: no-preference) {
  .submit-btn:not(.loading):not(:disabled):not(:hover) {
    animation:
      piece-enter 0.55s cubic-bezier(0.16, 1, 0.3, 1) backwards,
      btn-idle-pulse 3.5s ease-in-out 1.2s infinite;
  }
}
@keyframes btn-idle-pulse {
  0%, 100% {
    box-shadow:
      0 8px 22px rgba(var(--accent), 0.32),
      inset 0 1px 0 rgba(255, 255, 255, 0.30);
  }
  50% {
    box-shadow:
      0 14px 36px rgba(var(--accent), 0.52),
      0 0 50px rgba(var(--accent), 0.18),
      inset 0 1px 0 rgba(255, 255, 255, 0.36);
  }
}
