/**
 * 移动端滚动体验优化
 * 提供流畅的原生触摸滚动体验
 */

/* 移动端全局滚动优化 */
@media (max-width: 768px) {
  /* 启用原生触摸滚动 */
  * {
    -webkit-overflow-scrolling: touch;
  }

  /* 隐藏所有滚动条 */
  *::-webkit-scrollbar {
    display: none;
    width: 0;
    height: 0;
  }

  * {
    -ms-overflow-style: none;
    scrollbar-width: none;
  }

  /* 防止滚动穿透 */
  body.scroll-locked {
    overflow: hidden;
    position: fixed;
    width: 100%;
    height: 100%;
  }

  /* 滚动容器基础样式 */
  .scroll-container {
    overflow-y: auto;
    overflow-x: hidden;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior: contain;
  }

  /* 滚动指示器 */
  .scroll-indicator {
    position: fixed;
    right: 4px;
    top: 50%;
    transform: translateY(-50%);
    width: 3px;
    height: 60px;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 2px;
    opacity: 0;
    transition: opacity 0.3s ease;
    pointer-events: none;
    z-index: 1000;
  }

  .scroll-indicator.visible {
    opacity: 1;
  }

  .scroll-indicator::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 30%;
    background: rgba(64, 158, 255, 0.8);
    border-radius: 2px;
    transition: top 0.1s ease;
  }

  /* 滚动边界效果 */
  .scroll-boundary-top,
  .scroll-boundary-bottom {
    position: absolute;
    left: 0;
    right: 0;
    height: 40px;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.3s ease;
    z-index: 10;
  }

  .scroll-boundary-top {
    top: 0;
    background: linear-gradient(to bottom, rgba(10, 10, 10, 0.8), transparent);
  }

  .scroll-boundary-bottom {
    bottom: 0;
    background: linear-gradient(to top, rgba(10, 10, 10, 0.8), transparent);
  }

  .scroll-boundary-top.visible,
  .scroll-boundary-bottom.visible {
    opacity: 1;
  }

  /* 抽屉内容区滚动优化 */
  .drawer-content {
    overflow-y: auto;
    overflow-x: hidden;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior: contain;
    position: relative;
  }

  /* 防止抽屉滚动穿透 */
  .drawer-content.scrolling {
    touch-action: pan-y;
  }

  /* 列表滚动优化 */
  .list-container {
    overflow-y: auto;
    overflow-x: hidden;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior: contain;
  }

  /* 对话框内容滚动 */
  .el-dialog__body {
    overflow-y: auto;
    overflow-x: hidden;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior: contain;
  }

  /* 表格滚动 */
  .el-table__body-wrapper {
    overflow-y: auto;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior: contain;
  }

  /* 下拉菜单滚动 */
  .el-select-dropdown__wrap {
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior: contain;
  }

  /* 滚动性能优化 */
  .scroll-optimized {
    will-change: scroll-position;
    transform: translateZ(0);
  }

  /* 平滑滚动 */
  .smooth-scroll {
    scroll-behavior: smooth;
  }

  /* 快速滚动 */
  .fast-scroll {
    scroll-behavior: auto;
  }
}

/* 触摸设备特定优化 */
@media (hover: none) and (pointer: coarse) {
  /* 增强触摸反馈 */
  .scroll-container:active {
    cursor: grabbing;
  }

  /* 优化滚动条拖动 */
  .scroll-container {
    scroll-snap-type: y proximity;
  }

  /* 滚动吸附点 */
  .scroll-snap-item {
    scroll-snap-align: start;
    scroll-snap-stop: normal;
  }
}

/* 横屏模式滚动优化 */
@media (max-width: 768px) and (orientation: landscape) {
  .scroll-indicator {
    height: 40px;
  }

  .scroll-boundary-top,
  .scroll-boundary-bottom {
    height: 30px;
  }
}

/* 小屏幕设备优化 */
@media (max-width: 480px) {
  .scroll-indicator {
    width: 2px;
    height: 50px;
  }

  .scroll-boundary-top,
  .scroll-boundary-bottom {
    height: 30px;
  }
}
