/* ===== ОСНОВНЫЕ СТИЛИ КОНТЕЙНЕРА ===== */
.pdf-semantic-parser-container {
    border: 1px solid #404040;
    border-radius: 8px;
    overflow: hidden;
    background: #1e1e1e;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

.pdf-semantic-parser {
    position: relative;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    height: 100%;
}

/* ===== СОВРЕМЕННЫЙ ТУЛБАР ===== */
.pdf-toolbar {
    display: flex;
    align-items: center;
    gap: 0;
    padding: 8px 12px;
    background: #2c2c2c;
    border-bottom: 1px solid #404040;
    color: white;
    font-size: 13px;
    min-height: 40px;
    box-sizing: border-box;
}

.toolbar-group {
    display: flex;
    align-items: center;
    background: #404040;
    border-radius: 4px;
    border: 1px solid #555;
    overflow: hidden;
}

.toolbar-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 28px;
    background: transparent;
    border: none;
    color: white;
    cursor: pointer;
    transition: background 0.2s;
    font-size: 14px;
    font-weight: bold;
}

.toolbar-btn:hover:not(:disabled) {
    background: #555;
}

.toolbar-btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

.toolbar-btn .btn-icon {
    display: block;
    line-height: 1;
}

.zoom-level {
    padding: 0 12px;
    min-width: 60px;
    text-align: center;
    font-weight: 500;
    background: #353535;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.zoom-value {
    font-size: 12px;
}

.page-navigation {
    display: flex;
    align-items: center;
    padding: 0 8px;
    background: #353535;
    height: 28px;
    gap: 4px;
}

.page-input {
    width: 40px;
    height: 20px;
    background: #2c2c2c;
    border: 1px solid #555;
    border-radius: 2px;
    color: white;
    text-align: center;
    font-size: 12px;
    padding: 0 4px;
}

.page-input:focus {
    outline: none;
    border-color: #007acc;
}

.page-separator {
    color: #999;
    font-size: 12px;
}

.total-pages {
    font-size: 12px;
    color: #ccc;
}

.toolbar-divider {
    width: 1px;
    height: 24px;
    background: #555;
    margin: 0 8px;
}

.toolbar-status {
    margin-left: auto;
    padding: 0 12px;
    color: #ccc;
    font-size: 12px;
}

.pdf-status {
    color: #ccc;
}

/* ===== ОБЛАСТЬ ПРОСМОТРА PDF ===== */
.pdf-viewer {
    display: flex;
    height: calc(100% - 56px);
    background: #1e1e1e;
}

.pdf-canvas-container {
    flex: 1;
    position: relative;
    background: #525659;
    overflow: auto;
    display: flex;
    justify-content: center;
    align-items: flex-start;
    padding: 20px;
}

.pdf-canvas {
    display: block;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
    border-radius: 2px;
    background: white;
}

.pdf-overlay {
    position: absolute;
    top: 20px;
    left: 50%;
    transform: translateX(-50%);
    pointer-events: none;
    z-index: 2;
}

/* ===== БОКОВАЯ ПАНЕЛЬ ===== */
.pdf-sidebar {
    width: 300px;
    background: #2c2c2c;
    border-left: 1px solid #404040;
    padding: 15px;
    overflow-y: auto;
    color: #e0e0e0;
}

.image-preview {
    text-align: center;
}

.no-selection {
    color: #7f8c8d;
    font-style: italic;
    padding: 40px 0;
}

.preview-content {
    max-width: 100%;
    max-height: 200px;
    border: 1px solid #555;
    border-radius: 4px;
    background: white;
}

.image-info {
    margin-top: 15px;
    padding: 10px;
    background: #353535;
    border-radius: 4px;
    font-size: 12px;
    text-align: left;
    line-height: 1.4;
    color: #ccc;
    border: 1px solid #404040;
}

/* ===== СТИЛИ ВЫДЕЛЕНИЙ ===== */
.image-selection {
    position: absolute;
    pointer-events: none;
    z-index: 10;
    animation: pulse 2s infinite;
    border: 3px solid #3498db;
    background: rgba(52, 152, 219, 0.1);
    box-shadow: 0 0 10px rgba(52, 152, 219, 0.5);
}

@keyframes pulse {
    0% { box-shadow: 0 0 5px rgba(52, 152, 219, 0.5); }
    50% { box-shadow: 0 0 20px rgba(52, 152, 219, 0.8); }
    100% { box-shadow: 0 0 5px rgba(52, 152, 219, 0.5); }
}

.debug-image-rect {
    position: absolute;
    pointer-events: none;
    z-index: 5;
    border: 2px solid #e74c3c;
    background: rgba(231, 76, 60, 0.1);
}

.debug-image-rect div {
    color: #e74c3c;
    font-size: 10px;
    background: rgba(0, 0, 0, 0.7);
    padding: 2px 4px;
}

/* ===== СТИЛИ ДЛЯ ВЫДЕЛЕНИЯ ТЕКСТА ===== */
.text-selection-rectangle {
    position: absolute;
    border: 2px solid #e74c3c;
    background: rgba(231, 76, 60, 0.2);
    pointer-events: none;
    z-index: 15;
}

/* ===== ТЕКСТОВЫЕ БЛОКИ РЕДАКТОРА ===== */
.text-blocks-container {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none !important; /* Контейнер не блокирует */
    z-index: 8;
}

/* Структурные блоки редактора */
.editor-text-block {
    position: absolute;
    border: 2px solid #e67e22;
    background: rgba(230, 126, 34, 0.1);
    cursor: pointer;
    z-index: 8;
	pointer-events: auto !important; /* Блоки кликабельны */	
    transition: all 0.3s ease;
    box-sizing: border-box;
}

.editor-text-block:hover {
    border-color: #3498db !important;
    background: rgba(52, 152, 219, 0.2) !important;
    transform: scale(1.05);
    box-shadow: 0 6px 12px rgba(0,0,0,0.3) !important;
    z-index: 9;
}

/* Выделенный блок */
.editor-text-block.selected {
    border-color: #27ae60 !important;
    background: rgba(39, 174, 96, 0.25) !important;
    box-shadow: 0 0 0 3px rgba(39, 174, 96, 0.3);
    z-index: 10;
}

/* ===== ПАНЕЛЬ ВЫВОДА ТЕКСТА ===== */
.pdf-text-panel {
    margin-top: 20px;
    padding: 20px;
    background: #2c2c2c;
    border-radius: 8px;
    border: 1px solid #404040;
    color: #e0e0e0;
    animation: slideDown 0.4s ease;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.2);
}

.pdf-text-panel h4 {
    margin: 0 0 15px 0;
    color: #3498db;
    font-size: 16px;
    font-weight: 600;
    border-bottom: 1px solid #404040;
    padding-bottom: 8px;
}

.selected-text-output {
    width: 100%;
    height: 120px;
    padding: 12px;
    border: 2px solid #555;
    border-radius: 6px;
    font-family: 'Courier New', Monaco, monospace;
    font-size: 14px;
    line-height: 1.5;
    resize: vertical;
    background: #1e1e1e;
    color: #e0e0e0;
    transition: all 0.3s ease;
    box-sizing: border-box;
}

.selected-text-output:focus {
    outline: none;
    border-color: #3498db;
    background: #252525;
    box-shadow: 0 0 0 3px rgba(52, 152, 219, 0.1);
}

.selected-text-output::placeholder {
    color: #7f8c8d;
    font-style: italic;
}

.block-info {
    font-size: 12px;
    color: #bdc3c7;
    margin-top: 12px;
    padding: 10px;
    background: #353535;
    border-radius: 4px;
    border-left: 3px solid #27ae60;
    line-height: 1.4;
}

.block-info strong {
    color: #3498db;
}

/* Анимация появления панели */
@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-15px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ===== СТИЛИ ДЛЯ РАЗНЫХ ТИПОВ БЛОКОВ ===== */
.text-block {
    transition: all 0.2s ease;
}

.text-block:hover {
    background: rgba(52, 152, 219, 0.2) !important;
    border-color: #3498db !important;
    z-index: 9;
}

.real-text-block {
    transition: all 0.3s ease;
}

.real-text-block:hover {
    background: rgba(52, 152, 219, 0.2) !important;
    border-color: #3498db !important;
    z-index: 9;
    transform: scale(1.02);
}

.text-block-debug {
    transition: all 0.3s ease;
}

.text-block-debug:hover {
    background: rgba(52, 152, 219, 0.3) !important;
    border-color: #3498db !important;
    z-index: 10;
    transform: scale(1.02);
}

/* ===== СООБЩЕНИЯ ОБ ОШИБКАХ ===== */
.pdf-parser-error {
    background: #e74c3c;
    color: white;
    padding: 20px;
    border-radius: 4px;
    text-align: center;
    margin: 10px 0;
    border: 1px solid #c0392b;
}

/* ===== АДАПТИВНОСТЬ ===== */
@media (max-width: 768px) {
    .pdf-toolbar {
        padding: 6px 8px;
        font-size: 12px;
        flex-wrap: wrap;
        gap: 8px;
    }
    
    .toolbar-btn {
        width: 28px;
        height: 24px;
        font-size: 12px;
    }
    
    .zoom-level {
        padding: 0 8px;
        min-width: 50px;
    }
    
    .page-navigation {
        padding: 0 6px;
    }
    
    .page-input {
        width: 35px;
        font-size: 11px;
    }
    
    .toolbar-status {
        order: 1;
        width: 100%;
        text-align: center;
        margin: 5px 0 0 0;
        padding: 0;
    }
    
    .pdf-viewer {
        flex-direction: column;
        height: calc(100% - 80px);
    }
    
    .pdf-sidebar {
        width: 100%;
        border-left: none;
        border-top: 1px solid #404040;
        max-height: 200px;
    }
    
    .pdf-text-panel {
        margin-top: 15px;
        padding: 15px;
    }
    
    .selected-text-output {
        height: 100px;
        font-size: 13px;
    }
}

/* ===== УТИЛИТЫ ===== */
.hidden {
    display: none !important;
}

.text-center {
    text-align: center;
}

.text-muted {
    color: #7f8c8d;
}