:root {
  --senshi-bg: #080808;
  --senshi-surface: #0D0D0E;
  --senshi-surface-soft: #151516;
  --senshi-input: rgba(18, 18, 19, 0.82);
  --senshi-border: rgba(255, 255, 255, 0.18);
  --senshi-border-hover: rgba(255, 255, 255, 0.32);
  --senshi-red: #C8102E;
  --senshi-red-bright: #ED1638;
  --senshi-text: #F4F4F5;
  --senshi-text-secondary: #A1A1A6;
  --senshi-text-muted: #75757A;
  --senshi-success: #22C55E;
  --senshi-error: #FB4B62;
  --senshi-radius-card: 11px;
  --senshi-radius-control: 8px;
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

html,
body {
  margin: 0;
  padding: 0;
}

body {
  font-family: 'Inter', system-ui, -apple-system, 'Segoe UI', sans-serif;
  background: var(--senshi-bg);
  color: var(--senshi-text);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

.auth-page {
  position: relative;
  isolation: isolate;
  min-height: 100vh;
  min-height: 100dvh;
  overflow-x: hidden;
  display: grid;
  place-items: center;
  align-items: center;
  padding: 24px;
  background: #080808;
}

.auth-card {
  position: relative;
  z-index: 2;
  width: min(100%, 478px);
  min-height: 760px;
  height: auto;
  max-height: none;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  border: 1px solid var(--senshi-border);
  border-radius: var(--senshi-radius-card);
  background: rgba(13, 13, 14, 0.94);
  backdrop-filter: blur(8px);
  box-shadow:
    0 24px 70px rgba(0, 0, 0, 0.55),
    inset 0 1px 0 rgba(255, 255, 255, 0.02);
  animation: auth-card-in 0.45s ease both;
  transition:
    min-height 180ms ease,
    box-shadow 180ms ease;
}

@supports not (backdrop-filter: blur(8px)) {
  .auth-card {
    background: rgba(13, 13, 14, 0.98);
  }
}

@keyframes auth-card-in {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.auth-card__content {
  position: relative;
  z-index: 2;
  flex: 1;
  display: flex;
  flex-direction: column;
  padding: 0 42px;
}

/* === Marca === */
.auth-brand {
  display: flex;
  flex-direction: column;
  align-items: center;
  margin-top: 62px;
}

.auth-brand__logo {
  width: 92px;
  height: 92px;
  padding: 2px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 14px;

  background:
    rgba(7, 7, 8, 0.28);

  border:
    1px solid
    rgba(255, 255, 255, 0.10);

  border-radius: 16px;

  box-shadow:
    0 10px 28px rgba(0, 0, 0, 0.28);

  backdrop-filter:
    blur(4px);
}

.auth-brand__logo img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  border-radius: 13px;
}

.auth-brand__name {
  color: #FFFFFF;
  font-size: clamp(28px, 6vw, 34px);
  font-weight: 800;
  line-height: 1;
  text-transform: uppercase;
  letter-spacing: 0.16em;
  padding-left: 0.16em;
  text-align: center;
}

.auth-brand__sub {
  color: var(--senshi-red-bright);
  font-size: 12.5px;
  font-weight: 700;
  line-height: 1.2;
  text-transform: uppercase;
  letter-spacing: 0.18em;
  padding-left: 0.18em;
  text-align: center;
  margin-top: 8px;
}

.auth-brand__tagline {
  margin: 13px 0 0;
  font-size: 13px;
  font-weight: 400;
  color: #A1A1A6;
  letter-spacing: 0.01em;
  text-align: center;
}

/* === Volver al inicio === */
.back-link {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  align-self: flex-start;
  margin-top: 26px;
  font-size: 13px;
  font-weight: 600;
  color: var(--senshi-text-secondary);
  text-decoration: none;
  transition: color 0.15s ease;
}

.back-link__icon {
  width: 16px;
  height: 16px;
}

.back-link:hover {
  color: var(--senshi-text);
}

.back-link:focus-visible {
  outline: 2px solid var(--senshi-red-bright);
  outline-offset: 2px;
  border-radius: 3px;
}

/* === Encabezado del formulario === */
.auth-section-divider {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 24px;
}

.auth-section-divider::before,
.auth-section-divider::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--senshi-border);
}

.auth-section-divider__label {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--senshi-text-muted);
  white-space: nowrap;
}

.auth-section-divider--context {
  margin-top: 20px;
}

.auth-header {
  margin-top: 28px;
  text-align: center;
}

.auth-header__title {
  margin: 0;
  font-size: 28px;
  font-weight: 700;
  line-height: 1.2;
  color: var(--senshi-text);
  letter-spacing: -0.01em;
}

.auth-header__rule {
  width: 26px;
  height: 2px;
  margin: 15px auto 0;
  background: #E81432;
}

.auth-header__subtitle {
  margin: 18px 0 0;
  font-size: 14px;
  font-weight: 400;
  color: #8C8C91;
}

/* === Formulario === */
.login-form {
  margin-top: 26px;
}

.field {
  position: relative;
  height: 62px;
}

.field + .field {
  margin-top: 14px;
}

.floating-field input {
  width: 100%;
  height: 100%;
  padding: 24px 52px 8px 52px;
  font-family: inherit;
  font-size: 15px;
  color: var(--senshi-text);
  background: rgba(18, 18, 19, 0.84);
  border: 1px solid var(--senshi-border);
  border-radius: var(--senshi-radius-control);
  outline: none;
  transition: border-color 160ms ease, background-color 160ms ease, box-shadow 160ms ease;
}

.floating-field input::placeholder {
  color: transparent;
}

.floating-field:hover input {
  border-color: var(--senshi-border-hover);
}

.floating-field:focus-within input {
  border-color: var(--senshi-red);
  background: rgba(26, 26, 28, 0.9);
  box-shadow: 0 0 0 3px rgba(232, 20, 50, 0.16);
}

.floating-field.is-invalid input {
  border-color: rgba(251, 75, 98, 0.75);
  box-shadow: 0 0 0 3px rgba(251, 75, 98, 0.12);
}

.floating-field.is-invalid .field__icon {
  color: var(--senshi-error);
}

.floating-field.is-invalid label {
  color: var(--senshi-error);
}

.floating-field label {
  position: absolute;
  top: 50%;
  left: 52px;
  max-width: calc(100% - 112px);
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
  padding: 0;
  transform: translateY(-50%);
  transform-origin: left center;
  font-size: 15px;
  font-weight: 500;
  line-height: 1;
  color: #85858A;
  background: transparent;
  pointer-events: none;
  z-index: 1;
  transition:
    top 180ms ease,
    transform 180ms ease,
    color 180ms ease,
    font-size 180ms ease;
}

.floating-field:focus-within label,
.floating-field input:not(:placeholder-shown) + label {
  top: 13px;
  transform: translateY(0);
  font-size: 11px;
  font-weight: 600;
  background: transparent;
}

.floating-field input:not(:placeholder-shown) + label {
  color: #A1A1A6;
}

.floating-field:focus-within label,
.floating-field:focus-within input:not(:placeholder-shown) + label {
  color: var(--senshi-red-bright);
}

.floating-field input:-webkit-autofill + label {
  top: 10px;
  transform: translateY(0);
  font-size: 11px;
  font-weight: 600;
  color: #A1A1A6;
  background: transparent;
}

.floating-field--date label,
.floating-field input[type="date"] + label {
  top: 10px;
  transform: translateY(0);
  font-size: 11px;
  font-weight: 600;
  color: #A1A1A6;
  background: transparent;
}

.floating-field--date:focus-within label {
  color: var(--senshi-red-bright);
}

.floating-field.is-invalid label,
.floating-field.is-invalid input:not(:placeholder-shown) + label,
.floating-field.is-invalid:focus-within label,
.floating-field.is-invalid:focus-within input:not(:placeholder-shown) + label {
  color: var(--senshi-error);
}

.floating-field input:-webkit-autofill,
.floating-field input:-webkit-autofill:hover,
.floating-field input:-webkit-autofill:focus {
  -webkit-box-shadow: 0 0 0 1000px rgba(18, 18, 19, 0.84) inset;
  -webkit-text-fill-color: var(--senshi-text);
  caret-color: var(--senshi-text);
  transition: background-color 9999s ease-out 0s;
}

.floating-field input:disabled {
  cursor: not-allowed;
  color: var(--senshi-text-muted);
}

.field__icon {
  position: absolute;
  left: 18px;
  top: 50%;
  transform: translateY(-50%);
  display: flex;
  color: #85858A;
  pointer-events: none;
  transition: color 0.15s ease;
}

.floating-field:focus-within .field__icon {
  color: var(--senshi-text);
}

.field__icon svg {
  width: 20px;
  height: 20px;
}

.field--password input {
  padding-right: 58px;
}

/* === Opciones: Recordarme / Recuperar === */
.login-options {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  margin-top: 16px;
}

.remember-control {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-size: 13px;
  color: var(--senshi-text-secondary);
  cursor: pointer;
  user-select: none;
}

.ios-checkbox {
  --checkbox-size: 24px;
  --checkbox-color: #D90D32;
  --checkbox-color-hover: #ED1638;
  --checkbox-focus: rgba(217, 13, 50, 0.20);
  --checkbox-border: rgba(255, 255, 255, 0.34);
  --checkbox-surface: rgba(18, 18, 19, 0.94);

  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
}

.ios-checkbox input {
  appearance: none;
  -webkit-appearance: none;
  position: absolute;
  left: 0;
  top: 50%;
  width: var(--checkbox-size);
  height: var(--checkbox-size);
  margin: 0;
  transform: translateY(-50%);
  opacity: 0;
  cursor: pointer;
  z-index: 2;
}

.checkbox-wrapper {
  position: relative;
  width: var(--checkbox-size);
  height: var(--checkbox-size);
  flex: 0 0 var(--checkbox-size);
  border-radius: 7px;
  transition:
    transform 180ms ease,
    filter 180ms ease;
}

.checkbox-bg {
  position: absolute;
  inset: 0;
  border-radius: 7px;
  border: 1.5px solid var(--checkbox-border);
  background: var(--checkbox-surface);
  transition:
    background-color 180ms ease,
    border-color 180ms ease,
    box-shadow 180ms ease;
}

.checkbox-icon {
  position: absolute;
  inset: 0;
  margin: auto;
  width: 78%;
  height: 78%;
  color: #FFFFFF;
  transform: scale(0);
  opacity: 0;
  transition:
    transform 180ms ease,
    opacity 180ms ease;
}

.check-path {
  stroke-dasharray: 40;
  stroke-dashoffset: 40;
  transition:
    stroke-dashoffset 260ms ease 70ms;
}

.ios-checkbox input:checked + .checkbox-wrapper .checkbox-bg {
  background: var(--checkbox-color);
  border-color: var(--checkbox-color);
  box-shadow:
    0 0 0 3px rgba(217, 13, 50, 0.12),
    0 5px 15px rgba(217, 13, 50, 0.22);
}

.ios-checkbox input:checked + .checkbox-wrapper .checkbox-icon {
  transform: scale(1);
  opacity: 1;
}

.ios-checkbox input:checked + .checkbox-wrapper .check-path {
  stroke-dashoffset: 0;
}

.ios-checkbox:hover .checkbox-wrapper {
  transform: scale(1.05);
}

.ios-checkbox:hover .checkbox-bg {
  border-color: var(--checkbox-color-hover);
}

.ios-checkbox:active .checkbox-wrapper {
  transform: scale(0.95);
}

.ios-checkbox input:focus-visible + .checkbox-wrapper .checkbox-bg {
  box-shadow:
    0 0 0 4px var(--checkbox-focus);
}

.ios-checkbox:has(input:disabled) {
  cursor: not-allowed;
  opacity: 0.46;
}

@keyframes senshi-checkbox-bounce {
  0%,
  100% {
    transform: scale(1);
  }

  50% {
    transform: scale(1.10);
  }
}

.ios-checkbox input:checked + .checkbox-wrapper {
  animation:
    senshi-checkbox-bounce
    280ms
    cubic-bezier(0.4, 0, 0.2, 1);
}

.forgot-link {
  font-size: 13px;
  color: var(--senshi-text-secondary);
  text-decoration: none;
  transition: color 0.15s ease;
}

.forgot-link:hover {
  color: var(--senshi-text);
}

/* === Mensajes === */
.form-message-slot {
  display: grid;
  grid-template-rows: 0fr;
  margin-top: 0;
  opacity: 0;
  transition:
    grid-template-rows 180ms ease,
    margin-top 180ms ease,
    opacity 150ms ease;
}

.form-message-slot.is-visible {
  grid-template-rows: 1fr;
  margin-top: 12px;
  opacity: 1;
}

.form-message {
  min-height: 0;
  overflow: hidden;
  visibility: hidden;
  pointer-events: none;
  padding: 0 12px;
  border-width: 0;
  border-style: solid;
  border-radius: var(--senshi-radius-control);
  font-size: 12.5px;
  font-weight: 500;
  line-height: 1.35;
  transition:
    min-height 180ms ease,
    padding 180ms ease,
    border-width 180ms ease;
}

.form-message-slot.is-visible .form-message {
  min-height: 44px;
  visibility: visible;
  pointer-events: auto;
  padding: 9px 12px;
  border-width: 1px;
}

.form-message--error {
  color: var(--senshi-error);
  background: rgba(251, 75, 98, 0.08);
  border-color: rgba(251, 75, 98, 0.32);
}

.form-message--success {
  color: var(--senshi-success);
  background: rgba(34, 197, 94, 0.08);
  border-color: rgba(34, 197, 94, 0.32);
}

.form-message--info {
  color: var(--senshi-text-secondary);
  background: rgba(161, 161, 166, 0.08);
  border-color: rgba(161, 161, 166, 0.25);
}

.form-message.auth-animated {
  animation: auth-message-enter 0.3s ease both;
}

.form-message.auth-animated.auth-msg-leaving {
  animation: auth-message-leave 0.35s ease forwards;
}

@keyframes auth-message-enter {
  from {
    opacity: 0;
    transform: translateY(-6px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes auth-message-leave {
  from {
    opacity: 1;
    transform: translateY(0);
    max-height: 120px;
  }
  to {
    opacity: 0;
    transform: translateY(-8px);
    max-height: 0;
  }
}

/* === Botón INGRESAR === */
.login-submit {
  position: relative;
  width: 100%;
  height: 60px;
  margin-top: 28px;
  display: grid;
  place-items: center;
  padding: 0 52px;
  font-family: inherit;
  font-size: 14px;
  font-weight: 800;
  letter-spacing: 0.10em;
  text-transform: uppercase;
  color: #FFFFFF;
  background: linear-gradient(135deg, #C8102E, #E80732);
  border: none;
  border-radius: var(--senshi-radius-control);
  cursor: pointer;
  transition: transform 0.15s ease, filter 0.15s ease, box-shadow 0.15s ease, opacity 0.15s ease;
}

.login-submit__label {
  display: block;
  width: 100%;
  text-align: center;
}

.login-submit.is-loading {
  pointer-events: none;
}

.login-submit:hover {
  transform: translateY(-1px);
  filter: brightness(1.08);
  box-shadow: 0 10px 24px rgba(232, 7, 50, 0.28);
}

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

.login-submit:focus-visible {
  outline: 2px solid #FFFFFF;
  outline-offset: 3px;
}

.login-submit:disabled {
  cursor: wait;
  opacity: 0.75;
  filter: none;
  box-shadow: none;
}

/* El texto se oculta durante loading; el loader lo reemplaza. */
.login-submit.is-loading .login-submit__label {
  visibility: hidden;
}

/* === Registro === */
.auth-register {
  text-align: center;
  padding: 8px 0;
}

.auth-register__cta {
  display: inline-block;
  font-size: 14px;
  font-weight: 600;
  color: #F01837;
  text-decoration: none;
  transition: color 0.15s ease;
}

.auth-register__cta:hover {
  color: var(--senshi-red-bright);
}

.auth-register__cta:focus-visible {
  outline: 2px solid var(--senshi-red-bright);
  outline-offset: 2px;
  border-radius: 2px;
}

.auth-register__hint {
  margin: 4px 0 0;
  font-size: 12px;
  color: var(--senshi-text-muted);
}

/* === Pie === */
.auth-card__footer {
  position: relative;
  z-index: 2;
  margin-top: auto;
  padding: 28px 42px 32px;
  text-align: center;
  font-size: 11.5px;
  font-weight: 400;
  color: #707075;
  letter-spacing: 0.02em;
}

.auth-card__footer .dot {
  margin: 0 6px;
}

/* === Aviso pendiente (toast) === */
.pending-note {
  position: fixed;
  left: 50%;
  bottom: 24px;
  transform: translateX(-50%);
  max-width: min(90vw, 420px);
  padding: 12px 18px;
  font-size: 13px;
  font-weight: 500;
  color: var(--senshi-text);
  background: var(--senshi-surface-soft);
  border: 1px solid var(--senshi-border-hover);
  border-radius: var(--senshi-radius-control);
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.5);
  text-align: center;
  z-index: 50;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

/* === Responsive === */
@media (max-width: 767px) {
  .auth-card {
    background: rgba(13, 13, 14, 0.97);
  }
}

@media (max-width: 560px) {
  .auth-page {
    padding: 12px;
  }

  .auth-card {
    border-radius: 9px;
  }

  .auth-card__content {
    padding: 0 22px;
  }

  .auth-brand {
    margin-top: 46px;
  }

  .auth-brand__logo {
    width: 78px;
    height: 78px;
  }

  .auth-brand__name {
    font-size: clamp(26px, 6vw, 30px);
  }

  .auth-brand__sub {
    font-size: 12px;
  }

  .auth-header__title {
    font-size: 25px;
  }

  .field {
    height: 58px;
  }

  .auth-card__footer {
    padding: 24px 22px 26px;
  }
}

@media (max-width: 380px) {
  .login-options {
    flex-direction: column;
    align-items: flex-start;
    gap: 12px;
  }

  .forgot-link {
    align-self: flex-start;
  }
}

@media (max-height: 820px) {
  .auth-brand {
    margin-top: 34px;
  }

  .auth-brand__logo {
    width: 74px;
    height: 74px;
  }

  .auth-brand__tagline {
    margin-top: 10px;
  }

  .auth-header {
    margin-top: 26px;
  }

  .login-form {
    margin-top: 20px;
  }

  .login-submit {
    margin-top: 24px;
  }

  .auth-card__footer {
    padding: 18px 42px 22px;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}
