/* =============================================
   AUTH WIDGET — header sign-in / user pill
   ============================================= */

.auth-widget {
  position: relative;
  display: flex;
  align-items: center;
  margin-left: 0.5rem;
  flex-shrink: 0;
}

/* ── Sign-in button ── */
.auth-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 6px 14px;
  background: transparent;
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 2rem;
  color: rgba(255, 255, 255, 0.85);
  font-size: 0.88rem;
  font-weight: 500;
  cursor: pointer;
  font-family: inherit;
  letter-spacing: 0.3px;
  transition: border-color 0.2s, background 0.2s, box-shadow 0.2s;
  white-space: nowrap;
}

.auth-btn:hover {
  border-color: rgba(255, 255, 255, 0.5);
  background: rgba(255, 255, 255, 0.06);
  box-shadow: 0 0 14px rgba(66, 133, 244, 0.25);
}

/* ── User pill ── */
.auth-user {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 4px 12px 4px 4px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 2rem;
  cursor: pointer;
  transition: border-color 0.2s, background 0.2s;
  user-select: none;
  outline: none;
}

.auth-user:hover,
.auth-user:focus-visible {
  border-color: rgba(199, 64, 64, 0.4);
  background: rgba(255, 255, 255, 0.04);
}

.auth-avatar {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  object-fit: cover;
  flex-shrink: 0;
}

.auth-avatar--fallback {
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(60, 80, 220, 0.5);
  color: #fff;
  font-size: 0.75rem;
  font-weight: 700;
}

.auth-name {
  font-size: 0.85rem;
  font-weight: 500;
  color: rgba(255, 255, 255, 0.85);
  max-width: 110px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.auth-chevron {
  color: rgba(255, 255, 255, 0.4);
  flex-shrink: 0;
  transition: transform 0.2s;
}

.auth-user[aria-expanded="true"] .auth-chevron {
  transform: rotate(180deg);
}

/* ── Dropdown ── */
.auth-dropdown {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  min-width: 200px;
  background: rgba(10, 10, 28, 0.96);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 12px;
  box-shadow: 0 16px 48px rgba(0, 0, 0, 0.6);
  overflow: hidden;
  z-index: 2000;
  display: flex;
  flex-direction: column;
}

.auth-dropdown[hidden] {
  display: none;
}

.auth-dropdown-email {
  display: block;
  padding: 10px 14px 8px;
  font-size: 0.75rem;
  color: rgba(255, 255, 255, 0.35);
  border-bottom: 1px solid rgba(255, 255, 255, 0.07);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.auth-dropdown-item {
  display: block;
  padding: 10px 14px;
  font-size: 0.88rem;
  color: rgba(255, 255, 255, 0.75);
  text-decoration: none;
  background: transparent;
  border: none;
  cursor: pointer;
  font-family: inherit;
  text-align: left;
  transition: background 0.15s, color 0.15s;
}

.auth-dropdown-item:hover {
  background: rgba(255, 255, 255, 0.07);
  color: #fff;
}

.auth-dropdown-item--admin {
  color: rgba(199, 64, 64, 0.85);
}

.auth-dropdown-item--admin:hover {
  color: rgb(199, 64, 64);
}

.auth-dropdown-item--signout {
  border-top: 1px solid rgba(255, 255, 255, 0.07);
  color: rgba(255, 255, 255, 0.45);
  width: 100%;
}

.auth-dropdown-item--signout:hover {
  color: rgba(255, 80, 80, 0.9);
  background: rgba(199, 64, 64, 0.08);
}

/* ── Mobile adjustments ── */
@media (max-width: 640px) {
  .auth-name {
    display: none;
  }

  /* Show a compact label so the button doesn't look empty */
  .auth-btn {
    padding: 6px 12px;
    font-size: 0.78rem;
    gap: 0.35rem;
  }

  .auth-btn svg {
    width: 16px;
    height: 16px;
    flex-shrink: 0;
  }

  /* Tighter user pill on mobile */
  .auth-user {
    padding: 4px 8px 4px 4px;
    gap: 0.35rem;
  }

  /* Dropdown opens left-anchored so it doesn't clip off screen */
  .auth-dropdown {
    right: auto;
    left: 0;
    min-width: 180px;
  }
}
