/* PDFLeader Free PDF Editor Stylesheet */
:root {
    --bg-main: #f4f6f9;
    --bg-header: #ffffff;
    --bg-toolbar: #ffffff;
    --bg-sidebar: #f8fafc;
    --border-color: #e2e8f0;
    --border-focus: #3b82f6;
    --primary: #2563eb;
    --primary-hover: #1d4ed8;
    --text-main: #0f172a;
    --text-muted: #64748b;
    --active-bg: #eff6ff;
    --active-text: #2563eb;
    --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.08);
    --shadow-lg: 0 10px 25px rgba(0, 0, 0, 0.12);
    --radius-sm: 6px;
    --radius-md: 10px;
    --radius-lg: 16px;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    font-family: 'Inter', system-ui, -apple-system, sans-serif;
}

body.editor-body {
    background-color: var(--bg-main);
    color: var(--text-main);
    height: 100vh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

/* Header Navbar */
.editor-header {
    height: 60px;
    background: var(--bg-header);
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 20px;
    z-index: 100;
}

.header-left {
    display: flex;
    align-items: center;
    gap: 24px;
}

.brand-logo {
    display: flex;
    align-items: center;
    gap: 10px;
    text-decoration: none;
}

.logo-icon {
    width: 36px;
    height: 36px;
    background: linear-gradient(135deg, #2563eb, #3b82f6);
    color: white;
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
}

.brand-name {
    font-family: 'Outfit', sans-serif;
    font-weight: 700;
    font-size: 20px;
    color: #0f172a;
}

.brand-name span {
    color: var(--primary);
}

.zoom-controls {
    display: flex;
    align-items: center;
    gap: 4px;
    background: #f1f5f9;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    padding: 2px;
}

.btn-icon {
    width: 30px;
    height: 30px;
    background: transparent;
    border: none;
    border-radius: 4px;
    color: var(--text-muted);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.15s ease;
}

.btn-icon:hover {
    background: #e2e8f0;
    color: var(--text-main);
}

.zoom-input-wrapper {
    position: relative;
}

#zoomPercent {
    width: 64px;
    height: 30px;
    text-align: center;
    background: transparent;
    border: none;
    font-weight: 600;
    font-size: 13px;
    color: var(--text-main);
    cursor: pointer;
}

.dropdown-arrow {
    position: absolute;
    right: 4px;
    top: 9px;
    font-size: 10px;
    color: var(--text-muted);
    pointer-events: none;
}

.zoom-dropdown {
    position: absolute;
    top: 36px;
    left: 50%;
    transform: translateX(-50%);
    background: white;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    box-shadow: var(--shadow-md);
    width: 90px;
    display: none;
    z-index: 1000;
}

.zoom-dropdown.active {
    display: block;
}

.zoom-option {
    padding: 8px 12px;
    font-size: 13px;
    cursor: pointer;
    text-align: center;
}

.zoom-option:hover {
    background: var(--active-bg);
    color: var(--primary);
}

.header-center {
    flex: 1;
    text-align: center;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    padding: 0 20px;
}

.doc-title {
    font-weight: 600;
    font-size: 14px;
    color: var(--text-muted);
}

.header-right {
    display: flex;
    align-items: center;
    gap: 12px;
}

.btn-secondary {
    background: #ffffff;
    border: 1px solid var(--border-color);
    color: var(--text-main);
    padding: 8px 16px;
    font-weight: 600;
    font-size: 13px;
    border-radius: var(--radius-sm);
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
    transition: all 0.15s ease;
}

.btn-secondary:hover {
    background: #f8fafc;
    border-color: #cbd5e1;
}

.btn-primary-done {
    background: linear-gradient(135deg, #2563eb, #1d4ed8);
    color: white;
    border: none;
    padding: 8px 22px;
    font-weight: 600;
    font-size: 14px;
    border-radius: var(--radius-sm);
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
    box-shadow: 0 2px 8px rgba(37, 99, 235, 0.3);
    transition: all 0.15s ease;
}

.btn-primary-done:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(37, 99, 235, 0.4);
}

/* Main Top Editing Toolbar */
.main-toolbar {
    height: 52px;
    background: var(--bg-toolbar);
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    padding: 0 20px;
    gap: 12px;
    z-index: 90;
    box-shadow: var(--shadow-sm);
}

.toolbar-group {
    display: flex;
    align-items: center;
    gap: 4px;
}

.toolbar-divider {
    width: 1px;
    height: 24px;
    background-color: var(--border-color);
    margin: 0 4px;
}

.tool-btn {
    height: 38px;
    padding: 0 12px;
    background: transparent;
    border: 1px solid transparent;
    border-radius: var(--radius-sm);
    color: var(--text-muted);
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
    transition: all 0.15s ease;
}

.tool-btn i {
    font-size: 15px;
}

.tool-btn:hover {
    background: #f1f5f9;
    color: var(--text-main);
}

.tool-btn.active {
    background: var(--active-bg);
    color: var(--active-text);
    border-color: #bfdbfe;
    font-weight: 600;
}

/* Formatting Sub-Toolbar */
.format-toolbar {
    height: 44px;
    background: #f8fafc;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    padding: 0 20px;
    gap: 12px;
    z-index: 85;
}

.format-toolbar.hidden {
    visibility: hidden;
    opacity: 0;
    pointer-events: none;
}

.format-group {
    display: flex;
    align-items: center;
    gap: 8px;
}

.format-select {
    height: 30px;
    padding: 0 10px;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    font-size: 12px;
    font-weight: 500;
    background: white;
    cursor: pointer;
}

.font-size-control {
    display: flex;
    align-items: center;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    background: white;
}

.btn-fmt {
    width: 26px;
    height: 28px;
    border: none;
    background: transparent;
    cursor: pointer;
    color: var(--text-muted);
}

.btn-fmt:hover {
    background: #f1f5f9;
    color: var(--text-main);
}

#fontSizeInput {
    width: 38px;
    height: 28px;
    border: none;
    text-align: center;
    font-size: 13px;
    font-weight: 600;
}

.color-picker-wrapper {
    position: relative;
    width: 28px;
    height: 28px;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    overflow: hidden;
    cursor: pointer;
}

#textColorPicker {
    position: absolute;
    opacity: 0;
    width: 100%;
    height: 100%;
    cursor: pointer;
}

.color-preview {
    display: block;
    width: 100%;
    height: 100%;
}

.btn-fmt-toggle {
    width: 30px;
    height: 30px;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    background: white;
    color: var(--text-muted);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}

.btn-fmt-toggle:hover {
    background: #f1f5f9;
    color: var(--text-main);
}

.btn-fmt-toggle.active {
    background: var(--active-bg);
    color: var(--primary);
    border-color: #bfdbfe;
}

.btn-fmt-danger {
    width: 30px;
    height: 30px;
    border: 1px solid #fecdd3;
    border-radius: 4px;
    background: #fff1f2;
    color: #e11d48;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}

.btn-fmt-danger:hover {
    background: #ffe4e6;
}

/* Editor Main Workspace Layout */
.editor-workspace {
    flex: 1;
    position: relative;
    display: flex;
    overflow: hidden;
}

/* Dropzone Upload View */
.upload-dropzone {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 40px;
    background: radial-gradient(circle at center, #ffffff 0%, #f1f5f9 100%);
}

.dropzone-card {
    background: white;
    border: 2px dashed #cbd5e1;
    border-radius: var(--radius-lg);
    padding: 60px 80px;
    text-align: center;
    max-width: 600px;
    box-shadow: var(--shadow-lg);
    transition: all 0.2s ease;
}

.dropzone-card:hover {
    border-color: var(--primary);
    transform: translateY(-2px);
}

.dropzone-icon {
    width: 80px;
    height: 80px;
    background: #eff6ff;
    color: var(--primary);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 36px;
    margin: 0 auto 24px;
}

.dropzone-card h2 {
    font-family: 'Outfit', sans-serif;
    font-size: 26px;
    font-weight: 700;
    margin-bottom: 12px;
}

.dropzone-card p {
    color: var(--text-muted);
    font-size: 14px;
    line-height: 1.6;
    margin-bottom: 32px;
}

.btn-choose-file {
    background: linear-gradient(135deg, #2563eb, #1d4ed8);
    color: white;
    border: none;
    padding: 14px 36px;
    font-size: 16px;
    font-weight: 600;
    border-radius: var(--radius-md);
    cursor: pointer;
    box-shadow: 0 4px 16px rgba(37, 99, 235, 0.3);
    transition: all 0.2s ease;
}

.btn-choose-file:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(37, 99, 235, 0.4);
}

.dropzone-footer {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 24px;
    margin-top: 36px;
    padding-top: 24px;
    border-top: 1px solid var(--border-color);
    color: var(--text-muted);
    font-size: 13px;
}

/* Editor Main View Container */
.editor-view-container {
    flex: 1;
    display: flex;
    height: 100%;
    overflow: hidden;
}

.editor-view-container.hidden,
.upload-dropzone.hidden {
    display: none !important;
}

/* Left Sidebar Thumbnails */
.sidebar-thumbnails {
    width: 220px;
    background: var(--bg-sidebar);
    border-right: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.sidebar-header {
    padding: 14px 16px;
    font-weight: 600;
    font-size: 13px;
    color: var(--text-muted);
    border-bottom: 1px solid var(--border-color);
}

.thumbnail-list {
    flex: 1;
    overflow-y: auto;
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.thumbnail-card {
    background: white;
    border: 2px solid transparent;
    border-radius: var(--radius-sm);
    padding: 8px;
    cursor: pointer;
    box-shadow: var(--shadow-sm);
    text-align: center;
    transition: all 0.15s ease;
}

.thumbnail-card:hover {
    border-color: #93c5fd;
    transform: translateY(-1px);
}

.thumbnail-card.active {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.15);
}

.thumbnail-canvas-container {
    width: 100%;
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 4px;
    overflow: hidden;
}

.thumbnail-canvas-container canvas {
    width: 100%;
    height: auto;
    display: block;
}

.thumbnail-label {
    display: inline-block;
    margin-top: 6px;
    font-size: 12px;
    font-weight: 600;
    color: var(--text-muted);
}

/* Pages Main Container */
/* Pages Main Container - Adobe Reader-style scroll viewport */
.pages-main-container {
    flex: 1;
    background: #cbd5e1;
    overflow-x: auto;
    overflow-y: auto;
    padding: 40px 20px;
    box-sizing: border-box;
    display: block;
}

/* Pages wrapper: centered column, width grows with page size */
.pages-wrapper {
    display: flex;
    flex-direction: column;
    gap: 32px;
    align-items: center;
    margin: 0 auto;
    width: max-content;
    min-width: 100%;
    padding-bottom: 40px;
}

/* Individual Rendered PDF Page Container */
.pdf-page-container {
    position: relative;
    background: white;
    box-shadow: 0 8px 28px rgba(0,0,0,0.20), 0 2px 8px rgba(0,0,0,0.10);
    border-radius: 4px;
    user-select: none;
    /* Critical: must not be resized by any parent flex container */
    flex-shrink: 0;
    overflow: hidden;
}

.pdf-canvas-layer {
    display: block;
    width: 100%;
    height: 100%;
}

/* Overlay Layer for Text Detection & Editing */
.pdf-overlay-layer {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 10;
}

/* Text Bounding Boxes (PDFLeader Dotted Blue Highlight Box) */
.text-bbox-highlight {
    position: absolute;
    border: 2px dotted #3498db;
    background: rgba(52, 152, 219, 0.04);
    border-radius: 2px;
    cursor: pointer;
    pointer-events: auto;
    transition: all 0.15s ease;
    padding: 2px;
    box-sizing: border-box;
    z-index: 5;
    color: #000000;
}

.text-bbox-highlight:hover {
    background: rgba(52, 152, 219, 0.12);
    border-style: dotted;
    border-color: #2980b9;
}

.text-bbox-highlight.editing {
    border-color: #e74c3c !important;
    background: rgba(231, 76, 60, 0.05) !important;
    z-index: 20 !important;
}

/* Inline Active Editable Text Box */
.editable-text-node {
    position: absolute;
    outline: none;
    background: transparent;
    color: #000000;
    padding: 1px 2px;
    border-radius: 2px;
    cursor: text;
    z-index: 20;
    white-space: pre-wrap;
    word-break: break-word;
    line-height: 1.2;
    box-sizing: border-box;
    box-shadow: none;
    border: none;
}

.editable-text-node:focus {
    background: #ffffff;
    box-shadow: 0 0 0 1.5px #2563eb, 0 2px 6px rgba(37, 99, 235, 0.15);
}

/* Added Elements Layer (Text, Images, Shapes, Drawings) */
.canvas-element-node {
    position: absolute;
    pointer-events: auto;
    cursor: move;
    border: 1px dashed transparent;
    user-select: none;
    z-index: 15;
}

.canvas-element-node.selected {
    border-color: var(--primary);
    box-shadow: 0 0 0 1px var(--primary);
}

/* Active Selection Box Overlay & 6-Dot Resize Controls */
.selection-box-overlay {
    position: absolute;
    border: 2px dashed #2563eb;
    background: rgba(37, 99, 235, 0.03);
    pointer-events: none;
    z-index: 100;
    box-sizing: border-box;
}

.resize-dot {
    position: absolute;
    width: 14px;
    height: 14px;
    background: #ffffff;
    border: 2.5px solid #2563eb;
    border-radius: 50%;
    pointer-events: auto;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.3);
    z-index: 110;
    transition: transform 0.1s ease, background-color 0.1s ease;
}

.resize-dot:hover {
    background: #2563eb;
    transform: scale(1.35);
}

.dot-nw { top: -7px; left: -7px; cursor: nwse-resize; }
.dot-n  { top: -7px; left: calc(50% - 7px); cursor: ns-resize; }
.dot-ne { top: -7px; right: -7px; cursor: nesw-resize; }
.dot-sw { bottom: -7px; left: -7px; cursor: nesw-resize; }
.dot-s  { bottom: -7px; left: calc(50% - 7px); cursor: ns-resize; }
.dot-se { bottom: -7px; right: -7px; cursor: nwse-resize; }
.dot-w  { top: calc(50% - 7px); left: -7px; cursor: ew-resize; }
.dot-e  { top: calc(50% - 7px); right: -7px; cursor: ew-resize; }

/* Modals */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(15, 23, 42, 0.6);
    backdrop-filter: blur(4px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2000;
}

.modal-overlay.hidden {
    display: none !important;
}

.modal-card {
    background: white;
    border-radius: var(--radius-lg);
    width: 580px;
    max-width: 90vw;
    box-shadow: var(--shadow-lg);
    overflow: hidden;
}

.modal-card.modal-sm {
    width: 400px;
}

.modal-header {
    padding: 20px 24px;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.modal-header h3 {
    font-size: 18px;
    font-weight: 700;
}

.modal-close {
    background: transparent;
    border: none;
    font-size: 18px;
    color: var(--text-muted);
    cursor: pointer;
}

.modal-tabs {
    display: flex;
    border-bottom: 1px solid var(--border-color);
    background: #f8fafc;
}

.tab-btn {
    flex: 1;
    padding: 12px;
    border: none;
    background: transparent;
    font-weight: 600;
    font-size: 14px;
    color: var(--text-muted);
    cursor: pointer;
    border-bottom: 2px solid transparent;
}

.tab-btn.active {
    color: var(--primary);
    border-bottom-color: var(--primary);
    background: white;
}

.modal-body {
    padding: 24px;
}

.tab-content {
    display: none;
}

.tab-content.active {
    display: block;
}

#signPadCanvas {
    background: #f8fafc;
    border: 1px dashed #cbd5e1;
    border-radius: var(--radius-sm);
    width: 100%;
    height: 180px;
    cursor: crosshair;
}

.pad-actions {
    margin-top: 10px;
    text-align: right;
}

.btn-secondary-sm {
    padding: 6px 12px;
    font-size: 12px;
    border: 1px solid var(--border-color);
    background: white;
    border-radius: 4px;
    cursor: pointer;
}

.sign-text-input {
    width: 100%;
    padding: 12px 16px;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    font-size: 16px;
    margin-bottom: 16px;
}

.sign-preview-box {
    height: 100px;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: 'Outfit', cursive, sans-serif;
    font-size: 32px;
    background: #fafafa;
}

.sign-upload-box {
    border: 2px dashed #cbd5e1;
    border-radius: var(--radius-sm);
    padding: 40px;
    text-align: center;
    cursor: pointer;
    color: var(--text-muted);
}

.sign-upload-box i {
    font-size: 32px;
    margin-bottom: 10px;
    display: block;
}

.modal-footer {
    padding: 16px 24px;
    border-top: 1px solid var(--border-color);
    display: flex;
    justify-content: flex-end;
    gap: 12px;
    background: #f8fafc;
}

.btn-primary {
    background: var(--primary);
    color: white;
    border: none;
    padding: 10px 20px;
    font-weight: 600;
    border-radius: var(--radius-sm);
    cursor: pointer;
}

.progress-bar-container {
    width: 100%;
    height: 8px;
    background: #e2e8f0;
    border-radius: 4px;
    overflow: hidden;
    margin-top: 16px;
}

.progress-bar-fill {
    height: 100%;
    background: var(--primary);
    transition: width 0.3s ease;
}

/* PDFLeader Conversion Progress Modal Styling */
.conversion-card {
    padding: 40px;
    text-align: center;
    border-radius: 20px;
    background: #ffffff;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.15);
}

.conversion-icon-wrapper {
    position: relative;
    width: 110px;
    height: 110px;
    margin: 0 auto 20px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.conversion-badge {
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, #eff6ff, #dbeafe);
    border: 2px dashed #3b82f6;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 32px;
    color: #2563eb;
    box-shadow: inset 0 2px 6px rgba(37, 99, 235, 0.1);
}

.conversion-circle {
    position: absolute;
    font-family: 'Outfit', sans-serif;
    font-size: 32px;
    font-weight: 800;
    color: #2563eb;
    background: rgba(255, 255, 255, 0.9);
    padding: 6px 14px;
    border-radius: 20px;
    box-shadow: 0 4px 12px rgba(37, 99, 235, 0.15);
}

.conversion-title {
    font-family: 'Outfit', sans-serif;
    font-size: 22px;
    font-weight: 700;
    color: #0f172a;
    margin-bottom: 6px;
}

.conversion-subtitle {
    font-size: 13px;
    color: #64748b;
    margin-bottom: 20px;
}

/* -------------------------------------------------------------------
   LAYER SYSTEM � Named z-indexed layers within each page container
   ------------------------------------------------------------------- */

/* Each layer sits absolutely inside .pdf-page-container */
.page-layer {
    position: absolute;
    top: 0; left: 0;
    width: 100%; height: 100%;
    pointer-events: none;
}

/* Canvas layer � PDF.js background (z=0) */
.layer-canvas   { z-index: 0; pointer-events: none; }

/* Image layer  (z=10) */
.layer-image    { z-index: 10; }

/* Text layer   (z=15) */
.layer-text     { z-index: 15; }

/* Shape / eraser layer (z=20) */
.layer-shape    { z-index: 20; }

/* Annotation / comments layer (z=25) */
.layer-annotation { z-index: 25; }

/* Signature layer (z=28) */
.layer-signature  { z-index: 28; }

/* Draw layer � freehand pencil canvas (z=29) */
.layer-draw     { z-index: 29; pointer-events: none; }

/* Selection / UI layer � resize handles, guides (z=30) */
.layer-selection  { z-index: 30; pointer-events: none; }

/* When a layer is toggled hidden */
.page-layer.layer-hidden {
    display: none !important;
}

/* Elements inside layers get pointer-events back when tool is active */
.layer-image.layer-active,
.layer-text.layer-active,
.layer-shape.layer-active,
.layer-annotation.layer-active,
.layer-signature.layer-active {
    pointer-events: auto;
}

/* Virtual page placeholder (renders before actual page loads) */
.pdf-page-placeholder {
    background: #fff;
    box-shadow: 0 4px 24px rgba(0,0,0,0.10);
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #94a3b8;
    font-size: 13px;
    font-weight: 500;
    letter-spacing: 0.03em;
    position: relative;
}

.pdf-page-placeholder::after {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.6), transparent);
    animation: shimmer 1.6s infinite;
    border-radius: 4px;
}

@keyframes shimmer {
    0%   { transform: translateX(-100%); }
    100% { transform: translateX(100%); }
}


/* -------------------------------------------------------------------
   OBJECT INSPECTOR PANEL
   ------------------------------------------------------------------- */

.inspector-panel {
    width: 270px;
    min-width: 270px;
    background: #fff;
    border-left: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    overflow-y: auto;
    flex-shrink: 0;
}

.inspector-header {
    padding: 14px 16px;
    font-size: 13px;
    font-weight: 600;
    color: var(--text-main);
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
    position: sticky;
    top: 0;
    background: #fff;
    z-index: 2;
}

.inspector-header span {
    display: flex;
    align-items: center;
    gap: 7px;
}

.inspector-header i {
    color: var(--primary);
    font-size: 14px;
}

.inspector-close {
    background: none;
    border: none;
    cursor: pointer;
    padding: 4px 6px;
    border-radius: 6px;
    color: var(--text-muted);
    font-size: 13px;
    transition: all 0.15s;
}
.inspector-close:hover {
    background: var(--active-bg);
    color: var(--primary);
}

.inspector-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: 40px 20px;
    color: #94a3b8;
    text-align: center;
}
.inspector-empty i { font-size: 28px; }
.inspector-empty p { font-size: 12.5px; line-height: 1.5; }

.inspector-props.hidden { display: none; }

.inspector-section {
    padding: 14px 16px;
    border-bottom: 1px solid #f1f5f9;
}

.inspector-section-title {
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--text-muted);
    margin-bottom: 10px;
    display: flex;
    align-items: center;
    gap: 6px;
}

.inspector-type-badge {
    display: inline-block;
    background: var(--active-bg);
    color: var(--primary);
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    padding: 3px 10px;
    border-radius: 20px;
    border: 1px solid #bfdbfe;
}

.inspector-grid-2 {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
}

.inspector-field {
    display: flex;
    flex-direction: column;
    gap: 4px;
}
.inspector-field-full {
    grid-column: 1 / -1;
}

.inspector-field label {
    font-size: 10.5px;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.inspector-input {
    width: 100%;
    padding: 5px 8px;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    font-size: 12.5px;
    color: var(--text-main);
    background: #f8fafc;
    outline: none;
    transition: border-color 0.15s;
}
.inspector-input:focus {
    border-color: var(--primary);
    background: #fff;
}
.inspector-input[readonly] {
    background: #f1f5f9;
    color: #64748b;
    cursor: default;
}

.inspector-color {
    width: 100%;
    height: 30px;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    padding: 2px;
    cursor: pointer;
    background: #f8fafc;
}

.inspector-select {
    width: 100%;
    padding: 5px 8px;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    font-size: 12.5px;
    color: var(--text-main);
    background: #f8fafc;
    outline: none;
    cursor: pointer;
}

.inspector-actions {
    display: flex;
    gap: 8px;
}

.insp-btn {
    flex: 1;
    padding: 7px 10px;
    border-radius: 7px;
    border: 1px solid var(--border-color);
    background: #f8fafc;
    color: var(--text-main);
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 5px;
    transition: all 0.15s;
}
.insp-btn:hover {
    background: var(--active-bg);
    border-color: var(--primary);
    color: var(--primary);
}
.insp-btn-danger:hover {
    background: #fef2f2;
    border-color: #ef4444;
    color: #ef4444;
}


/* -------------------------------------------------------------------
   LAYER VISIBILITY PANEL (inside inspector)
   ------------------------------------------------------------------- */

.layer-visibility-panel {
    background: #fafbfc;
}

.layer-vis-row {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 7px 0;
    font-size: 12.5px;
    color: var(--text-main);
    border-bottom: 1px solid #f1f5f9;
}
.layer-vis-row:last-child { border-bottom: none; }

.layer-icon {
    width: 16px;
    color: var(--text-muted);
    font-size: 12px;
}

.layer-vis-row span {
    flex: 1;
    font-weight: 500;
}

.layer-toggle-btn {
    background: none;
    border: none;
    cursor: pointer;
    padding: 4px 6px;
    border-radius: 5px;
    color: #10b981;
    font-size: 13px;
    transition: all 0.15s;
}
.layer-toggle-btn:not(.active) {
    color: #cbd5e1;
}
.layer-toggle-btn:hover {
    background: var(--active-bg);
}


/* -------------------------------------------------------------------
   AUTOSAVE STATUS BAR
   ------------------------------------------------------------------- */

.autosave-status {
    margin-top: auto;
    padding: 12px 16px;
    border-top: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    gap: 7px;
    font-size: 12px;
    color: #10b981;
    background: #f0fdf4;
}

.autosave-status.saving {
    color: var(--primary);
    background: var(--active-bg);
}

.autosave-status.error {
    color: #ef4444;
    background: #fef2f2;
}

#autosaveIcon {
    font-size: 13px;
}

.autosave-status.saving #autosaveIcon {
    animation: spin 1s linear infinite;
}

@keyframes spin {
    from { transform: rotate(0deg); }
    to   { transform: rotate(360deg); }
}


/* -------------------------------------------------------------------
   OCR BADGE (shown on pages processed by OCR)
   ------------------------------------------------------------------- */

.ocr-badge {
    position: absolute;
    top: 8px;
    right: 8px;
    background: linear-gradient(135deg, #f59e0b, #d97706);
    color: white;
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    padding: 2px 8px;
    border-radius: 10px;
    z-index: 50;
    pointer-events: none;
    box-shadow: 0 2px 6px rgba(217,119,6,0.3);
}

/* Snap guide lines */
.snap-guide {
    position: absolute;
    background: #3b82f6;
    pointer-events: none;
    z-index: 100;
    opacity: 0.7;
}
.snap-guide.horizontal { width: 100%; height: 1px; left: 0; }
.snap-guide.vertical   { height: 100%; width: 1px;  top: 0; }

