/* PDF Text Editor Styles - Adobe Acrobat DC Level Precision */

.pdf-text-layer {
    position: absolute;
    background: transparent;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    overflow: hidden;
    line-height: 1.0;
    pointer-events: none; /* Allow clicks to pass through to canvas unless on text */
    z-index: 10;
    /* Prevent text selection artifacts */
    -webkit-user-select: none;
    user-select: none;
}

.pdf-text-item {
    position: absolute;
    /* transform-origin removed here, handled inline or by rotation logic */
    cursor: text;
    pointer-events: auto;
    color: transparent; /* Hide text initially, show on hover/edit */
    /* Use outline instead of border to avoid layout shift */
    border: none;
    outline: none;
    box-sizing: border-box;
    transition: background-color 0.15s ease, outline-color 0.15s ease, box-shadow 0.15s ease;
    /* Improve text rendering */
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    text-rendering: optimizeLegibility;
    /* Ensure text fits within bounds */
    overflow: visible;
    /* Padding for better click target */
    padding: 0;
    margin: 0;
}

.pdf-text-content {
    display: block;
    transform-origin: left top;
    white-space: nowrap;
    width: 100%;
    height: 100%;
    cursor: inherit;
    /* Inherit color from parent (transparent or visible) */
    color: inherit;
}

.pdf-text-item:hover {
    background-color: rgba(101, 105, 208, 0.1);
    outline: 1px solid rgba(101, 105, 208, 0.4);
    outline-offset: 0px;
    /* Show text on hover for preview */
    color: inherit;
}

.pdf-text-item[data-is-bold="true"] {
    /* Use inline style for precise weight (e.g. 600 vs 700) */
    /* font-weight: bold !important; - Removed to allow specific weights */
}

.pdf-text-item.editing {
    /* Color will be set dynamically based on detected text color */
    /* Use outline instead of border to avoid layout shift */
    border: none !important;
    outline: 2px solid #6569d0;
    outline-offset: 0px;
    border-radius: 2px;
    z-index: 20;
    min-width: 20px;
    overflow: visible;
    box-shadow: 0 2px 8px rgba(101, 105, 208, 0.3);
    /* Enable text selection when editing */
    -webkit-user-select: text;
    user-select: text;
    /* Smooth caret */
    caret-color: #6569d0;
    /* Allow text to expand when editing */
    width: auto !important;
    min-height: 1em;
}

.pdf-text-item.editing .pdf-text-content {
    white-space: pre;
    /* Allow content to expand */
    width: auto !important;
    height: auto !important;
    min-width: 1em;
    outline: none;
}

/* Defensive styles to prevent unwanted markers */
.pdf-text-item::before,
.pdf-text-item::after,
.pdf-text-item.editing::before,
.pdf-text-item.editing::after {
    content: none !important;
    display: none !important;
    border: none !important;
    background: none !important;
}

.pdf-text-item.modified {
    /* Visual indicator for modified text */
    /* border-left removed as requested */
    width: auto !important;
}

.pdf-text-item.modified:not(.editing) {
    /* Show modified text with subtle highlight */
    /* background-color removed to avoid green tint */
    /* Show the modified text */
    color: inherit;
}

/* Ensure the text editor indicator is visible */
.pdf-edit-mode-indicator {
    position: fixed;
    top: 80px;
    left: 50%;
    transform: translateX(-50%);
    background-color: #333;
    color: white;
    padding: 8px 16px;
    border-radius: 20px;
    display: none !important;
    align-items: center;
    gap: 8px;
    z-index: 1000;
    box-shadow: 0 2px 8px rgba(0,0,0,0.2);
    font-size: 14px;
    pointer-events: none;
}

.pdf-edit-mode-indicator i {
    font-size: 18px;
}

/* Language selector in properties sidebar */
.text-editor-properties {
    padding: 16px;
}

.text-editor-prop-group {
    margin-bottom: 16px;
}

.text-editor-prop-label {
    display: block;
    font-size: 12px;
    color: var(--on-surface-variant);
    margin-bottom: 8px;
}

.text-editor-select {
    width: 100%;
    padding: 8px;
    border-radius: 4px;
    border: 1px solid var(--outline);
    background-color: var(--surface);
    color: var(--on-surface);
}
