/* ===== UX Enhancements v1 - 全局互动动效增强包 ===== */
/* 本文件为纯增量样式，不修改任何原有样式规则 */
/* 所有动画仅使用 transform / opacity / box-shadow，不触发重排 */

/* ---------- 1. 全局过渡 tokens ---------- */
:root {
  --ux-ease: cubic-bezier(0.22, 0.61, 0.36, 1);
  --ux-ease-out: cubic-bezier(0.16, 1, 0.3, 1);
  --ux-ease-spring: cubic-bezier(0.34, 1.56, 0.64, 1);
  --ux-fast: 150ms;
  --ux-mid: 250ms;
  --ux-slow: 400ms;
}

/* ---------- 2. 按钮/可点击元素：按下回弹 + 悬停微抬 ---------- */
button:not(.no-ux),
[class*="btn"]:not(.no-ux),
[class*="chip"]:not(.no-ux),
[class*="type-opt"]:not(.no-ux),
[class*="cd-type-opt"]:not(.no-ux),
[class*="tray-item"]:not(.no-ux),
[class*="vm-item"]:not(.no-ux),
[class*="confirm-btn"]:not(.no-ux),
[class*="upload-submit"]:not(.no-ux),
[class*="upload-next"]:not(.no-ux),
[class*="upload-back"]:not(.no-ux),
[class*="add-btn"]:not(.no-ux),
[class*="icon-btn"]:not(.no-ux),
[class*="birthday-btn"]:not(.no-ux),
[class*="report-next"]:not(.no-ux),
[class*="report-skip"]:not(.no-ux),
[class*="crop-cancel"]:not(.no-ux),
[class*="crop-ok"]:not(.no-ux),
[class*="letter-compose-cancel"]:not(.no-ux),
[class*="letter-compose-send"]:not(.no-ux),
[class*="view-on-map-btn"]:not(.no-ux),
[class*="delete-btn"]:not(.no-ux),
[class*="trash-clear-btn"]:not(.no-ux),
[class*="add-photos-btn"]:not(.no-ux),
[class*="photo-sel-bar"] button:not(.no-ux),
[class*="event-actions-row"] button:not(.no-ux),
[class*="lb-btn"]:not(.no-ux),
[class*="lb-like-btn"]:not(.no-ux),
[class*="lb-comment-input"] button:not(.no-ux),
[class*="location-list"] button:not(.no-ux),
[class*="loc-search-box"] button:not(.no-ux),
#add-countdown-btn:not(.no-ux),
.login-enter-btn:not(.no-ux) {
  transition:
    transform var(--ux-fast) var(--ux-ease),
    box-shadow var(--ux-mid) var(--ux-ease),
    background-color var(--ux-mid) var(--ux-ease),
    border-color var(--ux-mid) var(--ux-ease),
    color var(--ux-fast) linear;
  -webkit-tap-highlight-color: transparent;
}

/* 按下反馈 */
button:active:not(:disabled):not(.no-ux),
[class*="btn"]:active:not(:disabled):not(.no-ux),
[class*="chip"]:active:not(.no-ux),
[class*="type-opt"]:active:not(.no-ux),
[class*="cd-type-opt"]:active:not(.no-ux),
[class*="tray-item"]:active:not(.no-ux),
[class*="vm-item"]:active:not(.no-ux),
[class*="confirm-btn"]:active:not(.no-ux),
[class*="upload-submit"]:active:not(.no-ux),
[class*="upload-next"]:active:not(.no-ux),
[class*="add-btn"]:active:not(.no-ux),
[class*="icon-btn"]:active:not(.no-ux),
[class*="birthday-btn"]:active:not(.no-ux),
[class*="report-next"]:active:not(.no-ux),
[class*="crop-ok"]:active:not(.no-ux),
[class*="letter-compose-send"]:active:not(.no-ux),
[class*="photo-sel-bar"] button:active:not(.no-ux),
[class*="event-actions-row"] button:active:not(.no-ux),
[class*="lb-like-btn"]:active:not(.no-ux),
[class*="lb-comment-input"] button:active:not(.no-ux),
#add-countdown-btn:active:not(.no-ux),
.login-enter-btn:active:not(.no-ux) {
  transform: scale(0.96);
  transition-duration: 80ms;
}

/* 登录按钮特殊处理 */
.login-enter-btn {
  transition: transform var(--ux-fast) var(--ux-ease), box-shadow var(--ux-mid) var(--ux-ease);
}

/* ---------- 3. 卡片悬停效果 ---------- */
.timeline-item:not(.no-ux) {
  transition:
    transform var(--ux-mid) var(--ux-ease),
    box-shadow var(--ux-mid) var(--ux-ease),
    border-color var(--ux-mid) var(--ux-ease),
    background-color var(--ux-mid) var(--ux-ease);
}
.timeline-item:hover:not(.no-ux) {
  transform: translateY(-3px);
  box-shadow: 0 12px 36px rgba(0, 0, 0, 0.35), inset 0 1px 0 rgba(255, 255, 255, 0.18);
  border-color: rgba(100, 210, 255, 0.3);
}

.countdown-card:not(.no-ux) {
  transition:
    transform var(--ux-mid) var(--ux-ease),
    box-shadow var(--ux-mid) var(--ux-ease),
    border-color var(--ux-mid) var(--ux-ease);
}
.countdown-card:hover:not(.no-ux) {
  transform: translateY(-3px);
  box-shadow: 0 14px 40px rgba(0, 0, 0, 0.35), inset 0 1px 0 rgba(255, 255, 255, 0.18);
  border-color: rgba(100, 210, 255, 0.35);
}

.letter-card:not(.no-ux),
.letter-item:not(.no-ux) {
  transition:
    transform var(--ux-mid) var(--ux-ease),
    box-shadow var(--ux-mid) var(--ux-ease),
    border-color var(--ux-mid) var(--ux-ease),
    background-color var(--ux-mid) var(--ux-ease);
}
.letter-card:hover:not(.no-ux),
.letter-item:hover:not(.no-ux) {
  transform: translateY(-2px);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
  border-color: rgba(100, 210, 255, 0.25);
}

.role-card:not(.no-ux) {
  transition:
    transform var(--ux-fast) var(--ux-ease),
    box-shadow var(--ux-mid) var(--ux-ease),
    border-color var(--ux-mid) var(--ux-ease),
    background-color var(--ux-mid) var(--ux-ease);
}
.role-card:hover:not(.no-ux) {
  transform: translateY(-2px);
}
.role-her:hover:not(.no-ux) {
  box-shadow: 0 0 24px rgba(255, 55, 95, 0.25);
}
.role-his:hover:not(.no-ux) {
  box-shadow: 0 0 24px rgba(10, 132, 255, 0.25);
}

.drawer-item:not(.no-ux) {
  transition:
    background-color var(--ux-fast) var(--ux-ease),
    color var(--ux-fast) var(--ux-ease),
    transform var(--ux-fast) var(--ux-ease);
}
.drawer-item:hover:not(.no-ux) {
  background: rgba(255, 255, 255, 0.08);
  transform: translateX(2px);
}
.drawer-item.active:not(.no-ux) {
  background: rgba(100, 210, 255, 0.15);
  color: var(--cyan);
  box-shadow: 0 0 20px rgba(100, 210, 255, 0.1);
}

.photo-thumb:not(.no-ux) {
  transition:
    transform var(--ux-fast) var(--ux-ease),
    box-shadow var(--ux-fast) var(--ux-ease);
}
.photo-thumb:hover:not(.no-ux) {
  transform: scale(1.05);
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.4);
}

.map-pin-wrap:not(.no-ux) {
  transition: transform var(--ux-fast) var(--ux-ease);
}
.map-pin-wrap:hover:not(.no-ux) {
  transform: scale(1.1);
}

/* ---------- 4. 输入框聚焦效果 ---------- */
.form-input:focus:not(.no-ux),
input.form-input:focus:not(.no-ux),
textarea.form-input:focus:not(.no-ux),
select.form-input:focus:not(.no-ux),
.login-password:focus:not(.no-ux),
#comment-text:focus:not(.no-ux),
#timeline-search:focus:not(.no-ux),
#letters-search:focus:not(.no-ux),
#loc-search-input:focus:not(.no-ux),
#lb-comment-text:focus:not(.no-ux),
#letter-subject:focus:not(.no-ux),
#letter-content-new:focus:not(.no-ux),
#upload-title:focus:not(.no-ux),
#upload-desc:focus:not(.no-ux),
#upload-note:focus:not(.no-ux),
#cd-new-title:focus:not(.no-ux),
#settings-name:focus:not(.no-ux),
#settings-oldpwd:focus:not(.no-ux),
#settings-pwd:focus:not(.no-ux),
#letter-signature:focus:not(.no-ux) {
  border-color: rgba(100, 210, 255, 0.5);
  box-shadow: 0 0 0 3px rgba(100, 210, 255, 0.12);
  background-color: rgba(255, 255, 255, 0.12);
}

/* 输入框通用过渡 */
.form-input:not(.no-ux),
input.form-input:not(.no-ux),
textarea.form-input:not(.no-ux),
select.form-input:not(.no-ux),
.login-password:not(.no-ux),
#comment-text:not(.no-ux),
#timeline-search:not(.no-ux),
#letters-search:not(.no-ux),
#loc-search-input:not(.no-ux),
#lb-comment-text:not(.no-ux),
#letter-subject:not(.no-ux),
#letter-content-new:not(.no-ux),
#upload-title:not(.no-ux),
#upload-desc:not(.no-ux),
#upload-note:not(.no-ux),
#cd-new-title:not(.no-ux),
#settings-name:not(.no-ux),
#settings-oldpwd:not(.no-ux),
#settings-pwd:not(.no-ux),
#letter-signature:not(.no-ux) {
  transition:
    border-color var(--ux-mid) var(--ux-ease),
    box-shadow var(--ux-mid) var(--ux-ease),
    background-color var(--ux-mid) var(--ux-ease);
}

/* ---------- 5. 类型选择器增强 ---------- */
.type-opt:not(.no-ux),
.cd-type-opt:not(.no-ux) {
  transition: all var(--ux-mid) var(--ux-ease);
}
.type-opt:hover:not(.no-ux):not(.active),
.cd-type-opt:hover:not(.no-ux):not(.active) {
  background: rgba(255, 255, 255, 0.1);
  border-color: rgba(255, 255, 255, 0.2);
}

/* ---------- 6. 弹窗增强 ---------- */
.modal-content:not(.no-ux) {
  transition:
    transform var(--ux-slow) var(--ux-ease-out),
    box-shadow var(--ux-slow) var(--ux-ease),
    border-color var(--ux-slow) var(--ux-ease);
}
.modal.closing .modal-content:not(.no-ux) {
  transition:
    transform 0.3s cubic-bezier(0.4, 0, 0.6, 1),
    opacity 0.25s ease;
}
.modal-backdrop:not(.no-ux) {
  transition: opacity var(--ux-mid) ease;
}

/* ---------- 7. 通知条增强 ---------- */
.notify-toast:not(.no-ux) {
  transition:
    transform var(--ux-mid) var(--ux-ease),
    box-shadow var(--ux-mid) var(--ux-ease);
}
.notify-toast:hover:not(.no-ux) {
  box-shadow: 0 12px 48px rgba(0, 0, 0, 0.6);
}

/* ---------- 8. Toast 增强 ---------- */
.toast:not(.no-ux) {
  transition:
    transform var(--ux-mid) var(--ux-ease),
    box-shadow var(--ux-mid) var(--ux-ease),
    opacity var(--ux-mid) ease;
}

/* ---------- 9. 照片查看器增强 ---------- */
#lightbox:not(.no-ux) {
  transition: opacity var(--ux-fast) ease;
}
.lb-img:not(.no-ux) {
  transition: opacity var(--ux-fast) ease, transform var(--ux-slow) var(--ux-ease);
}
.lb-btn:not(.no-ux) {
  transition:
    background-color var(--ux-fast) ease,
    transform var(--ux-fast) var(--ux-ease);
}
.lb-btn:hover:not(.no-ux) {
  background: rgba(255, 255, 255, 0.25);
  transform: scale(1.08);
}

/* ---------- 10. 年度报告增强 ---------- */
.report-slide:not(.no-ux) {
  transition: opacity var(--ux-slow) ease, transform var(--ux-slow) var(--ux-ease-out);
}
.report-card:not(.no-ux) {
  transition: transform var(--ux-slow) var(--ux-ease-out);
}
.carousel-layer:not(.no-ux).active {
  opacity: 1;
}

/* ---------- 11. 生日页增强 ---------- */
.birthday-content:not(.no-ux) {
  transition: opacity var(--ux-slow) ease, transform var(--ux-slow) var(--ux-ease-out);
}
.birthday-btn:not(.no-ux) {
  transition:
    transform var(--ux-fast) var(--ux-ease),
    box-shadow var(--ux-mid) var(--ux-ease);
}
.birthday-btn:hover:not(.no-ux) {
  transform: scale(1.05);
  box-shadow: 0 8px 30px rgba(191, 90, 242, 0.3);
}

/* ---------- 13. 筛选栏增强 ---------- */
.filter-btn:not(.no-ux) {
  transition:
    color var(--ux-fast) var(--ux-ease),
    font-size var(--ux-mid) var(--ux-ease),
    font-weight var(--ux-mid) var(--ux-ease),
    background-color var(--ux-mid) var(--ux-ease);
}

/* ---------- 14. 用户菜单增强 ---------- */
.user-menu:not(.no-ux) {
  transition: opacity var(--ux-fast) ease, transform var(--ux-fast) var(--ux-ease);
}

/* ---------- 15. 图片淡入 ---------- */
img:not(.no-ux):not([src=""]):not([src*="data:"]) {
  transition: opacity var(--ux-mid) ease;
}
img.img-loading { opacity: 0; }
img.img-loaded { opacity: 1; }

/* ---------- 16. 滚动条美化 ---------- */
::-webkit-scrollbar-thumb:hover {
  background: rgba(255, 255, 255, 0.35) !important;
}

/* ---------- 17. 照片上传区域增强 ---------- */
.photo-upload-zone:not(.no-ux) {
  transition:
    border-color var(--ux-mid) var(--ux-ease),
    background-color var(--ux-mid) var(--ux-ease);
}

/* ---------- 18. 上传步骤指示器增强 ---------- */
.ustep:not(.no-ux) {
  transition:
    color var(--ux-fast) ease,
    background-color var(--ux-fast) ease,
    border-color var(--ux-fast) ease;
}
.ustep.active:not(.no-ux) {
  background: var(--cyan);
  color: #000;
  box-shadow: 0 0 12px rgba(100, 210, 255, 0.4);
}

/* ---------- 19. 信件心情标签增强 ---------- */
.letter-mood:not(.no-ux) {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 100px;
  font-size: 11px;
  background: rgba(255, 214, 10, 0.15);
  color: #ffd60a;
  margin-right: 6px;
}

/* ---------- 20. 信件未读/已读标签增强 ---------- */
.letter-read-tag:not(.no-ux) {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 100px;
  font-size: 10px;
  font-weight: 600;
}
.letter-read-tag.unread:not(.no-ux) {
  background: rgba(255, 55, 95, 0.2);
  color: #ff375f;
  animation: uxTagPulse 2s ease-in-out infinite;
}
.letter-read-tag.read:not(.no-ux) {
  background: rgba(255, 255, 255, 0.06);
  color: var(--text2);
}
@keyframes uxTagPulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(255, 55, 95, 0.3); }
  50% { box-shadow: 0 0 0 4px rgba(255, 55, 95, 0); }
}

/* ---------- 21. 水波纹 ---------- */
.ux-ripple {
  position: absolute;
  border-radius: 50%;
  pointer-events: none;
  transform: scale(0);
  opacity: 0.35;
  background: radial-gradient(circle, rgba(255, 255, 255, 0.4), rgba(255, 255, 255, 0) 70%);
  animation: uxRipple 0.52s cubic-bezier(0.22, 0.61, 0.36, 1) forwards;
  z-index: 1;
}
@keyframes uxRipple {
  to { transform: scale(2.6); opacity: 0; }
}

/* ---------- 22. 滚动进场 ---------- */
.ux-reveal {
  opacity: 0;
  transform: translateY(16px);
  transition: opacity 0.5s cubic-bezier(0.16, 1, 0.3, 1),
              transform 0.5s cubic-bezier(0.16, 1, 0.3, 1);
}

/* ---------- 23. 全局焦点可见性 ---------- */
*:focus-visible {
  outline: 2px solid rgba(100, 210, 255, 0.7);
  outline-offset: 2px;
  border-radius: 4px;
}

/* ---------- 24. 减少动效偏好 ---------- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
  .timeline-item:hover:not(.no-ux),
  .countdown-card:hover:not(.no-ux),
  .letter-card:hover:not(.no-ux),
  .role-card:hover:not(.no-ux),
  .drawer-item:hover:not(.no-ux),
  .photo-thumb:hover:not(.no-ux),
  .map-pin-wrap:hover:not(.no-ux) {
    transform: none;
  }
  img.img-loading { opacity: 1 !important; }
}

/* ---------- 25. 移动端适配（禁用悬停效果避免误触） ---------- */
@media (max-width: 768px) {
  .timeline-item:hover:not(.no-ux) { transform: none; }
  .countdown-card:hover:not(.no-ux) { transform: none; }
  .letter-card:hover:not(.no-ux) { transform: none; }
  .photo-thumb:hover:not(.no-ux) { transform: none; }
}

/* V6: photo navigation must never translate or scale when hovered/pressed. */
#lightbox .lb-btn:hover:not(.no-ux), #lightbox .lb-btn:active:not(.no-ux) { transform: translateY(-50%); }
