/* User Profile Dropdown Block */
.user-profile-dropdown {
  position: relative;
}

/* Dropdown Trigger Button */
.user-profile-dropdown__trigger {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--size-1);
  background: transparent;
  border: none;
  border-radius: var(--radius-round);
  cursor: pointer;
  transition: background-color var(--ease-2) 150ms;

  &:hover {
    background-color: var(--surface-3);
  }

  &:focus-visible {
    outline: 2px solid var(--brand);
    outline-offset: 2px;
  }
}

/* Dropdown Avatar */
.user-profile-dropdown__avatar {
  display: block;
  width: var(--size-7);
  height: var(--size-7);
  border-radius: var(--radius-round);
}

/* Dropdown Menu */
.user-profile-dropdown__menu {
  position: fixed;
  margin: 0;
  padding: 0;
  background-color: var(--surface-1);
  color: var(--text-1);
  border: 1px solid var(--surface-4);
  border-radius: var(--radius-3);
  box-shadow: var(--shadow-5);
  min-width: 200px;
  max-width: 280px;
  z-index: var(--layer-important);
  overflow: hidden;

  /* Remove default popover styling */
  &::backdrop {
    background: transparent;
  }

  /* Popover animation */
  opacity: 0;
  transform: scale(0.95);
  transition-property: opacity, transform;
  transition-duration: 150ms;
  transition-timing-function: var(--ease-out-3);
  transition-behavior: allow-discrete;

  &:popover-open {
    opacity: 1;
    transform: scale(1);
  }

  @starting-style {
    &:popover-open {
      opacity: 0;
      transform: scale(0.95);
    }
  }
}

/* Dropdown Navigation */
.user-profile-dropdown__nav {
  display: flex;
  flex-direction: column;
  gap: 0;
}

/* Dropdown Header */
.user-profile-dropdown__header {
  padding: var(--size-3);
  text-align: center;
}

.user-profile-dropdown__email {
  font-size: var(--font-size-0);
  color: var(--app-muted);
  word-break: break-all;
}

/* Dropdown Divider */
.user-profile-dropdown__divider {
  height: 1px;
  background-color: var(--surface-4);
  margin: 0;
}

/* Dropdown Section */
.user-profile-dropdown__section {
  padding: var(--size-1);
}

/* Dropdown Link */
.user-profile-dropdown__link {
  display: flex;
  align-items: center;
  gap: var(--size-2);
  padding: var(--size-2) var(--size-3);
  border-radius: var(--radius-2);
  text-decoration: none;
  color: var(--text-1);
  font-size: var(--font-size-1);
  font-weight: var(--font-weight-5);
  /* Removed transition for instant keyboard navigation */

  &:hover,
  &:focus-visible {
    background-color: var(--surface-3);
    outline: none;
  }

  /* Danger modifier for logout */
  &.user-profile-dropdown__link--danger {
    color: var(--app-danger);

    &:hover,
    &:focus-visible {
      background-color: var(--red-2);
    }
  }
}

/* Dropdown Icon */
.user-profile-dropdown__icon {
  width: var(--size-3);
  height: var(--size-3);
  flex-shrink: 0;
}
