/*!
 * WTS 通知条（ACFUN 风格气泡公告）v2.0.0
 * 配色由插件后台注入 CSS 变量，本文件只负责布局与动效。
 */

.wts-container {
  position: fixed;
  z-index: 999999;
  display: flex;
  flex-direction: column;
  gap: 12px;
  max-width: calc(100vw - 32px);
  pointer-events: none;
}

/* ---------- 位置 ---------- */

.wts-pos-top-left      { top: 20px; left: 20px; align-items: flex-start; }
.wts-pos-top-right     { top: 20px; right: 20px; align-items: flex-end; }
.wts-pos-top-center    { top: 20px; left: 50%; transform: translateX(-50%); align-items: center; }
.wts-pos-bottom-left   { bottom: 20px; left: 20px; align-items: flex-start; flex-direction: column-reverse; }
.wts-pos-bottom-right  { bottom: 20px; right: 20px; align-items: flex-end; flex-direction: column-reverse; }
.wts-pos-bottom-center { bottom: 20px; left: 50%; transform: translateX(-50%); align-items: center; flex-direction: column-reverse; }

/* ---------- 通知条本体 ---------- */

.wts-notify {
  --wts-bg: #ff8c83;
  --wts-border: #fa8072;
  --wts-title-color: #ffffff;
  --wts-text-color: #fff5f4;
  --wts-duration: 8000ms;

  position: relative;
  box-sizing: border-box;
  display: flex;
  align-items: flex-start;
  gap: 10px;
  width: 360px;
  max-width: 100%;
  padding: 13px 40px 13px 15px;
  overflow: hidden;
  font-size: 14px;
  line-height: 1.55;
  color: var(--wts-text-color);
  background: var(--wts-bg);
  border-left: 6px solid var(--wts-border);
  border-radius: 10px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.18);
  pointer-events: auto;
  opacity: 0;
  transform: translateX(-28px);
  transition: opacity 0.45s ease, transform 0.45s cubic-bezier(0.22, 1, 0.36, 1);
  will-change: opacity, transform;
}

/* 右侧 / 中间的默认进场方向 */
.wts-pos-top-right .wts-notify,
.wts-pos-bottom-right .wts-notify { transform: translateX(28px); }

.wts-pos-top-center .wts-notify,
.wts-pos-bottom-center .wts-notify { transform: translateY(-18px); }

/* ---------- 出场动画 ---------- */

.wts-anim-fade .wts-notify { transform: none; }
.wts-anim-drop .wts-notify { transform: translateY(-22px); }
.wts-anim-zoom .wts-notify { transform: scale(0.88); }
.wts-anim-none .wts-notify { transition: none; }

/* ---------- 进入 / 退出状态（必须在位置与动画之后） ---------- */

.wts-notify.is-in {
  opacity: 1;
  transform: translate(0, 0) scale(1);
}

.wts-notify.is-out {
  opacity: 0;
  transform: translateY(14px) scale(0.98);
}

/* 右侧位置：强调色条靠右、关闭按钮靠左，避免视觉重心错位 */
.wts-pos-top-right .wts-notify,
.wts-pos-bottom-right .wts-notify {
  padding: 13px 15px 13px 40px;
  border-left-width: 0;
  border-right: 6px solid var(--wts-border);
}

.wts-pos-top-right .wts-close,
.wts-pos-bottom-right .wts-close {
  right: auto;
  left: 8px;
}

/* ---------- 内容 ---------- */

.wts-icon {
  flex: 0 0 auto;
  font-size: 18px;
  line-height: 1.3;
}

.wts-body {
  flex: 1 1 auto;
  min-width: 0;
}

.wts-title {
  margin-bottom: 2px;
  font-size: 15px;
  font-weight: 700;
  color: var(--wts-title-color);
  word-break: break-word;
}

.wts-content {
  color: var(--wts-text-color);
  white-space: pre-line;
  word-break: break-word;
}

.wts-content a {
  color: inherit;
  text-decoration: underline;
}

.wts-link {
  display: inline-block;
  margin-top: 6px;
  color: var(--wts-title-color);
  font-weight: 600;
  text-decoration: none;
  border-bottom: 1px dashed currentColor;
}

.wts-link:hover {
  opacity: 0.85;
}

/* ---------- 关闭按钮 ---------- */

.wts-close {
  position: absolute;
  top: 6px;
  right: 8px;
  width: 22px;
  height: 22px;
  padding: 0;
  font-size: 16px;
  line-height: 1;
  color: inherit;
  text-align: center;
  cursor: pointer;
  background: transparent;
  border: 0;
  border-radius: 50%;
  opacity: 0.7;
  transition: opacity 0.2s, background-color 0.2s;
}

.wts-close:hover {
  background-color: rgba(255, 255, 255, 0.18);
  opacity: 1;
}

/* ---------- 进度条 ---------- */

.wts-progress {
  position: absolute;
  bottom: 0;
  left: 0;
  width: 100%;
  height: 3px;
  background: rgba(255, 255, 255, 0.5);
  transform-origin: left center;
  animation: wts-progress var(--wts-duration) linear forwards;
}

.wts-notify.is-paused .wts-progress {
  animation-play-state: paused;
}

@keyframes wts-progress {
  from { transform: scaleX(1); }
  to   { transform: scaleX(0); }
}

/* ---------- 样式风格 ---------- */

.wts-style-glass .wts-notify {
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  box-shadow: 0 12px 34px rgba(0, 0, 0, 0.28);
}

.wts-notify.is-dark {
  box-shadow: 0 12px 34px rgba(0, 0, 0, 0.45);
}

/* ---------- 移动端 ---------- */

@media (max-width: 640px) {
  .wts-container {
    top: 12px;
    right: 12px;
    bottom: auto;
    left: 12px;
    max-width: none;
    align-items: stretch !important;
    transform: none !important;
  }

  .wts-pos-bottom-left,
  .wts-pos-bottom-center,
  .wts-pos-bottom-right {
    top: auto;
    bottom: 12px;
    flex-direction: column-reverse;
  }

  .wts-notify {
    width: auto !important;
    max-width: none !important;
  }
}

/* ---------- 无障碍：减少动效 ---------- */

@media (prefers-reduced-motion: reduce) {
  .wts-notify {
    transition: opacity 0.15s linear;
    transform: none !important;
  }

  .wts-progress {
    display: none;
  }
}
