/* PDF 페이지 선택 모달 — Enter Bill 업로드 시 100p 미리보기+체크.
   색/폰트 하드코딩 금지: Bootstrap 토큰(--bs-*) 사용, 라이트/다크 자동. */

.pdfps-modal .modal-dialog { max-width: 920px; transition: max-width .25s ease; }
/* 돋보기 열리면 모달이 오른쪽으로 넓어짐 */
.pdfps-modal.pdfps-has-preview .modal-dialog { max-width: 94vw; }

/* 좌(그리드) / 우(큰 프리뷰) 2단 */
.pdfps-main { display: flex; gap: 1rem; align-items: stretch; }
.pdfps-body { flex: 1 1 auto; min-width: 0; }
.pdfps-preview-pane {
    display: none;
    flex: 1.15 1 0;
    min-width: 0;
    flex-direction: column;
    border-left: 1px solid var(--bs-border-color);
    padding-left: 1rem;
}
.pdfps-modal.pdfps-has-preview .pdfps-preview-pane { display: flex; }
.pdfps-preview-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding-bottom: .5rem;
    margin-bottom: .5rem;
    border-bottom: 1px solid var(--bs-border-color);
    font-weight: 600;
    font-size: .9rem;
}
.pdfps-preview-body {
    flex: 1 1 auto;
    max-height: 66vh;
    overflow: auto;
    display: flex;
    align-items: flex-start;
    justify-content: center;
    background: var(--bs-tertiary-bg, var(--bs-body-bg));
    border-radius: var(--bs-border-radius, .375rem);
    padding: .5rem;
}
.pdfps-preview-body canvas {
    max-width: 100%;
    height: auto;
    background: #fff;
    box-shadow: 0 2px 12px rgba(0, 0, 0, .18);
}

/* 썸네일 돋보기 버튼(우상단, hover 시 표시) */
.pdfps-thumb .pdfps-zoom {
    position: absolute;
    top: .3rem;
    right: .3rem;
    width: 1.5rem;
    height: 1.5rem;
    border: none;
    border-radius: 50%;
    background: rgba(0, 0, 0, .55);
    color: #fff;
    display: none;
    align-items: center;
    justify-content: center;
    font-size: .78rem;
    line-height: 1;
    cursor: pointer;
    z-index: 2;
}
.pdfps-thumb:hover .pdfps-zoom { display: flex; }
.pdfps-thumb .pdfps-zoom:hover { background: var(--bs-primary); }

.pdfps-toolbar {
    display: flex;
    align-items: center;
    gap: .75rem;
    flex-wrap: wrap;
    padding-bottom: .5rem;
    border-bottom: 1px solid var(--bs-border-color);
    margin-bottom: .75rem;
}
.pdfps-toolbar .pdfps-count { margin-left: auto; font-weight: 600; }

.pdfps-hint { color: var(--bs-secondary-color); font-size: .85rem; }

.pdfps-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
    gap: .75rem;
    max-height: 62vh;
    overflow-y: auto;
    padding: .25rem;
}

.pdfps-thumb {
    position: relative;
    border: 2px solid var(--bs-border-color);
    border-radius: var(--bs-border-radius, .375rem);
    background: var(--bs-tertiary-bg, var(--bs-body-bg));
    cursor: pointer;
    overflow: hidden;
    user-select: none;
    transition: border-color .12s ease, box-shadow .12s ease;
}
.pdfps-thumb:hover { border-color: var(--bs-primary); }
.pdfps-thumb.is-selected {
    border-color: var(--bs-primary);
    box-shadow: 0 0 0 2px color-mix(in srgb, var(--bs-primary) 35%, transparent);
}

.pdfps-thumb .pdfps-canvas-wrap {
    display: flex;
    align-items: center;
    justify-content: center;
    aspect-ratio: 3 / 4;
    background: var(--bs-body-bg);
}
.pdfps-thumb canvas { max-width: 100%; max-height: 100%; display: block; }

/* 아직 렌더 전(플레이스홀더) */
.pdfps-thumb .pdfps-spinner {
    width: 1.5rem; height: 1.5rem;
    border: 2px solid var(--bs-border-color);
    border-top-color: var(--bs-primary);
    border-radius: 50%;
    animation: pdfps-spin .8s linear infinite;
}
@keyframes pdfps-spin { to { transform: rotate(360deg); } }

.pdfps-thumb .pdfps-pageno {
    text-align: center;
    font-size: .78rem;
    padding: .2rem 0;
    background: var(--bs-secondary-bg, var(--bs-tertiary-bg));
    color: var(--bs-body-color);
    border-top: 1px solid var(--bs-border-color);
}

/* 선택 체크 배지 (좌상단) */
.pdfps-thumb .pdfps-check {
    position: absolute;
    top: .3rem; left: .3rem;
    width: 1.15rem; height: 1.15rem;
    border-radius: 50%;
    background: var(--bs-primary);
    color: var(--bs-primary-bg-subtle, #fff);
    display: none;
    align-items: center;
    justify-content: center;
    font-size: .8rem;
    line-height: 1;
    box-shadow: 0 1px 3px rgba(0,0,0,.3);
}
.pdfps-thumb.is-selected .pdfps-check { display: flex; }

.pdfps-loading {
    display: flex;
    align-items: center;
    gap: .5rem;
    padding: 2rem;
    justify-content: center;
    color: var(--bs-secondary-color);
}
