/* =========================================================
   WIRTZ HUB · LOGIN
   Dirección: telemetría de carrera / carbono / luces de largada
   Paleta: negro carbono · rojo de carrera · blanco perla · verde-go
   Logo real: frontend/src/assets/img/wirtz-racing-logo.png
   ========================================================= */

@import url("https://fonts.googleapis.com/css2?family=Oswald:wght@500;600;700&family=Inter:wght@400;500;600;700&family=JetBrains+Mono:wght@500;600&display=swap");

:root {
  --wr-void: #0a0a0c;
  --wr-surface: #16171b;
  --wr-surface-2: #1d1f24;
  --wr-line: rgba(255, 255, 255, 0.085);
  --wr-line-strong: rgba(255, 255, 255, 0.16);
  --wr-red: #e10600;
  --wr-red-dim: rgba(225, 6, 0, 0.16);
  --wr-white: #f4f4f6;
  --wr-muted: #91949c;
  --wr-muted-2: #5c5f68;
  --wr-go: #00c853;
  --wr-overlay: rgba(0, 0, 0, 0.28);
  --wr-overlay-strong: rgba(0, 0, 0, 0.42);
  --wr-noise: rgba(255, 255, 255, 0.018);
  --wr-noise-2: rgba(255, 255, 255, 0.014);
  --wr-mark: rgba(255, 255, 255, 0.022);
}

/* =========================================================
   TEMA CLARO · TOGGLE MANUAL
   ========================================================= */

.login-page[data-theme="light"] {
  --wr-void: #f3f3f5;
  --wr-surface: #ffffff;
  --wr-surface-2: #f7f7f9;
  --wr-line: rgba(10, 10, 12, 0.09);
  --wr-line-strong: rgba(10, 10, 12, 0.16);
  --wr-red: #e10600;
  --wr-red-dim: rgba(225, 6, 0, 0.10);
  --wr-white: #0a0a0c;
  --wr-muted: #5c5f68;
  --wr-muted-2: #8a8d96;
  --wr-go: #00a648;
  --wr-overlay: rgba(10, 10, 12, 0.035);
  --wr-overlay-strong: rgba(10, 10, 12, 0.06);
  --wr-noise: rgba(10, 10, 12, 0.028);
  --wr-noise-2: rgba(10, 10, 12, 0.02);
  --wr-mark: rgba(10, 10, 12, 0.035);
}

/* =========================================================
   BASE / FONDO
   ========================================================= */

.login-page {
  position: relative;
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 20px;
  overflow: hidden;
  background: var(--wr-void);
  font-family: "Inter", -apple-system, sans-serif;
}

.login-backdrop {
  position: absolute;
  inset: 0;
  pointer-events: none;
  overflow: hidden;
}

.login-backdrop::before {
  content: "";
  position: absolute;
  inset: 0;
  background-image:
    repeating-linear-gradient(45deg, var(--wr-noise) 0 2px, transparent 2px 6px),
    repeating-linear-gradient(-45deg, var(--wr-noise-2) 0 2px, transparent 2px 6px);
  opacity: 0.7;
}

.login-backdrop::after {
  content: "";
  position: absolute;
  inset: 0;
  background:
    radial-gradient(circle at 18% 15%, rgba(225, 6, 0, 0.10), transparent 32%),
    radial-gradient(circle at 85% 85%, rgba(225, 6, 0, 0.055), transparent 38%);
}

.login-backdrop__sweep {
  position: absolute;
  top: 50%;
  left: -20%;
  width: 140%;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(225, 6, 0, 0.55), transparent);
  animation: wrSweep 7s ease-in-out infinite;
}

.login-backdrop__mark {
  position: absolute;
  right: 3.5vw;
  bottom: -2vh;
  color: var(--wr-mark);
  font-family: "Oswald", sans-serif;
  font-size: clamp(180px, 20vw, 320px);
  font-weight: 700;
  letter-spacing: -0.06em;
  line-height: 0.8;
  user-select: none;
}

/* =========================================================
   LAYOUT
   ========================================================= */

.login-shell {
  position: relative;
  z-index: 2;
  width: min(900px, 100%);
  display: grid;
  grid-template-columns: minmax(0, 1.14fr) 336px;
  gap: 1px;
  background: var(--wr-line);
  border-radius: 16px;
  overflow: hidden;
  box-shadow:
    0 30px 80px rgba(0, 0, 0, 0.55),
    0 0 0 1px rgba(255, 255, 255, 0.04);
  animation: wrShellIn 0.5s cubic-bezier(0.16, 1, 0.3, 1) both;
}

.login-shell::before {
  content: "";
  position: absolute;
  z-index: 3;
  inset: 0 0 auto;
  height: 3px;
  background: linear-gradient(
    90deg,
    var(--wr-red) 0%,
    var(--wr-red) 38%,
    var(--wr-white) 38%,
    var(--wr-white) 44%,
    var(--wr-red) 44%,
    var(--wr-red) 100%
  );
  opacity: 0.92;
}

.login-panel,
.login-card {
  position: relative;
  background: var(--wr-surface);
}

/* =========================================================
   PANEL DE MARCA
   ========================================================= */

.login-panel {
  display: grid;
  align-content: center;
  gap: 14px;
  padding: 26px 26px 22px;
  background:
    linear-gradient(160deg, var(--wr-surface) 0%, var(--wr-surface-2) 100%);
}

.login-panel__top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

/* =========================================================
   LOGO REAL WIRTZ RACING
   zoom fuerte · centrado real · reducido apenas
   ========================================================= */

.login-logo {
  position: relative;
  display: block;
  width: 176px;
  height: 66px;
  border: 1px solid var(--wr-line-strong);
  border-radius: 12px;
  background: #ffffff;
  overflow: hidden;
}

.login-page[data-theme="light"] .login-logo {
  background: #ffffff;
  border-color: rgba(10, 10, 12, 0.12);
}

.login-logo::after {
  display: none;
}

.login-logo img {
  position: absolute;
  top: 50%;
  left: 50%;
  z-index: 1;
  display: block;
  width: 240px;
  height: auto;
  max-height: none;
  object-fit: contain;
  object-position: center;
  transform: translate(-50%, -50%) scale(1.12);
  filter: none;
}

/* =========================================================
   ESTADO / TEMA
   ========================================================= */

.login-status {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 23px;
  padding: 0 9px 0 7px;
  border: 1px solid var(--wr-line-strong);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.03);
  color: var(--wr-muted);
  font-family: "JetBrains Mono", monospace;
  font-size: 8.6px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  white-space: nowrap;
}

.login-theme-toggle {
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  border: 1px solid var(--wr-line-strong);
  border-radius: 999px;
  background: var(--wr-overlay);
  color: var(--wr-muted);
  cursor: pointer;
  transition:
    background 0.16s ease,
    color 0.16s ease,
    border-color 0.16s ease;
}

.login-theme-toggle:hover {
  border-color: var(--wr-red);
  color: var(--wr-red);
}

.login-theme-toggle .icon {
  width: 14px;
  height: 14px;
  stroke-width: 2.4;
}

.login-status__dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--wr-go);
  box-shadow: 0 0 0 0 rgba(0, 200, 83, 0.6);
  animation: wrPulseDot 1.8s ease-out infinite;
}

/* =========================================================
   TEXTOS PRINCIPALES
   ========================================================= */

.login-eyebrow {
  color: var(--wr-red);
  font-family: "JetBrains Mono", monospace;
  font-size: 8.2px;
  font-weight: 600;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

.login-panel h1 {
  margin: 2px 0 0;
  color: var(--wr-white);
  font-family: "Oswald", sans-serif;
  font-size: clamp(34px, 3.6vw, 46px);
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 0.94;
  text-transform: uppercase;
}

.login-panel p,
.login-card__header p {
  max-width: 560px;
  margin: 0;
  color: var(--wr-muted);
  font-size: 10.2px;
  font-weight: 500;
  line-height: 1.5;
}

/* =========================================================
   TELEMETRÍA
   ========================================================= */

.login-telemetry {
  display: flex;
  align-items: stretch;
  gap: 0;
  border: 1px solid var(--wr-line);
  border-radius: 9px;
  overflow: hidden;
  background: var(--wr-overlay);
}

.login-telemetry__item {
  flex: 1;
  min-width: 0;
  display: grid;
  gap: 2px;
  padding: 7px 10px;
  border-right: 1px solid var(--wr-line);
}

.login-telemetry__item:last-child {
  border-right: 0;
}

.login-telemetry__label {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  color: var(--wr-muted-2);
  font-family: "JetBrains Mono", monospace;
  font-size: 6.6px;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.login-telemetry__value {
  overflow: hidden;
  color: var(--wr-white);
  font-family: "JetBrains Mono", monospace;
  font-size: 11px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.01em;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.login-telemetry__value--go {
  color: var(--wr-go);
}

/* =========================================================
   STATEMENT
   ========================================================= */

.login-statement {
  display: grid;
  grid-template-columns: 3px minmax(0, 1fr);
  gap: 10px;
  padding: 2px 0 2px 11px;
  border-left: 2px solid var(--wr-red);
}

.login-statement::before {
  content: "";
  grid-row: 1 / -1;
}

.login-statement strong {
  display: block;
  margin-bottom: 2px;
  color: var(--wr-white);
  font-size: 10.4px;
  font-weight: 700;
  letter-spacing: -0.01em;
}

.login-statement span {
  color: var(--wr-muted);
  font-size: 8.9px;
  font-weight: 500;
  line-height: 1.4;
}

/* =========================================================
   ÁREAS
   ========================================================= */

.login-areas {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  border: 1px solid var(--wr-line);
  border-radius: 9px;
  overflow: hidden;
}

.login-area {
  display: grid;
  grid-template-columns: 20px minmax(0, 1fr);
  align-items: center;
  gap: 8px;
  min-width: 0;
  padding: 8px 9px;
  border-right: 1px solid var(--wr-line);
  border-bottom: 1px solid var(--wr-line);
  transition: background 0.16s ease;
}

.login-area:nth-child(2n) {
  border-right: 0;
}

.login-area:nth-last-child(-n + 2) {
  border-bottom: 0;
}

.login-area:hover {
  background: rgba(225, 6, 0, 0.07);
}

.login-area .icon {
  width: 14px;
  height: 14px;
  color: var(--wr-red);
  stroke-width: 2.4;
}

.login-area strong {
  overflow: hidden;
  color: var(--wr-white);
  font-size: 9px;
  font-weight: 600;
  line-height: 1.15;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.login-area span {
  overflow: hidden;
  color: var(--wr-muted-2);
  font-size: 7.7px;
  font-weight: 500;
  line-height: 1.2;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* =========================================================
   FRANJA COMERCIAL
   ========================================================= */

.login-commercial {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}

.login-commercial article {
  min-width: 0;
  padding-top: 7px;
  border-top: 1px solid var(--wr-line);
}

.login-commercial strong {
  display: block;
  margin-bottom: 2px;
  color: var(--wr-red);
  font-family: "JetBrains Mono", monospace;
  font-size: 7.4px;
  font-weight: 600;
  letter-spacing: 0.1em;
}

.login-commercial span {
  overflow: hidden;
  color: var(--wr-white);
  font-size: 8.1px;
  font-weight: 600;
  line-height: 1.25;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* =========================================================
   CARD DE ACCESO
   ========================================================= */

.login-card {
  display: grid;
  align-content: center;
  gap: 12px;
  padding: 24px 22px;
}

.login-card__header {
  display: grid;
  grid-template-columns: 38px minmax(0, 1fr);
  gap: 10px;
  align-items: start;
}

.login-card__icon {
  display: grid;
  width: 38px;
  height: 38px;
  place-items: center;
  border: 1px solid var(--wr-line-strong);
  border-radius: 10px;
  background: var(--wr-void);
  color: var(--wr-red);
}

.login-card__icon .icon {
  width: 16px;
  height: 16px;
  stroke-width: 2.4;
}

.login-card__header h2 {
  margin: 3px 0 0;
  color: var(--wr-white);
  font-family: "Oswald", sans-serif;
  font-size: 20px;
  font-weight: 600;
  letter-spacing: -0.01em;
  line-height: 1;
  text-transform: uppercase;
}

.login-card__header > div:last-child {
  display: grid;
  gap: 3px;
  min-width: 0;
}

/* =========================================================
   FORMULARIO
   ========================================================= */

.login-form {
  display: grid;
  gap: 9px;
}

.login-form label {
  display: grid;
  gap: 4px;
  min-width: 0;
}

.login-form label > span {
  color: var(--wr-muted-2);
  font-family: "JetBrains Mono", monospace;
  font-size: 7.6px;
  font-weight: 600;
  letter-spacing: 0.13em;
  text-transform: uppercase;
}

.login-input {
  display: grid;
  grid-template-columns: 15px minmax(0, 1fr) auto;
  align-items: center;
  gap: 7px;
  width: 100%;
  min-height: 36px;
  padding: 0 10px;
  border: 1px solid var(--wr-line-strong);
  border-radius: 8px;
  background: var(--wr-overlay);
  transition:
    border-color 0.16s ease,
    box-shadow 0.16s ease,
    background 0.16s ease;
}

.login-input:focus-within {
  border-color: var(--wr-red);
  box-shadow: 0 0 0 3px var(--wr-red-dim);
  background: var(--wr-overlay-strong);
}

.login-input > .icon {
  width: 13px;
  height: 13px;
  color: var(--wr-muted-2);
  stroke-width: 2.3;
}

.login-input:focus-within > .icon {
  color: var(--wr-red);
}

.login-input input {
  width: 100%;
  height: 34px;
  min-width: 0;
  padding: 0;
  border: 0;
  outline: none;
  background: transparent;
  color: var(--wr-white);
  font-family: "Inter", sans-serif;
  font-size: 10.4px;
  font-weight: 600;
}

.login-input input::placeholder {
  color: var(--wr-muted-2);
  font-weight: 500;
}

.login-input__action {
  display: grid;
  width: 25px;
  height: 25px;
  place-items: center;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--wr-muted-2);
  cursor: pointer;
  transition:
    background 0.16s ease,
    color 0.16s ease;
}

.login-input__action:hover {
  background: var(--wr-red-dim);
  color: var(--wr-red);
}

.login-input__action .icon {
  width: 13px;
  height: 13px;
  stroke-width: 2.3;
}

.login-note {
  display: grid;
  gap: 5px;
  padding: 8px 10px;
  border: 1px dashed var(--wr-line-strong);
  border-radius: 8px;
}

.login-note span {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  min-width: 0;
  color: var(--wr-muted);
  font-size: 8.1px;
  font-weight: 600;
  line-height: 1.2;
}

.login-note .icon {
  width: 11px;
  height: 11px;
  color: var(--wr-red);
  stroke-width: 2.5;
  flex-shrink: 0;
}

/* =========================================================
   BOTÓN DE LARGADA
   ========================================================= */

.login-submit {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  width: 100%;
  min-height: 38px;
  margin-top: 2px;
  border: 1px solid var(--wr-red);
  border-radius: 8px;
  background: var(--wr-red);
  color: #ffffff;
  font-family: "Oswald", sans-serif;
  font-size: 10.5px;
  font-weight: 600;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  cursor: pointer;
  transition:
    filter 0.16s ease,
    transform 0.16s ease,
    background 0.2s ease,
    border-color 0.2s ease;
}

.login-submit:hover {
  filter: brightness(1.08);
  transform: translateY(-1px);
}

.login-submit:active {
  transform: translateY(0);
}

.login-submit:disabled {
  cursor: not-allowed;
  transform: none;
}

.login-submit.is-go {
  background: var(--wr-go);
  border-color: var(--wr-go);
}

.start-lights {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.start-lights .light {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.3);
}

.login-submit.is-loading .start-lights .light {
  animation: wrLightUp 1.1s ease forwards;
}

.login-submit.is-loading .start-lights .light:nth-child(1) {
  animation-delay: 0s;
}

.login-submit.is-loading .start-lights .light:nth-child(2) {
  animation-delay: 0.16s;
}

.login-submit.is-loading .start-lights .light:nth-child(3) {
  animation-delay: 0.32s;
}

.login-submit.is-loading .start-lights .light:nth-child(4) {
  animation-delay: 0.48s;
}

.login-submit.is-loading .start-lights .light:nth-child(5) {
  animation-delay: 0.64s;
}

.login-submit.is-go .start-lights .light {
  background: #ffffff;
}

.login-form-message {
  min-height: 12px;
  margin: 0;
  color: var(--wr-red);
  font-size: 8.4px;
  font-weight: 700;
  line-height: 1.3;
}

.login-form-message.is-ok {
  color: var(--wr-go);
}

/* =========================================================
   FOOTER DEL CARD
   ========================================================= */

.login-card__footer {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
}

.login-card__footer span {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  min-height: 21px;
  padding: 0 8px;
  border: 1px solid var(--wr-line);
  border-radius: 999px;
  color: var(--wr-muted-2);
  font-size: 7.6px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.login-card__footer .icon {
  width: 10px;
  height: 10px;
  color: var(--wr-red);
  stroke-width: 2.4;
}

/* =========================================================
   ANIMACIONES
   ========================================================= */

@keyframes wrShellIn {
  from {
    opacity: 0;
    transform: translateY(18px) scale(0.985);
  }

  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

@keyframes wrSweep {
  0%,
  100% {
    transform: translateX(-6%);
    opacity: 0;
  }

  50% {
    transform: translateX(6%);
    opacity: 1;
  }
}

@keyframes wrPulseDot {
  0% {
    box-shadow: 0 0 0 0 rgba(0, 200, 83, 0.55);
  }

  70% {
    box-shadow: 0 0 0 6px rgba(0, 200, 83, 0);
  }

  100% {
    box-shadow: 0 0 0 0 rgba(0, 200, 83, 0);
  }
}

@keyframes wrLightUp {
  0% {
    background: rgba(255, 255, 255, 0.3);
  }

  100% {
    background: var(--wr-red);
    box-shadow: 0 0 8px 1px rgba(225, 6, 0, 0.7);
  }
}

/* =========================================================
   RESPONSIVE
   ========================================================= */

@media (max-width: 1080px) {
  .login-shell {
    width: min(860px, 100%);
    grid-template-columns: minmax(0, 1fr) 320px;
  }
}

@media (max-width: 920px) {
  .login-page {
    align-items: start;
    padding: 16px;
    overflow-y: auto;
  }

  .login-shell {
    width: min(620px, 100%);
    grid-template-columns: 1fr;
  }

  .login-backdrop__mark {
    font-size: clamp(120px, 26vw, 210px);
    bottom: 0;
  }
}

@media (max-width: 620px) {
  .login-panel,
  .login-card {
    padding: 20px;
  }

  .login-panel h1 {
    font-size: 32px;
  }

  .login-logo {
    width: 154px;
    height: 58px;
  }

  .login-logo img {
    width: 210px;
    max-height: none;
    transform: translate(-50%, -50%) scale(1.08);
  }

  .login-areas {
    grid-template-columns: 1fr;
  }

  .login-area:nth-child(2n) {
    border-right: 1px solid var(--wr-line);
  }

  .login-area:last-child {
    border-right: 0;
  }

  .login-area:nth-last-child(-n + 2) {
    border-bottom: 1px solid var(--wr-line);
  }

  .login-area:last-child {
    border-bottom: 0;
  }

  .login-commercial {
    grid-template-columns: 1fr;
    gap: 7px;
  }

  .login-telemetry {
    flex-direction: column;
  }

  .login-telemetry__item {
    border-right: 0;
    border-bottom: 1px solid var(--wr-line);
  }

  .login-telemetry__item:last-child {
    border-bottom: 0;
  }
}

@media (max-width: 380px) {
  .login-panel,
  .login-card {
    padding: 16px;
  }

  .login-panel h1 {
    font-size: 28px;
  }

  .login-card__header {
    grid-template-columns: 1fr;
  }

  .login-logo {
    width: 142px;
    height: 54px;
  }

  .login-logo img {
    width: 190px;
    max-height: none;
    transform: translate(-50%, -50%) scale(1.05);
  }
}

@media (prefers-reduced-motion: reduce) {
  .login-shell,
  .login-backdrop__sweep,
  .login-status__dot,
  .login-submit.is-loading .start-lights .light {
    animation: none;
  }

  .login-area,
  .login-input,
  .login-input__action,
  .login-submit {
    transition: none;
  }
}