/* ==========================================================================
   Forprocer LMS - Pagina de Autenticacion
   Login, OAuth, Magic Link, 2FA
   ========================================================================== */

/* --------------------------------------------------------------------------
   Layout de autenticacion: centrado vertical y horizontal
   -------------------------------------------------------------------------- */
.auth-layout,
.auth-page {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  padding: var(--space-6);
  position: relative;
  background-image:
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 400 400'%3E%3Ccircle cx='30' cy='45' r='10' fill='%23347172' opacity='0.06'/%3E%3Ccircle cx='75' cy='50' r='10' fill='%23349084' opacity='0.05'/%3E%3Ccircle cx='123' cy='42' r='10' fill='%233caaaa' opacity='0.04'/%3E%3Ccircle cx='290' cy='20' r='8' fill='%23349084' opacity='0.04'/%3E%3Ccircle cx='330' cy='25' r='8' fill='%233caaaa' opacity='0.05'/%3E%3Ccircle cx='373' cy='18' r='8' fill='%23347172' opacity='0.03'/%3E%3Ccircle cx='180' cy='130' r='12' fill='%233caaaa' opacity='0.05'/%3E%3Ccircle cx='228' cy='125' r='12' fill='%23347172' opacity='0.04'/%3E%3Ccircle cx='273' cy='135' r='12' fill='%23349084' opacity='0.06'/%3E%3Ccircle cx='50' cy='200' r='7' fill='%23349084' opacity='0.03'/%3E%3Ccircle cx='88' cy='195' r='7' fill='%233caaaa' opacity='0.05'/%3E%3Ccircle cx='128' cy='205' r='7' fill='%23347172' opacity='0.04'/%3E%3Ccircle cx='330' cy='180' r='11' fill='%23347172' opacity='0.05'/%3E%3Ccircle cx='370' cy='175' r='11' fill='%23349084' opacity='0.04'/%3E%3Ccircle cx='368' cy='220' r='6' fill='%233caaaa' opacity='0.03'/%3E%3Ccircle cx='100' cy='310' r='9' fill='%233caaaa' opacity='0.04'/%3E%3Ccircle cx='142' cy='305' r='9' fill='%23349084' opacity='0.06'/%3E%3Ccircle cx='188' cy='315' r='9' fill='%23347172' opacity='0.04'/%3E%3Ccircle cx='280' cy='350' r='14' fill='%23349084' opacity='0.04'/%3E%3Ccircle cx='330' cy='340' r='14' fill='%233caaaa' opacity='0.05'/%3E%3Ccircle cx='375' cy='355' r='14' fill='%23347172' opacity='0.03'/%3E%3Ccircle cx='15' cy='370' r='6' fill='%23347172' opacity='0.05'/%3E%3Ccircle cx='220' cy='260' r='10' fill='%233caaaa' opacity='0.03'/%3E%3Ccircle cx='260' cy='255' r='10' fill='%23347172' opacity='0.05'/%3E%3Ccircle cx='305' cy='265' r='10' fill='%23349084' opacity='0.04'/%3E%3C/svg%3E");
  background-size: 500px 500px;
}

/* Blob decorativo adicional para auth */
.auth-layout::before,
.auth-page::before {
  content: '';
  position: fixed;
  top: 20%;
  left: -10%;
  width: 400px;
  height: 400px;
  border-radius: 50%;
  background: radial-gradient(
    circle,
    rgba(60, 170, 170, 0.12) 0%,
    transparent 70%
  );
  filter: blur(80px);
  pointer-events: none;
}

.auth-layout::after,
.auth-page::after {
  content: '';
  position: fixed;
  bottom: 10%;
  right: -5%;
  width: 350px;
  height: 350px;
  border-radius: 50%;
  background: radial-gradient(
    circle,
    rgba(52, 113, 114, 0.1) 0%,
    transparent 70%
  );
  filter: blur(60px);
  pointer-events: none;
}

/* --------------------------------------------------------------------------
   Tarjeta de login (glass card centrada)
   -------------------------------------------------------------------------- */
.auth-card {
  background: var(--glass-bg-card);
  backdrop-filter: blur(var(--glass-blur-strong));
  -webkit-backdrop-filter: blur(var(--glass-blur-strong));
  border: 1px solid var(--glass-border-strong);
  border-radius: var(--glass-radius-lg);
  box-shadow: var(--glass-shadow-lg);
  padding: var(--space-10) var(--space-8);
  width: 100%;
  max-width: 440px;
  position: relative;
  z-index: 1;
}

/* --------------------------------------------------------------------------
   Logo Forprocer en la parte superior
   -------------------------------------------------------------------------- */
.auth-card__logo {
  display: flex;
  justify-content: center;
  margin-bottom: var(--space-8);
}

.auth-card__logo img {
  height: 48px;
  width: auto;
}

.auth-card__logo-text {
  font-size: var(--text-2xl);
  font-weight: var(--font-bold);
  background: linear-gradient(135deg, var(--color-primary-dark) 0%, var(--color-primary-light) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  letter-spacing: 0.04em;
}

/* --------------------------------------------------------------------------
   Titulo y subtitulo
   -------------------------------------------------------------------------- */
.auth-card__title {
  font-size: var(--text-2xl);
  font-weight: var(--font-bold);
  color: var(--color-gray-900);
  text-align: center;
  margin-bottom: var(--space-2);
}

.auth-card__subtitle {
  font-size: var(--text-sm);
  color: var(--color-gray-500);
  text-align: center;
  margin-bottom: var(--space-8);
}

/* --------------------------------------------------------------------------
   Botones OAuth (Google, Microsoft)
   -------------------------------------------------------------------------- */
.auth-oauth-buttons {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
  margin-bottom: var(--space-6);
}

.btn-oauth {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-3);
  width: 100%;
  padding: var(--space-3) var(--space-5);
  min-height: 48px;
  font-size: var(--text-sm);
  font-weight: var(--font-semibold);
  border-radius: var(--radius-full);
  cursor: pointer;
  transition:
    background-color var(--transition-base),
    box-shadow var(--transition-base),
    transform var(--transition-base);
  text-decoration: none;
}

.btn-oauth:hover {
  transform: scale(1.02);
  text-decoration: none;
}

.btn-oauth:active {
  transform: scale(0.98);
}

.btn-oauth__icon {
  width: 20px;
  height: 20px;
  flex-shrink: 0;
}

.btn-oauth__icon img,
.btn-oauth__icon svg {
  width: 100%;
  height: 100%;
}

/* Google: fondo blanco, texto oscuro, borde gris */
.btn-oauth--google {
  background: var(--color-white);
  color: var(--color-gray-700);
  border: 1px solid var(--color-gray-300);
  box-shadow: var(--shadow-sm);
}

.btn-oauth--google:hover {
  background: var(--color-gray-50);
  box-shadow: var(--shadow-md);
  color: var(--color-gray-800);
}

/* Microsoft: fondo azul Microsoft */
.btn-oauth--microsoft {
  background: #2f2f2f;
  color: var(--color-white);
  border: 1px solid #2f2f2f;
  box-shadow: var(--shadow-sm);
}

.btn-oauth--microsoft:hover {
  background: #1a1a1a;
  box-shadow: var(--shadow-md);
  color: var(--color-white);
}

/* OAuth deshabilitado */
.btn-oauth--disabled {
  opacity: 0.4;
  cursor: default;
  filter: grayscale(1);
  pointer-events: auto;
}

.btn-oauth--disabled:hover {
  transform: none;
  box-shadow: var(--shadow-sm);
}

/* --------------------------------------------------------------------------
   Separador con texto "o"
   -------------------------------------------------------------------------- */
.auth-separator {
  display: flex;
  align-items: center;
  gap: var(--space-4);
  margin: var(--space-6) 0;
  color: var(--color-gray-400);
  font-size: var(--text-sm);
}

.auth-separator::before,
.auth-separator::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--color-gray-200);
}

/* --------------------------------------------------------------------------
   Formulario de Magic Link
   -------------------------------------------------------------------------- */
.auth-form {
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
}

.auth-form .input-field {
  padding: var(--space-3) var(--space-4);
  min-height: 48px;
  font-size: var(--text-base);
}

.auth-form .btn {
  min-height: 48px;
  font-size: var(--text-base);
}

/* --------------------------------------------------------------------------
   Mensaje post-envio (revisa tu email)
   -------------------------------------------------------------------------- */
.auth-message {
  text-align: center;
  padding: var(--space-6) 0;
}

.auth-message__icon {
  width: 64px;
  height: 64px;
  margin: 0 auto var(--space-5);
  color: var(--color-primary);
}

.auth-message__title {
  font-size: var(--text-xl);
  font-weight: var(--font-semibold);
  color: var(--color-gray-900);
  margin-bottom: var(--space-3);
}

.auth-message__text {
  font-size: var(--text-sm);
  color: var(--color-gray-500);
  margin-bottom: var(--space-6);
  line-height: var(--leading-relaxed);
}

.auth-message__email {
  font-weight: var(--font-semibold);
  color: var(--color-gray-800);
}

/* --------------------------------------------------------------------------
   Pagina 2FA: Inputs de digitos grandes
   -------------------------------------------------------------------------- */
.twofa-container {
  text-align: center;
}

.twofa-title {
  font-size: var(--text-xl);
  font-weight: var(--font-semibold);
  color: var(--color-gray-900);
  margin-bottom: var(--space-2);
}

.twofa-subtitle {
  font-size: var(--text-sm);
  color: var(--color-gray-500);
  margin-bottom: var(--space-8);
}

.twofa-inputs {
  display: flex;
  justify-content: center;
  gap: var(--space-3);
  margin-bottom: var(--space-6);
}

.twofa-input {
  width: 52px;
  height: 64px;
  text-align: center;
  font-family: var(--font-family-mono);
  font-size: var(--text-2xl);
  font-weight: var(--font-bold);
  color: var(--color-gray-900);
  background: rgba(255, 255, 255, 0.8);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border: 2px solid var(--color-gray-300);
  border-radius: var(--radius-lg);
  outline: none;
  transition:
    border-color var(--transition-base),
    box-shadow var(--transition-base);
  caret-color: var(--color-primary);
}

.twofa-input:focus {
  border-color: var(--color-primary);
  box-shadow: 0 0 0 3px rgba(var(--color-primary-rgb), 0.15);
}

.twofa-input.is-error {
  border-color: var(--color-error);
  box-shadow: 0 0 0 3px rgba(var(--color-error-rgb), 0.1);
  animation: shake 0.3s ease;
}

.twofa-input.is-filled {
  border-color: var(--color-primary);
  background: var(--color-primary-50);
}

@keyframes shake {
  0%, 100% { transform: translateX(0); }
  20% { transform: translateX(-4px); }
  40% { transform: translateX(4px); }
  60% { transform: translateX(-4px); }
  80% { transform: translateX(4px); }
}

/* Reenviar codigo */
.twofa-resend {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  font-size: var(--text-sm);
  color: var(--color-gray-500);
  margin-top: var(--space-6);
}

.twofa-resend__sep {
  color: var(--color-gray-300);
}

.twofa-resend button {
  background: none;
  border: none;
  font-family: inherit;
  font-size: inherit;
  padding: 0;
}

.twofa-resend__link {
  color: var(--color-primary);
  font-weight: var(--font-semibold);
  cursor: pointer;
  text-decoration: none;
  transition: color var(--transition-fast);
}

.twofa-resend__link:hover {
  color: var(--color-primary-dark);
  text-decoration: underline;
}

.twofa-resend__link:disabled,
.twofa-resend__link.is-disabled {
  color: var(--color-gray-400);
  cursor: not-allowed;
  pointer-events: none;
}

.twofa-resend__timer {
  color: var(--color-gray-400);
  font-variant-numeric: tabular-nums;
}

/* --------------------------------------------------------------------------
   Pagina de error (link expirado/invalido)
   -------------------------------------------------------------------------- */
.auth-error {
  text-align: center;
  padding: var(--space-6) 0;
}

.auth-error__icon {
  width: 64px;
  height: 64px;
  margin: 0 auto var(--space-5);
  color: var(--color-error);
}

.auth-error__title {
  font-size: var(--text-xl);
  font-weight: var(--font-semibold);
  color: var(--color-gray-900);
  margin-bottom: var(--space-3);
}

.auth-error__text {
  font-size: var(--text-sm);
  color: var(--color-gray-500);
  margin-bottom: var(--space-6);
  line-height: var(--leading-relaxed);
}

/* --------------------------------------------------------------------------
   Footer de auth (enlaces adicionales)
   -------------------------------------------------------------------------- */
.auth-footer {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-2);
  margin-top: var(--space-8);
  font-size: var(--text-xs);
  color: var(--color-gray-400);
}

.auth-footer a {
  display: inline-flex;
  text-decoration: none;
  transition: opacity var(--transition-fast);
}

.auth-footer a:hover {
  opacity: 0.8;
}

.auth-footer img {
  height: 96px !important;
  width: auto;
  opacity: 0.5;
}

/* --------------------------------------------------------------------------
   Responsive auth
   -------------------------------------------------------------------------- */
@media (max-width: 480px) {
  .auth-layout,
  .auth-page {
    padding: var(--space-4);
    align-items: flex-start;
    padding-top: var(--space-12);
  }

  .auth-card {
    padding: var(--space-6) var(--space-5);
    border-radius: var(--glass-radius);
  }

  .twofa-inputs {
    gap: var(--space-2);
  }

  .twofa-input {
    width: 44px;
    height: 56px;
    font-size: var(--text-xl);
  }

  .btn-oauth {
    min-height: 44px;
  }
}
