: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: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: #080808;
}

.auth-card {
  position: relative;
  z-index: 2;
  width: min(100%, 478px);
  min-height: 480px;
  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;
}

/* === Topbar === */
.recover-topbar {
  position: relative;
  z-index: 3;
  display: flex;
  align-items: center;
  width: min(100%, 478px);
  padding: 14px 16px;
  margin-bottom: 16px;
  border: 1px solid var(--senshi-border);
  border-radius: var(--senshi-radius-card);
  background: rgba(13, 13, 14, 0.88);
  backdrop-filter: blur(8px);
}

.recover-topbar__link {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  color: var(--senshi-text-secondary);
  text-decoration: none;
  border-radius: 8px;
  transition: color 180ms, background 180ms;
  flex-shrink: 0;
}

.recover-topbar__link:hover {
  color: var(--senshi-text);
  background: rgba(255, 255, 255, 0.05);
}

.recover-topbar__arrow {
  width: 18px;
  height: 18px;
}

.recover-topbar__brand {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
}

.recover-topbar__logo {
  flex-shrink: 0;
  width: 96px;
  height: 96px;
  border-radius: 14px;
  overflow: hidden;
  background: rgba(7, 7, 8, 0.28);
  border: 1px solid rgba(255, 255, 255, 0.10);
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.28);
  margin-bottom: 6px;
}

.recover-topbar__logo img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
}

.recover-topbar__name {
  font-size: 20px;
  font-weight: 800;
  letter-spacing: 0.16em;
  color: #FFFFFF;
  line-height: 1;
}

.recover-topbar__sub {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.18em;
  color: var(--senshi-red-bright);
  text-transform: uppercase;
  line-height: 1;
}

.recover-topbar__spacer {
  width: 36px;
  flex-shrink: 0;
}

@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: 32px 24px 28px;
  overflow-y: auto;
  gap: 28px;
}

/* Respiro entre el último botón de cada panel y el footer */
.recover-panel > .submit-btn:last-child,
.recovery-status ~ .submit-btn,
.recovery-contact ~ .submit-btn {
  margin-top: 8px;
  margin-bottom: 4px;
}

.back-link {
  display: none;
}

.auth-header {
  text-align: center;
  margin-bottom: 4px;
}

.auth-header__title {
  font-size: 22px;
  font-weight: 700;
  letter-spacing: -0.01em;
  margin: 0 0 12px;
  color: var(--senshi-text);
  line-height: 1.2;
}

.auth-header__rule {
  width: 48px;
  height: 2px;
  background: linear-gradient(90deg, transparent, var(--senshi-red-bright), transparent);
  margin: 0 auto 12px;
  border-radius: 1px;
}

.auth-header__subtitle {
  font-size: 13px;
  color: var(--senshi-text-secondary);
  margin: 0;
  line-height: 1.5;
}

.recover-form {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.field {
  position: relative;
  display: flex;
  align-items: stretch;
}

.floating-field {
  flex-direction: column;
}

.floating-field input,
.floating-field select {
  order: 2;
  padding-top: 18px;
  padding-bottom: 8px;
  background: var(--senshi-input);
  color: var(--senshi-text);
  border: 1px solid var(--senshi-border);
  border-radius: var(--senshi-radius-control);
  font-size: 14px;
  font-weight: 500;
  transition: border-color 180ms, background 180ms;
  padding-left: 40px;
}

.floating-field input:focus,
.floating-field select:focus {
  outline: none;
  border-color: var(--senshi-red-bright);
  box-shadow: 0 0 0 2px rgba(237, 22, 56, 0.1);
}

.floating-field input:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.floating-field label {
  order: 1;
  position: absolute;
  top: 14px;
  left: 40px;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.03em;
  color: var(--senshi-text-muted);
  transform-origin: left top;
  transition: transform 180ms, color 180ms;
  pointer-events: none;
  text-transform: uppercase;
}

.floating-field input:focus ~ label,
.floating-field input:not(:placeholder-shown) ~ label,
.floating-field select:focus ~ label,
.floating-field select:not(:invalid) ~ label {
  transform: translateY(-22px) scale(0.85);
  color: var(--senshi-text-secondary);
}

.floating-field input:-webkit-autofill ~ label {
  transform: translateY(-22px) scale(0.85);
  color: var(--senshi-text-secondary);
}

.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--date label,
.floating-field input[type="date"] ~ label {
  transform: translateY(-22px) scale(0.85);
  color: var(--senshi-text-secondary);
}

.floating-field input.is-invalid,
.floating-field select.is-invalid {
  border-color: var(--senshi-error);
}

.field__icon {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  z-index: 2;
  width: 20px;
  height: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--senshi-text-muted);
  pointer-events: none;
  flex-shrink: 0;
}

.field__icon svg {
  width: 100%;
  height: 100%;
  stroke: currentColor;
}

.field--password input {
  padding-right: 58px;
}

.field--date input {
  cursor: pointer;
}

.form-message-slot {
  max-height: 0;
  overflow: hidden;
  transition: max-height 180ms ease;
}

.form-message-slot.is-visible {
  max-height: 200px;
}

.form-message {
  font-size: 13px;
  font-weight: 500;
  padding: 12px 12px;
  border-radius: var(--senshi-radius-control);
  line-height: 1.4;
  margin: 0;
}

.form-message--error {
  background: rgba(251, 75, 98, 0.12);
  color: var(--senshi-error);
  border: 1px solid rgba(251, 75, 98, 0.25);
}

.form-message--success {
  background: rgba(34, 197, 94, 0.12);
  color: var(--senshi-success);
  border: 1px solid rgba(34, 197, 94, 0.25);
}

.submit-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 11px 18px;
  background: linear-gradient(135deg, var(--senshi-red-bright), var(--senshi-red));
  color: #fff;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: var(--senshi-radius-control);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  cursor: pointer;
  transition: all 180ms;
  position: relative;
  min-height: 44px;
  min-width: 160px;
}

.submit-btn:hover:not(:disabled) {
  box-shadow: 0 8px 24px rgba(237, 22, 56, 0.3);
  transform: translateY(-2px);
}

.submit-btn:focus {
  outline: none;
  box-shadow: 0 0 0 2px var(--senshi-bg), 0 0 0 4px var(--senshi-red-bright);
}

.submit-btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  transform: none;
}

.submit-btn:active:not(:disabled) {
  transform: translateY(0);
}

.submit-btn--primary {
  background: linear-gradient(135deg, var(--senshi-red-bright), var(--senshi-red));
  box-shadow: 0 4px 12px rgba(237, 22, 56, 0.25);
}

.submit-btn--ghost {
  background: transparent;
  color: var(--senshi-text-secondary);
  border-color: var(--senshi-border);
  box-shadow: none;
}

.submit-btn--ghost:hover:not(:disabled) {
  color: var(--senshi-text);
  border-color: var(--senshi-border-hover);
  background: rgba(255, 255, 255, 0.05);
  box-shadow: none;
}

.submit-btn__label {
  display: inline-block;
}

.recover-panel {
  display: none;
  animation: panel-in 0.3s ease both;
}

.recover-panel.is-active {
  display: contents;
}

@keyframes panel-in {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.recovery-methods {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.recovery-methods__title {
  font-size: 14px;
  font-weight: 600;
  color: var(--senshi-text-secondary);
  margin: 0 0 4px;
  text-transform: uppercase;
  letter-spacing: 0.02em;
}

.recovery-method {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 16px;
  background: var(--senshi-surface);
  border: 1px solid var(--senshi-border);
  border-radius: var(--senshi-radius-control);
  cursor: pointer;
  transition: all 180ms;
  text-align: left;
  color: var(--senshi-text);
}

.recovery-method:hover {
  background: rgba(255, 255, 255, 0.05);
  border-color: var(--senshi-border-hover);
  transform: translateX(4px);
}

.recovery-method:focus {
  outline: none;
  border-color: var(--senshi-red-bright);
  box-shadow: 0 0 0 2px rgba(237, 22, 56, 0.1);
}

.recovery-method__icon {
  width: 32px;
  height: 32px;
  min-width: 32px;
  color: var(--senshi-red-bright);
  display: flex;
  align-items: center;
  justify-content: center;
}

.recovery-method__icon svg {
  width: 100%;
  height: 100%;
}

.recovery-method__body {
  flex: 1;
}

.recovery-method__title {
  font-size: 14px;
  font-weight: 600;
  margin: 0 0 4px;
  line-height: 1.3;
}

.recovery-method__desc {
  font-size: 12px;
  color: var(--senshi-text-secondary);
  margin: 0;
  line-height: 1.4;
}

.recovery-status,
.recovery-success,
.recovery-contact {
  text-align: center;
  padding: 24px 0;
}

.recovery-status__icon,
.recovery-success__icon,
.recovery-contact__icon {
  width: 64px;
  height: 64px;
  margin: 0 auto 16px;
  color: var(--senshi-success);
  display: flex;
  align-items: center;
  justify-content: center;
}

.recovery-status__icon svg,
.recovery-success__icon svg,
.recovery-contact__icon svg {
  width: 100%;
  height: 100%;
}

.recovery-status__title,
.recovery-success__title,
.recovery-contact__title {
  font-size: 18px;
  font-weight: 700;
  margin: 0 0 12px;
  line-height: 1.3;
}

.recovery-status__text,
.recovery-success__text,
.recovery-contact__text {
  font-size: 14px;
  color: var(--senshi-text-secondary);
  margin: 0 0 12px;
  line-height: 1.5;
}

.recovery-contact__hint {
  font-size: 12px;
  color: var(--senshi-text-muted);
  margin: 0;
  line-height: 1.4;
}

.strength {
  padding: 12px;
  background: rgba(237, 22, 56, 0.08);
  border: 1px solid rgba(237, 22, 56, 0.2);
  border-radius: var(--senshi-radius-control);
}

.strength__label {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--senshi-text-muted);
  margin: 0 0 8px;
}

.strength__list {
  list-style: none;
  margin: 0 0 12px;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.strength__item {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  color: var(--senshi-text-secondary);
  line-height: 1.3;
}

.strength__indicator {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.2);
  flex-shrink: 0;
  transition: background 180ms;
}

.strength__item.is-met .strength__indicator {
  background: var(--senshi-success);
}

.strength__bar {
  width: 100%;
  height: 3px;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 2px;
  overflow: hidden;
}

.strength__bar-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--senshi-error), var(--senshi-red-bright));
  border-radius: 2px;
  width: 0;
  transition: width 180ms;
}

.strength__bar-fill.is-medium {
  background: linear-gradient(90deg, var(--senshi-red-bright), #FFA500);
}

.strength__bar-fill.is-strong {
  background: var(--senshi-success);
}

.auth-card__footer {
  flex-shrink: 0;
  padding: 12px 24px;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  text-align: center;
  font-size: 11px;
  color: var(--senshi-text-muted);
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 6px;
  animation: footer-breathe 4s ease-in-out infinite;
}

@keyframes footer-breathe {
  0%, 100% {
    opacity: 0.7;
  }
  50% {
    opacity: 1;
  }
}

.dot {
  width: 2px;
  height: 2px;
  background: currentColor;
  border-radius: 50%;
}

/* === Responsive === */
@media (max-width: 480px) {
  .recover-topbar {
    width: 100%;
    padding: 10px 12px;
    margin-bottom: 12px;
  }

  .recover-topbar__logo {
    width: 72px;
    height: 72px;
  }

  .recover-topbar__name {
    font-size: 16px;
  }

  .recover-topbar__sub {
    font-size: 9px;
  }

  .auth-card {
    width: 100%;
    min-height: 420px;
  }

  .auth-card__content {
    padding: 24px 16px;
    gap: 20px;
  }

  .auth-header__title {
    font-size: 20px;
  }

  .submit-btn {
    min-width: 140px;
    font-size: 11px;
  }

  .auth-card__footer {
    padding: 10px 16px;
  }
}

@media (max-width: 560px) {
  .auth-card__content {
    padding: 24px 16px;
    gap: 20px;
  }

  .auth-header__title {
    font-size: 20px;
  }

  .submit-btn {
    min-width: 140px;
    font-size: 11px;
  }

  .auth-card__footer {
    padding: 10px 16px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .auth-card__footer {
    animation: none;
  }
}
