/* 목록 페이지 전용 */

body { overflow-y: auto; }

header { position: sticky; top: 0; z-index: 10; }

/* 필터 줄 — 헤더(nav/검색/유저) 아래 별도 줄로 분리해서 헤더가 덜 빽빽해 보이게 함 */
#filter-bar {
  position: sticky;
  top: 50px;
  z-index: 9;
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
  padding: 10px 20px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
}

/* ☰ 메뉴 드롭다운 (통계/랭킹/문제 만들기/사용법) */
.nav-dropdown {
  min-width: 170px;
  padding: 6px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.nav-dd-item {
  display: block;
  padding: 8px 10px;
  border-radius: 6px;
  color: var(--text);
  text-decoration: none;
  font-size: 14px;
}
.nav-dd-item:hover { background: var(--border); color: var(--accent); }

/* 공지사항 — ☰ 메뉴 옆 빈 공간에서 오른쪽 → 왼쪽으로 흘러가는 띠 */
.announcement {
  flex: 1;
  min-width: 0;
  height: 50px;
  overflow: hidden;
  display: flex;
  align-items: center;
  -webkit-mask-image: linear-gradient(90deg, transparent, #000 24px, #000 calc(100% - 24px), transparent);
          mask-image: linear-gradient(90deg, transparent, #000 24px, #000 calc(100% - 24px), transparent);
}
.announcement-track {
  display: inline-block;
  white-space: nowrap;
  padding-left: 100%;
  color: var(--text-dim);
  font-size: 13px;
  animation: announcement-scroll 18s linear infinite;
}
@keyframes announcement-scroll {
  from { transform: translateX(0); }
  to   { transform: translateX(-100%); }
}
@media (prefers-reduced-motion: reduce) {
  .announcement-track { animation: none; padding-left: 0; }
}

.search-input {
  flex: 1;
  max-width: 380px;
  padding: 6px 14px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--text);
  font-size: 14px;
  outline: none;
}
.search-input:focus { border-color: var(--accent); }

/* 풀었던 문제만 필터 */
.solved-filter-btn.active {
  color: var(--ok);
  border-color: color-mix(in srgb, var(--ok) 55%, var(--border));
  background: color-mix(in srgb, var(--ok) 12%, var(--surface));
}

/* 풀고 있는 문제만 필터 */
.inprogress-filter-btn.active {
  color: var(--purple);
  border-color: color-mix(in srgb, var(--purple) 55%, var(--border));
  background: color-mix(in srgb, var(--purple) 12%, var(--surface));
}

/* 내가 만든 문제만 필터 */
.custom-filter-btn.active {
  color: var(--accent);
  border-color: color-mix(in srgb, var(--accent) 55%, var(--border));
  background: color-mix(in srgb, var(--accent) 12%, var(--surface));
}

.custom-badge {
  background: color-mix(in srgb, var(--accent) 18%, transparent);
  color: var(--accent);
}

/* 필터 드롭다운 */
.filter-wrap { position: relative; }

.filter-btn {
  padding: 6px 12px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--text);
  cursor: pointer;
  font-size: 14px;
  display: flex;
  align-items: center;
  gap: 6px;
  white-space: nowrap;
}
.filter-btn:hover { border-color: var(--accent); }

.cnt {
  background: var(--accent);
  color: #000;
  border-radius: 10px;
  padding: 1px 7px;
  font-size: 12px;
  font-weight: 700;
  display: none;
}
.cnt.show { display: inline; }

.dropdown {
  display: none;
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  z-index: 100;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 10px;
  min-width: 230px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, .5);
}
.dropdown.open { display: block; }

.dd-search {
  width: 100%;
  padding: 5px 10px;
  margin-bottom: 8px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 5px;
  color: var(--text);
  font-size: 13px;
  outline: none;
}

/* 스크롤 힌트 그라데이션 */
.dd-list-wrap {
  position: relative;
}
.dd-list-wrap::after {
  content: '';
  position: absolute;
  bottom: 0; left: 0; right: 0;
  height: 32px;
  background: linear-gradient(transparent, var(--surface2));
  pointer-events: none;
  border-radius: 0 0 4px 4px;
  transition: opacity .2s;
}
.dd-list-wrap.scrolled-end::after { opacity: 0; }

.dd-list { max-height: 280px; overflow-y: auto; }
.dd-list label { display: flex; align-items: center; gap: 8px; padding: 4px 6px; border-radius: 4px; cursor: pointer; font-size: 13px; }
.dd-list label:hover { background: var(--border); }
.dd-list input[type=checkbox] { accent-color: var(--accent); flex-shrink: 0; }

.lv-group-title { font-size: 12px; color: var(--text-dim); padding: 6px 6px 3px; }

/* 정보바 */
#list-info {
  padding: 10px 20px;
  font-size: 13px;
  color: var(--text-dim);
  border-bottom: 1px solid var(--border);
}

/* 카드 그리드 */
#problem-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 10px;
  padding: 16px 20px;
}

.prob-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 14px 16px;
  cursor: pointer;
  transition: border-color .15s, transform .1s;
  display: flex;
  flex-direction: column;
  gap: 8px;
  text-decoration: none;
  color: inherit;
}
.prob-card:hover { border-color: var(--accent); transform: translateY(-1px); }
.prob-card.solved {
  border-color: color-mix(in srgb, var(--ok) 40%, var(--border));
  background: color-mix(in srgb, var(--ok) 8%, var(--surface));
}

.card-top { display: flex; align-items: center; gap: 8px; }
.pid { font-size: 13px; color: var(--text-dim); }
.ptitle { flex: 1; font-size: 14px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.draft-badge {
  background: color-mix(in srgb, var(--purple) 18%, transparent);
  color: var(--purple);
}

.fav-filter-btn.active {
  color: var(--favorite);
  border-color: color-mix(in srgb, var(--favorite) 55%, var(--border));
  background: color-mix(in srgb, var(--favorite) 12%, var(--surface));
}

.prob-card.favorited {
  background: linear-gradient(135deg, color-mix(in srgb, var(--favorite) 6%, var(--surface)) 0%, var(--surface) 40%);
}

.prob-card.solved.favorited {
  border-color: color-mix(in srgb, var(--ok) 40%, var(--border));
  background: linear-gradient(135deg,
    color-mix(in srgb, var(--favorite) 8%, var(--surface)) 0%,
    color-mix(in srgb, var(--ok) 8%, var(--surface)) 100%);
}

.card-tags { display: flex; flex-wrap: wrap; gap: 4px; }
.tag { font-size: 11px; padding: 2px 7px; border-radius: 10px; background: var(--surface2); border: 1px solid var(--border); color: var(--text-dim); }

.card-meta { font-size: 12px; color: var(--text-dim); display: flex; gap: 10px; }

/* 페이지네이션 */
#pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  padding: 16px;
  border-top: 1px solid var(--border);
}

.pg-btn {
  min-width: 30px;
  height: 30px;
  padding: 0 8px;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 5px;
  color: var(--text);
  cursor: pointer;
  font-size: 13px;
  display: flex;
  align-items: center;
  justify-content: center;
}
.pg-btn:hover:not(:disabled) { border-color: var(--accent); color: var(--accent); }
.pg-btn:disabled { opacity: .3; cursor: default; }
.pg-btn.cur { border-color: var(--accent); color: var(--accent); background: #1a3a3a; }
