/* 이미지 편집 모달(크롭 + 회전 + 사이즈 선택) 전용 스타일.
 *
 * src/client/edit/image.ts 의 ImageEditor 가 사용하는 #imageEditorModal 마크업과 한 쌍.
 * 위키 에디터 페이지(edit.html / blog-edit.html)는 기존대로 css/edit.css 의 동일 정의를
 * 사용하므로 이 파일을 추가로 로드할 필요가 없다. 토론·티켓 페이지처럼 edit.css 를
 * 통째로 로드하기엔 무거운 페이지가 이 파일만 별도로 로드한다.
 */

.img-editor-canvas-wrap {
    position: relative;
    width: 100%;
    max-height: 60vh;
    overflow: hidden;
    background: repeating-conic-gradient(#e0e0e0 0% 25%, #fff 0% 50%) 50% / 16px 16px;
    border: 1px solid var(--wiki-border);
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    touch-action: none;
    user-select: none;
    -webkit-user-select: none;
}

@media (prefers-color-scheme: dark) {
    html:not([data-theme="light"]) .img-editor-canvas-wrap {
        background: repeating-conic-gradient(#333 0% 25%, #222 0% 50%) 50% / 16px 16px;
    }
}
html[data-theme="dark"] .img-editor-canvas-wrap {
    background: repeating-conic-gradient(#333 0% 25%, #222 0% 50%) 50% / 16px 16px;
}

.img-editor-canvas-wrap canvas {
    max-width: 100%;
    max-height: 60vh;
    display: block;
}

/* 크롭 오버레이 */
.crop-overlay {
    position: absolute;
    inset: 0;
    pointer-events: none;
}

.crop-overlay .crop-dim {
    position: absolute;
    background: rgba(0, 0, 0, 0.45);
}

.crop-overlay .crop-box {
    position: absolute;
    border: 2px solid #fff;
    box-shadow: 0 0 0 9999px rgba(0, 0, 0, 0.45);
    pointer-events: auto;
    cursor: move;
    touch-action: none;
}

.crop-overlay .crop-handle {
    position: absolute;
    width: 20px;
    height: 20px;
    background: #fff;
    border: 2px solid var(--wiki-primary);
    border-radius: 50%;
    pointer-events: auto;
    touch-action: none;
    z-index: 1;
}

.crop-overlay .crop-handle.tl { top: -10px; left: -10px; cursor: nw-resize; }
.crop-overlay .crop-handle.tr { top: -10px; right: -10px; cursor: ne-resize; }
.crop-overlay .crop-handle.bl { bottom: -10px; left: -10px; cursor: sw-resize; }
.crop-overlay .crop-handle.br { bottom: -10px; right: -10px; cursor: se-resize; }

.img-editor-toolbar {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 12px;
    flex-wrap: wrap;
}

.img-editor-toolbar button {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 14px;
    border: 1px solid var(--wiki-border);
    border-radius: 8px;
    background: var(--wiki-card-bg);
    color: var(--wiki-text);
    font-size: 0.88rem;
    cursor: pointer;
    transition: background 0.15s, border-color 0.15s;
}

.img-editor-toolbar button:hover {
    border-color: var(--wiki-primary);
    background: var(--wiki-bg);
}

.img-editor-toolbar button.active {
    border-color: var(--wiki-primary);
    background: var(--wiki-primary);
    color: #fff;
}

.img-editor-toolbar button i {
    font-size: 1.1rem;
}

.img-editor-toolbar .separator {
    width: 1px;
    height: 24px;
    background: var(--wiki-border);
}

.img-editor-info {
    margin-top: 8px;
    font-size: 0.8rem;
    color: var(--wiki-text-muted);
}
