/* ============================================
   For You Tab - 沉浸式全屏 Feed（对标设计稿）
   布局与 Player 页一致
   ============================================ */

#tab-foryou {
  background: #000;
  bottom: 0;
}

/* ---- Feed 滚动容器 ---- */
.foryou-container {
  height: 100%;
  position: relative;
  overflow: hidden;
}

.foryou-container::-webkit-scrollbar { display: none; }

/* 卡片包裹层：由 JS transform 驱动切换 */
.foryou-feed-inner {
  height: 100%;
  will-change: transform;
}

/* ---- Feed 卡片 ---- */
.feed-card {
  width: 100%;
  height: 100%;
  position: relative;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #000;
  overflow: hidden;
}

/* ---- 视频/封面背景 ---- */
.feed-video {
  position: absolute;
  top: 0; left: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  z-index: 1;
  pointer-events: none;
}

/* iOS tap 层：接管点击（video pointer-events:none 不接事件）*/
.feed-tap-layer {
  position: absolute;
  top: 0; left: 0; right: 0; bottom: 0;
  z-index: 3;
  background: transparent;
  pointer-events: auto;
  touch-action: manipulation;
  border: 0;
  padding: 0;
}

.feed-bg {
  position: absolute;
  top: 0; left: 0; right: 0; bottom: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 2;
  transition: opacity 0.3s ease;
}

/* 封面图片 */
.feed-cover {
  position: absolute;
  top: 0; left: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.feed-bg-icon {
  font-size: 64px;
  opacity: 0.3;
  display: flex;
  align-items: center;
  justify-content: center;
}

.feed-playback-state {
  position: absolute;
  inset: 0;
  z-index: 12;
  display: none;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 16px;
  padding: 32px;
  background: rgba(0, 0, 0, 0.58);
  color: #fff;
  text-align: center;
}

.feed-playback-state.visible {
  display: flex;
}

.feed-playback-error p {
  max-width: 280px;
  margin: 0;
  font-size: 15px;
  line-height: 1.5;
}

.feed-playback-retry {
  min-width: 112px;
  min-height: 44px;
  padding: 10px 24px;
  border: 1px solid rgba(255, 255, 255, 0.55);
  border-radius: 24px;
  background: rgba(0, 0, 0, 0.28);
  color: #fff;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
}

/* ---- 底部渐变遮罩 ---- */
.feed-gradient-mask {
  position: absolute;
  left: 0; right: 0; bottom: 0;
  height: 65%;
  background: linear-gradient(to top,
    rgba(0,0,0,0.95) 0%,
    rgba(0,0,0,0.7) 35%,
    rgba(0,0,0,0.2) 65%,
    transparent 100%
  );
  pointer-events: none;
  z-index: 2;
}

/* ---- 左下 & 右下信息区域 (剧名、类型、描述在左下，剧集在右下) ---- */
.feed-info-overlay {
  position: absolute;
  left: 16px;
  right: 16px;
  bottom: calc(var(--safe-bottom, 0px) + 20px);
  z-index: 5;
  pointer-events: none;
  transition: transform 0.28s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

.feed-info-row {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
  width: 100%;
  pointer-events: none;
}

.feed-info-left {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  pointer-events: none;
}

.feed-drama-title {
  font-size: 18px;
  font-weight: 700;
  color: #fff;
  line-height: 1.25;
  margin-bottom: 4px;
  white-space: normal;
  overflow-wrap: anywhere;
  word-break: break-word;
  max-width: 100%;
  text-shadow: 0 2px 8px rgba(0, 0, 0, 0.7);
  pointer-events: none;
  user-select: none;
}

.feed-drama-detail {
  font-size: 12.5px;
  font-weight: 400;
  color: rgba(255, 255, 255, 0.85);
  line-height: 1.35;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100%;
  text-shadow: 0 1px 4px rgba(0, 0, 0, 0.7);
  pointer-events: none;
  user-select: none;
}

.feed-drama-desc {
  font-size: 16px;
  font-weight: 400;
  line-height: 1.5;
  color: rgba(255, 255, 255, 0.88);
  margin-top: 4px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  max-width: 100%;
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.8);
  pointer-events: none;
  user-select: none;
}

.feed-drama-desc.is-expanded {
  display: block;
  -webkit-line-clamp: unset;
  max-height: 50vh;
  max-height: 50dvh;
  overflow-y: auto;
  overscroll-behavior: contain;
  pointer-events: auto;
  touch-action: pan-y;
  -webkit-overflow-scrolling: touch;
}

.feed-desc-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: flex-start;
  min-height: 44px;
  margin-top: 0;
  margin-bottom: 18px;
  padding: 0 4px;
  border: 0;
  background: transparent;
  color: #fff;
  font: inherit;
  font-size: 14px;
  font-weight: 700;
  line-height: 1;
  cursor: pointer;
  pointer-events: auto;
  touch-action: manipulation;
  text-shadow: 0 1px 4px rgba(0, 0, 0, 0.8);
}

.feed-desc-toggle:active {
  opacity: 0.72;
}

/* 右下角剧集按钮 */
.feed-ep-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, #ff2e74 0%, #ff5388 100%);
  color: #ffffff;
  font-size: 13px;
  font-weight: 700;
  padding: 6px 16px;
  border-radius: 20px;
  border: none;
  cursor: pointer;
  pointer-events: auto;
  box-shadow: 0 4px 16px rgba(255, 46, 116, 0.45);
  white-space: nowrap;
  flex-shrink: 0;
  letter-spacing: 0.2px;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.feed-ep-btn:active {
  transform: scale(0.95);
  box-shadow: 0 2px 8px rgba(255, 46, 116, 0.6);
}

/* 当底部导航栏唤出时，信息层、进度条与侧边栏平滑上移避让底栏，确保内容和按钮完全不被遮挡 */
#app.tabbar-visible .feed-info-overlay,
#tab-foryou.tabbar-visible .feed-info-overlay {
  transform: translateY(calc(-1 * (var(--tabbar-height, 48px) + var(--safe-bottom, 0px) + 4px)));
}

#app.tabbar-visible .feed-progress-area,
#tab-foryou.tabbar-visible .feed-progress-area {
  transform: translateY(calc(-1 * (var(--tabbar-height, 48px) + var(--safe-bottom, 0px) + 4px)));
}

#app.tabbar-visible .foryou-sidebar,
#tab-foryou.tabbar-visible .foryou-sidebar {
  transform: translateY(calc(-1 * (var(--tabbar-height, 48px) + var(--safe-bottom, 0px) + 4px)));
}

/* ---- 进度条 (常驻细条 + 32px 超大触控热区 + 拖拽/暂停加粗与发光手柄) ---- */
.feed-progress-area {
  position: absolute;
  left: 0;
  right: 0;
  bottom: calc(var(--safe-bottom, 0px) + 2px);
  z-index: 12;
  padding: 14px 0 10px;
  cursor: pointer;
  touch-action: none;
  pointer-events: auto;
  opacity: 1;
  transition: transform 0.28s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

.feed-progress-bar {
  width: 100%;
  height: 2.5px;
  background: rgba(255, 255, 255, 0.28);
  border-radius: 2px;
  position: relative;
  transition: height 0.18s ease, background-color 0.18s ease;
}

.feed-progress-filled {
  position: absolute;
  top: 0;
  left: 0;
  height: 100%;
  background: linear-gradient(90deg, #ff2e74, #ff5388);
  border-radius: 2px;
  width: 0%;
  transition: none;
}

.feed-progress-thumb {
  position: absolute;
  right: -5px;
  top: 50%;
  transform: translateY(-50%) scale(0);
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: #ffffff;
  box-shadow: 0 0 6px rgba(255, 46, 116, 0.9), 0 2px 4px rgba(0, 0, 0, 0.4);
  transition: transform 0.18s cubic-bezier(0.34, 1.56, 0.64, 1);
  pointer-events: none;
}

/* 触摸、拖拽或暂停（.visible）时进度条加粗并弹出拖动手柄 */
.feed-progress-area:hover .feed-progress-bar,
.feed-progress-area:active .feed-progress-bar,
.feed-progress-area.dragging .feed-progress-bar,
.feed-progress-area.visible .feed-progress-bar {
  height: 5px;
  background: rgba(255, 255, 255, 0.45);
}

.feed-progress-area:hover .feed-progress-thumb,
.feed-progress-area:active .feed-progress-thumb,
.feed-progress-area.dragging .feed-progress-thumb,
.feed-progress-area.visible .feed-progress-thumb {
  transform: translateY(-50%) scale(1);
}

.feed-progress-area.dragging .feed-progress-bar {
  height: 6px;
}
.feed-progress-area.dragging .feed-progress-thumb {
  transform: translateY(-50%) scale(1.25);
}

/* ---- 右侧操作栏 ---- */
.foryou-sidebar {
  position: absolute;
  right: 14px;
  bottom: calc(var(--safe-bottom, 0px) + 110px);
  z-index: 10;
  display: none;
  flex-direction: column;
  align-items: center;
  gap: 22px;
}

.sidebar-action {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  cursor: pointer;
  transition: transform 0.15s;
  background: none;
  border: none;
  padding: 0;
}

.sidebar-action:active {
  transform: scale(0.88);
}

.sidebar-icon {
  width: 46px;
  height: 46px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.sidebar-fav-img,
.sidebar-speed-img {
  width: 32px;
  height: 32px;
  object-fit: contain;
}

/* 收藏激活状态 */
.sidebar-icon.favorited {
  /* 去圈后无需特殊背景 */
}

.sidebar-count {
  font-size: 11px;
  color: #fff;
  font-weight: 500;
  text-shadow: 0 1px 3px rgba(0,0,0,0.6);
  white-space: nowrap;
}

.quality-action {
  position: relative;
  min-width: 44px;
  min-height: 44px;
}

.sidebar-quality-glyph {
  width: 32px;
  height: 32px;
  display: grid;
  place-items: center;
  border: 2px solid #fff;
  border-radius: 50%;
  color: #fff;
  font-size: 14px;
  font-weight: 800;
}

.sidebar-quality-select {
  position: absolute;
  inset: 0;
  width: 100%;
  min-height: 44px;
  opacity: 0;
  cursor: pointer;
}

/* ============================================
   下拉刷新 / 加载更多 指示器
   ============================================ */

.foryou-refresh-indicator {
  position: absolute;
  top: 16px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 30;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 20px;
  background: rgba(28,28,30,0.92);
  border-radius: 20px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s;
}

.foryou-refresh-indicator.visible {
  opacity: 1;
}

.foryou-refresh-spinner {
  width: 18px;
  height: 18px;
  border: 2px solid rgba(255,255,255,0.2);
  border-top-color: #fff;
  border-radius: 50%;
  animation: foryou-spin 0.7s linear infinite;
}

@keyframes foryou-spin {
  to { transform: rotate(360deg); }
}

.foryou-refresh-text {
  font-size: 13px;
  color: rgba(255,255,255,0.85);
  font-weight: 500;
}

.foryou-loadmore-indicator {
  position: absolute;
  bottom: calc(var(--safe-bottom, 0px) + 16px);
  left: 50%;
  transform: translateX(-50%);
  z-index: 30;
  padding: 10px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s;
}

.foryou-loadmore-indicator.visible {
  opacity: 1;
}

/* ---- 已无更多内容提示 ---- */
.foryou-nomore-tip {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  z-index: 40;
  background: rgba(0, 0, 0, 0.65);
  color: #fff;
  font-size: 14px;
  padding: 12px 24px;
  border-radius: 8px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s;
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
}

.foryou-nomore-tip.visible {
  opacity: 1;
}

/* ============================================
   Feed 卡片骨架屏
   ============================================ */

.feed-card--skeleton .feed-bg {
  background: #1a1a1e !important;
  display: flex;
  align-items: center;
  justify-content: center;
}

.feed-skeleton-poster {
  width: 30%;
  opacity: 0.35;
}

.feed-skeleton-poster img {
  width: 100%;
  height: auto;
}

.feed-skel-info {
  position: absolute;
  left: 16px;
  right: 118px;
  bottom: calc(var(--safe-bottom, 0px) + 90px);
  z-index: 5;
}

.feed-skel-line {
  height: 14px;
  border-radius: 7px;
  background: rgba(255,255,255,0.08);
  margin-bottom: 8px;
}

.feed-skel-line--title {
  width: 55%;
  height: 20px;
  border-radius: 10px;
}

.feed-skel-line--desc {
  width: 80%;
}

.feed-skel-line--short {
  width: 50%;
}

.feed-skel-line--ep {
  width: 100%;
  height: 14px;
  border-radius: 7px;
}

.feed-ep-bar--skeleton {
  background: #1c1c1e;
  border-top: 0.5px solid rgba(255,255,255,0.04);
  padding: 14px 18px;
}

@media (min-width: 768px) {
  #tab-foryou {
    top: 64px;
    bottom: 0;
  }

  .feed-ep-bar {
    bottom: 0;
    padding-bottom: 12px;
  }

  .feed-progress-area {
    bottom: 50px;
  }

  .feed-info-overlay {
    bottom: 60px;
  }

  .feed-skel-info {
    bottom: 110px;
  }

  .foryou-sidebar {
    bottom: 108px;
  }

  .foryou-loadmore-indicator {
    bottom: 16px;
  }

  #app.tabbar-visible .feed-info-overlay,
  #tab-foryou.tabbar-visible .feed-info-overlay,
  #app.tabbar-visible .feed-progress-area,
  #tab-foryou.tabbar-visible .feed-progress-area,
  #app.tabbar-visible .foryou-sidebar,
  #tab-foryou.tabbar-visible .foryou-sidebar {
    transform: none !important;
  }
}
