
/* ============================
   썸네일 영역
============================ */
:root {
    --a4ratio: 1 / 1.4142; /* 기본값 = 세로형 A4 비율 */
}


/* 썸네일 카드 하나 */
.thumb-item {
    /*height: 120px;               !* 🔥 고정 높이 *!*/
    position: relative;
    cursor: pointer;
    border: 1px solid #dee2e6;
    border-radius: .35rem;
    background: #fafafa;
    padding: .25rem;
    transition: 0.15s;
}

.thumb-item:hover {
    box-shadow: 0 0 .25rem rgba(0, 0, 0, .15);
    transform: translateY(-1px);
}

/*이미지 들어가는 하얀 종이 영역 */
.thumb-page-box {
    width: 100%;
    height: 120px;
    display: flex;
    justify-content: center;
    align-items: center;
    overflow: hidden;
    background: #fff;
}

.thumb-page-box img {
    width: auto !important;
    height: auto !important;
    max-width: none !important;
    max-height: none !important;
    transform-origin: center center;
    display: block;
}


.thumb-selected {
    outline: 3px solid #0d6efd;
}
.thumb-zoom-btn,
.thumb-delete-btn {
    position: absolute;
    width: 26px;
    height: 26px;
    border-radius: 4px;
    font-size: 14px;
    padding: 0;
    cursor: pointer;
    z-index: 3;
}
.thumb-zoom-btn {
    top: 4px;
    left: 4px;
    background: rgba(0, 0, 0, .65);
    color: #fff;
    border: none;
}
.thumb-delete-btn {
    top: 4px;
    right: 4px;
    background: #dc3545;
    color: #fff;
    border: none;
}

/* 마지막 작업한 페이지 하이라이트 */
.thumb-label-last-active {
    background: rgba(111, 66, 193, 0.15); /* 은은한 보라 배경 */
    border-radius: 4px;
    padding: 2px 6px;
    transition: background 0.2s;
}


/* =============================
     모달 레이아웃
============================= */
#pageModal .modal-dialog {
    max-width: 1200px !important;
    width: 90%;
    height: 90vh;
    margin: 20px auto;
}
#pageModal .modal-content {
    height: 100%;
    display: flex;
    flex-direction: column;
}
#pageModal .modal-body {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 1rem;
    overflow: hidden;
}
#modalPrev,
#modalNext {
    min-width: 56px;
}
#modalImageContainer {
    display: flex;
    justify-content: center;
    align-items: center;
    width: 100%;
    height: 100%;
    overflow: hidden;
}


#modalPagePosition {
    display: inline-flex;
    transition:
            color 0.25s ease,
            background-color 0.25s ease,
            transform 0.25s ease;
}

#modalPagePosition.changed {
    color: #0d6efd !important;               /* text-secondary 덮기 */
    background-color: rgba(13,110,253,0.15); /* 확실히 보이게 */
    border-radius: 6px;
    padding: 2px 6px;
    transform: scale(1.08);                  /* 이게 핵심 */
}

/* =========================================
   ✨ A4 PAGE FRAME — 완전 고정 & 버그 0%
========================================= */
#pageFrame {
    position: relative;
    background: white;
    border: 1px solid #ccc;

    /* 크기는 전부 JS에서 지정 */
    width: 0;
    height: 0;

    max-width: 100%;
    max-height: 100%;

    display: flex;
    justify-content: center;
    align-items: center;
    overflow: hidden;
}

/* 이미지 */
#modalPageImg {
    position: absolute;
    top: 50%;
    left: 50%;
    width: auto;
    height: auto;
    max-width: none;
    max-height: none;
    transform-origin: center center;
    user-select: none;
    -webkit-user-drag: none;
}

#pageModal .modal-footer {
    padding-top: .5rem;
    padding-bottom: .75rem;
}

#scrollBox {
    height: 460px;
    overflow-y: auto;
    padding: 1rem;

    border: 1px solid #dee2e6;
    border-radius: .5rem;
    background: #fff;
    margin-bottom: 20px;
}

/* ============================
Global Loading Overlay
============================ */
#globalLoadingOverlay {
    position: fixed;
    inset: 0;
    background: rgba(255,255,255,0.75);
    z-index: 5000;
    display: flex;
    align-items: center;
    justify-content: center;
}

#globalLoadingOverlay .loading-box {
    pointer-events: none;
}

.pdf-dropzone {
    border: 2px dashed #bbb;
    padding: 30px;
    border-radius: 10px;
    cursor: pointer;
}



#thumbGrid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: 0.75rem;
}

/* 🔥 드래그 중 원본 카드 완전히 제거 */
.sortable-chosen {
    opacity: 0 !important;
    visibility: hidden !important;
}

/* 카드 프레임도 차지하지 않게 */
.sortable-chosen * {
    pointer-events: none !important;
}

/* 따라오는 썸네일 (fallback) */
.sortable-fallback {
    opacity: 0.6 !important;
    z-index: 10000 !important;
    pointer-events: none !important;
}

/* 삽입 위치 표시 */
.sortable-ghost {
    opacity: 0.25 !important;
}
