/* 왼쪽 '하이라이트·메모' 패널(viewer-sidebar-highlights.js). 틀·행·칩·빈 상태·스켈레톤은 viewer-sidebar.css 공통 클래스를 쓰고,
   여기에는 이 패널만의 모양만 둔다: 거르기 칩 줄, 위에 붙는 쪽 머리(p.N), 왼쪽 색 막대가 있는 인용 카드. */

/* 본문은 칩 줄(고정) + 목록(스크롤)으로 나눈다. 칩 줄을 펼쳐도 쪽 머리가 칩 줄 바로 아래에 붙도록 목록만 스크롤한다. */
.vs-pane.vs-hl {
    display: flex;
    flex-direction: column;
    overflow: hidden;
    padding-bottom: 0;
}

.vs-hl[hidden],
.vs-hl [hidden] {
    display: none !important;
}

/* ── 머리줄 거르기 단추: 거르는 중이면 오른쪽 위에 accent 점 ─────────── */

.vs-hl-filter-btn {
    position: relative;
}

.vs-hl-filter-dot {
    position: absolute;
    top: 5px;
    right: 5px;
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--app-accent);
    opacity: 0;
    transform: scale(0.4);
    transition: opacity 0.12s, transform 0.16s var(--app-ease-out);
}

.vs-hl-filter-btn.is-active .vs-hl-filter-dot {
    opacity: 1;
    transform: none;
}

/* ── 거르기 칩 줄: 종류(전체·AI·직접·메모 있음) / 색 다섯 ─────────────── */

.vs-hl-filters {
    display: flex;
    flex: none;
    flex-wrap: wrap;
    gap: 6px 8px;
    padding: 2px 12px 10px 14px;
    border-bottom: 1px solid var(--app-edge);
    animation: vs-hl-drop 0.16s var(--app-ease-out);
}

.vs-hl-filter-group {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
}

.vs-hl-chip {
    height: 24px;
    padding: 0 9px;
    color: var(--app-fg-3);
    font: inherit;
    font-size: 12px;
    cursor: pointer;
    transition: background-color 0.12s, border-color 0.12s, color 0.12s;
}

.vs-hl-chip:hover {
    background: var(--app-inset);
    color: var(--app-fg);
}

.vs-hl-chip.is-on {
    border-color: transparent;
    background: var(--app-overlay);
    color: var(--app-fg);
}

.pdf-viewer .vs-hl-chip:focus-visible {
    outline: 2px solid var(--app-accent);
    outline-offset: 1px;
}

.vs-hl-chip.is-color {
    justify-content: center;
    width: 24px;
    padding: 0;
}

.vs-hl-chip-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: var(--vs-hl-color);
    /* 옅은 노랑·초록도 바탕과 갈리게 아주 얇은 테두리 */
    box-shadow: inset 0 0 0 1px rgba(39, 38, 30, 0.1);
}

/* ── 목록 ───────────────────────────────────────────── */

.vs-hl-list,
.vs-hl-state {
    flex: 1;
    min-height: 0;
    overflow-x: hidden;
    overflow-y: auto;
    overscroll-behavior: contain;
    scrollbar-width: thin;
    scrollbar-color: color-mix(in srgb, var(--ink) 22%, transparent) transparent;
}

.vs-hl-list {
    padding-bottom: 12px;
    transition: opacity 0.12s;
}

@supports not (scrollbar-color: auto) {
    .vs-hl-list::-webkit-scrollbar {
        width: 8px;
        background: transparent;
    }

    .vs-hl-list::-webkit-scrollbar-thumb {
        border-radius: 4px;
        background: color-mix(in srgb, var(--ink) 22%, transparent);
    }
}

/* 충돌로 다시 불러오는 동안은 지금 목록을 흐리게 둔다 */
.vs-hl.is-busy .vs-hl-list {
    opacity: 0.6;
}

/* 쪽 머리: 스크롤해도 위에 붙고, 다음 쪽 머리가 밀어 올린다 */
.vs-hl-page {
    position: sticky;
    top: 0;
    z-index: 1;
    padding: 10px 16px 4px;
    background: var(--vs-surface, var(--app-elevated));
    font-size: 11.5px;
    font-variant-numeric: tabular-nums;
}

.vs-hl-group:first-child .vs-hl-page {
    padding-top: 4px;
}

/* 인용 카드: 왼쪽 3px 색 막대 · 인용 두 줄 · 메모 두 줄 · 메타 */
.vs-row.vs-hl-item {
    align-items: stretch;
    gap: 9px;
    margin-bottom: 2px;
    color: var(--app-fg);
}

.vs-hl-bar {
    flex: none;
    width: 3px;
    border-radius: 2px;
    background: var(--vs-hl-color);
    box-shadow: inset 0 0 0 1px rgba(39, 38, 30, 0.07);
}

.vs-hl-item .vs-row-body {
    gap: 3px;
}

.vs-hl-item .vs-hl-quote,
.vs-hl-item .vs-hl-note {
    display: -webkit-box;
    overflow: hidden;
    white-space: normal;
    overflow-wrap: anywhere;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
    line-clamp: 2;
}

.vs-row-title.vs-hl-quote {
    line-height: 19px;
}

.vs-hl-quote.is-empty {
    color: var(--app-fg-4);
}

.vs-hl-note {
    color: var(--app-fg-3);
    font-size: 12px;
    line-height: 17px;
}

.vs-row-meta.vs-hl-meta {
    gap: 5px;
    margin-top: 1px;
}

.vs-hl-meta-icon {
    display: inline-flex;
    flex: none;
}

.vs-hl-meta-icon > svg {
    width: 12px;
    height: 12px;
}

/* ── 불러오는 중: 쪽 머리 + 색 막대 카드 모양 스켈레톤 ─────────────────── */

.vs-hl-skel-page {
    width: 26px;
    height: 8px;
    margin: 8px 16px 6px;
}

.vs-skeleton-row.vs-hl-skel {
    align-items: stretch;
    gap: 9px;
    margin-bottom: 2px;
}

.vs-skeleton.vs-hl-skel-bar {
    flex: none;
    width: 3px;
    height: auto;
    border-radius: 2px;
}

.vs-hl-skel .vs-skeleton-lines {
    gap: 7px;
    padding: 4px 0 2px;
}

.vs-skeleton.vs-hl-skel-meta {
    height: 7px;
    margin-top: 2px;
}

@keyframes vs-hl-drop {
    from {
        opacity: 0;
        transform: translateY(-4px);
    }
}

@media (prefers-reduced-motion: reduce) {
    .vs-hl-filters {
        animation: none;
    }

    .vs-hl-filter-dot,
    .vs-hl-chip,
    .vs-hl-list {
        transition: none;
    }
}

/* 휴대폰 서랍: 손가락으로 누르기 쉽게 칩을 조금 키운다 */
@media (max-width: 759px) {
    .vs-hl-chip {
        height: 28px;
        padding: 0 11px;
    }

    .vs-hl-chip.is-color {
        width: 28px;
    }
}
