/* ==========================================================================
   Login / Registro — NextPatch
   Prototipo visual. Estilos extraídos de la maqueta original (antes inline).
   Paleta: primario índigo #635BFF, acento coral #FF7A59, fondo oscuro #12141D.
   ========================================================================== */

*,
*::before,
*::after {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  height: 100%;
}

body {
  font-family: 'Outfit', system-ui, sans-serif;
  background: #fbfbf8;
  color: #16201c;
  font-size: 15px;
  line-height: 1.6;
}

:where(a, button, input, [tabindex]):focus-visible {
  outline: 3px solid #ff7a59;
  outline-offset: 3px;
}

input::placeholder {
  color: #66736b;
}

@keyframes brk-float {
  0%,
  100% {
    transform: translateY(0);
  }
  50% {
    transform: translateY(-10px);
  }
}

@keyframes brk-blink {
  0%,
  45%,
  55%,
  100% {
    opacity: 1;
  }
  48%,
  52% {
    opacity: 0;
  }
}

/* Layout ------------------------------------------------------------------ */

.login-page {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 1.05fr 1fr;
  background: #fbfbf8;
}

.panel {
  position: relative;
}

/* Panel izquierdo: ilustración ------------------------------------------- */

.panel--visual {
  overflow: hidden;
  background: #12141d;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 44px 48px;
}

.blob {
  position: absolute;
  border-radius: 50%;
}

.blob--primary {
  width: 420px;
  height: 420px;
  background: radial-gradient(circle at 30% 30%, #635bff, transparent 70%);
  top: -120px;
  right: -100px;
  opacity: 0.55;
  filter: blur(60px);
}

.blob--accent {
  width: 340px;
  height: 340px;
  background: radial-gradient(circle at 50% 50%, #ff7a59, transparent 70%);
  bottom: -140px;
  left: -90px;
  opacity: 0.22;
}

.brand {
  position: relative;
  display: flex;
  align-items: center;
  gap: 12px;
}

.brand__mark {
  width: 40px;
  height: 40px;
  border-radius: 11px;
  background: #635bff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: 'JetBrains Mono', monospace;
  font-weight: 500;
  font-size: 22px;
  color: #12141d;
  box-shadow: 0 4px 14px rgba(99, 91, 255, 0.35);
}

.brand__name {
  font-family: 'Outfit', sans-serif;
  font-weight: 600;
  font-size: 22px;
  color: #fbfbf8;
  letter-spacing: -0.02em;
}

.visual__content {
  position: relative;
  max-width: 440px;
}

.visual__title {
  font-family: 'Outfit', sans-serif;
  font-weight: 600;
  font-size: 40px;
  line-height: 1.1;
  letter-spacing: -0.03em;
  color: #fbfbf8;
  margin: 0 0 16px;
}

.visual__title .accent {
  color: #635bff;
}

.visual__subtitle {
  font-size: 15.5px;
  line-height: 1.6;
  color: #94a3b8;
  margin: 0 0 32px;
}

/* Mock de editor de código */

.editor {
  animation: brk-float 6s ease-in-out infinite;
  border-radius: 14px;
  overflow: hidden;
  background: #eef1f5;
  border: 1px solid rgba(15, 23, 42, 0.1);
  box-shadow: 0 24px 50px -20px rgba(0, 0, 0, 0.5);
}

.editor__bar {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 11px 14px;
  background: #e2e7ee;
  border-bottom: 1px solid rgba(15, 23, 42, 0.09);
}

.editor__run {
  width: 14px;
  height: 14px;
  border-radius: 4px;
  background: rgba(255, 122, 89, 0.16);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-family: 'JetBrains Mono', monospace;
  font-size: 9px;
  color: #ff7a59;
}

.editor__file {
  font-family: 'JetBrains Mono', monospace;
  font-size: 11.5px;
  color: #94a3b8;
}

.editor__code {
  margin: 0;
  padding: 16px 18px;
  font-family: 'JetBrains Mono', monospace;
  font-size: 13px;
  line-height: 1.75;
  color: #12141d;
}

.tok-kw {
  color: #4f46e5;
}
.tok-type {
  color: #2563eb;
}
.tok-fn {
  color: #635bff;
}
.tok-str {
  color: #15803d;
}
.tok-num {
  color: #ff7a59;
}
.tok-op {
  color: #6b756f;
}

.editor__caret {
  display: inline-block;
  width: 8px;
  height: 16px;
  background: #635bff;
  vertical-align: -3px;
  margin-left: 2px;
  animation: brk-blink 1.1s step-end infinite;
}

/* Panel derecho: formulario ---------------------------------------------- */

.panel--form {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 40px 32px;
}

.form {
  width: 100%;
  max-width: 400px;
}

.form__heading {
  font-family: 'Outfit', sans-serif;
  font-weight: 600;
  font-size: clamp(1.8rem, 4vw, 2.2rem);
  line-height: 1.2;
  letter-spacing: 0;
  color: #16201c;
  margin: 0 0 6px;
}

.form__subheading {
  font-size: 14.5px;
  color: #6b756f;
  line-height: 1.55;
  margin: 0 0 24px;
}

/* Toggle segmentado login / signup */

.toggle {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 4px;
  padding: 4px;
  background: #f0f1ee;
  border-radius: 12px;
  margin-bottom: 26px;
}

.toggle__btn {
  min-height: 44px;
  padding: 10px;
  border: none;
  border-radius: 9px;
  font-family: 'Outfit', sans-serif;
  font-weight: 600;
  font-size: 14px;
  cursor: pointer;
  transition: background-color 0.15s ease, color 0.15s ease, box-shadow 0.15s ease;
  background: transparent;
  color: #6b756f;
}

.toggle__btn.is-active {
  background: #fff;
  color: #16201c;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
}

/* Botón de Google */

.btn-google {
  width: 100%;
  text-decoration: none; /* ahora es un <a> hacia /oauth2/authorization/google */
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  min-height: 46px;
  padding: 12px 13px;
  border: 1.5px solid #e4e6e2;
  border-radius: 12px;
  background: #fff;
  font-family: 'Outfit', sans-serif;
  font-weight: 600;
  font-size: 14.5px;
  color: #16201c;
  cursor: pointer;
  transition: border-color 0.15s ease, background-color 0.15s ease;
}

.btn-google:hover {
  border-color: #cfd3ce;
  background: #f7f8f6;
}

/* Cada control tiene su propio significado de hover: el toggle inactivo solo
   insinúa que es clicable, Google conserva su propio botón neutro (ya
   definido junto a `.btn-google`, más abajo) y la acción primaria se aclara
   en índigo — el coral queda reservado a racha/XP/celebración, nunca a un
   hover genérico. */
@media (hover: hover) and (pointer: fine) {
  .toggle__btn:not(.is-active):hover {
    color: #16201c;
    background: rgba(22, 32, 28, 0.05);
  }

  .btn-submit:hover {
    background: #756eff;
    box-shadow: 0 10px 26px -6px rgba(99, 91, 255, 0.55);
  }
}

.toggle__btn,
.btn-google,
.btn-submit {
  transition: transform 150ms ease, background-color 150ms ease,
    border-color 150ms ease, color 150ms ease, opacity 150ms ease,
    box-shadow 150ms ease;
}

.toggle__btn:active,
.btn-google:active,
.btn-submit:active {
  transform: translateY(1px) scale(0.985);
  transition-duration: 120ms;
}

/* Divisor */

.divider {
  display: flex;
  align-items: center;
  gap: 14px;
  margin: 22px 0;
}

.divider__line {
  flex: 1;
  height: 1px;
  background: #e4e6e2;
}

.divider__text {
  font-size: 12.5px;
  color: #9aa39e;
}

/* Campos */

.field {
  margin-bottom: 16px;
}

.field[hidden] {
  display: none;
}

.field__label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: #3d453f;
  margin-bottom: 8px;
}

.field__input {
  width: 100%;
  min-height: 46px;
  padding: 12px 15px;
  border: 1.5px solid #e4e6e2;
  border-radius: 12px;
  font-family: 'Outfit', sans-serif;
  font-size: 14.5px;
  color: #16201c;
  background: #fff;
  transition: border-color 0.12s, box-shadow 0.12s;
}

.field__input:focus {
  border-color: #635bff;
  box-shadow: 0 0 0 4px rgba(99, 91, 255, 0.12);
}

.field__password {
  position: relative;
}

.field__password .field__input {
  padding-right: 46px;
}

.field__toggle {
  position: absolute;
  right: 6px;
  top: 50%;
  transform: translateY(-50%);
  border: none;
  background: transparent;
  cursor: pointer;
  padding: 8px;
  font-size: 12.5px;
  font-weight: 600;
  color: #6b756f;
}

/* Recordarme + olvidé contraseña */

.form__row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 24px;
}

.remember {
  display: flex;
  align-items: center;
  gap: 9px;
  cursor: pointer;
  font-size: 13.5px;
  color: #3d453f;
  user-select: none;
}

.remember__input {
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0;
}

.remember__box {
  width: 20px;
  height: 20px;
  border-radius: 6px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 600;
  transition: all 0.12s;
  background: #fff;
  border: 1.5px solid #cfd3ce;
  color: transparent;
}

.remember__box::after {
  content: '✓';
}

.remember__input:checked + .remember__box {
  background: #635bff;
  border-color: #635bff;
  color: #fff;
}

.remember__input:focus-visible + .remember__box {
  box-shadow: 0 0 0 3px rgba(99, 91, 255, 0.3);
}

.link {
  font-size: 13.5px;
  font-weight: 600;
  color: #635bff;
  text-decoration: none;
}

.link--bold {
  font-weight: 600;
}

/* Botón principal */

.btn-submit {
  width: 100%;
  min-height: 48px;
  padding: 13px 14px;
  border: none;
  border-radius: 12px;
  background: #635bff;
  color: #fff;
  font-family: 'Outfit', sans-serif;
  font-weight: 600;
  font-size: 15.5px;
  cursor: pointer;
  box-shadow: 0 8px 20px -6px rgba(99, 91, 255, 0.5);
  transition: background-color 0.15s ease, box-shadow 0.15s ease;
}

.form__switch {
  text-align: center;
  font-size: 14px;
  color: #6b756f;
  margin: 22px 0 0;
}

/* Responsive -------------------------------------------------------------- */

@media (max-width: 860px) {
  .login-page {
    grid-template-columns: 1fr;
  }

  .panel--visual {
    display: none;
  }
}

/* Avisos del servidor (login/registro) ------------------------------------ */

.form__alert {
  margin: 0 0 16px;
  padding: 10px 14px;
  border-radius: 10px;
  font-size: 0.88rem;
  line-height: 1.4;
}

.form__alert--error {
  background: #fdecea;
  color: #b3261e;
  border: 1px solid #f5c6c2;
}

.form__alert--success {
  background: #e8f5ee;
  color: #1e7a4c;
  border: 1px solid #bfe3d0;
}
