/* ═══════════════════════════════════════════════════
   firebase-auth.css  —  KarenVision · v1.0.0
   Sistema Modular de Vigilancia Inteligente
   Paleta de marca:
     #1e3457 primario  ·  #ec6d0b secundario
     #7835a5 terciario ·  #54bddf cuarto
   ═══════════════════════════════════════════════════ */

@import url('https://fonts.googleapis.com/css2?family=Outfit:wght@600;700;800&family=DM+Sans:ital,opsz,wght@0,9..40,400;0,9..40,500;0,9..40,600;1,9..40,400&display=swap');

/* ── Tokens de diseño KarenVision ── */
:root {
  --kv-primary:          #1e3457;
  --kv-secondary:        #ec6d0b;
  --kv-tertiary:         #7835a5;
  --kv-quaternary:       #54bddf;

  --auth-accent:         #7835a5;
  --auth-accent-hover:   #9246c4;
  --auth-accent-dim:     rgba(120, 53, 165, 0.12);
  --auth-accent-glow:    rgba(120, 53, 165, 0.28);
  --auth-bg:             #222a3a;
  --auth-surface:        #f7f8fa;
  --auth-surface-2:      #eef0f5;
  --auth-border:         rgba(30, 52, 87, 0.12);
  --auth-border-focus:   rgba(120, 53, 165, 0.55);
  --auth-text:           #1e3457;
  --auth-text-muted:     #5a6b87;
  --auth-text-subtle:    #94a3b8;
  --auth-error:          #f87171;
  --auth-error-bg:       rgba(248, 113, 113, 0.1);
  --auth-success:        #34d399;
  --auth-success-bg:     rgba(52, 211, 153, 0.1);
  --auth-warning:        #fbbf24;
  --auth-warning-bg:     rgba(251, 191, 36, 0.1);
  --auth-font:           'DM Sans', system-ui, sans-serif;
  --auth-font-display:   'Outfit', var(--auth-font);
  --auth-radius:         14px;
  --auth-radius-sm:      8px;
  --auth-radius-lg:      20px;
  --auth-shadow:         0 24px 60px rgba(0, 0, 0, 0.45), 0 2px 8px rgba(0,0,0,0.18);
  --auth-transition:     0.22s cubic-bezier(0.4, 0, 0.2, 1);
}

/* ── Reset base ── */
.auth-wrap *, .auth-wrap *::before, .auth-wrap *::after { box-sizing: border-box; margin: 0; padding: 0; }

/* ── Wrapper de pantalla completa ── */
.auth-wrap {
  font-family: var(--auth-font);
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--auth-bg);
  padding: 24px 16px;
  position: relative;
  overflow: hidden;
}

/* ── Fondo con manchas de luz ── */
.auth-wrap::before,
.auth-wrap::after {
  content: '';
  position: absolute;
  border-radius: 50%;
  filter: blur(80px);
  pointer-events: none;
  z-index: 0;
}
.auth-wrap::before {
  width: 480px; height: 480px;
  background: radial-gradient(circle, rgba(120,53,165,0.18) 0%, transparent 70%);
  top: -140px; right: -100px;
}
.auth-wrap::after {
  width: 360px; height: 360px;
  background: radial-gradient(circle, rgba(84,189,223,0.12) 0%, transparent 70%);
  bottom: -100px; left: -80px;
}
/* Mancha cálida (naranja secundario) en el centro inferior */
.auth-wrap > .auth-glow-warm {
  position: absolute; width: 260px; height: 260px; border-radius: 50%;
  background: radial-gradient(circle, rgba(236,109,11,0.08) 0%, transparent 70%);
  filter: blur(80px); bottom: -40px; right: 20%; pointer-events: none; z-index: 0;
}

/* ── Card ── */
.auth-card {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: 420px;
  background: var(--auth-surface);
  border: 1px solid var(--auth-border);
  border-radius: var(--auth-radius-lg);
  box-shadow: var(--auth-shadow);
  overflow: hidden;
  animation: auth-card-in 0.4s cubic-bezier(0.2, 0.8, 0.3, 1) both;
}

@keyframes auth-card-in {
  from { opacity: 0; transform: translateY(20px) scale(0.98); }
  to   { opacity: 1; transform: translateY(0)   scale(1); }
}

/* ── Barra de color superior (marca KarenVision) ── */
.auth-card-bar {
  height: 3px;
  background: linear-gradient(90deg,
    var(--kv-quaternary) 0%,
    var(--kv-tertiary) 45%,
    var(--kv-secondary) 100%);
}

/* ── Header de la card ── */
.auth-header {
  padding: 32px 36px 24px;
  text-align: center;
}

.auth-logo {
  width: 72px; height: 72px;
  background: transparent;
  border: none;
  border-radius: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 14px;
  filter: drop-shadow(0 6px 18px rgba(120,53,165,0.35));
}
.auth-logo img, .auth-logo svg { width: 100%; height: 100%; object-fit: contain; }

.auth-brand-tag {
  display: inline-block;
  font-family: var(--auth-font-display);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 2px;
  text-transform: uppercase;
  color: var(--kv-quaternary);
  margin-top: 6px;
  padding: 3px 10px;
  background: rgba(84,189,223,0.08);
  border: 1px solid rgba(84,189,223,0.2);
  border-radius: 100px;
}

.auth-title {
  font-family: var(--auth-font-display);
  font-size: 24px;
  font-weight: 800;
  color: var(--auth-text);
  letter-spacing: -0.4px;
  line-height: 1.15;
}
.auth-title .kv-accent { color: var(--kv-secondary); }

.auth-subtitle {
  margin-top: 6px;
  font-size: 14px;
  color: var(--auth-text-muted);
  line-height: 1.5;
}

/* ── Tabs ── */
.auth-tabs {
  display: flex;
  margin: 0 36px 24px;
  background: var(--auth-surface-2);
  border-radius: var(--auth-radius-sm);
  padding: 3px;
  gap: 2px;
}

.auth-tab {
  flex: 1;
  padding: 8px;
  border: none;
  border-radius: 6px;
  background: transparent;
  color: var(--auth-text-muted);
  font-family: var(--auth-font);
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: var(--auth-transition);
}

.auth-tab.active {
  background: var(--auth-surface);
  color: var(--auth-text);
  box-shadow: 0 1px 4px rgba(0,0,0,0.3);
}

.auth-tab:hover:not(.active) {
  color: var(--auth-text);
}

/* ── Formulario ── */
.auth-form {
  padding: 0 36px 32px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.auth-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.auth-label {
  font-size: 13px;
  font-weight: 500;
  color: var(--auth-text-muted);
  letter-spacing: 0.2px;
}

.auth-input-wrap {
  position: relative;
  display: flex;
  align-items: center;
}

.auth-input-icon {
  position: absolute;
  left: 13px;
  color: var(--auth-text-subtle);
  display: flex;
  align-items: center;
  pointer-events: none;
}

.auth-input {
  width: 100%;
  background: var(--auth-surface-2);
  border: 1px solid var(--auth-border);
  border-radius: var(--auth-radius-sm);
  color: var(--auth-text);
  font-family: var(--auth-font);
  font-size: 15px;
  padding: 11px 14px 11px 40px;
  outline: none;
  transition: var(--auth-transition);
  -webkit-appearance: none;
}

.auth-input::placeholder { color: var(--auth-text-subtle); }

.auth-input:focus {
  border-color: var(--auth-border-focus);
  background: var(--auth-surface);
  box-shadow: 0 0 0 3px var(--auth-accent-glow);
}

.auth-input.error {
  border-color: rgba(248, 113, 113, 0.5);
}

/* Toggle de contraseña */
.auth-pass-toggle {
  position: absolute;
  right: 12px;
  background: none;
  border: none;
  cursor: pointer;
  color: var(--auth-text-muted);
  display: flex;
  align-items: center;
  padding: 2px;
  border-radius: 4px;
  transition: color var(--auth-transition);
}
.auth-pass-toggle:hover { color: var(--auth-text); }

/* ── Botón primario ── */
.auth-btn {
  width: 100%;
  padding: 12px;
  border: none;
  border-radius: var(--auth-radius-sm);
  font-family: var(--auth-font);
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  transition: var(--auth-transition);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  position: relative;
  overflow: hidden;
}

.auth-btn-primary {
  background: linear-gradient(135deg, var(--kv-tertiary) 0%, #5a2583 100%);
  color: #fff;
  box-shadow: 0 4px 14px rgba(120,53,165,0.35);
}
.auth-btn-primary:hover {
  background: linear-gradient(135deg, var(--auth-accent-hover) 0%, var(--kv-tertiary) 100%);
  transform: translateY(-1px);
  box-shadow: 0 8px 24px var(--auth-accent-glow);
}
.auth-btn-primary:active { transform: translateY(0); }

.auth-btn-primary[disabled] {
  opacity: 0.6;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

/* ── Divider ── */
.auth-divider {
  display: flex;
  align-items: center;
  gap: 12px;
  color: var(--auth-text-subtle);
  font-size: 12px;
  letter-spacing: 0.5px;
}
.auth-divider::before,
.auth-divider::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--auth-border);
}

/* ── Botón de Google ── */
.auth-btn-google {
  background: var(--auth-surface-2);
  color: var(--auth-text);
  border: 1px solid var(--auth-border);
}
.auth-btn-google:hover {
  background: #ffffff;
  border-color: rgba(30,52,87,0.22);
  transform: translateY(-1px);
  box-shadow: 0 4px 14px rgba(30,52,87,0.08);
}
.auth-btn-google:active { transform: translateY(0); }

.auth-google-icon {
  width: 18px; height: 18px;
  flex-shrink: 0;
}

/* ── Link de olvidé contraseña ── */
.auth-link-row {
  display: flex;
  justify-content: flex-end;
}

.auth-link {
  font-size: 13px;
  color: var(--auth-accent);
  background: none;
  border: none;
  cursor: pointer;
  padding: 0;
  font-family: var(--auth-font);
  transition: color var(--auth-transition);
}
.auth-link:hover { color: var(--auth-accent-hover); text-decoration: underline; }

/* ── Mensajes de alerta ── */
.auth-alert {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 12px 14px;
  border-radius: var(--auth-radius-sm);
  font-size: 14px;
  line-height: 1.5;
  animation: auth-alert-in 0.2s ease both;
}
@keyframes auth-alert-in {
  from { opacity: 0; transform: translateY(-4px); }
  to   { opacity: 1; transform: translateY(0); }
}
.auth-alert.error   { background: var(--auth-error-bg);   color: var(--auth-error);   border: 1px solid rgba(248,113,113,0.2); }
.auth-alert.success { background: var(--auth-success-bg); color: var(--auth-success); border: 1px solid rgba(52,211,153,0.2); }
.auth-alert.warning { background: var(--auth-warning-bg); color: var(--auth-warning); border: 1px solid rgba(251,191,36,0.2); }
.auth-alert-icon { flex-shrink: 0; margin-top: 1px; }

/* ── Loading spinner ── */
.auth-spinner {
  width: 16px; height: 16px;
  border: 2px solid rgba(255,255,255,0.3);
  border-top-color: #fff;
  border-radius: 50%;
  animation: auth-spin 0.7s linear infinite;
}
@keyframes auth-spin { to { transform: rotate(360deg); } }

/* ── Pantalla de verificación ── */
.auth-verify-icon {
  width: 64px; height: 64px;
  background: var(--auth-accent-dim);
  border: 1px solid var(--auth-border-focus);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 20px;
  font-size: 28px;
  animation: auth-verify-pulse 2.5s ease-in-out infinite;
}
@keyframes auth-verify-pulse {
  0%, 100% { box-shadow: 0 0 0 0 var(--auth-accent-glow); }
  50% { box-shadow: 0 0 0 10px transparent; }
}

.auth-verify-email {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--auth-surface-2);
  border: 1px solid var(--auth-border);
  border-radius: 100px;
  padding: 4px 14px 4px 10px;
  font-size: 13px;
  color: var(--auth-text-muted);
  margin: 8px 0 4px;
}

.auth-verify-dot {
  width: 6px; height: 6px;
  background: var(--auth-warning);
  border-radius: 50%;
  animation: auth-dot-blink 1.5s ease-in-out infinite;
}
@keyframes auth-dot-blink { 0%,100%{opacity:1} 50%{opacity:0.3} }

.auth-check-btn {
  background: none;
  border: 1px dashed var(--auth-border-focus);
  color: var(--auth-accent);
  border-radius: var(--auth-radius-sm);
  padding: 10px;
  font-family: var(--auth-font);
  font-size: 14px;
  cursor: pointer;
  width: 100%;
  transition: var(--auth-transition);
}
.auth-check-btn:hover { background: var(--auth-accent-dim); }

/* ── Panel de usuario logueado ── */
.auth-user-panel {
  padding: 32px 36px;
}

.auth-user-avatar {
  width: 68px; height: 68px;
  border-radius: 50%;
  border: 2px solid var(--kv-tertiary);
  object-fit: cover;
  background: var(--auth-surface-2);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 24px;
  font-weight: 800;
  color: var(--kv-quaternary);
  box-shadow: 0 0 0 4px rgba(120,53,165,0.12);
  font-family: var(--auth-font-display);
  margin: 0 auto 16px;
  overflow: hidden;
}
.auth-user-avatar img { width: 100%; height: 100%; object-fit: cover; }

.auth-user-name {
  font-family: var(--auth-font-display);
  font-size: 18px;
  font-weight: 700;
  color: var(--auth-text);
  text-align: center;
  margin-bottom: 4px;
}

.auth-user-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  background: var(--auth-success-bg);
  border: 1px solid rgba(52,211,153,0.2);
  color: var(--auth-success);
  font-size: 12px;
  font-weight: 500;
  padding: 3px 10px;
  border-radius: 100px;
  margin-bottom: 20px;
}

.auth-user-info {
  background: var(--auth-surface-2);
  border: 1px solid var(--auth-border);
  border-radius: var(--auth-radius-sm);
  overflow: hidden;
  margin-bottom: 20px;
}

.auth-user-row {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 11px 14px;
  border-bottom: 1px solid var(--auth-border);
  font-size: 13px;
}
.auth-user-row:last-child { border-bottom: none; }

.auth-user-row-label {
  color: var(--auth-text-muted);
  white-space: nowrap;
  min-width: 72px;
  flex-shrink: 0;
  font-weight: 500;
}

.auth-user-row-value {
  color: var(--auth-text);
  word-break: break-all;
  font-family: inherit;
}

.auth-user-row-value.mono {
  font-family: 'SF Mono', 'Cascadia Code', 'Fira Code', monospace;
  font-size: 11px;
  color: var(--auth-text-muted);
}

.auth-provider-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  background: var(--auth-surface);
  border: 1px solid var(--auth-border);
  border-radius: 100px;
  padding: 2px 8px;
  font-size: 12px;
  color: var(--auth-text-muted);
}

/* ── Transiciones de pantalla ── */
.auth-screen {
  animation: auth-screen-in 0.28s cubic-bezier(0.2, 0.8, 0.3, 1) both;
}
@keyframes auth-screen-in {
  from { opacity: 0; transform: translateY(10px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ── Responsive ── */
@media (max-width: 480px) {
  .auth-card { border-radius: var(--auth-radius); }
  .auth-header, .auth-form, .auth-user-panel { padding-left: 24px; padding-right: 24px; }
  .auth-tabs { margin-left: 24px; margin-right: 24px; }
}
