/* ============================================================
   My Shadow Track — Login Page
   Plain CSS, no React. Designed to be dropped into Django
   templates. All :root tokens mirror the landing page tokens
   so visual identity is consistent.
   ============================================================ */

:root {
  --l-bg: #0a0b0d;
  --l-bg-2: #111316;
  --l-bg-3: #16191d;
  --l-surface: #1b1f24;
  --l-surface-2: #22272e;
  --l-line: #2a2f37;
  --l-line-soft: #1f2329;
  --l-ink-1: #f5f6f7;
  --l-ink-2: #c8ccd2;
  --l-ink-3: #8a909a;
  --l-ink-4: #5b6068;
  --l-accent: #e63946;
  --l-accent-2: #f59e0b;
  --l-brand: #5e79ff;
  --l-brand-deep: #2a1f5c;
  --l-green: #22c55e;
  --l-glow: rgba(230, 57, 70, 0.45);
  --l-glow-brand: rgba(94, 121, 255, 0.35);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--l-bg);
  color: var(--l-ink-1);
  font-family: 'Space Grotesk', system-ui, sans-serif;
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
}

a { color: inherit; text-decoration: none; }
button { font-family: inherit; cursor: pointer; }

/* ============================================================
   Page layout — split screen
   Left: form | Right: editorial visual
   ============================================================ */
.login-page {
  display: grid;
  grid-template-columns: minmax(520px, 580px) 1fr;
  min-height: 100vh;
}

/* ============== LEFT — Form column =========================== */
.login-left {
  background: var(--l-bg);
  display: flex;
  flex-direction: column;
  padding: 40px 64px;
  position: relative;
  overflow: hidden;
}
.login-left::before {
  content: '';
  position: absolute; inset: 0;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='200' height='200'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='0.9'/><feColorMatrix values='0 0 0 0 0  0 0 0 0 0  0 0 0 0 0  0 0 0 1 0'/></filter><rect width='100%' height='100%' filter='url(%23n)' opacity='1'/></svg>");
  opacity: 0.04;
  pointer-events: none;
  mix-blend-mode: overlay;
}
.login-left > * { position: relative; z-index: 2; }

/* ---- Header (logo + breadcrumb) ----- */
.login-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.login-logo {
  display: flex;
  align-items: center;
  gap: 12px;
  font-weight: 700;
  letter-spacing: 0.02em;
  color: var(--l-ink-1);
}
.login-logo-mark {
  width: 40px; height: 40px;
  border-radius: 10px;
  background: linear-gradient(155deg, #2a1f5c 0%, #0f1240 60%, #060826 100%);
  display: grid; place-items: center;
  position: relative;
  overflow: hidden;
  box-shadow:
    0 0 0 1px rgba(125,140,255,0.20),
    0 0 24px var(--l-glow-brand),
    inset 0 1px 0 rgba(255,255,255,0.08);
}
.login-logo-mark::before {
  content: '';
  position: absolute; inset: 0;
  background: radial-gradient(ellipse 60% 50% at 35% 30%, rgba(125,140,255,0.25), transparent 70%);
}
.login-logo-mark svg { position: relative; z-index: 2; }

.login-logo-text {
  font-size: 16px;
  line-height: 1;
}
.login-logo-text small {
  display: block;
  font-size: 10px;
  font-weight: 500;
  color: var(--l-ink-3);
  letter-spacing: 0.18em;
  margin-top: 4px;
  text-transform: uppercase;
}

.login-back {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-family: 'JetBrains Mono', monospace;
  font-size: 11px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--l-ink-3);
  border: 1px solid var(--l-line);
  padding: 8px 12px 8px 10px;
  border-radius: 8px;
  transition: color 0.15s, border-color 0.15s;
  white-space: nowrap;
}
.login-back:hover {
  color: var(--l-ink-1);
  border-color: var(--l-line);
  background: var(--l-surface);
}

/* ---- Form body ----- */
.login-body {
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: center;
  max-width: 420px;
  width: 100%;
  margin: 0 auto;
  padding: 40px 0;
}

.login-eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-family: 'JetBrains Mono', monospace;
  font-size: 11px;
  font-weight: 600;
  color: var(--l-accent);
  letter-spacing: 0.22em;
  text-transform: uppercase;
  margin-bottom: 24px;
}
.login-eyebrow::before {
  content: '';
  width: 24px; height: 1px;
  background: var(--l-accent);
}

.login-title {
  font-size: 44px;
  font-weight: 700;
  line-height: 1.05;
  letter-spacing: -0.025em;
  margin: 0 0 14px;
  color: var(--l-ink-1);
}
.login-title em {
  font-style: italic;
  color: var(--l-accent);
  font-weight: 600;
  position: relative;
}
.login-title em::after {
  content: '';
  position: absolute;
  left: 0; right: 0; bottom: 4px;
  height: 8px;
  background: var(--l-accent);
  opacity: 0.18;
  transform: skewX(-12deg);
  z-index: -1;
}

.login-subtitle {
  font-size: 15px;
  line-height: 1.55;
  color: var(--l-ink-2);
  margin: 0 0 36px;
  text-wrap: pretty;
}

/* ---- Server feedback (Django messages) ---- */
.login-alert {
  padding: 12px 14px;
  border-radius: 10px;
  background: rgba(230, 57, 70, 0.10);
  border: 1px solid rgba(230, 57, 70, 0.35);
  color: var(--l-ink-1);
  font-size: 13px;
  display: flex;
  align-items: flex-start;
  gap: 10px;
  margin-bottom: 22px;
}
.login-alert.success {
  background: rgba(34, 197, 94, 0.10);
  border-color: rgba(34, 197, 94, 0.35);
}
.login-alert svg { flex-shrink: 0; margin-top: 1px; }

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

.login-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.login-field label {
  font-family: 'JetBrains Mono', monospace;
  font-size: 10px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--l-ink-3);
  font-weight: 600;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.login-field label .req {
  color: var(--l-accent);
  margin-left: 4px;
}

.login-input-wrap {
  position: relative;
}
.login-input-wrap .lead-icon {
  position: absolute;
  left: 16px; top: 50%;
  transform: translateY(-50%);
  color: var(--l-ink-3);
  pointer-events: none;
  transition: color 0.15s;
}
.login-input {
  width: 100%;
  height: 52px;
  padding: 0 48px 0 46px;
  border-radius: 10px;
  background: var(--l-surface);
  border: 1px solid var(--l-line);
  color: var(--l-ink-1);
  font-family: inherit;
  font-size: 15px;
  letter-spacing: 0.01em;
  transition: border-color 0.15s, background 0.15s, box-shadow 0.15s;
  outline: none;
}
.login-input::placeholder {
  color: var(--l-ink-4);
}
.login-input:hover {
  border-color: var(--l-line);
  background: var(--l-surface-2);
}
.login-input:focus {
  border-color: var(--l-accent);
  background: var(--l-surface-2);
  box-shadow:
    0 0 0 4px rgba(230, 57, 70, 0.10),
    inset 0 0 0 1px var(--l-accent);
}
.login-input:focus + .lead-icon,
.login-input-wrap:focus-within .lead-icon { color: var(--l-accent); }

.login-input.has-error {
  border-color: var(--l-accent);
  box-shadow: 0 0 0 4px rgba(230, 57, 70, 0.10);
}
.login-error {
  font-size: 12px;
  color: var(--l-accent);
  margin-top: 4px;
  display: flex;
  align-items: center;
  gap: 6px;
}

.login-pass-toggle {
  position: absolute;
  right: 8px; top: 50%;
  transform: translateY(-50%);
  width: 36px; height: 36px;
  border: none;
  background: transparent;
  border-radius: 8px;
  display: grid; place-items: center;
  color: var(--l-ink-3);
  transition: color 0.15s, background 0.15s;
}
.login-pass-toggle:hover {
  color: var(--l-ink-1);
  background: var(--l-surface);
}

/* ---- Row: remember + forgot ---- */
.login-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: -4px;
}

.login-check {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-size: 13px;
  color: var(--l-ink-2);
  cursor: pointer;
  user-select: none;
}
.login-check input { display: none; }
.login-check-box {
  width: 18px; height: 18px;
  border-radius: 5px;
  border: 1px solid var(--l-line);
  background: var(--l-surface);
  display: grid;
  place-items: center;
  transition: all 0.15s;
  flex-shrink: 0;
}
.login-check-box svg {
  opacity: 0;
  transform: scale(0.6);
  transition: all 0.15s;
}
.login-check input:checked + .login-check-box {
  background: var(--l-accent);
  border-color: var(--l-accent);
}
.login-check input:checked + .login-check-box svg {
  opacity: 1;
  transform: scale(1);
  color: white;
}

.login-forgot {
  font-size: 13px;
  font-weight: 500;
  color: var(--l-ink-2);
  display: inline-flex;
  align-items: center;
  gap: 6px;
  position: relative;
}
.login-forgot::after {
  content: '';
  position: absolute;
  left: 0; right: 0; bottom: -2px;
  height: 1px;
  background: currentColor;
  transform: scaleX(0);
  transform-origin: right;
  transition: transform 0.2s;
}
.login-forgot:hover {
  color: var(--l-accent);
}
.login-forgot:hover::after {
  transform: scaleX(1);
  transform-origin: left;
}

/* ---- Submit button ---- */
.login-submit {
  height: 54px;
  border-radius: 10px;
  background: var(--l-accent);
  color: white;
  font-family: inherit;
  font-size: 15px;
  font-weight: 600;
  letter-spacing: 0.02em;
  border: none;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  margin-top: 8px;
  position: relative;
  overflow: hidden;
  box-shadow:
    0 8px 24px var(--l-glow),
    inset 0 1px 0 rgba(255, 255, 255, 0.18);
  transition: transform 0.1s, box-shadow 0.15s;
}
.login-submit::after {
  content: '';
  position: absolute;
  inset: 0;
  background: repeating-linear-gradient(45deg, transparent 0 6px, rgba(0, 0, 0, 0.06) 6px 12px);
  opacity: 0;
  transition: opacity 0.2s;
  pointer-events: none;
}
.login-submit:hover::after { opacity: 1; }
.login-submit:hover {
  box-shadow:
    0 10px 30px var(--l-glow),
    inset 0 1px 0 rgba(255, 255, 255, 0.22);
}
.login-submit:active { transform: translateY(1px); }
.login-submit:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}
.login-submit .spinner {
  display: none;
  width: 18px; height: 18px;
  border: 2px solid rgba(255,255,255,0.4);
  border-top-color: white;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
.login-submit.is-loading .login-submit-text { opacity: 0.6; }
.login-submit.is-loading .spinner { display: block; }

/* ---- Divider ---- */
.login-divider {
  display: flex;
  align-items: center;
  gap: 14px;
  margin: 28px 0 18px;
}
.login-divider::before,
.login-divider::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--l-line);
}
.login-divider span {
  font-family: 'JetBrains Mono', monospace;
  font-size: 10px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--l-ink-3);
  padding: 4px 10px;
  border: 1px solid var(--l-line);
  border-radius: 999px;
  background: var(--l-bg);
  white-space: nowrap;
}

/* ---- Social ---- */
.login-social {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}
.login-social-btn {
  height: 50px;
  border-radius: 10px;
  background: var(--l-surface);
  border: 1px solid var(--l-line);
  color: var(--l-ink-1);
  font-family: inherit;
  font-size: 14px;
  font-weight: 500;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  transition: all 0.15s;
}
.login-social-btn:hover {
  border-color: var(--l-line);
  background: var(--l-surface-2);
  transform: translateY(-1px);
}
.login-social-btn svg { flex-shrink: 0; }

/* ---- Footer ---- */
.login-footer {
  text-align: center;
  font-size: 14px;
  color: var(--l-ink-2);
  padding-top: 40px;
}
.login-footer a {
  color: var(--l-ink-1);
  font-weight: 600;
  position: relative;
  margin-left: 4px;
}
.login-footer a::after {
  content: '';
  position: absolute;
  left: 0; right: 0; bottom: -2px;
  height: 1px;
  background: var(--l-accent);
}

.login-meta {
  display: flex;
  justify-content: space-between;
  font-family: 'JetBrains Mono', monospace;
  font-size: 10px;
  color: var(--l-ink-4);
  letter-spacing: 0.12em;
  text-transform: uppercase;
  margin-top: 24px;
}
.login-meta span { white-space: nowrap; }

/* ============== RIGHT — Editorial visual ===================== */
.login-right {
  background: linear-gradient(155deg, #15171c 0%, #0a0b0d 60%, #060709 100%);
  position: relative;
  overflow: hidden;
  padding: 40px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

/* checker flag corner */
.login-right::before {
  content: '';
  position: absolute;
  top: 0; left: 0;
  width: 6px; height: 100%;
  background: repeating-linear-gradient(0deg, var(--l-ink-1) 0 14px, var(--l-bg-2) 14px 28px);
  opacity: 0.4;
  z-index: 2;
}

.login-right-glow {
  position: absolute;
  inset: 0;
  background:
    radial-gradient(ellipse 800px 600px at 70% 30%, var(--l-glow) 0%, transparent 60%),
    radial-gradient(ellipse 400px 400px at 30% 90%, var(--l-glow-brand) 0%, transparent 70%);
  z-index: 1;
}

.login-right-grid {
  position: absolute; inset: 0;
  background-image:
    linear-gradient(rgba(255,255,255,0.03) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255,255,255,0.03) 1px, transparent 1px);
  background-size: 56px 56px;
  z-index: 1;
}

.login-right > * { position: relative; z-index: 3; }

/* Top live ticker */
.login-live {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-family: 'JetBrains Mono', monospace;
  font-size: 11px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--l-ink-2);
  padding: 8px 14px 8px 10px;
  border: 1px solid var(--l-line);
  background: rgba(15, 17, 21, 0.6);
  border-radius: 999px;
  backdrop-filter: blur(12px);
  align-self: flex-start;
}
.login-live .pulse {
  width: 8px; height: 8px;
  border-radius: 50%;
  background: var(--l-accent);
  animation: pulse 2s infinite;
}
@keyframes pulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(230, 57, 70, 0.6); }
  50% { box-shadow: 0 0 0 8px rgba(230, 57, 70, 0); }
}

/* Big editorial map — dominant feature */
.login-map-wrap {
  position: absolute;
  inset: 60px 40px 200px 40px;
  z-index: 2;
}
.login-map-wrap svg {
  width: 100%; height: 100%;
}

/* Telemetry pill cards floating */
.login-telemetry {
  display: flex;
  gap: 14px;
  flex-wrap: wrap;
  margin-top: auto;
}
.tel-card {
  background: rgba(15, 17, 21, 0.85);
  border: 1px solid var(--l-line);
  border-radius: 14px;
  padding: 16px 18px;
  backdrop-filter: blur(12px);
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 140px;
  position: relative;
  overflow: hidden;
}
.tel-card::before {
  content: '';
  position: absolute;
  top: 0; left: 0;
  width: 28px; height: 2px;
  background: var(--l-accent);
}
.tel-card.brand::before { background: var(--l-brand); }
.tel-card.green::before { background: var(--l-green); }
.tel-card-label {
  font-family: 'JetBrains Mono', monospace;
  font-size: 9px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--l-ink-3);
}
.tel-card-value {
  font-family: 'JetBrains Mono', monospace;
  font-size: 22px;
  font-weight: 600;
  letter-spacing: -0.02em;
  color: var(--l-ink-1);
  line-height: 1;
}
.tel-card-value .unit {
  font-size: 11px; color: var(--l-ink-3); font-weight: 500;
}
.tel-card-value .red { color: var(--l-accent); }
.tel-card-sub {
  font-size: 11px;
  color: var(--l-ink-3);
  white-space: nowrap;
}
.tel-card-sub strong { color: var(--l-ink-1); }

/* Quote strip */
.login-quote {
  background: rgba(15, 17, 21, 0.85);
  border: 1px solid var(--l-line);
  border-radius: 16px;
  padding: 22px 24px;
  backdrop-filter: blur(12px);
  margin-top: 18px;
  position: relative;
}
.login-quote-text {
  font-size: 17px;
  line-height: 1.45;
  color: var(--l-ink-1);
  font-weight: 500;
  text-wrap: balance;
  margin: 0 0 14px;
}
.login-quote-text em {
  color: var(--l-accent);
  font-style: italic;
}
.login-quote-meta {
  display: flex;
  align-items: center;
  gap: 12px;
}
.login-quote-av {
  width: 36px; height: 36px;
  border-radius: 9px;
  background: linear-gradient(135deg, #b8252e, #5a1217);
  display: grid; place-items: center;
  color: white;
  font-weight: 700;
  font-size: 12px;
  letter-spacing: 0.04em;
  border: 1px solid var(--l-line);
}
.login-quote-name {
  font-size: 13px;
  font-weight: 600;
  color: var(--l-ink-1);
}
.login-quote-name small {
  display: block;
  font-size: 11px;
  font-weight: 500;
  color: var(--l-ink-3);
  margin-top: 2px;
  font-family: 'JetBrains Mono', monospace;
  letter-spacing: 0.06em;
}

/* Stats strip top */
.login-statstrip {
  display: flex;
  gap: 32px;
  margin-top: 20px;
  padding-bottom: 4px;
  border-bottom: 1px solid var(--l-line-soft);
  padding-bottom: 18px;
}
.login-statstrip-item {
  flex: 1;
}
.login-statstrip-num {
  font-family: 'JetBrains Mono', monospace;
  font-size: 22px;
  font-weight: 600;
  letter-spacing: -0.02em;
  line-height: 1;
}
.login-statstrip-num em {
  font-style: normal;
  color: var(--l-accent);
}
.login-statstrip-label {
  font-size: 10px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--l-ink-3);
  margin-top: 6px;
  font-weight: 500;
}

/* ============== Responsive =================================== */
/* Tablet horizontal / laptops pequeños — keep the split, just let the
 * left column shrink so the right aside stays visible. */
@media (max-width: 1100px) {
  .login-page { grid-template-columns: minmax(420px, 480px) 1fr; }
  .login-left { padding: 32px 36px; }
}

/* Mobile only — collapse to a single column and hide the right aside
 * (the editorial visual is decorative; on a phone you want the form
 * front-and-centre and to save bandwidth on the SVG map). */
@media (max-width: 760px) {
  .login-page { grid-template-columns: 1fr; }
  .login-right { display: none; }
  .login-left { padding: 24px; }
  .login-body { padding: 32px 0; }
}
