/* ============================================
   Home Tab - 首页样式（1:1 对齐 UI 设计稿）
   ============================================ */

#tab-home {
  background: #000000;
  min-height: 100%;
}

/* ================================
   顶部 Header（搜索栏 + 18+ Minis）
   设计稿：左侧深灰圆角搜索条 + 右侧 18+ 徽章按钮
   ================================ */
.home-header {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  padding-top: calc(10px + env(safe-area-inset-top, 0px));
  position: sticky;
  top: 0;
  z-index: var(--z-header);
  background: #000000;
}

/* ---- 搜索栏 ---- */
.search-bar {
  flex: 1;
  display: flex;
  align-items: center;
  gap: 8px;
  height: 40px;
  padding: 0 14px;
  background: #2c2c2e;
  border: none;
  border-radius: 12px;
  color: #8e8e93;
  font-size: 15px;
  font-family: inherit;
  cursor: pointer;
  transition: background 0.15s;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
  text-align: left;
  width: 0; /* 配合 flex:1 让它自适应但不溢出 */
}

.search-bar:active {
  background: #3a3a3c;
}

.search-icon {
  width: 22px;
  height: 22px;
  flex-shrink: 0;
}

.search-placeholder {
  color: #8e8e93;
  font-size: 15px;
}

/* ---- 18+ TikTok Minis 徽章按钮 ---- */
.minis-badge-btn {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 110px;
  height: 48px;
  background: none;
  border: none;
  cursor: pointer;
  padding: 0;
  border-radius: 10px;
  transition: transform 0.15s;
  -webkit-tap-highlight-color: transparent;
}

.minis-badge-btn:active {
  transform: scale(0.94);
}

.minis-badge-img {
  width: 95px;
  height: auto;
  display: block;
}

/* ================================
   Section 容器
   ================================ */
.home-section {
  padding: 16px 14px 0;
}

.home-section:first-of-type {
  padding-top: 12px;
}

.home-section-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
  padding: 0 2px;
}

.home-section-title {
  font-size: 18px;
  font-weight: 700;
  color: #ffffff;
  letter-spacing: -0.3px;
}

.home-more-btn {
  font-size: 14px;
  color: #8e8e93;
  cursor: pointer;
  white-space: nowrap;
  padding: 4px 4px;
  border-radius: 6px;
  transition: all 0.15s;
  -webkit-tap-highlight-color: transparent;
  font-weight: 400;
}

.home-more-btn:active {
  color: #ffffff;
  opacity: 0.7;
}

/* ================================
   横向滚动列表 (Trending / New Releases)
   设计稿：横向滚动、卡片竖版、HOT/NEW 角标在右上角
   ================================ */
.drama-scroll {
  display: flex;
  gap: 12px;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scroll-snap-type: x mandatory;
  padding-bottom: 4px;
  scrollbar-width: none;
  -ms-overflow-style: none;
}
.drama-scroll::-webkit-scrollbar { display: none; }

/* 横滚区域专用 - 卡片尺寸 */
#trending-list .drama-card,
#new-releases-list .drama-card {
  flex-shrink: 0;
  width: 130px;
  scroll-snap-align: start;
}

#trending-list .card-poster,
#new-releases-list .card-poster {
  width: 130px;
  height: 182px;
}

/* ================================
   网格布局
   ================================ */

/* ---- 2列网格 (Exclusive Dramas) 大卡片 ---- */
.home-exclusive-section {
  padding: 16px 8px 0;
}

.drama-grid--2col {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
  padding: 0 0 24px;
}

.drama-grid--2col .drama-card {
  width: 100%;
}

.drama-grid--2col .card-poster {
  width: 100%;
  aspect-ratio: 2 / 3;
  height: auto;
  background-color: #1c1c1e;
  overflow: hidden;
  border-radius: 10px;
}

.drama-grid--2col .card-title {
  font-size: 14px;
  margin-top: 8px;
}

/* ---- 3列网格 (All Short Dramas) 小卡片 ---- */
.drama-grid--3col {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  padding: 0 0 32px;
  justify-items: center;
}

.drama-grid--3col .drama-card {
  width: 100%;
}

.drama-grid--3col .card-poster {
  width: 100%;
  aspect-ratio: 2 / 3;
  height: auto;
}

/* ================================
   卡片 Badge 样式（右上角）
   ================================ */

/* HOT 角标 - 使用图片 */
#tab-home .card-badge.badge-img.hot {
  position: absolute;
  top: 0;
  right: 0;
  width: 45px;
  height: 17px;
  z-index: 2;
  object-fit: contain;
}

/* NEW 角标 - 使用图片 */
#tab-home .card-badge.badge-img.new {
  position: absolute;
  top: 0;
  right: 0;
  width: 45px;
  height: 17px;
  z-index: 2;
  object-fit: contain;
}

/* NEW 角标 - 青蓝渐变（备用）*/
#tab-home .card-badge.new {
  position: absolute;
  top: 0;
  right: 0;
  font-size: 9px;
  font-weight: 800;
  letter-spacing: 0.5px;
  text-transform: uppercase;
  z-index: 2;
}

/* VIP 角标 - 金色渐变（备用）*/
#tab-home .card-badge.vip {
  position: absolute;
  top: 0;
  right: 0;
  font-size: 9px;
  font-weight: 800;
  letter-spacing: 0.5px;
  text-transform: uppercase;
  z-index: 2;
}

/* ================================
   全局卡片基础覆盖（首页内）
   ================================ */
#tab-home .drama-card {
  cursor: pointer;
  border-radius: 10px;
  overflow: hidden;
  transition: transform 0.15s ease;
  background: transparent;
}

#tab-home .drama-card:active {
  transform: scale(0.97);
}

#tab-home .drama-card .card-poster {
  border-radius: 10px;
  overflow: hidden;
  position: relative;
  background: #1c1c1e;
  display: flex;
  align-items: center;
  justify-content: center;
}

#tab-home .drama-card .card-poster img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

#tab-home .drama-card .card-title {
  margin-top: 6px;
  font-size: 13px;
  font-weight: 500;
  color: #ffffff;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  line-height: 1.3;
  padding: 0 2px;
}

#tab-home .drama-card .card-meta {
  font-size: 11px;
  color: #8e8e93;
  margin-top: 2px;
  padding: 0 2px;
}

/* ================================
   骨架屏（加载占位）
   ================================ */
.card-skeleton {
  background: transparent;
  border-radius: 10px;
  overflow: hidden;
  flex-shrink: 0;
}
.card-skeleton--scroll {
  width: 130px;
}
.card-skeleton--scroll .sk-poster {
  width: 130px;
  height: 182px;
  aspect-ratio: auto;
}
.card-skeleton .sk-poster {
  width: 100%;
  aspect-ratio: 3/4;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(90deg, #2c2c2e 25%, #3a3a3c 50%, #2c2c2e 75%);
  background-size: 200% 100%;
  animation: skeleton-shimmer 1.4s infinite;
  border-radius: 10px 10px 0 0;
}
.card-skeleton--grid3 .sk-poster {
  width: 100%;
  aspect-ratio: 2/3;
}
.card-skeleton .sk-poster img {
  width: 36%;
  height: auto;
  opacity: 0.5;
}
.card-skeleton .sk-title {
  height: 17px;
  margin: 6px 0 0;
  padding: 0 2px;
  background: #2c2c2e;
  border-radius: 4px;
  animation: skeleton-shimmer 1.4s infinite;
  box-sizing: border-box;
}
@keyframes skeleton-shimmer {
  0%   { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

/* ================================
   空态 / 失败 / 末尾提示
   ================================ */
.home-empty {
  color: #636366;
  font-size: 13px;
  text-align: center;
  padding: 24px 0;
  width: 100%;
  grid-column: 1 / -1;
}
.home-load-end {
  color: #48484a;
  font-size: 12px;
  text-align: center;
  padding: 16px 0;
  width: 100%;
  grid-column: 1 / -1;
}

/* ================================
   底部加载 Spinner
   ================================ */
.home-load-spinner {
  display: flex;
  justify-content: center;
  padding: 16px 0;
  width: 100%;
}
.home-load-spinner .spinner {
  width: 20px;
  height: 20px;
  border: 2px solid #3a3a3c;
  border-top-color: #ffffff;
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}
@keyframes spin {
  to { transform: rotate(360deg); }
}
