/*
 * auth-loading.css hides the Log in / Sign up buttons for a moment while Firebase checks if the user is signed in.
 * See assets/js/auth-loading.js.
 */
.auth-state-pending .topbar-right #auth-links,
.auth-state-pending .topbar-right #authLinks,
.auth-state-pending .topbar-right #user-menu,
.auth-state-pending .topbar-right > a[href*="login.html"],
.auth-state-pending .topbar-right > a[href*="signup.html"] {
  display: none !important;
}

.auth-loading-chip {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 200px;
  height: 40px;
  box-sizing: border-box;
  padding: 0 13px;
  overflow: hidden;
  border: 1px solid color-mix(in srgb, var(--accent, #fc27a3) 24%, var(--border, #e2ddd7));
  border-radius: 999px;
  color: var(--text, #2d2926);
  background: color-mix(in srgb, var(--accent, #fc27a3) 8%, var(--white, #fff));
  box-shadow: 0 4px 16px rgba(252, 39, 163, 0.1);
  font-size: 0.82rem;
  font-weight: 800;
  white-space: nowrap;
  text-overflow: ellipsis;
  animation: auth-chip-enter 0.28s ease-out both;
}

.topbar-user-section .user-menu-btn {
  width: 200px;
  height: 40px;
  box-sizing: border-box;
}

.topbar-user-section .user-menu-btn #user-name {
  min-width: 0;
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.auth-loading-chip::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(105deg, transparent 25%, rgba(255, 255, 255, 0.68) 48%, transparent 70%);
  transform: translateX(-110%);
  animation: auth-chip-shine 1.6s ease-in-out infinite;
  pointer-events: none;
}

.auth-loading-chip-icon {
  flex: 0 0 auto;
  width: 15px;
  height: 15px;
  border: 2px solid color-mix(in srgb, var(--accent, #fc27a3) 24%, transparent);
  border-top-color: var(--accent, #fc27a3);
  border-radius: 50%;
  animation: auth-chip-spin 0.8s linear infinite;
}

.auth-loading-chip.is-leaving {
  opacity: 0;
  transform: translateY(-3px);
  transition: opacity 0.2s ease, transform 0.2s ease;
}

@keyframes auth-chip-spin {
  to { transform: rotate(360deg); }
}

@keyframes auth-chip-shine {
  0%, 38% { transform: translateX(-110%); }
  78%, 100% { transform: translateX(110%); }
}

@keyframes auth-chip-enter {
  from { opacity: 0; transform: translateY(-4px) scale(0.96); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

@media (max-width: 768px) {
  .auth-loading-chip,
  .topbar-user-section .user-menu-btn {
    width: 40px;
    height: 40px;
    padding: 0;
  }

  .auth-loading-chip {
    gap: 0;
  }

  .auth-loading-chip > span:last-child {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip-path: inset(50%);
  }
}

@media (prefers-reduced-motion: reduce) {
  .auth-loading-chip,
  .auth-loading-chip::after,
  .auth-loading-chip-icon {
    animation: none !important;
  }
}
