/* ============================================================
   LOGIN — Split-screen con fondo de partículas
   Verde olivo institucional
   ============================================================ */

:root {
  --olivo-principal: #556B2F;
  --olivo-oscuro:    #3E4E1F;
  --olivo-claro:     #7A8B4F;
  --olivo-muy-claro: #B5C090;
  --olivo-pale:      #F4F6EE;
  --olivo-border:    #E2E6D5;
  --dorado:          #C9A227;
  --dorado-claro:    #E5C158;
  --fondo-oscuro:    #1E2A14;
  --fondo-oscuro-2:  #2F3C18;
}

/* ============================================================
   HTML + BODY — Fondo completo siempre
   ============================================================ */
html {
  min-height: 100%;
  background: #1E2A14; /* Fondo base por si todo falla */
}

/* ============================================================
   RESET Y BODY
   ============================================================ */
*, *::before, *::after { box-sizing: border-box; }

body.login-body {
  margin: 0;
  min-height: 100vh;
  min-height: 100dvh; /* Altura dinámica del viewport */
  font-family: 'Inter', -apple-system, sans-serif;
  background: #1E2A14;
  color: #fff;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
  position: relative;
}

/* ============================================================
   CANVAS DE PARTÍCULAS
   ============================================================ */
.particles-canvas {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: 0;
  pointer-events: none;
  opacity: .7;
}

/* Radial glow decorativo */
body.login-body::before {
  content: '';
  position: fixed;
  top: -30%;
  left: -10%;
  width: 60%;
  height: 60%;
  background: radial-gradient(circle, rgba(122, 139, 79, .25) 0%, transparent 70%);
  filter: blur(80px);
  pointer-events: none;
  z-index: 0;
}
body.login-body::after {
  content: '';
  position: fixed;
  bottom: -30%;
  right: -10%;
  width: 60%;
  height: 60%;
  background: radial-gradient(circle, rgba(201, 162, 39, .18) 0%, transparent 70%);
  filter: blur(80px);
  pointer-events: none;
  z-index: 0;
}

/* ============================================================
   LAYOUT GENERAL
   ============================================================ */
.login-page {
  position: relative;
  z-index: 1;
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 40px 24px;
}

.login-container {
  display: grid;
  grid-template-columns: 1fr 1fr;
  width: 100%;
  max-width: 1040px;
  min-height: 620px;
  background: #fff;
  border-radius: 24px;
  overflow: hidden;
  box-shadow:
    0 40px 100px -20px rgba(0, 0, 0, .55),
    0 0 0 1px rgba(255, 255, 255, .05);
  animation: loginIn .7s cubic-bezier(.16, 1, .3, 1);
}

@keyframes loginIn {
  from {
    opacity: 0;
    transform: translateY(30px) scale(.97);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

/* ============================================================
   PANEL IZQUIERDO — Foto institucional
   ============================================================ */
.login-panel--photo {
  position: relative;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  color: #fff;
}

.login-panel__bg {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  z-index: 1;
  animation: bgZoom 25s ease-in-out infinite alternate;
}

@keyframes bgZoom {
  from { transform: scale(1); }
  to   { transform: scale(1.08); }
}

.login-panel__overlay {
  position: absolute;
  inset: 0;
  z-index: 2;
  background:
    linear-gradient(135deg, rgba(62, 78, 31, .95) 0%, rgba(85, 107, 47, .82) 60%, rgba(30, 42, 20, .95) 100%);
}

.login-panel__content {
  position: relative;
  z-index: 3;
  padding: 48px 44px;
  display: flex;
  flex-direction: column;
  flex: 1;
}

/* Brand */
.login-panel__brand {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 60px;
}
.login-panel__logo {
  width: 54px;
  height: 54px;
  object-fit: contain;
  filter: drop-shadow(0 6px 20px rgba(0, 0, 0, .3));
}
.login-panel__brand-text {
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.login-panel__brand-title {
  font-size: 1rem;
  font-weight: 800;
  letter-spacing: -.01em;
  color: #fff;
}
.login-panel__brand-sub {
  font-size: .75rem;
  color: rgba(255, 255, 255, .75);
  font-weight: 500;
}

/* Títulos */
.login-panel__title {
  font-size: 2.2rem;
  font-weight: 900;
  line-height: 1.15;
  letter-spacing: -.035em;
  margin: 0 0 18px;
  text-shadow: 0 4px 20px rgba(0, 0, 0, .25);
}
.login-panel__subtitle {
  font-size: .95rem;
  line-height: 1.6;
  color: rgba(255, 255, 255, .85);
  margin: 0 0 32px;
  max-width: 400px;
}

/* Lista de features */
.login-panel__list {
  list-style: none;
  padding: 0;
  margin: auto 0 0;
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.login-panel__list li {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: .88rem;
  color: rgba(255, 255, 255, .9);
  font-weight: 500;
}
.login-panel__list i {
  color: var(--dorado-claro);
  font-size: 1.1rem;
  flex-shrink: 0;
}

/* Footer del panel izquierdo */
.login-panel__footer {
  position: relative;
  z-index: 3;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 16px;
  background: rgba(0, 0, 0, .25);
  font-size: .75rem;
  color: rgba(255, 255, 255, .65);
  text-transform: uppercase;
  letter-spacing: .1em;
  font-weight: 600;
  backdrop-filter: blur(10px);
}
.login-panel__footer i { color: var(--dorado-claro); }

/* ============================================================
   PANEL DERECHO — Formulario
   ============================================================ */
.login-panel--form {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 48px 44px;
  background: #fff;
}

.login-form {
  width: 100%;
  max-width: 380px;
}

/* Head del formulario */
.login-form__head {
  text-align: center;
  margin-bottom: 32px;
}
.login-form__logo {
  width: 100px;
  height: 100px;
  object-fit: contain;
  margin: 0 auto 16px;
}
.login-form__title {
  font-size: 1.6rem;
  font-weight: 800;
  letter-spacing: -.025em;
  color: var(--olivo-oscuro);
  margin: 0 0 6px;
}
.login-form__subtitle {
  font-size: .88rem;
  color: #64748b;
  margin: 0;
}

/* ============================================================
   ALERTAS
   ============================================================ */
.alert {
  display: none;
  padding: 12px 16px;
  border-radius: 12px;
  font-size: .85rem;
  line-height: 1.5;
  margin-bottom: 20px;
  border: 1px solid transparent;
  animation: alertIn .3s ease;
}
.alert.is-visible { display: block; }
@keyframes alertIn {
  from { opacity: 0; transform: translateY(-6px); }
  to   { opacity: 1; transform: translateY(0); }
}

.alert--error   { background: #fef2f2; color: #991b1b; border-color: #fecaca; }
.alert--success { background: #ecfdf5; color: #065f46; border-color: #a7f3d0; }
.alert--info    { background: var(--olivo-pale); color: var(--olivo-oscuro); border-color: var(--olivo-border); }

/* ============================================================
   FORMULARIO
   ============================================================ */
.form-group {
  margin-bottom: 18px;
}

.form-label {
  display: block;
  font-size: .82rem;
  font-weight: 700;
  color: var(--olivo-oscuro);
  margin-bottom: 8px;
  letter-spacing: .01em;
}

.form-control-wrap {
  position: relative;
}

.form-control-icon {
  position: absolute;
  left: 16px;
  top: 50%;
  transform: translateY(-50%);
  color: #94a3b8;
  font-size: 1rem;
  pointer-events: none;
  transition: color 200ms;
  z-index: 1;
}

.form-control {
  width: 100%;
  height: 52px;
  padding: 0 16px 0 46px;
  border: 1.5px solid var(--olivo-border);
  border-radius: 12px;
  font-size: .95rem;
  font-family: inherit;
  background: #fff;
  color: #0f172a;
  outline: none;
  transition: all 200ms;
}
.form-control--with-action {
  padding-right: 52px;
}
.form-control::placeholder {
  color: #94a3b8;
  font-weight: 400;
}
.form-control:hover {
  border-color: var(--olivo-muy-claro);
}
.form-control:focus {
  border-color: var(--olivo-principal);
  box-shadow: 0 0 0 4px rgba(85, 107, 47, .12);
}
.form-control:focus ~ .form-control-icon {
  color: var(--olivo-principal);
}
.form-control.is-invalid {
  border-color: #ef4444;
  box-shadow: 0 0 0 4px rgba(239, 68, 68, .1);
}

/* Botón mostrar/ocultar contraseña */
.form-action-btn {
  position: absolute;
  right: 8px;
  top: 50%;
  transform: translateY(-50%);
  width: 40px;
  height: 40px;
  border: 0;
  background: transparent;
  color: #94a3b8;
  border-radius: 8px;
  cursor: pointer;
  display: grid;
  place-items: center;
  font-size: 1.05rem;
  transition: all 200ms;
}
.form-action-btn:hover {
  background: var(--olivo-pale);
  color: var(--olivo-principal);
}

/* Errores */
.field-error {
  display: none;
  font-size: .78rem;
  color: #dc2626;
  margin-top: 6px;
  padding-left: 4px;
  font-weight: 500;
}
.field-error.is-visible { display: block; }

/* ============================================================
   OPCIONES (recordarme + olvidé)
   ============================================================ */
.form-options {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin: 20px 0 24px;
  gap: 12px;
}

.checkbox-wrap {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
  user-select: none;
  font-size: .85rem;
  color: #475569;
  font-weight: 500;
}
.checkbox-wrap input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}
.checkbox-box {
  width: 20px;
  height: 20px;
  border: 1.5px solid var(--olivo-border);
  border-radius: 6px;
  background: #fff;
  position: relative;
  transition: all 200ms;
  flex-shrink: 0;
}
.checkbox-wrap input:checked + .checkbox-box {
  background: var(--olivo-principal);
  border-color: var(--olivo-principal);
}
.checkbox-wrap input:checked + .checkbox-box::after {
  content: '';
  position: absolute;
  left: 6px;
  top: 2px;
  width: 5px;
  height: 10px;
  border: solid #fff;
  border-width: 0 2px 2px 0;
  transform: rotate(45deg);
}
.checkbox-wrap:hover .checkbox-box {
  border-color: var(--olivo-muy-claro);
}

.form-link {
  color: var(--olivo-principal);
  text-decoration: none;
  font-size: .85rem;
  font-weight: 600;
  transition: color 200ms;
}
.form-link:hover {
  color: var(--olivo-oscuro);
  text-decoration: underline;
}

/* ============================================================
   BOTÓN DE LOGIN
   ============================================================ */
.btn-login {
  position: relative;
  width: 100%;
  height: 56px;
  border: 0;
  border-radius: 14px;
  background: linear-gradient(135deg, var(--olivo-claro), var(--olivo-principal) 50%, var(--olivo-oscuro));
  color: #fff;
  font-size: .98rem;
  font-weight: 800;
  letter-spacing: .02em;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  overflow: hidden;
  box-shadow: 0 12px 28px -10px rgba(85, 107, 47, .55);
  transition: all 250ms cubic-bezier(.4, 0, .2, 1);
  font-family: inherit;
}
.btn-login::before {
  content: '';
  position: absolute;
  top: 0; left: -100%;
  width: 100%; height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, .2), transparent);
  transition: left 600ms;
}
.btn-login:hover:not(:disabled)::before {
  left: 100%;
}
.btn-login:hover:not(:disabled) {
  transform: translateY(-2px);
  box-shadow: 0 18px 36px -10px rgba(85, 107, 47, .7);
}
.btn-login:active:not(:disabled) {
  transform: translateY(0);
}
.btn-login:disabled {
  opacity: .7;
  cursor: not-allowed;
  box-shadow: none;
}

.btn-login__icon { font-size: 1.05rem; }
.btn-login__arrow {
  transition: transform 250ms;
  font-size: 1rem;
}
.btn-login:hover:not(:disabled) .btn-login__arrow {
  transform: translateX(4px);
}

/* Spinner */
.btn-login .spinner {
  width: 18px;
  height: 18px;
  border: 2.5px solid rgba(255, 255, 255, .35);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin .7s linear infinite;
  display: none;
}
.btn-login.is-loading .spinner { display: inline-block; }
.btn-login.is-loading .btn-login__icon,
.btn-login.is-loading .btn-login__arrow { display: none; }
.btn-login.is-loading .btn-text::after {
  content: '...';
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ============================================================
   AVISO INSTITUCIONAL
   ============================================================ */
.login-form__notice {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  padding: 14px 16px;
  background: var(--olivo-pale);
  border: 1px solid var(--olivo-border);
  border-radius: 12px;
  margin-top: 24px;
  font-size: .78rem;
  line-height: 1.5;
  color: var(--olivo-oscuro);
}
.login-form__notice i {
  color: var(--dorado);
  font-size: 1rem;
  flex-shrink: 0;
  margin-top: 1px;
}

/* ============================================================
   FOOTER DEL FORMULARIO
   ============================================================ */
.login-form__footer {
  margin-top: 24px;
  padding-top: 20px;
  border-top: 1px solid var(--olivo-border);
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: .78rem;
  color: #94a3b8;
  flex-wrap: wrap;
  gap: 8px;
}
.form-link--back {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--olivo-principal);
  font-size: .8rem;
}

/* ============================================================
   RESPONSIVE
   ============================================================ */
@media (max-width: 900px) {
  .login-page { padding: 20px 16px; }

  .login-container {
    grid-template-columns: 1fr;
    max-width: 480px;
    min-height: auto;
    border-radius: 20px;
  }

  /* Panel izquierdo se convierte en banner superior */
  .login-panel--photo {
    min-height: 220px;
  }
  .login-panel__content {
    padding: 32px 28px 28px;
    text-align: center;
    align-items: center;
  }
  .login-panel__brand {
    margin-bottom: 20px;
    flex-direction: column;
    gap: 10px;
  }
  .login-panel__brand-text { align-items: center; }
  .login-panel__logo { width: 48px; height: 48px; }
  .login-panel__title {
    font-size: 1.5rem;
    margin-bottom: 8px;
  }
  .login-panel__title br { display: none; }
  .login-panel__subtitle {
    font-size: .85rem;
    margin-bottom: 0;
  }
  .login-panel__list,
  .login-panel__footer {
    display: none;
  }

  .login-panel--form {
    padding: 32px 24px;
  }

  .login-form { max-width: 100%; }
  .login-form__head { margin-bottom: 24px; }
  .login-form__logo { width: 48px; height: 48px; }
  .login-form__title { font-size: 1.35rem; }

  .form-options { flex-direction: column; align-items: flex-start; gap: 12px; }

  .login-form__footer { justify-content: center; text-align: center; }
}

@media (max-width: 400px) {
  .login-form__title { font-size: 1.2rem; }
  .form-control { height: 48px; font-size: .9rem; }
  .btn-login { height: 52px; font-size: .92rem; }
}

/* ============================================================
   PREFERS REDUCED MOTION
   ============================================================ */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .01ms !important;
    transition-duration: .01ms !important;
  }
  .particles-canvas { display: none; }
}

/* ============================================================
   ICONO CIRCULAR PARA RECUPERACIÓN
   ============================================================ */
.recover-icon {
  width: 72px;
  height: 72px;
  border-radius: 20px;
  display: grid;
  place-items: center;
  font-size: 2rem;
  color: #fff;
  margin: 0 auto 20px;
  box-shadow: 0 15px 35px -12px rgba(0, 0, 0, .3);
  position: relative;
}
.recover-icon::after {
  content: '';
  position: absolute;
  inset: -6px;
  border-radius: 26px;
  border: 2px solid currentColor;
  opacity: .15;
  animation: pulseRing 2.5s ease-in-out infinite;
}
@keyframes pulseRing {
  0%, 100% { transform: scale(1); opacity: .15; }
  50%      { transform: scale(1.06); opacity: .08; }
}

.recover-icon--blue {
  background: linear-gradient(135deg, var(--olivo-claro), var(--olivo-principal));
  color: #fff;
}
.recover-icon--green {
  background: linear-gradient(135deg, #10b981, #059669);
  color: #fff;
}
.recover-icon--red {
  background: linear-gradient(135deg, #ef4444, #dc2626);
  color: #fff;
}

/* ============================================================
   INDICADOR DE FUERZA DE CONTRASEÑA
   ============================================================ */
.password-strength {
  margin-top: -6px;
  margin-bottom: 20px;
}
.password-strength__bars {
  display: flex;
  gap: 4px;
  margin-bottom: 6px;
}
.password-strength__bars span {
  flex: 1;
  height: 4px;
  background: var(--olivo-border);
  border-radius: 2px;
  transition: all 300ms;
}
.password-strength__label {
  font-size: .75rem;
  font-weight: 600;
  color: #94a3b8;
}

/* Estados de fuerza */
.password-strength.is-weak .password-strength__bars span:nth-child(1) {
  background: #ef4444;
}
.password-strength.is-weak .password-strength__label { color: #ef4444; }

.password-strength.is-fair .password-strength__bars span:nth-child(1),
.password-strength.is-fair .password-strength__bars span:nth-child(2) {
  background: #f59e0b;
}
.password-strength.is-fair .password-strength__label { color: #f59e0b; }

.password-strength.is-good .password-strength__bars span:nth-child(1),
.password-strength.is-good .password-strength__bars span:nth-child(2),
.password-strength.is-good .password-strength__bars span:nth-child(3) {
  background: #3b82f6;
}
.password-strength.is-good .password-strength__label { color: #3b82f6; }

.password-strength.is-strong .password-strength__bars span {
  background: var(--olivo-principal);
}
.password-strength.is-strong .password-strength__label { color: var(--olivo-principal); }

/* ============================================================
   ESTADO DE ERROR (enlace inválido)
   ============================================================ */
.login-form--error {
  text-align: center;
}
.login-form--error .login-form__title {
  color: #dc2626;
}
.login-form--error .btn-login {
  margin-top: 20px;
}

/* ============================================================
   MÓVIL — Ajustes específicos de recuperación
   ============================================================ */
@media (max-width: 900px) {
  .recover-icon {
    width: 60px;
    height: 60px;
    font-size: 1.6rem;
    border-radius: 16px;
    margin-bottom: 16px;
  }
}