/* Authentication UI styles — matches FIMI Taxonomy design system */

.auth-controls {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-left: 0.5rem;
}

.auth-btn {
  padding: 0.375rem 0.875rem;
  font-family: -apple-system, system-ui, sans-serif;
  font-size: 0.875rem;
  font-weight: 500;
  border: 1px solid transparent;
  border-radius: 4px;
  cursor: pointer;
  transition: all 0.2s ease;
  text-decoration: none;
  display: inline-block;
  white-space: nowrap;
}

#login-btn {
  background: var(--mulberry, #551638);
  color: white !important;
  border-color: var(--mulberry, #551638);
}

#login-btn:hover {
  background: #6d1c47;
  border-color: #6d1c47;
  opacity: 0.9;
}

#logout-btn {
  background: rgba(255, 255, 255, 0.1);
  color: rgba(255, 255, 255, 0.8) !important;
  border: 1px solid rgba(255, 255, 255, 0.2);
}

#logout-btn:hover {
  background: rgba(255, 255, 255, 0.15);
  border-color: rgba(255, 255, 255, 0.3);
  color: white !important;
}

#user-profile {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.25rem 0.75rem;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 20px;
}

.user-avatar {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  border: 2px solid rgba(255, 255, 255, 0.3);
}

.user-name {
  font-size: 0.875rem;
  font-weight: 500;
  color: rgba(255, 255, 255, 0.9);
}

.hidden {
  display: none !important;
}

/* Gate shown when protected content is hidden (not signed in) */
.protected-content-gate {
  border: 2px solid var(--mulberry, #551638);
  border-radius: 8px;
  background: rgba(85, 22, 56, 0.08);
  padding: 1.5rem 1.75rem;
  margin: 1.5rem 0;
  max-width: 28em;
}
.protected-content-gate__title {
  font-size: 1.125rem;
  font-weight: 600;
  margin: 0 0 0.35em 0;
  color: var(--mulberry, #551638);
  display: flex;
  align-items: center;
  gap: 0.5rem;
}
.protected-content-gate__icon {
  font-size: 1.25em;
}
.protected-content-gate__text {
  margin: 0 0 1rem 0;
  color: var(--bs-body-color, #333);
  font-size: 0.95rem;
}
.protected-content-gate__link {
  display: inline-block;
  padding: 0.5rem 1rem;
  background: var(--mulberry, #551638);
  color: white !important;
  border-radius: 6px;
  font-weight: 500;
  text-decoration: none;
  transition: background 0.2s ease;
}
.protected-content-gate__link:hover {
  background: #6d1c47;
  color: white !important;
}

/* Protected content: hidden until auth script confirms signed-in (prevents flash of content) */
.protected-content {
  border-left: 3px solid var(--mulberry, #551638);
  padding-left: 1rem;
  margin: 1rem 0;
  display: none !important;
}
.protected-content.protected-content-visible {
  display: block !important;
}

/* Loading state */
.auth-loading {
  display: inline-block;
  width: 20px;
  height: 20px;
  border: 3px solid rgba(85, 22, 56, 0.2);
  border-radius: 50%;
  border-top-color: var(--mulberry, #551638);
  animation: spin 1s ease-in-out infinite;
}

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

/* Dark mode: gate */
.quarto-dark .protected-content-gate {
  background: rgba(85, 22, 56, 0.15);
  border-color: rgba(85, 22, 56, 0.6);
}
.quarto-dark .protected-content-gate__text {
  color: rgba(255, 255, 255, 0.85);
}

/* Dark mode support */
.quarto-dark #user-profile {
  background: rgba(255, 255, 255, 0.1);
}

.quarto-dark .user-name {
  color: rgba(255, 255, 255, 0.9);
}

.quarto-dark #logout-btn {
  color: rgba(255, 255, 255, 0.7);
  border-color: rgba(255, 255, 255, 0.2);
}

.quarto-dark #logout-btn:hover {
  background: rgba(255, 255, 255, 0.1);
  border-color: var(--mulberry, #551638);
}
