// 背景色呼吸动画 - 用于吸引用户注意
@keyframes notification-breathe {
  0%,
  100% {
    background-color: #fef8e2;
  }
  50% {
    background-color: #fff1c9;
  }
}

.toolbar-notification {
  display: flex;
  align-items: center;
  padding: 0 8px;
  gap: 8px;
  z-index: 0;
  border-radius: 4px;
  max-width: 0;
  opacity: 0;
  overflow: hidden;
  transition:
    max-width 300ms ease-out,
    opacity 280ms ease-out,
    padding 280ms ease-out;
  background: #f0f5ff;
  box-sizing: border-box;
  margin-right: 4px;
  white-space: nowrap;

  &.toolbar-notification-visible {
    max-width: 600px;
    opacity: 1;
    animation: notification-breathe 2s ease-in-out infinite; // 2秒一个循环，无限循环
  }

  // 已保存状态：蓝色背景，停止呼吸动画
  &.toolbar-notification-saved {
    background: #f0f5ff;
    animation: none;
  }

  &.toolbar-notification-closing {
    max-width: 0;
    opacity: 0;
    padding-left: 0;
    padding-right: 0;
  }
}

.toolbar-notification-icon {
  display: flex;
  align-items: center;
  color: #4161fd;
  font-size: 16px;
}

.toolbar-notification-message {
  display: flex;
  align-items: center;
  gap: 4px;
  color: #333;
  font-size: 12px;
  font-weight: bold;
  line-height: 24px;
  white-space: nowrap;
  transition: color 0.9s ease;

  &.toolbar-notification-message-saved {
    color: #4161fd;
  }
}

.toolbar-notification-saved-icon {
  color: #4161fd;
  flex-shrink: 0;
}

.toolbar-notification-actions {
  display: flex;
  align-items: center;
  gap: 0;
}

/* 提高选择器优先级以覆盖 CnButton 默认样式，避免使用 !important */
.toolbar-notification
  .toolbar-notification-actions
  button.cn-ui-button.toolbar-notification-cancel {
  display: flex;
  align-items: center;
  padding: 3px 4px;
  z-index: 0;
  color: #4161fd;
  font-size: 12px;
  gap: 2px;

  &:hover {
    color: #2d4cfd;
  }

  svg,
  .cn-icon {
    color: #4161fd;
  }
}

.toolbar-notification .toolbar-notification-actions .cn-ui-button.toolbar-notification-save {
  display: flex;
  align-items: center;
  padding: 3px 4px;
  z-index: 0;
  color: #4161fd;
  font-size: 12px;
  gap: 2px;

  &:hover {
    color: #2d4cfd;
  }

  svg,
  .cn-icon {
    color: #4161fd;
  }
}

.toolbar-notification
  .toolbar-notification-actions
  .cn-ui-button.toolbar-notification-save:disabled {
  color: #bfbfbf;
  cursor: not-allowed;

  svg,
  .cn-icon {
    color: #bfbfbf;
  }
}

.toolbar-notification-divider {
  width: 1px;
  height: 12px;
  background-color: #d9d9d9;
  margin: 0 2px;
}

.toolbar-notification-save-menu {
  padding: 4px 0;
  min-width: 100px;
}

.toolbar-notification-save-menu-item {
  padding: 8px 16px;
  cursor: pointer;
  font-size: 14px;
  color: #262626;

  &:hover {
    background-color: #f5f5f5;
  }
}
