/* 自定义右键菜单样式（美化版）
 * 毛玻璃卡片 + 渐变悬停 + 弹出缩放动画，跟随亮/暗模式自动换色
 * 动画作用在 .rm-body 内层容器上，避免影响 JS 的边界测量
 */

#rightmenu {
  display: none;
  position: fixed;
  width: 172px;
  height: fit-content;
  font-size: 13px;
  background: rgba(255, 255, 255, 0.72);
  border: 1px solid rgba(60, 60, 67, 0.1);
  border-radius: 12px;
  box-shadow:
    0 8px 24px rgba(0, 0, 0, 0.14),
    0 2px 6px rgba(0, 0, 0, 0.06);
  -webkit-backdrop-filter: blur(14px) saturate(1.6);
  backdrop-filter: blur(14px) saturate(1.6);
  z-index: 100000;
  overflow: hidden;
}

/* 不支持毛玻璃的浏览器降级为实色卡片 */
@supports not ((backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px))) {
  #rightmenu {
    background: var(--card-bg, #fff);
  }
}

/* 暗色模式 */
[data-theme='dark'] #rightmenu {
  background: rgba(32, 34, 39, 0.78);
  border-color: rgba(255, 255, 255, 0.09);
  box-shadow:
    0 8px 24px rgba(0, 0, 0, 0.4),
    0 2px 6px rgba(0, 0, 0, 0.3);
}

/* 弹出动画：缩放原点由 JS 按光标方向动态设置 */
#rightmenu .rm-body {
  animation: rm-pop 0.18s cubic-bezier(0.21, 1.02, 0.73, 1);
}

@keyframes rm-pop {
  from {
    opacity: 0;
    transform: scale(0.88);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}

/* 透明遮罩：点击菜单外区域关闭 */
#rightmenu-mask {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 99998;
  background: transparent;
}

#rightmenu .rightmenu-group {
  padding: 6px 8px;
}

/* 分组间分割线（柔和浅灰） */
#rightmenu .rightmenu-group:not(:nth-last-child(1)) {
  border-bottom: 1px solid rgba(128, 128, 128, 0.16);
}

#rightmenu .rightmenu-item {
  display: flex;
  align-items: center;
  height: 34px;
  line-height: 34px;
  padding: 0 8px;
  border-radius: 8px;
  transition: background 0.2s ease, color 0.2s ease;
  color: var(--font-color, #4c4948);
  cursor: pointer;
  user-select: none;
}

/* 顶部小按钮组：横向均分，悬停为主题色胶囊 */
#rightmenu .rightmenu-group.rightmenu-small {
  display: flex;
  justify-content: space-between;
}

#rightmenu .rightmenu-small .rightmenu-item {
  justify-content: center;
  padding: 0;
}

#rightmenu .rightmenu-small .rightmenu-item:hover {
  background: rgba(73, 177, 245, 0.12);
  color: #49b1f5;
}

[data-theme='dark'] #rightmenu .rightmenu-small .rightmenu-item:hover {
  background: rgba(73, 177, 245, 0.22);
  color: #7cc4f8;
}

/* 文字行分组：悬停为主题色渐变 + 白字 */
#rightmenu .rightmenu-line .rightmenu-item:hover {
  background: linear-gradient(135deg, #49b1f5, #00c4b6);
  color: #fff;
}

#rightmenu .rightmenu-item i {
  display: inline-block;
  text-align: center;
  width: 26px;
  height: 26px;
  line-height: 26px;
  margin-right: 8px;
  flex-shrink: 0;
  font-size: 14px;
}

#rightmenu .rightmenu-small .rightmenu-item i {
  margin-right: 0;
}

#rightmenu .rightmenu-item span {
  line-height: 34px;
  white-space: nowrap;
  letter-spacing: 0.3px;
}

/* 隐藏的分组（上下文检测控制） */
#rightmenu .rightmenu-group.hide,
#rightmenu .hide {
  display: none;
}
