/* WP PDF Editor — editor.css */

/* ── 레이아웃 래퍼 ── */
.wppe-wrap {
    display: flex;
    flex-direction: column;
    width: 100%;
    height: 720px;
    min-height: 500px;
    background: #f0ede8;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    box-sizing: border-box;
    overflow: hidden;
    border: 1px solid #ddd;
    border-radius: 4px;
}
.wppe-wrap *, .wppe-wrap *::before, .wppe-wrap *::after {
    box-sizing: border-box;
}

/* ── 상단 툴바 ── */
.wppe-topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 14px;
    background: #1e293b;
    color: #f1f5f9;
    flex-shrink: 0;
    gap: 12px;
    min-height: 48px;
}
.wppe-topbar-left, .wppe-topbar-right {
    display: flex;
    align-items: center;
    gap: 8px;
}
.wppe-logo {
    font-size: 15px;
    font-weight: 600;
    color: #60a5fa;
    white-space: nowrap;
    display: flex;
    align-items: center;
    gap: 6px;
}
.wppe-title-input {
    background: rgba(255,255,255,0.08);
    border: 1px solid rgba(255,255,255,0.15);
    border-radius: 4px;
    color: #f1f5f9;
    font-size: 13px;
    padding: 4px 10px;
    width: 200px;
    outline: none;
}
.wppe-title-input:focus {
    border-color: #60a5fa;
    background: rgba(255,255,255,0.12);
}
.wppe-btn {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 5px 11px;
    border: 1px solid rgba(255,255,255,0.2);
    border-radius: 4px;
    background: rgba(255,255,255,0.08);
    color: #f1f5f9;
    font-size: 12px;
    cursor: pointer;
    transition: background 0.15s;
    white-space: nowrap;
}
.wppe-btn:hover { background: rgba(255,255,255,0.18); }
.wppe-btn-primary {
    background: #2563eb !important;
    border-color: #1d4ed8 !important;
}
.wppe-btn-primary:hover { background: #1d4ed8 !important; }
.wppe-status {
    font-size: 12px;
    color: #94a3b8;
    min-width: 80px;
    text-align: right;
}

/* ── 바디 ── */
.wppe-body {
    display: flex;
    flex: 1;
    overflow: hidden;
}

/* ── 사이드바 ── */
.wppe-sidebar {
    width: 210px;
    flex-shrink: 0;
    background: #fff;
    border-right: 1px solid #e2e8f0;
    overflow-y: auto;
    padding: 0 0 12px;
}
.wppe-panel {
    padding: 10px 12px;
    border-bottom: 1px solid #f1f5f9;
}
.wppe-panel-title {
    font-size: 10px;
    font-weight: 700;
    letter-spacing: .06em;
    text-transform: uppercase;
    color: #94a3b8;
    margin-bottom: 8px;
}
.wppe-tool-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 5px;
}
.wppe-tool {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 3px;
    padding: 8px 4px;
    border: 1px solid #e2e8f0;
    border-radius: 6px;
    background: #f8fafc;
    color: #334155;
    font-size: 11px;
    cursor: pointer;
    transition: all 0.15s;
}
.wppe-tool:hover { border-color: #93c5fd; background: #eff6ff; color: #1d4ed8; }
.wppe-tool.active {
    border-color: #2563eb;
    background: #eff6ff;
    color: #1d4ed8;
    font-weight: 600;
}
.wppe-tool .dashicons { font-size: 18px; width: 18px; height: 18px; }

/* ── 색상 팔레트 ── */
.wppe-colors {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}
.wppe-color-swatch {
    width: 22px;
    height: 22px;
    border-radius: 50%;
    cursor: pointer;
    border: 2px solid transparent;
    transition: border-color .1s, transform .1s;
}
.wppe-color-swatch:hover { transform: scale(1.15); }
.wppe-color-swatch.active { border-color: #334155; }

/* ── 속성 패널 ── */
.wppe-prop-row {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-bottom: 7px;
}
.wppe-prop-label {
    font-size: 11px;
    color: #64748b;
    width: 60px;
    flex-shrink: 0;
}
.wppe-prop-input {
    flex: 1;
    font-size: 12px;
    padding: 3px 6px;
    border: 1px solid #e2e8f0;
    border-radius: 4px;
    background: #fff;
    color: #1e293b;
    outline: none;
    min-width: 0;
}
.wppe-prop-input:focus { border-color: #93c5fd; }
.wppe-prop-num { width: 54px; flex: none; }
.wppe-prop-range { flex: 1; padding: 0; min-width: 0; }
.wppe-prop-unit { font-size: 11px; color: #94a3b8; white-space: nowrap; }

/* ── 드롭존 ── */
.wppe-dropzone {
    border: 2px dashed #cbd5e1;
    border-radius: 6px;
    padding: 16px 10px;
    text-align: center;
    color: #94a3b8;
    font-size: 12px;
    cursor: pointer;
    transition: all .2s;
    line-height: 1.5;
}
.wppe-dropzone:hover, .wppe-dropzone.dragover {
    border-color: #2563eb;
    color: #2563eb;
    background: #eff6ff;
}

/* ── 페이지 탐색 ── */
.wppe-page-ctrl {
    display: flex;
    align-items: center;
    gap: 8px;
    justify-content: center;
}
.wppe-page-ctrl span { font-size: 13px; color: #334155; }

/* ── 전체 너비 버튼 ── */
.wppe-btn-full {
    width: 100%;
    justify-content: center;
    border-color: #e2e8f0;
    background: #f8fafc;
    color: #334155;
    font-size: 12px;
    padding: 6px;
    border-radius: 5px;
}
.wppe-btn-full:hover { background: #f1f5f9; }

/* ── 캔버스 영역 ── */
.wppe-canvas-area {
    flex: 1;
    overflow: auto;
    display: flex;
    align-items: flex-start;
    justify-content: center;
    padding: 24px;
    background: #e8e4df;
    position: relative;
}
.wppe-page-wrap {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 20px;
}
.wppe-page {
    position: relative;
    background: #fff;
    box-shadow: 0 4px 24px rgba(0,0,0,0.18);
    border-radius: 2px;
    /* 기본 A4 크기, JS에서 PDF 크기에 따라 동적 변경 */
    width: 794px;
    min-height: 1123px;
}
.wppe-page canvas,
.wppe-page svg {
    position: absolute;
    top: 0;
    left: 0;
    display: block;
}
#wppe-pdf-canvas { z-index: 1; border-radius: 2px; }
#wppe-draw-canvas { z-index: 2; pointer-events: none; }
#wppe-svg-layer  { z-index: 3; pointer-events: none; }

/* ── 텍스트 블록 ── */
.wppe-text-block {
    position: absolute;
    z-index: 10;
    cursor: move;
    min-width: 60px;
    min-height: 24px;
    outline: none;
    word-break: break-word;
    user-select: text;
    padding: 2px 4px;
    border-radius: 2px;
}
.wppe-text-block.selected { outline: 1.5px dashed #2563eb; outline-offset: 2px; }
.wppe-text-block:empty::after {
    content: attr(data-placeholder);
    color: #aaa;
    pointer-events: none;
    font-style: italic;
    font-size: 13px;
}

/* ── 도형 / 이미지 요소 ── */
.wppe-shape-el,
.wppe-img-el {
    position: absolute;
    z-index: 10;
    cursor: move;
}
.wppe-shape-el.selected,
.wppe-img-el.selected { outline: 1.5px dashed #2563eb; outline-offset: 2px; }
.wppe-img-el img { display: block; width: 100%; height: 100%; object-fit: cover; }
.wppe-resize-handle {
    position: absolute;
    width: 10px; height: 10px;
    background: #2563eb;
    border-radius: 50%;
    cursor: se-resize;
    right: -5px; bottom: -5px;
    z-index: 20;
}

/* ── 로딩 오버레이 ── */
.wppe-loading {
    position: absolute;
    inset: 0;
    background: rgba(240,237,232,.82);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 12px;
    font-size: 14px;
    color: #334155;
    z-index: 100;
}
.wppe-spinner {
    width: 36px; height: 36px;
    border: 3px solid #e2e8f0;
    border-top-color: #2563eb;
    border-radius: 50%;
    animation: wppe-spin .7s linear infinite;
}
@keyframes wppe-spin { to { transform: rotate(360deg); } }

/* ── 반응형 ── */
@media (max-width: 768px) {
    .wppe-sidebar { width: 170px; }
    .wppe-page { width: 100% !important; min-height: auto !important; }
    .wppe-canvas-area { padding: 12px; }
    .wppe-title-input { width: 130px; }
}
@media (max-width: 540px) {
    .wppe-sidebar { display: none; }
    .wppe-topbar { flex-wrap: wrap; }
}
