/* ====================================================
   📂 分類頁專用樣式
   ==================================================== */

/* 滾動標題列 */
.cat-scroll-header {
  position: fixed;
  top: 0; left: 0; right: 0;
  height: 50px;
  background: #3097fd;
  z-index: 700;
  display: flex;
  align-items: center;
  padding: 0 12px;
  box-sizing: border-box;
  box-shadow: 0 2px 8px rgba(0,0,0,0.15);
  transform: translateY(-100%);
  opacity: 0;
  transition: transform 0.3s ease, opacity 0.3s ease;
  pointer-events: none;
}
.cat-scroll-header.visible {
  transform: translateY(0);
  opacity: 1;
  pointer-events: auto;
}
.cat-back-btn {
  display: flex; align-items: center; justify-content: center;
  width: 40px; height: 40px;
  background: none; border: none; color: #fff;
  cursor: pointer; padding: 0;
  -webkit-tap-highlight-color: transparent;
}
.cat-back-btn svg { width: 22px; height: 22px; }
.cat-scroll-title {
  flex: 1; color: #fff; font-size: 15px; font-weight: 500;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  padding: 0 10px; min-width: 0;
}

/* 公共頭部隱藏 */
.site-header, .desktop-nav {
  transition: transform 0.3s ease, opacity 0.3s ease;
}
.site-header.header-hidden, .desktop-nav.header-hidden {
  transform: translateY(-100%);
  opacity: 0;
  pointer-events: none;
}

/* ====================================================
   📌 頁面標題列（含翻頁按鈕）
   ==================================================== */
.cat-title-bar {
  display: flex;
  align-items: center;
  padding: 12px 10px 8px;
  gap: 8px;
}
.cat-title-left {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: 1;
  min-width: 0;
}
.cat-title-left::before {
  content: '';
  display: inline-block;
  width: 4px; height: 18px;
  background: #3097fd;
  border-radius: 2px;
  flex-shrink: 0;
}
.cat-title-name {
  font-size: 18px;
  font-weight: 600;
  color: #333;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.cat-title-page {
  font-size: 14px;
  color: #999;
  font-weight: normal;
  white-space: nowrap;
  flex-shrink: 0;
}

/* 翻頁按鈕區 */
.cat-title-nav {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
}
.cat-nav-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: #3097fd;
  color: #fff;
  text-decoration: none;
  transition: background 0.2s;
  -webkit-tap-highlight-color: transparent;
}
.cat-nav-btn:active {
  background: #1a7de0;
}
.cat-nav-btn.disabled {
  background: #ccc;
  pointer-events: none;
}
.cat-nav-btn svg {
  width: 18px;
  height: 18px;
}

/* ====================================================
   🎬 影片 Grid（手機 3 欄）
   ==================================================== */
.cat-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  padding: 0 10px 16px;
  margin: 0;
  box-sizing: border-box;
}
.cat-card {
  display: block;
  text-decoration: none;
  color: inherit;
  overflow: hidden;
  min-width: 0;
}
.cat-card-cover {
  position: relative;
  width: 100%;
  padding-top: 133.33%;
  overflow: hidden;
  border-radius: 6px;
  background: #f0f0f0;
}
.cat-card-cover img {
  position: absolute;
  top: 0; left: 0;
  width: 100%; height: 100%;
  object-fit: cover;
  display: block;
}
.cat-card-cover .cat-sn-overlay {
  position: absolute;
  bottom: 0; left: 0; right: 0;
  padding: 4px 6px;
  background: rgba(0,0,0,0.6);
  color: #fff;
  font-size: 11px;
  line-height: 1.3;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  text-align: right;
  z-index: 2;
}
.cat-card-title {
  font-size: 12px;
  color: #333;
  line-height: 1.3;
  margin-top: 4px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* 無結果 */
.cat-no-data {
  text-align: center;
  padding: 60px 20px;
  font-size: 15px;
  color: #999;
}

/* ====================================================
   📄 分頁器
   ==================================================== */
.cat-paginator {
  padding: 16px 10px 20px;
}
.paginator-controls {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  flex-wrap: wrap;
}
.page-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 38px; height: 38px;
  border-radius: 50%;
  font-size: 14px;
  text-decoration: none;
  text-align: center;
  box-sizing: border-box;
  border: none;
}
.page-btn.nav-btn {
  background-color: #3097fd;
  color: #fff;
}
.page-btn.num-btn {
  background-color: #e0efff;
  color: #3097fd;
}
.page-btn.active {
  background-color: #ff8800 !important;
  color: #fff !important;
  font-weight: bold;
}
.page-btn.disabled {
  opacity: 0.4;
  pointer-events: none;
}
.paginator-jump {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  margin-top: 12px;
  font-size: 14px;
  color: #999;
}
.paginator-jump input {
  width: 45px; height: 30px;
  text-align: center;
  border-radius: 15px;
  border: 1px solid #ddd;
  font-size: 14px;
  outline: none;
  box-sizing: border-box;
}
.paginator-jump button {
  width: 36px; height: 36px;
  line-height: 36px;
  padding: 0;
  background: #3097fd;
  color: #fff;
  border: none;
  border-radius: 50%;
  cursor: pointer;
  font-size: 13px;
  font-weight: bold;
}

/* ====================================================
   💻 平板 (768px+)：4 欄
   ==================================================== */
@media screen and (min-width: 768px) {
  html { font-size: 16px !important; }
  body { background: #eef0f4 !important; }

  .wrapper {
    max-width: 960px !important;
    margin: 0 auto !important;
    background: #fff !important;
    box-shadow: 0 0 20px rgba(0,0,0,0.05);
    min-height: 100vh;
    overflow-x: hidden !important;
  }

  .cat-scroll-header { height: 56px; padding: 0 20px; }
  .cat-scroll-title { font-size: 16px; }

  .cat-title-bar {
    padding: 16px 16px 10px;
  }
  .cat-title-name { font-size: 22px; }
  .cat-title-page { font-size: 16px; }
  .cat-nav-btn {
    width: 40px;
    height: 40px;
  }
  .cat-nav-btn svg {
    width: 20px;
    height: 20px;
  }

  .cat-grid {
    grid-template-columns: repeat(4, 1fr);
    gap: 14px;
    padding: 0 16px 20px;
  }

  .cat-card-cover {
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
  }
  .cat-card:hover .cat-card-cover {
    transform: translateY(-4px);
    box-shadow: 0 6px 16px rgba(0,0,0,0.15);
  }

  .cat-card-cover .cat-sn-overlay {
    font-size: 12px;
    padding: 5px 8px;
  }

  .cat-card-title { font-size: 14px; margin-top: 5px; }

  .cat-paginator { padding: 20px 16px 24px; }
}

/* ====================================================
   💻 小桌面 (1024px+)：5 欄
   ==================================================== */
@media screen and (min-width: 1024px) {
  .wrapper { max-width: 1200px !important; }
  .cat-grid {
    grid-template-columns: repeat(5, 1fr);
    gap: 16px;
    padding: 0 20px 24px;
  }
}

/* ====================================================
   💻 大桌面 (1440px+)：6 欄
   ==================================================== */
@media screen and (min-width: 1440px) {
  .wrapper { max-width: 1400px !important; }
  .cat-grid {
    grid-template-columns: repeat(6, 1fr);
    gap: 20px;
    padding: 0 24px 28px;
  }
}
