/*!
 * dashboard-gate.css — 订阅保护在原生「一键订阅」弹窗内的样式
 *
 * 全部类名以 xbdg- 前缀，避免与 naive-ui / tailwind 的样式冲突。
 * 只影响被标记为 data-xbdg-owned 的自有节点，以及带 .xbdg-content--locked 的原生内容。
 */

.xbdg-content {
  position: relative;
}

.xbdg-content--locked {
  min-height: 300px;
}

.xbdg-content--locked .xbdg-panel {
  position: absolute;
  top: 50%;
  left: 16px;
  right: 16px;
  transform: translateY(-50%);
  padding: 18px;
  border: 1px solid rgba(148, 163, 184, 0.24);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.88);
  background: color-mix(in srgb, var(--n-color-modal, #fff) 88%, transparent);
  box-shadow: 0 8px 32px rgba(15, 23, 42, 0.08);
}

.xbdg-close {
  margin-left: auto;
}

.xbdg-switch:focus-visible,
.xbdg-mode:focus-visible,
.xbdg-close:focus-visible,
.xbdg-retry:focus-visible {
  outline: 2px solid #2563eb;
  outline-offset: 3px;
}

/* ---------------------------------------------------------------- *
 * 锁定态：原生内容不可点、不可聚焦、不可读，并做毛玻璃模糊
 * ---------------------------------------------------------------- */
.xbdg-content--locked > *:not([data-xbdg-owned]) {
  filter: blur(4px);
  opacity: 0.5;
  pointer-events: none;
  user-select: none;
  -webkit-user-select: none;
  transition:
    filter 180ms cubic-bezier(0.23, 1, 0.32, 1),
    opacity 180ms cubic-bezier(0.23, 1, 0.32, 1);
}

/* ---------------------------------------------------------------- *
 * 毛玻璃遮罩（覆盖弹窗内容区，不新开全屏弹窗）
 * ---------------------------------------------------------------- */
.xbdg-frost {
  position: absolute;
  inset: 0;
  z-index: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: inherit;
  background: rgba(255, 255, 255, 0.55);
  background: color-mix(in srgb, var(--n-color-modal, #fff) 58%, transparent);
  -webkit-backdrop-filter: blur(6px) saturate(1.15);
  backdrop-filter: blur(6px) saturate(1.15);
  pointer-events: auto;
}

.xbdg-frost--hidden {
  display: none !important;
}

.xbdg-lock {
  color: var(--n-text-color, rgb(51, 54, 57));
  opacity: 0.16;
  pointer-events: none;
}

/* ---------------------------------------------------------------- *
 * 状态条（自有节点，位于原生选项之上）
 * ---------------------------------------------------------------- */
.xbdg-panel {
  position: relative;
  z-index: 2;
  padding: 10px 12px 12px;
  color: var(--n-text-color, rgb(51, 54, 57));
  font-size: 13px;
  line-height: 1.5;
  border-bottom: 1px solid var(--n-border-color, rgba(239, 239, 245, 1));
  background: rgba(255, 255, 255, 0.92);
  background: color-mix(in srgb, var(--n-color-modal, #fff) 92%, transparent);
  text-align: left;
}

.xbdg-head {
  display: flex;
  align-items: center;
  gap: 6px;
  min-height: 22px;
}

.xbdg-dot {
  flex: none;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: rgba(120, 120, 128, 0.45);
}

.xbdg-panel--open .xbdg-dot {
  background: #18a058;
}

.xbdg-panel--bad .xbdg-dot {
  background: #d03050;
}

.xbdg-title {
  font-weight: 500;
}

.xbdg-countdown {
  margin-left: auto;
  font-size: 12px;
  font-variant-numeric: tabular-nums;
  opacity: 0.7;
}

.xbdg-desc {
  margin: 2px 0 8px;
  font-size: 12px;
  opacity: 0.72;
}

.xbdg-controls {
  display: flex;
  align-items: center;
}

/* ---------------------------------------------------------------- *
 * 开关
 * ---------------------------------------------------------------- */
.xbdg-switch {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 4px 6px;
  margin: -4px -6px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: inherit;
  font: inherit;
  font-size: 13px;
  cursor: pointer;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
  user-select: none;
  -webkit-user-select: none;
  transition: transform 120ms cubic-bezier(0.23, 1, 0.32, 1), background-color 120ms ease-out;
}

.xbdg-switch[disabled] {
  cursor: default;
  opacity: 0.55;
}

.xbdg-switch__track {
  position: relative;
  flex: none;
  width: 34px;
  height: 18px;
  border-radius: 9px;
  background: rgba(120, 120, 128, 0.32);
  transition: background-color 180ms cubic-bezier(0.23, 1, 0.32, 1);
}

.xbdg-switch__thumb {
  position: absolute;
  top: 2px;
  left: 2px;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.22);
  transition: transform 180ms cubic-bezier(0.23, 1, 0.32, 1);
}

.xbdg-switch[aria-checked="true"] .xbdg-switch__track {
  background: #18a058;
}

.xbdg-switch[aria-checked="true"] .xbdg-switch__thumb {
  transform: translateX(16px);
}

/* ---------------------------------------------------------------- *
 * 开启时长
 * ---------------------------------------------------------------- */
.xbdg-modes {
  display: flex;
  gap: 6px;
  margin-top: 8px;
}

.xbdg-modes[hidden] {
  display: none !important;
}

.xbdg-mode {
  padding: 3px 8px;
  border: 1px solid var(--n-border-color, rgba(239, 239, 245, 1));
  border-radius: 5px;
  background: transparent;
  color: inherit;
  font: inherit;
  font-size: 12px;
  line-height: 1.6;
  cursor: pointer;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
  user-select: none;
  -webkit-user-select: none;
  transition: border-color 150ms ease-out, color 150ms ease-out, transform 120ms cubic-bezier(0.23, 1, 0.32, 1);
}

.xbdg-mode[aria-checked="true"] {
  border-color: var(--n-color-target, #316c72ff);
  color: var(--n-color-target, #316c72ff);
}

/* ---------------------------------------------------------------- *
 * 错误 / 提示
 * ---------------------------------------------------------------- */
.xbdg-message {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: 8px;
  font-size: 12px;
  color: #d03050;
}

.xbdg-message--empty {
  display: none !important;
}

.xbdg-retry {
  padding: 1px 8px;
  border: 1px solid currentColor;
  border-radius: 5px;
  background: transparent;
  color: inherit;
  font: inherit;
  font-size: 12px;
  line-height: 1.6;
  cursor: pointer;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
  user-select: none;
  -webkit-user-select: none;
}

/* ---------------------------------------------------------------- *
 * 关闭按钮
 * ---------------------------------------------------------------- */
.xbdg-close {
  flex: none;
  width: 22px;
  height: 22px;
  padding: 0;
  border: 0;
  border-radius: 5px;
  background: transparent;
  color: inherit;
  font-size: 17px;
  line-height: 1;
  opacity: 0.55;
  cursor: pointer;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
  user-select: none;
  -webkit-user-select: none;
  transition: opacity 150ms ease-out, transform 120ms cubic-bezier(0.23, 1, 0.32, 1);
}

.xbdg-panel--open .xbdg-close,
.xbdg-panel--bad .xbdg-close {
  margin-left: 4px;
}

/* ---------------------------------------------------------------- *
 * 指针设备才有的 hover / 按压反馈
 * ---------------------------------------------------------------- */
@media (hover: hover) and (pointer: fine) {
  .xbdg-switch:hover:not([disabled]) {
    background: var(--n-color-hover, rgba(243, 243, 245, 1));
  }

  .xbdg-mode:hover {
    border-color: var(--n-color-target, #316c72ff);
  }

  .xbdg-close:hover {
    opacity: 0.9;
  }

  .xbdg-retry:hover {
    opacity: 0.8;
  }
}

.xbdg-switch:active:not([disabled]),
.xbdg-mode:active,
.xbdg-close:active,
.xbdg-retry:active {
  transform: scale(0.97);
}

.xbdg-panel--busy {
  cursor: progress;
}

/* ---------------------------------------------------------------- *
 * 降低动效偏好
 * ---------------------------------------------------------------- */
@media (prefers-reduced-motion: reduce) {
  .xbdg-content--locked > *:not([data-xbdg-owned]),
  .xbdg-switch,
  .xbdg-switch__track,
  .xbdg-switch__thumb,
  .xbdg-mode,
  .xbdg-close {
    transition: none !important;
  }

  .xbdg-switch:active:not([disabled]),
  .xbdg-mode:active,
  .xbdg-close:active,
  .xbdg-retry:active {
    transform: none;
  }
}
