/* ==========================================================================
   Estately Pro - Animated Login Experience (Google AI Studio Edition)
   Pure Vanilla CSS - Modern Aesthetics & Dynamic Physics
   ========================================================================== */

body.page-auth {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background-color: #070d18 !important;
  color: #f1f5f9;
  min-height: 100vh;
  margin: 0;
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  transition: background-color 1s ease;
}

body.page-auth .app-shell {
  min-height: 100vh;
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
}

body.page-auth .main-content.guest {
  background: transparent !important;
  padding: 0 !important;
  margin: 0 !important;
  min-height: 100vh;
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  overflow: hidden;
}

/* Contenedor del fondo animado */
#bg-container {
  position: fixed;
  inset: 0;
  pointer-events: none;
  overflow: hidden;
  z-index: 1;
}

#particles-canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}

/* Orbes de gradiente ambiental */
.orb {
  position: absolute;
  border-radius: 50%;
  filter: blur(120px);
  opacity: 0.6;
  transition: background 1s ease, transform 1s ease;
}

.orb-1 {
  width: 650px;
  height: 650px;
  top: -100px;
  left: -100px;
  background: rgba(2, 132, 199, 0.25);
  animation: float1 18s ease-in-out infinite alternate;
}

.orb-2 {
  width: 700px;
  height: 700px;
  bottom: -150px;
  right: -150px;
  background: rgba(13, 148, 136, 0.22);
  animation: float2 22s ease-in-out infinite alternate;
}

.orb-center {
  width: 800px;
  height: 800px;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  background: rgba(30, 58, 138, 0.25);
}

/* Resplandor central marcado (#2dd4bf en éxito) */
#central-glow {
  position: absolute;
  width: 720px;
  height: 720px;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  border-radius: 50%;
  filter: blur(80px);
  opacity: 0.25;
  transition: all 0.8s ease;
  background: radial-gradient(circle, rgba(2, 132, 199, 0.25) 0%, transparent 75%);
}

/* Tarjeta de Login */
.login-wrapper {
  position: relative;
  z-index: 10;
  padding: 1rem;
  width: 100%;
  max-width: 420px;
  margin: auto;
}

.login-card {
  background: rgba(17, 29, 51, 0.92);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid rgba(51, 65, 85, 0.7);
  border-radius: 22px;
  padding: 2.25rem;
  box-shadow: 0 25px 60px rgba(0, 0, 0, 0.6);
  transition: border-color 0.5s ease, box-shadow 0.5s ease;
}

/* Estados dinámicos de validación */
body.state-success #central-glow {
  opacity: 0.95;
  background: radial-gradient(circle, rgba(45, 212, 191, 0.75) 0%, rgba(20, 184, 166, 0.5) 40%, transparent 80%);
}

body.state-success .login-card {
  border-color: rgba(45, 212, 191, 0.7);
  box-shadow: 0 0 65px rgba(45, 212, 191, 0.35), 0 25px 60px rgba(0, 0, 0, 0.6);
}

body.state-success .submit-btn {
  background: #0d9488 !important;
  box-shadow: 0 0 25px rgba(45, 212, 191, 0.5) !important;
}

body.state-error #central-glow {
  opacity: 0.6;
  background: radial-gradient(circle, rgba(225, 29, 72, 0.45) 0%, transparent 75%);
}

body.state-error .login-card {
  border-color: rgba(244, 63, 94, 0.6);
  box-shadow: 0 0 50px rgba(244, 63, 94, 0.25);
  animation: shake 0.55s ease-in-out;
}

body.state-error .submit-btn {
  background: #e11d48 !important;
}

/* Brand header */
.brand {
  text-align: center;
}
.brand-logo-wrap {
  display: flex;
  justify-content: center;
  align-items: center;
  margin: 0 auto 0.25rem;
}
.brand-favicon {
  width: 58px;
  height: auto;
  object-fit: contain;
  filter: drop-shadow(0 6px 16px rgba(45, 212, 191, 0.25));
  transition: transform 0.3s ease;
}
.brand-favicon:hover {
  transform: scale(1.04);
}
.brand-title {
  font-size: 1.65rem;
  font-weight: 700;
  color: #ffffff;
  margin-top: 0.35rem;
  letter-spacing: -0.02em;
}
.brand-title span {
  color: #2dd4bf;
  text-shadow: 0 0 16px rgba(45, 212, 191, 0.4);
}
.agency-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  margin-top: 0.75rem;
  padding: 0.35rem 0.85rem;
  border-radius: 999px;
  background: rgba(15, 23, 42, 0.7);
  border: 1px solid rgba(51, 65, 85, 0.8);
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.15em;
  color: #cbd5e1;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.25);
}
.agency-logo-img {
  width: 22px;
  height: 22px;
  object-fit: contain;
  filter: invert(1) hue-rotate(180deg) brightness(3);
}

.subtitle {
  text-align: center;
  color: #94a3b8;
  font-size: 0.875rem;
  margin: 1.25rem 0 1.5rem;
}

/* Campos de Formulario */
.field-group {
  margin-bottom: 1rem;
}
.field-group label {
  display: block;
  font-size: 0.75rem;
  font-weight: 600;
  color: #cbd5e1;
  margin-bottom: 0.35rem;
}
.field-group input {
  width: 100%;
  background: rgba(12, 20, 37, 0.9);
  border: 1px solid rgba(51, 65, 85, 0.7);
  border-radius: 8px;
  padding: 0.65rem 0.85rem;
  color: #f1f5f9;
  font-size: 0.875rem;
  outline: none;
  transition: border-color 0.2s, box-shadow 0.2s;
}
.field-group input:focus {
  border-color: #06b6d4;
  box-shadow: 0 0 0 2px rgba(6, 182, 212, 0.15);
}

.password-wrapper {
  position: relative;
  display: flex;
  align-items: center;
}
.password-wrapper input {
  padding-right: 2.5rem;
}
.toggle-btn {
  position: absolute;
  right: 10px;
  top: 50%;
  transform: translateY(-50%);
  background: none;
  border: none;
  cursor: pointer;
  opacity: 0.75;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 4px;
  color: #94a3b8;
  transition: opacity 0.2s, color 0.2s;
}
.toggle-btn:hover {
  opacity: 1;
  color: #38bdf8;
}

.submit-btn {
  width: 100%;
  margin-top: 0.5rem;
  padding: 0.75rem 1rem;
  background: #0284c7;
  color: #ffffff;
  border: none;
  border-radius: 8px;
  font-weight: 600;
  font-size: 0.875rem;
  cursor: pointer;
  box-shadow: 0 4px 20px rgba(2, 132, 199, 0.4);
  transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}
.submit-btn:hover:not(:disabled) {
  background: #0369a1;
  box-shadow: 0 6px 24px rgba(2, 132, 199, 0.5);
  transform: translateY(-1px);
}
.submit-btn:active:not(:disabled) {
  transform: translateY(0);
}
.submit-btn:disabled {
  opacity: 0.85;
  cursor: not-allowed;
}

.copyright {
  text-align: center;
  font-size: 0.7rem;
  color: #64748b;
  margin-top: 2rem;
}

.error-banner {
  padding: 0.65rem 0.85rem;
  border-radius: 8px;
  background: rgba(76, 5, 25, 0.85);
  border: 1px solid rgba(190, 18, 60, 0.8);
  color: #fecdd3;
  font-size: 0.78rem;
  margin-bottom: 1rem;
  display: flex;
  align-items: center;
  gap: 8px;
  line-height: 1.35;
  animation: authFadeIn 0.3s ease-out;
}
.error-banner.hidden {
  display: none !important;
}

/* Spinner sutil para estado validando */
.auth-spinner {
  width: 16px;
  height: 16px;
  border: 2px solid rgba(255, 255, 255, 0.3);
  border-top-color: #ffffff;
  border-radius: 50%;
  animation: authSpin 0.8s linear infinite;
  display: inline-block;
}

@keyframes authSpin {
  to { transform: rotate(360deg); }
}

@keyframes authFadeIn {
  from { opacity: 0; transform: translateY(-4px); }
  to { opacity: 1; transform: translateY(0); }
}

/* Keyframes de física y orbes */
@keyframes shake {
  0%, 100% { transform: translateX(0); }
  20%, 60% { transform: translateX(-10px); }
  40%, 80% { transform: translateX(10px); }
}

@keyframes float1 {
  0% { transform: translate(0, 0); }
  100% { transform: translate(40px, 30px); }
}
@keyframes float2 {
  0% { transform: translate(0, 0); }
  100% { transform: translate(-30px, -40px); }
}
