/* ==============================
   카테고리 상세/허브 페이지 전용
============================== */
.category-page {
  max-width: 1200px;
  margin: 6px auto 40px;
  padding: 0 20px 40px;
}

/* 카테고리 내 검색바 */
.cat-search-bar {
  margin: 18px 0 22px;
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}
.cat-search-input-wrap {
  position: relative;
  flex: 1;
  min-width: 240px;
}
.cat-search-icon {
  position: absolute;
  left: 14px;
  top: 50%;
  transform: translateY(-50%);
  width: 18px;
  height: 18px;
  color: #9ca0ab;
  pointer-events: none;
}
.cat-search-input-wrap input {
  width: 100%;
  padding: 13px 46px 13px 44px;
  font-size: 15px;
  border: 2px solid #e5e7ee;
  border-radius: 10px;
  background: #fff;
  color: #1a1a1f;
  transition: border-color .15s, box-shadow .15s;
  -webkit-appearance: none;
  appearance: none;
}
.cat-search-input-wrap input:focus {
  outline: none;
  border-color: #8c00d4;
  box-shadow: 0 0 0 4px rgba(140,0,212,.1);
}
.cat-search-clear {
  position: absolute;
  right: 10px;
  top: 50%;
  transform: translateY(-50%);
  width: 28px;
  height: 28px;
  border: 0;
  background: #f3f4f6;
  color: #6a6a72;
  font-size: 18px;
  line-height: 1;
  border-radius: 50%;
  cursor: pointer;
  transition: background .12s;
}
.cat-search-clear:hover { background: #e5e7ee; color: #1a1a1f; }
.cat-search-count {
  font-size: 13px;
  color: #8c00d4;
  font-weight: 700;
  padding: 6px 12px;
  background: #faf5ff;
  border-radius: 999px;
}
.site-card.search-hidden { display: none !important; }
.cat-empty-msg {
  text-align: center;
  padding: 40px 20px;
  color: #6a6a72;
  font-size: 14.5px;
  background: #fafbfc;
  border-radius: 12px;
  margin: 20px 0;
}
.cat-empty-msg strong { color: #1a1a1f; }
@media (max-width: 600px) {
  .cat-search-bar { margin: 14px 0 16px; gap: 8px; }
  .cat-search-input-wrap input { font-size: 16px; padding: 12px 42px 12px 40px; }
  .cat-search-icon { width: 16px; height: 16px; left: 12px; }
}
.breadcrumb {
  font-size: 13px;
  color: #6a6a70;
  margin-bottom: 16px;
}
.breadcrumb a { color: #8c00d4; font-weight: 600; }
.breadcrumb a:hover { text-decoration: underline; }
.breadcrumb .sep { margin: 0 6px; color: #a0a0a6; }

.category-page .page-head {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 18px 0 16px;
  border-bottom: 1px solid #eef0f4;
  margin-bottom: 22px;
}
.category-page .page-head .cat-icon {
  width: 48px; height: 48px;
  border-radius: 12px;
  font-size: 22px;
}
.category-page .page-head h1 {
  font-size: 26px;
  font-weight: 800;
  color: #2e1f4a;
  letter-spacing: -.5px;
}
.category-page .page-head p {
  margin: 4px 0 0;
  font-size: 14px;
  color: #6a6a70;
}

/* ==============================
   사이트 그리드 (메인 콘텐츠)
============================== */
.site-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr); /* 데스크탑 4 */
  gap: 5px;
  margin: 0;
  padding: 0;
  list-style: none;
}
@media (max-width: 1024px) {
  .site-grid { grid-template-columns: repeat(3, 1fr); gap: 5px; } /* 태블릿 3 */
}
@media (max-width: 768px) {
  .site-grid { grid-template-columns: repeat(2, 1fr); gap: 4px; } /* 모바일 2 */
}
.site-card {
  position: relative;
  background: #fff;
  border: 1px solid #eef0f4;
  border-radius: 10px;
  padding: 10px 8px 8px;
  text-align: center;
  transition: transform .15s, box-shadow .15s, border-color .15s;
  overflow: visible;
  min-height: 108px;
}
.site-card:hover {
  transform: translateY(-2px);
  border-color: #d4c6e4;
  box-shadow: 0 6px 16px rgba(140,0,212,.08);
}

/* 랭크 배지: 상세 페이지에서는 숨김 (SEO용 DOM은 유지) */
.site-grid .rank-badge {
  position: absolute;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden;
  clip: rect(0,0,0,0);
  white-space: nowrap;
  border: 0;
}

/* 찜 버튼 (우상단) */
.fav-btn {
  position: absolute;
  top: 6px;
  right: 6px;
  width: 28px;
  height: 28px;
  border: 0;
  background: transparent;
  color: #c7b8e0;
  cursor: pointer;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: all .15s;
  z-index: 2;
}
.fav-btn svg { width: 14px; height: 14px; }
.fav-btn:hover { color: #ff3d9a; background: #fff0f5; }
.fav-btn.active { color: #d4007a; }
.fav-btn.active svg { filter: drop-shadow(0 0 3px rgba(212,0,122,.4)); }

/* 사이트 링크 (클릭 영역) */
.site-link {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 5px;
  color: inherit;
}

/* 썸네일 */
.site-thumb {
  width: 48px;
  height: 48px;
  border-radius: 10px;
  background: linear-gradient(135deg,#f5edff,#e8f3ff);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  margin-top: 0;
  box-shadow: inset 0 0 0 1px rgba(140,0,212,.06);
}
.site-thumb img {
  width: 34px;
  height: 34px;
  object-fit: contain;
  border-radius: 6px;
}
.site-thumb-letter {
  font-size: 22px;
  font-weight: 900;
  background: linear-gradient(90deg,#ff3d9a,#b039ff,#3d7fff,#00d4ff,#3eff9e);
  background-size: 200% 100%;
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  color: transparent;
  animation: rainbowBg 3s linear infinite;
  line-height: 1;
}

/* 사이트 이름 - 단일 색상 통일 */
.site-name {
  font-size: 15px;
  font-weight: 800;
  color: #2e1f4a;
  max-width: 100%;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  padding: 0 4px;
  margin: 0;
  letter-spacing: -.2px;
  transition: color .12s;
}
.site-card:hover .site-name { color: #8c00d4; }

/* 클릭수/인기 */
.site-count {
  font-size: 12.5px;
  color: #8a7ab0;
  display: inline-flex;
  align-items: center;
  gap: 3px;
  font-weight: 600;
}
.site-count svg { color: #ff3d9a; }

/* ==============================
   카테고리 허브 페이지 (index)
============================== */
.category-hub-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 14px;
  margin-top: 20px;
}
.category-hub-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 28px 16px;
  background: #fff;
  border: 1px solid #eef0f4;
  border-radius: 14px;
  color: #2e1f4a;
  text-align: center;
  transition: transform .15s, box-shadow .15s, border-color .15s;
  min-height: 150px;
}
.category-hub-card .cat-icon { width: 44px; height: 44px; font-size: 20px; }
.category-hub-card h2 { font-size: 15px; font-weight: 700; margin: 0; }
.category-hub-card p { font-size: 12px; color: #6a6a70; margin: 0; }
.category-hub-card:hover {
  transform: translateY(-3px);
  border-color: #8c00d4;
  box-shadow: 0 10px 22px rgba(140,0,212,.12);
}

/* ==============================
   토스트
============================== */
.toast {
  position: fixed;
  bottom: 30px;
  left: 50%;
  transform: translateX(-50%) translateY(20px);
  background: linear-gradient(135deg,#2e1f4a,#4a2a70);
  color: #fff;
  padding: 12px 22px;
  border-radius: 12px;
  font-size: 14px;
  font-weight: 600;
  opacity: 0;
  transition: opacity .25s, transform .25s;
  z-index: 3000;
  pointer-events: none;
  box-shadow: 0 12px 30px rgba(0,0,0,.25);
  max-width: calc(100vw - 40px);
  text-align: center;
}
.toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

/* ==============================
   반응형
============================== */
@media (max-width: 600px) {
  .category-page { margin: 4px auto 20px; padding: 0 8px 30px; }
  .category-page .page-head h1 { font-size: 20px; }
  .category-page .page-head .cat-icon { width: 40px; height: 40px; font-size: 17px; }
  .site-card { padding: 8px 6px 6px; border-radius: 10px; min-height: 92px; }
  .site-thumb { width: 42px; height: 42px; border-radius: 9px; }
  .site-thumb img { width: 30px; height: 30px; }
  .site-thumb-letter { font-size: 19px; }
  .site-name { font-size: 13.5px; }
  .site-count { font-size: 11.5px; }
  .fav-btn { width: 22px; height: 22px; top: 2px; right: 2px; }
  .fav-btn svg { width: 11px; height: 11px; }
  .site-link { gap: 3px; }
}
