/* KEPA Logistics — Sign-in screen, styled after the KEPA marketing card:
   deep-green backdrop with soft glows, drifting particles and a drawn
   emerald wave line, a white card with emerald accents, and gentle
   entrance motion.

   ISOLATION: this file is loaded ONLY by views/login.ejs. Every rule is
   scoped to .login-body or to the decorative .kl-* layer, and every
   animation is prefixed kl-, so nothing here can reach another screen.
   All motion is decorative (opacity / transform) and is switched off by
   prefers-reduced-motion. */

:root { --ui-scale: 0.84; } /* keep in step with style.css — see UI SCALE there */

.login-body {
  --kl-deep: #062E1E;
  --kl-forest: #0A3D28;
  --kl-primary: #0D5C3B;
  --kl-mid: #1A8A54;
  --kl-accent: #2ECC71;
  --kl-ink: #0B2419;
  --kl-text: #10231A;
  --kl-muted: #4F6559;
  --kl-line: #DCE6E0;
  --kl-ease: cubic-bezier(0.22, 1, 0.36, 1);

  zoom: var(--ui-scale);
  margin: 0;
  min-height: calc(100vh / var(--ui-scale));
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background:
    radial-gradient(900px 560px at 86% -6%, rgba(46, 204, 113, 0.22), transparent 62%),
    radial-gradient(760px 520px at -4% 104%, rgba(26, 138, 84, 0.28), transparent 62%),
    linear-gradient(160deg, var(--kl-primary) 0%, var(--kl-forest) 46%, var(--kl-deep) 100%);
  background-color: var(--kl-deep);
  color: #E9F5EE;
  overflow-x: hidden;
}

/* ---- decorative backdrop (aria-hidden, never clickable, behind content) ---- */
.kl-scene {
  position: fixed;
  inset: 0;
  z-index: -1;
  overflow: hidden;
  pointer-events: none;
}
.kl-glow { position: absolute; border-radius: 50%; will-change: transform; }
.kl-glow-a {
  width: 620px; height: 620px; right: -200px; top: -240px;
  background: radial-gradient(circle, rgba(46, 204, 113, 0.26) 0%, transparent 66%);
  animation: kl-float 16s ease-in-out infinite alternate;
}
.kl-glow-b {
  width: 560px; height: 560px; left: -220px; bottom: -240px;
  background: radial-gradient(circle, rgba(26, 138, 84, 0.34) 0%, transparent 66%);
  animation: kl-float 20s ease-in-out infinite alternate-reverse;
}
.kl-leaf {
  position: absolute;
  left: var(--x); top: var(--y);
  width: calc(14px * var(--s, 1));
  height: calc(4.5px * var(--s, 1));
  border-radius: 3px;
  background: linear-gradient(90deg, var(--kl-accent), var(--kl-mid));
  opacity: 0;
  animation: kl-drift var(--t, 20s) linear var(--d, 0s) infinite;
}
.kl-wave {
  position: absolute;
  left: 0; bottom: 0;
  width: 100%; height: 130px;
  display: block;
}
.kl-wave-fill { fill: rgba(6, 46, 30, 0.55); }
.kl-wave-line {
  fill: none;
  stroke: var(--kl-accent);
  stroke-width: 2;
  opacity: 0.75;
  vector-effect: non-scaling-stroke;
  stroke-dasharray: 1;
  stroke-dashoffset: 1;
  animation: kl-draw 2.4s var(--kl-ease) 0.4s forwards;
}

/* ---- layout ---- */
.login-shell {
  width: 100%;
  max-width: 400px;
  display: flex;
  flex-direction: column;
  align-items: center;
}

/* Brand lockup above the card — the existing logo, with a soft glow and a pulse ring */
.login-brand {
  position: relative;
  display: flex;
  justify-content: center;
  margin-bottom: 26px;
  animation: kl-rise 0.7s var(--kl-ease) both;
}
.login-brand::before {
  content: "";
  position: absolute;
  left: 50%; top: 50%;
  width: 150px; height: 150px;
  margin: -75px 0 0 -75px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(46, 204, 113, 0.28) 0%, transparent 68%);
  animation: kl-breathe 5s ease-in-out infinite;
  pointer-events: none;
  z-index: -1;
}
.login-brand::after {
  content: "";
  position: absolute;
  left: 50%; top: 50%;
  width: 116px; height: 116px;
  margin: -58px 0 0 -58px;
  border-radius: 50%;
  border: 1.5px solid rgba(46, 204, 113, 0.55);
  opacity: 0;
  animation: kl-ring 3.4s ease-out 1s infinite;
  pointer-events: none;
}
/* kept for compatibility with older markup */
.login-brand-badge {
  width: 34px; height: 34px; border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  background: linear-gradient(135deg, var(--kl-primary), var(--kl-accent));
}
.login-brand-badge svg { width: 19px; height: 19px; color: #fff; }
.login-brand-text { display: flex; flex-direction: column; gap: 2px; }
.login-brand-name { font-size: 15px; font-weight: 800; letter-spacing: 0.04em; color: #fff; }
.login-brand-sub { font-size: 10px; font-weight: 600; letter-spacing: 0.22em; color: var(--kl-accent); }

/* ---- the sign-in card ---- */
.login-card {
  position: relative;
  overflow: hidden;
  width: 100%;
  box-sizing: border-box;
  padding: 32px 30px 28px;
  border-radius: 20px;
  background: #FFFFFF;
  color: var(--kl-text);
  box-shadow:
    0 30px 70px -22px rgba(0, 0, 0, 0.6),
    0 0 0 1px rgba(46, 204, 113, 0.20),
    0 0 70px -14px rgba(46, 204, 113, 0.32);
  animation: kl-present 0.75s var(--kl-ease) 0.12s both;
}
.login-card::before {
  content: "";
  position: absolute;
  left: 0; right: 0; top: 0;
  height: 3px;
  background: linear-gradient(90deg, var(--kl-primary), var(--kl-accent), var(--kl-primary));
  background-size: 200% 100%;
  animation: kl-sheen 7s linear infinite;
}
.login-card h1 {
  margin: 0 0 5px;
  font-size: 23px;
  font-weight: 800;
  letter-spacing: -0.015em;
  color: var(--kl-ink);
}
.login-sub {
  margin: 0 0 22px;
  font-size: 13.5px;
  line-height: 1.5;
  color: var(--kl-muted);
}

.login-field { margin-bottom: 15px; }
.login-field label {
  display: block;
  margin-bottom: 7px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--kl-primary);
}
.login-field input {
  width: 100%;
  box-sizing: border-box;
  padding: 12px 14px;
  border: 1.5px solid var(--kl-line);
  border-radius: 12px;
  background: #F6FAF7;
  font: inherit;
  font-size: 14.5px;
  color: var(--kl-text);
  transition: border-color 0.2s ease, box-shadow 0.25s ease, background-color 0.2s ease;
}
.login-field input::placeholder { color: #7A8D82; }
.login-field input:hover { border-color: #B6D2C1; }
.login-field input:focus {
  outline: none;
  border-color: var(--kl-accent);
  background: #FFFFFF;
  box-shadow: 0 0 0 4px rgba(46, 204, 113, 0.18);
}

.login-submit {
  position: relative;
  overflow: hidden;
  width: 100%;
  margin-top: 8px;
  padding: 13px 18px;
  border: none;
  border-radius: 999px;
  background: linear-gradient(135deg, #34D67A 0%, var(--kl-accent) 45%, #25B565 100%);
  color: var(--kl-deep);
  font: inherit;
  font-size: 15px;
  font-weight: 800;
  letter-spacing: 0.01em;
  cursor: pointer;
  box-shadow: 0 12px 26px -10px rgba(46, 204, 113, 0.75);
  transition: transform 0.18s var(--kl-ease), box-shadow 0.25s ease, filter 0.2s ease;
}
.login-submit::after {
  content: "";
  position: absolute;
  top: 0; bottom: 0; left: -60%;
  width: 45%;
  background: linear-gradient(100deg, transparent, rgba(255, 255, 255, 0.55), transparent);
  transform: skewX(-18deg);
  opacity: 0;
  pointer-events: none;
}
.login-submit:hover {
  transform: translateY(-1px);
  filter: brightness(1.04);
  box-shadow: 0 16px 32px -10px rgba(46, 204, 113, 0.85);
}
.login-submit:hover::after { animation: kl-shine 0.8s ease; }
.login-submit:active { transform: translateY(1px); box-shadow: 0 6px 14px -6px rgba(46, 204, 113, 0.7); }
.login-submit:focus-visible { outline: none; box-shadow: 0 0 0 3px #FFFFFF, 0 0 0 6px rgba(46, 204, 113, 0.7); }

.login-error {
  display: flex;
  gap: 8px;
  align-items: flex-start;
  margin-bottom: 16px;
  padding: 11px 13px;
  border-radius: 12px;
  background: #FDEEEE;
  border: 1px solid #F3C4C4;
  color: #A32626;
  font-size: 13px;
  line-height: 1.45;
  animation: kl-nudge 0.45s ease;
}

.login-tagline {
  margin-top: 28px;
  text-align: center;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.32em;
  text-transform: uppercase;
  color: #5FE09A; /* lighter tint of the KEPA emerald: keeps small text above 4.5:1 wherever the glows drift */
  animation: kl-fade 0.8s ease 0.45s both;
}
.login-foot {
  margin-top: 12px;
  text-align: center;
  font-size: 11.5px;
  color: rgba(233, 245, 238, 0.74);
  letter-spacing: 0.02em;
  animation: kl-fade 0.8s ease 0.55s both;
}

@media (max-width: 420px) {
  .login-card { padding: 26px 20px 24px; border-radius: 16px; }
  .login-card h1 { font-size: 20px; }
  .login-tagline { letter-spacing: 0.24em; }
  .kl-wave { height: 90px; }
}

/* Full logo lockup on the sign-in screen (unchanged sizing). The PNG has a
   transparent background so it sits on the dark backdrop without a white box. */
.login-logo {
  display: block;
  width: 44px !important;
  max-width: 44px !important;
  height: 44px !important;
  max-height: 44px !important;
  object-fit: contain;
  flex-shrink: 0;
}
.login-logo-full {
  display: block;
  width: 92px !important;
  max-width: 92px !important;
  height: auto !important;
  max-height: 92px !important;
  object-fit: contain;
  margin: 0 auto;
}

/* ---- motion ---- */
@keyframes kl-rise    { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: none; } }
@keyframes kl-present { from { opacity: 0; transform: translateY(18px) scale(0.985); } to { opacity: 1; transform: none; } }
@keyframes kl-fade    { from { opacity: 0; } to { opacity: 1; } }
@keyframes kl-float   { from { transform: translate3d(0, 0, 0) scale(1); } to { transform: translate3d(-46px, 34px, 0) scale(1.08); } }
@keyframes kl-drift {
  0%   { opacity: 0;    transform: translate3d(0, 0, 0) skewX(-30deg); }
  12%  { opacity: 0.6; }
  85%  { opacity: 0.45; }
  100% { opacity: 0;    transform: translate3d(130px, -170px, 0) skewX(-30deg); }
}
@keyframes kl-draw    { to { stroke-dashoffset: 0; } }
@keyframes kl-breathe { 0%, 100% { opacity: 0.75; transform: scale(1); } 50% { opacity: 1; transform: scale(1.06); } }
@keyframes kl-ring    { 0% { opacity: 0.7; transform: scale(0.92); } 100% { opacity: 0; transform: scale(1.35); } }
@keyframes kl-sheen   { to { background-position: -200% 0; } }
@keyframes kl-shine   { from { left: -60%; opacity: 1; } to { left: 130%; opacity: 1; } }
@keyframes kl-nudge   { 0%, 100% { transform: none; } 25% { transform: translateX(-4px); } 60% { transform: translateX(3px); } }

@media (prefers-reduced-motion: reduce) {
  .login-body *, .login-body *::before, .login-body *::after { animation: none !important; transition: none !important; }
  .kl-leaf, .login-brand::after { display: none; }
  .kl-wave-line { stroke-dashoffset: 0; }
}
