/* ===========================================================
   Growing Automation — Login page
   Full-bleed background, floating glass card, dark/light toggle
   =========================================================== */

/* ── TOKENS ── */
:root {
  /* dark (default) */
  --l-tint:       rgba(4, 10, 20, 0.80);
  --l-glass:      rgba(8, 16, 26, 0.72);
  --l-border:     rgba(77, 159, 219, 0.18);
  --l-card-top:   rgba(77, 159, 219, 0.70);
  --l-electric:   #4d9fdb;
  --l-link:       #4d9fdb;
  --l-text:       #f0f4f8;
  --l-muted:      #8ba3bc;
  --l-input-bg:   rgba(255, 255, 255, 0.05);
  --l-input-br:   rgba(77, 159, 219, 0.22);
  --l-input-fc:   rgba(77, 159, 219, 0.55);
  --l-input-sh:   rgba(0, 87, 168, 0.18);
  --l-input-fbg:  rgba(77, 159, 219, 0.06);
  --l-eye:        #8ba3bc;
  --l-trust-bd:   rgba(77, 159, 219, 0.10);
  --l-trust-ln:   rgba(77, 159, 219, 0.14);
  --l-trust-tx:   rgba(139, 163, 188, 0.65);
  --l-badge-bg:   rgba(8, 16, 26, 0.60);
  --l-badge-br:   rgba(77, 159, 219, 0.22);
  --l-badge-tx:   rgba(139, 163, 188, 0.80);
  --l-tog-bg:     rgba(255, 255, 255, 0.07);
  --l-tog-br:     rgba(77, 159, 219, 0.22);
  --l-tog-ic:     #8ba3bc;
  --l-footer:     rgba(139, 163, 188, 0.40);
  --l-msg-err-bg: rgba(220, 38, 38, 0.10);
  --l-msg-err-br: rgba(220, 38, 38, 0.35);
  --l-msg-err-tx: #f87171;
  --l-msg-ok-bg:  rgba(0, 87, 168, 0.10);
  --l-msg-ok-br:  rgba(0, 87, 168, 0.30);
  --l-msg-ok-tx:  #60a5fa;
  --l-success:    #22c55e;
  --l-ph:         rgba(139, 163, 188, 0.45);
}

/* light overrides — applied when html has class="light" or does NOT have class="dark" and OS is light */
html.light,
html:not(.dark) {
  --l-tint:       rgba(220, 235, 255, 0.75);
  --l-glass:      rgba(255, 255, 255, 0.82);
  --l-border:     rgba(0, 87, 168, 0.16);
  --l-card-top:   rgba(0, 87, 168, 0.70);
  --l-electric:   #0057a8;
  --l-link:       #0057a8;
  --l-text:       #0d1b2e;
  --l-muted:      #4a6380;
  --l-input-bg:   rgba(0, 55, 120, 0.04);
  --l-input-br:   rgba(0, 87, 168, 0.20);
  --l-input-fc:   rgba(0, 87, 168, 0.55);
  --l-input-sh:   rgba(0, 87, 168, 0.14);
  --l-input-fbg:  rgba(0, 87, 168, 0.04);
  --l-eye:        #4a6380;
  --l-trust-bd:   rgba(0, 87, 168, 0.10);
  --l-trust-ln:   rgba(0, 87, 168, 0.12);
  --l-trust-tx:   rgba(74, 99, 128, 0.80);
  --l-badge-bg:   rgba(255, 255, 255, 0.75);
  --l-badge-br:   rgba(0, 87, 168, 0.18);
  --l-badge-tx:   #4a6380;
  --l-tog-bg:     rgba(0, 55, 120, 0.06);
  --l-tog-br:     rgba(0, 87, 168, 0.20);
  --l-tog-ic:     #0057a8;
  --l-footer:     rgba(74, 99, 128, 0.50);
  --l-msg-ok-tx:  #0057a8;
  --l-ph:         rgba(74, 99, 128, 0.45);
}

/* dark explicit override */
html.dark {
  --l-tint:       rgba(4, 10, 20, 0.80);
  --l-glass:      rgba(8, 16, 26, 0.72);
  --l-border:     rgba(77, 159, 219, 0.18);
  --l-card-top:   rgba(77, 159, 219, 0.70);
  --l-electric:   #4d9fdb;
  --l-link:       #4d9fdb;
  --l-text:       #f0f4f8;
  --l-muted:      #8ba3bc;
  --l-input-bg:   rgba(255, 255, 255, 0.05);
  --l-input-br:   rgba(77, 159, 219, 0.22);
  --l-input-fc:   rgba(77, 159, 219, 0.55);
  --l-input-sh:   rgba(0, 87, 168, 0.18);
  --l-input-fbg:  rgba(77, 159, 219, 0.06);
  --l-eye:        #8ba3bc;
  --l-trust-bd:   rgba(77, 159, 219, 0.10);
  --l-trust-ln:   rgba(77, 159, 219, 0.14);
  --l-trust-tx:   rgba(139, 163, 188, 0.65);
  --l-badge-bg:   rgba(8, 16, 26, 0.60);
  --l-badge-br:   rgba(77, 159, 219, 0.22);
  --l-badge-tx:   rgba(139, 163, 188, 0.80);
  --l-tog-bg:     rgba(255, 255, 255, 0.07);
  --l-tog-br:     rgba(77, 159, 219, 0.22);
  --l-tog-ic:     #8ba3bc;
  --l-footer:     rgba(139, 163, 188, 0.40);
  --l-ph:         rgba(139, 163, 188, 0.45);
}

/* ── RESET ── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html, body {
  height: 100%;
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  -webkit-font-smoothing: antialiased;
  overflow: hidden;
}

/* ── BACKGROUND ── */
.login-bg {
  position: fixed;
  inset: 0;
  background-image: url('../img/login-bg.jpg');
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
  transition: filter 0.4s;
  z-index: 0;
}

html.light .login-bg,
html:not(.dark) .login-bg {
  filter: brightness(1.25) saturate(0.65);
}

/* animated grid overlay */
.login-bg::before {
  content: '';
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(rgba(77, 159, 219, 0.04) 1px, transparent 1px),
    linear-gradient(90deg, rgba(77, 159, 219, 0.04) 1px, transparent 1px);
  background-size: 52px 52px;
  animation: loginGrid 22s linear infinite;
}

/* scan-line texture */
.login-bg::after {
  content: '';
  position: absolute;
  inset: 0;
  background: repeating-linear-gradient(
    0deg,
    transparent,
    transparent 3px,
    rgba(0, 0, 0, 0.055) 3px,
    rgba(0, 0, 0, 0.055) 4px
  );
  pointer-events: none;
}

html.light .login-bg::before,
html:not(.dark) .login-bg::before { opacity: 0.5; }

@keyframes loginGrid {
  from { transform: translateY(0); }
  to   { transform: translateY(52px); }
}

/* ── TINT ── */
.login-tint {
  position: fixed;
  inset: 0;
  background: var(--l-tint);
  transition: background 0.35s;
  pointer-events: none;
  z-index: 1;
}

/* ── AMBIENT GLOW ── */
.login-glow {
  position: fixed;
  width: 720px;
  height: 720px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(0, 87, 168, 0.16) 0%, transparent 65%);
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  pointer-events: none;
  z-index: 2;
  animation: loginGlow 14s ease-in-out infinite alternate;
}

@keyframes loginGlow {
  0%   { transform: translate(-55%, -45%) scale(1.00); }
  33%  { transform: translate(-47%, -53%) scale(1.08); }
  66%  { transform: translate(-53%, -47%) scale(0.95); }
  100% { transform: translate(-45%, -55%) scale(1.05); }
}

/* ── LOGO ── */
.login-logo {
  position: fixed;
  top: 28px;
  left: 40px;
  display: flex;
  align-items: center;
  gap: 14px;
  z-index: 20;
  text-decoration: none;
  transition: opacity 0.2s;
}

.login-logo:hover { opacity: 0.88; }

.login-logo img {
  width: 54px;
  height: 54px;
  border-radius: 13px;
  object-fit: contain;
  background: rgba(0, 87, 168, 0.18);
  border: 1.5px solid rgba(77, 159, 219, 0.40);
  box-shadow: 0 0 24px rgba(0, 87, 168, 0.50), 0 4px 12px rgba(0,0,0,0.25);
  padding: 5px;
  transition: box-shadow 0.3s, transform 0.2s;
}

.login-logo:hover img {
  transform: translateY(-1px);
  box-shadow: 0 0 32px rgba(77,159,219,0.55), 0 6px 18px rgba(0,0,0,0.3);
}

html.light .login-logo img,
html:not(.dark) .login-logo img {
  background: rgba(255, 255, 255, 0.90);
  border-color: rgba(0, 87, 168, 0.25);
  box-shadow: 0 4px 20px rgba(0, 87, 168, 0.22);
}

.login-logo-text {
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.login-logo-name {
  font-size: 15px;
  font-weight: 800;
  letter-spacing: 0.12em;
  color: #fff;
  line-height: 1;
  transition: color 0.3s;
  text-shadow: 0 1px 8px rgba(0,0,0,0.5);
}

.login-logo-tag {
  font-family: 'JetBrains Mono', 'Courier New', monospace;
  font-size: 10px;
  color: var(--l-electric);
  letter-spacing: 0.10em;
  line-height: 1;
  opacity: 0.95;
  transition: color 0.3s;
  font-weight: 600;
}

html.light .login-logo-name,
html:not(.dark) .login-logo-name {
  color: #0d1b2e;
  text-shadow: 0 1px 6px rgba(200,220,255,0.5);
}

html.light .login-logo-tag,
html:not(.dark) .login-logo-tag {
  color: #0057a8;
}

/* ── TOP RIGHT ── */
.login-topright {
  position: fixed;
  top: 26px;
  right: 36px;
  z-index: 20;
  display: flex;
  align-items: center;
  gap: 10px;
}

.login-status {
  display: flex;
  align-items: center;
  gap: 7px;
  font-family: 'JetBrains Mono', 'Courier New', monospace;
  font-size: 10px;
  font-weight: 500;
  letter-spacing: 0.05em;
  color: var(--l-badge-tx);
  background: var(--l-badge-bg);
  border: 1px solid var(--l-badge-br);
  border-radius: 20px;
  padding: 6px 13px;
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  transition: color 0.3s, background 0.3s, border-color 0.3s;
}

.login-status-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #22c55e;
  box-shadow: 0 0 8px #22c55e;
  flex-shrink: 0;
  animation: loginPulse 2.6s ease-in-out infinite;
}

@keyframes loginPulse {
  0%, 100% { opacity: 1; box-shadow: 0 0 8px #22c55e; }
  50%       { opacity: 0.55; box-shadow: 0 0 18px #22c55e; }
}

/* hide status text on small screens */
@media (max-width: 540px) { .login-status-txt { display: none; } }

/* ── THEME TOGGLE ── */
.login-theme-toggle {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  border: 1px solid var(--l-tog-br);
  background: var(--l-tog-bg);
  color: var(--l-tog-ic);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  transition: background 0.2s, border-color 0.2s, color 0.2s, transform 0.15s;
}

.login-theme-toggle:hover {
  transform: scale(1.08) rotate(12deg);
  background: #66d9ef;
  border-color: transparent;
  color: #1a1d23;
}

.login-theme-toggle:focus-visible {
  outline: 2px solid var(--l-electric);
  outline-offset: 3px;
}

.login-theme-toggle svg { width: 16px; height: 16px; display: block; }

/* icon visibility based on theme */
.icon-moon { display: block; }
.icon-sun  { display: none;  }

html.light .icon-moon,
html:not(.dark) .icon-moon { display: none;  }
html.light .icon-sun,
html:not(.dark) .icon-sun  { display: block; }

/* ── CARD WRAPPER ── */
.login-wrap {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 100px 24px 60px;
  z-index: 10;
}

/* ── GLASS CARD ── */
.login-card {
  position: relative;
  width: 100%;
  max-width: 452px;
  background: var(--l-glass);
  backdrop-filter: blur(28px) saturate(1.5);
  -webkit-backdrop-filter: blur(28px) saturate(1.5);
  border: 1px solid var(--l-border);
  border-radius: 22px;
  padding: 40px 40px 36px;
  box-shadow:
    0 0 0 1px rgba(77, 159, 219, 0.05),
    0 32px 80px rgba(0, 0, 0, 0.55),
    0 0 60px rgba(0, 87, 168, 0.10),
    inset 0 1px 0 rgba(255, 255, 255, 0.08);
  animation: loginCardIn 0.5s cubic-bezier(0.22, 1, 0.36, 1) both;
  transition: background 0.35s, border-color 0.35s, box-shadow 0.35s;
  overflow-y: auto;
  max-height: calc(100vh - 140px);
}

html.light .login-card,
html:not(.dark) .login-card {
  box-shadow:
    0 0 0 1px rgba(0, 87, 168, 0.07),
    0 24px 60px rgba(0, 30, 70, 0.16),
    inset 0 1px 0 rgba(255, 255, 255, 0.95);
}

/* glowing top edge accent */
.login-card::before {
  content: '';
  position: absolute;
  top: -1px;
  left: 18%;
  right: 18%;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--l-card-top), transparent);
  border-radius: 50%;
  pointer-events: none;
  transition: background 0.3s;
}

@keyframes loginCardIn {
  from { opacity: 0; transform: translateY(20px) scale(0.97); }
  to   { opacity: 1; transform: translateY(0)   scale(1);    }
}

/* ── CARD CONTENT ── */
.login-eyebrow {
  font-family: 'JetBrains Mono', 'Courier New', monospace;
  font-size: 10px;
  font-weight: 500;
  letter-spacing: 0.17em;
  color: var(--l-electric);
  text-transform: uppercase;
  margin-bottom: 10px;
  display: flex;
  align-items: center;
  gap: 8px;
  transition: color 0.3s;
}

.login-eyebrow::before {
  content: '';
  display: inline-block;
  width: 18px;
  height: 1px;
  background: currentColor;
  opacity: 0.6;
}

.login-h1 {
  font-size: 26px;
  font-weight: 800;
  line-height: 1.15;
  letter-spacing: -0.02em;
  color: var(--l-text);
  margin-bottom: 6px;
  text-wrap: balance;
  transition: color 0.3s;
}

.login-h1 em {
  font-style: normal;
  color: var(--l-electric);
  transition: color 0.3s;
}

.login-lede {
  font-size: 13px;
  color: var(--l-muted);
  line-height: 1.65;
  margin-bottom: 24px;
  transition: color 0.3s;
}

.login-divider {
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--l-border), transparent);
  margin-bottom: 24px;
  transition: background 0.3s;
}

/* ── LABELS & FIELDS ── */
.login-lbl {
  display: block;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  color: var(--l-muted);
  margin-bottom: 7px;
  margin-top: 16px;
  transition: color 0.3s;
}

.login-lbl:first-of-type { margin-top: 0; }

.login-field {
  position: relative;
  margin-bottom: 4px;
}

.login-ic {
  position: absolute;
  left: 14px;
  top: 50%;
  transform: translateY(-50%);
  width: 17px;
  height: 17px;
  color: var(--l-muted);
  opacity: 0.7;
  pointer-events: none;
  transition: color 0.3s;
}

.login-ic svg { width: 100%; height: 100%; display: block; }

.login-field input {
  width: 100%;
  height: 48px;
  background: var(--l-input-bg);
  border: 1px solid var(--l-input-br);
  border-radius: 12px;
  color: var(--l-text);
  font-family: inherit;
  font-size: 14px;
  padding: 0 14px 0 42px;
  outline: none;
  transition: border-color 0.18s, box-shadow 0.18s, background 0.18s, color 0.3s;
}

.login-field input::placeholder { color: var(--l-ph); }

.login-field input:focus {
  border-color: var(--l-input-fc);
  background: var(--l-input-fbg);
  box-shadow: 0 0 0 3px var(--l-input-sh);
}

/* ── PASSWORD EYE ── */
.login-eye {
  position: absolute;
  right: 12px;
  top: 50%;
  transform: translateY(-50%);
  width: 34px;
  height: 34px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: none;
  border: 0;
  cursor: pointer;
  color: var(--l-eye);
  border-radius: 50%;
  transition: color 0.15s;
}

.login-eye:hover { color: var(--l-text); }
.login-eye svg { width: 18px; height: 18px; display: block; }

/* ── ROW ── */
.login-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 14px;
  margin-bottom: 18px;
  font-size: 12px;
}

.login-session-note { color: var(--l-muted); transition: color 0.3s; }

.login-forgot {
  color: var(--l-link);
  text-decoration: none;
  font-weight: 500;
  transition: opacity 0.15s, color 0.3s;
}

.login-forgot:hover { opacity: 0.75; }

/* ── MESSAGE BOX ── */
.login-msg {
  display: none;
  align-items: center;
  gap: 9px;
  margin-bottom: 14px;
  padding: 11px 14px;
  border-radius: 10px;
  font-size: 13px;
  line-height: 1.4;
}

.login-msg.show { display: flex; }
.login-msg.err  { background: var(--l-msg-err-bg); border: 1px solid var(--l-msg-err-br); color: var(--l-msg-err-tx); }
.login-msg.ok   { background: var(--l-msg-ok-bg);  border: 1px solid var(--l-msg-ok-br);  color: var(--l-msg-ok-tx);  }
.login-msg svg  { width: 17px; height: 17px; flex-shrink: 0; }

/* ── SUBMIT ── */
.login-submit {
  width: 100%;
  height: 50px;
  background: linear-gradient(135deg, #1a6ec0 0%, #0057a8 45%, #003d7a 100%);
  border: none;
  border-radius: 13px;
  color: #fff;
  font-family: inherit;
  font-size: 15px;
  font-weight: 700;
  letter-spacing: 0.01em;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  position: relative;
  overflow: hidden;
  box-shadow: 0 6px 28px rgba(0, 87, 168, 0.42), 0 0 0 1px rgba(77, 159, 219, 0.18);
  transition: transform 0.14s, box-shadow 0.18s, filter 0.18s;
  margin-bottom: 18px;
}

.login-submit::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, rgba(255,255,255,0.09) 0%, transparent 55%);
  pointer-events: none;
}

.login-submit:hover {
  transform: translateY(-1px);
  box-shadow: 0 10px 36px rgba(0, 87, 168, 0.52), 0 0 0 1px rgba(77, 159, 219, 0.28);
}

.login-submit:active  { transform: translateY(1px); }
.login-submit:disabled { opacity: 0.72; cursor: not-allowed; transform: none; }

.login-submit svg  { width: 17px; height: 17px; flex-shrink: 0; }
.login-arw         { margin-left: 4px; }

/* ── REGISTER LINK ── */
.login-reg {
  text-align: center;
  font-size: 13px;
  color: var(--l-muted);
  margin-bottom: 24px;
  transition: color 0.3s;
}

.login-reg a {
  color: var(--l-link);
  text-decoration: none;
  font-weight: 600;
  transition: opacity 0.15s, color 0.3s;
}

.login-reg a:hover { opacity: 0.75; }

/* ── TRUST BADGES ── */
.login-trust {
  display: flex;
  align-items: center;
  justify-content: center;
  padding-top: 18px;
  border-top: 1px solid var(--l-trust-bd);
  transition: border-color 0.3s;
}

.login-titem {
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: 11px;
  color: var(--l-trust-tx);
  padding: 0 13px;
  position: relative;
  transition: color 0.3s;
}

.login-titem:not(:last-child)::after {
  content: '';
  position: absolute;
  right: 0;
  top: 10%;
  height: 80%;
  width: 1px;
  background: var(--l-trust-ln);
  transition: background 0.3s;
}

.login-titem svg { width: 12px; height: 12px; opacity: 0.65; flex-shrink: 0; }
.login-tsep { display: none; } /* kept for backwards-compat, replaced by ::after */

/* ── FOOTER ── */
.login-footer {
  position: fixed;
  bottom: 22px;
  left: 0;
  right: 0;
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 22px;
  font-size: 11px;
  color: var(--l-footer);
  z-index: 20;
  transition: color 0.3s;
}

.login-footer a { color: inherit; text-decoration: none; }
.login-footer a:hover { opacity: 0.75; }

/* ── RESPONSIVE ── */
@media (max-width: 520px) {
  .login-logo { left: 20px; top: 18px; gap: 10px; }
  .login-logo img { width: 42px; height: 42px; border-radius: 10px; }
  .login-logo-name { font-size: 12px; }
  .login-logo-tag { font-size: 9px; }
  .login-topright { right: 20px; top: 20px; }
  .login-card { padding: 32px 24px 28px; border-radius: 18px; }
  .login-h1 { font-size: 22px; }
  .login-titem { padding: 0 8px; font-size: 10px; }
}

@media (max-height: 700px) {
  .login-wrap { padding-top: 80px; padding-bottom: 50px; }
  .login-lede { margin-bottom: 16px; }
  .login-divider { margin-bottom: 16px; }
  .login-card { padding: 28px 36px 24px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
