/* ── PDF Editor ──────────────────────────────────────────────────────────── */

.pdf-editor {
    display: none;
    position: fixed;
    inset: 0;
    background: #1a1a2e;
    z-index: 9000;
    flex-direction: column;
}
.pdf-editor.active { display: flex; }

/* Toolbar */
.editor-toolbar {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 6px 12px;
    background: #16213e;
    border-bottom: 1px solid rgba(255,255,255,0.08);
    flex-wrap: wrap;
    flex-shrink: 0;
    min-height: 48px;
}

.editor-tool-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 5px 10px;
    background: transparent;
    color: #94a3b8;
    border: 1px solid transparent;
    border-radius: 6px;
    cursor: pointer;
    font-size: 12px;
    font-weight: 500;
    font-family: inherit;
    transition: background 0.15s, color 0.15s;
    white-space: nowrap;
}
.editor-tool-btn:hover { background: rgba(255,255,255,0.07); color: #e2e8f0; }
.editor-tool-btn.active { background: #4f46e5; color: #fff; border-color: #4f46e5; }
.editor-tool-btn svg { width: 14px; height: 14px; flex-shrink: 0; }

.editor-sep { width: 1px; height: 26px; background: rgba(255,255,255,0.1); margin: 0 4px; flex-shrink: 0; }
.editor-spacer { flex: 1; }

.editor-label { font-size: 11px; color: #64748b; padding: 0 4px; white-space: nowrap; }

/* Color swatches */
.editor-colors { display: flex; gap: 4px; align-items: center; }
.editor-swatch {
    width: 18px;
    height: 18px;
    border-radius: 4px;
    border: 2px solid transparent;
    cursor: pointer;
    transition: border-color 0.15s, transform 0.1s;
    flex-shrink: 0;
}
.editor-swatch:hover { transform: scale(1.15); }
.editor-swatch.active { border-color: #fff; }

/* Small selects */
.editor-select {
    background: rgba(255,255,255,0.06);
    color: #e2e8f0;
    border: 1px solid rgba(255,255,255,0.1);
    border-radius: 5px;
    padding: 4px 6px;
    font-size: 12px;
    font-family: inherit;
    cursor: pointer;
}
.editor-select:focus { outline: none; border-color: #4f46e5; }

/* Download & close */
.editor-download-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 14px;
    background: #22c55e;
    color: #fff;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 13px;
    font-weight: 600;
    font-family: inherit;
    transition: background 0.15s;
    white-space: nowrap;
}
.editor-download-btn:hover { background: #16a34a; }
.editor-download-btn:disabled { background: #475569; cursor: not-allowed; }

.editor-close-btn {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 5px 10px;
    background: transparent;
    color: #f87171;
    border: 1px solid #f87171;
    border-radius: 6px;
    cursor: pointer;
    font-size: 12px;
    font-family: inherit;
    transition: background 0.15s;
    white-space: nowrap;
}
.editor-close-btn:hover { background: rgba(248,113,113,0.1); }

/* Viewport */
.editor-viewport {
    flex: 1;
    overflow: auto;
    padding: 28px 24px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 24px;
    background: #0f172a;
    position: relative;
}

/* Loading overlay */
.editor-loading {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    gap: 16px;
    background: #0f172a;
    color: #e2e8f0;
    font-size: 15px;
    z-index: 10;
}
.editor-loading.hidden { display: none; }

.editor-spinner {
    width: 38px;
    height: 38px;
    border: 3px solid rgba(79,70,229,0.25);
    border-top-color: #4f46e5;
    border-radius: 50%;
    animation: spin 0.75s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* Per-page wrapper */
.editor-page-wrap {
    position: relative;
    display: block;
    box-shadow: 0 4px 32px rgba(0,0,0,0.6);
    cursor: crosshair;
    flex-shrink: 0;
}
.editor-page-wrap[data-tool="select"] { cursor: default; }
.editor-page-wrap[data-tool="text"]   { cursor: text; }
.editor-page-wrap[data-tool="erase"]  { cursor: cell; }

.editor-page-wrap .page-canvas,
.editor-page-wrap .annot-canvas,
.editor-page-wrap .interact-canvas {
    display: block;
}
.editor-page-wrap .annot-canvas,
.editor-page-wrap .interact-canvas {
    position: absolute;
    top: 0;
    left: 0;
}
.editor-page-wrap .annot-canvas   { pointer-events: none; }
.editor-page-wrap .interact-canvas { cursor: inherit; }

/* Inline text input placed over the page */
.editor-text-input {
    position: absolute;
    background: rgba(255,255,255,0.92);
    border: 2px dashed #4f46e5;
    border-radius: 3px;
    padding: 2px 6px;
    outline: none;
    min-width: 80px;
    color: #000;
    z-index: 20;
}

/* Status bar */
.editor-statusbar {
    padding: 5px 14px;
    background: #16213e;
    border-top: 1px solid rgba(255,255,255,0.06);
    color: #64748b;
    font-size: 11px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-shrink: 0;
}
.editor-statusbar kbd {
    background: rgba(255,255,255,0.08);
    border-radius: 3px;
    padding: 1px 5px;
    font-family: inherit;
    font-size: 10px;
}
