/*
 * esign-editor.css
 * ---------------------------------------------------------------------------
 * 편집기 모듈 전용 스타일. 데모 화면(app.css)과 분리해 두었으니
 * 다른 화면에 붙일 때는 이 파일 + esign-editor.js 만 가져가면 된다.
 * ---------------------------------------------------------------------------
 */

.esign-editor {
    position: relative;
    height: 100%;
    overflow: hidden;
    background: #52565c;
}

.esign-editor.esign-placing {
    cursor: crosshair;
}

.esign-scroll {
    height: 100%;
    overflow: auto;
    padding: 24px 16px 48px;
    box-sizing: border-box;
}

.esign-page-list {
    list-style: none;
    margin: 0 auto;
    padding: 0;
    max-width: 900px;
}

.esign-page {
    margin: 0 0 28px;
}

.esign-page-contents {
    position: relative;
    background: #fff;
    box-shadow: 0 2px 10px rgba(0, 0, 0, .35);
}

/* PDF 캔버스와 오버레이 레이어가 정확히 같은 사각형을 차지하게 만드는 게 핵심.
   aspect-ratio 는 PDF 페이지 실제 비율로 렌더링할 때 채워 넣는다. */
.esign-page-wrapper {
    position: relative;
    width: 100%;
    aspect-ratio: 21 / 29.7;
}

.esign-page-canvas {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    display: block;
}

/* 서명 아이템이 놓이는 투명 오버레이. 아이템의 offsetParent 가 된다. */
.esign-item-layer {
    position: absolute;
    inset: 0;
    font-size: 16px;    /* JS 가 페이지 폭에 비례해 다시 계산한다 */
}

.esign-page-no {
    margin-top: 6px;
    text-align: center;
    font-size: 12px;
    color: #d6d9dd;
}

.esign-empty {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #c3c8ce;
    font-size: 14px;
    pointer-events: none;
}

/* --------------------------------------------------------------- 아이템 */

.esign-item-box {
    position: absolute;
    box-sizing: border-box;     /* % 환산이 offsetWidth 와 정확히 맞아떨어지게 */
    display: flex;
    align-items: center;
    justify-content: center;
    border: 1px dashed hsl(var(--esign-hue, 210) 65% 40%);
    background: hsl(var(--esign-hue, 210) 100% 80% / .55);
    color: #1b2430;
    font-size: .8em;
    line-height: 1.2;
    overflow: hidden;
    cursor: move;
    user-select: none;
    touch-action: none;
}

.esign-item-box.esign-item-active {
    opacity: .8;
    border-style: solid;
    box-shadow: 0 0 0 1px hsl(var(--esign-hue, 210) 65% 40%);
}

.esign-item-label {
    padding: 0 2px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    pointer-events: none;
}

.esign-item-resize {
    position: absolute;
    right: -1px;
    bottom: -1px;
    width: 10px;
    height: 10px;
    background: #fff;
    border: 1px solid hsl(var(--esign-hue, 210) 65% 35%);
    cursor: se-resize;
}

.esign-item-delete {
    position: absolute;
    right: -8px;
    top: -8px;
    width: 17px;
    height: 17px;
    border-radius: 50%;
    background: #d64545;
    color: #fff;
    font-size: 12px;
    line-height: 1;
    display: none;
    align-items: center;
    justify-content: center;
    cursor: pointer;
}

.esign-item-box:hover .esign-item-delete {
    display: flex;
}

/* 보기 전용 모드 / PDF 합성용 렌더링에서는 핸들이 보이면 안 된다. */
.esign-readonly .esign-item-resize,
.esign-readonly .esign-item-delete {
    display: none !important;
}

.esign-readonly .esign-item-box {
    cursor: default;
}

/* ----------------------------------------------------------- 배치 고스트 */

.esign-helper {
    position: fixed;
    top: 0;
    left: 0;
    z-index: 9999;
    box-sizing: border-box;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 1px dashed hsl(var(--esign-hue, 210) 65% 40%);
    background: hsl(var(--esign-hue, 210) 100% 80% / .7);
    color: #1b2430;
    font-size: 12px;
    pointer-events: none;
    opacity: .9;
}
