.auth-overlay {
  position: fixed;
  inset: 0;
  z-index: 600;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  overflow-y: auto;
  background: #050505;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.35s var(--ease), visibility 0.35s var(--ease);
}

.auth-overlay.open {
  opacity: 1;
  visibility: visible;
}

/* Animated background */
.auth-bg {
  position: absolute;
  inset: 0;
  overflow: hidden;
  z-index: 0;
}

.auth-bg span {
  position: absolute;
  border-radius: 50%;
  background: radial-gradient(circle, var(--orange-glow), transparent 70%);
  filter: blur(10px);
  animation: authDrift 14s ease-in-out infinite;
}

.auth-bg span:nth-child(1) { width: 480px; height: 480px; top: -140px; left: -120px; animation-delay: 0s; }
.auth-bg span:nth-child(2) { width: 380px; height: 380px; bottom: -120px; right: -80px; animation-delay: 3s; }
.auth-bg span:nth-child(3) { width: 300px; height: 300px; top: 40%; left: 60%; animation-delay: 6s; opacity: 0.6; }

@keyframes authDrift {
  0%, 100% { transform: translate(0, 0) scale(1); }
  50% { transform: translate(40px, -30px) scale(1.1); }
}

.auth-close {
  position: absolute;
  top: 24px;
  right: 24px;
  z-index: 2;
  width: 38px;
  height: 38px;
  border-radius: 50%;
  border: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
  transition: all 0.2s var(--ease);
}

.auth-close:hover {
  color: var(--text);
  border-color: var(--orange);
}

.auth-close svg {
  width: 16px;
  height: 16px;
}

.auth-content {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: 420px;
  display: flex;
  flex-direction: column;
  align-items: center;
  transform: translateY(16px);
  opacity: 0;
  transition: transform 0.4s var(--ease), opacity 0.4s var(--ease);
}

.auth-overlay.open .auth-content {
  transform: translateY(0);
  opacity: 1;
}

.auth-logo {
  width: 78px;
  height: 78px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 16px;
  filter: drop-shadow(0 0 30px var(--orange-glow));
  animation: heroFloat 5s ease-in-out infinite;
}

.auth-logo img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.auth-brand {
  font-size: 22px;
  font-weight: 800;
  margin-bottom: 6px;
}

.auth-tagline {
  color: var(--text-muted);
  font-size: 13.5px;
  margin-bottom: 28px;
  text-align: center;
}

.auth-box {
  width: 100%;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 30px 28px;
}

/* Boton "Iniciar sesion con Google" (lo dibuja Google Identity Services dentro) */
.google-signin-wrap {
  display: flex;
  justify-content: center;
  min-height: 40px;
}

.auth-divider {
  position: relative;
  text-align: center;
  margin: 18px 0;
}

.auth-divider::before {
  content: "";
  position: absolute;
  top: 50%;
  left: 0;
  right: 0;
  height: 1px;
  background: var(--border-soft);
}

.auth-divider span {
  position: relative;
  background: var(--surface);
  padding: 0 12px;
  font-size: 12px;
  color: var(--text-faint);
}

.auth-tabs {
  position: relative;
  display: flex;
  background: var(--bg-soft);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius-pill);
  padding: 4px;
  margin-bottom: 24px;
}

.auth-tabs::before {
  content: "";
  position: absolute;
  top: 4px;
  left: 4px;
  bottom: 4px;
  width: calc(50% - 4px);
  border-radius: var(--radius-pill);
  background: linear-gradient(180deg, var(--orange-light), var(--orange));
  box-shadow: 0 2px 14px rgba(255, 106, 0, 0.4);
  transition: transform 0.35s var(--ease);
}

.auth-tabs.tab-register::before {
  transform: translateX(100%);
}

.auth-tab {
  position: relative;
  z-index: 1;
  flex: 1;
  text-align: center;
  padding: 9px 0;
  border-radius: var(--radius-pill);
  font-size: 13.5px;
  font-weight: 600;
  color: var(--text-muted);
  transition: color 0.3s var(--ease), transform 0.3s var(--ease);
}

.auth-tab.active {
  color: #fff;
  animation: authTabPop 0.35s var(--ease);
}

@keyframes authTabPop {
  0% { transform: scale(0.94); }
  55% { transform: scale(1.04); }
  100% { transform: scale(1); }
}

.auth-form {
  display: none;
  flex-direction: column;
  gap: 14px;
}

.auth-form.active {
  display: flex;
}

.auth-field label {
  display: block;
  font-size: 12.5px;
  color: var(--text-muted);
  margin-bottom: 6px;
}

.auth-field input {
  width: 100%;
  background: var(--bg-soft);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 11px 14px;
  color: var(--text);
  font-size: 14px;
  font-family: inherit;
}

.auth-field input:focus {
  outline: none;
  border-color: var(--orange);
}

.auth-hint {
  display: block;
  font-size: 11.5px;
  color: var(--text-faint);
  margin-top: 6px;
}

.auth-error {
  font-size: 12.5px;
  color: #ff7676;
  min-height: 16px;
}

.auth-submit {
  margin-top: 4px;
}

.auth-switch {
  text-align: center;
  font-size: 12.5px;
  color: var(--text-faint);
  margin-top: 18px;
}
