/* /www/wwwroot/razguliay33.ru/admin_styles.css - ПОЛНАЯ ВЕРСИЯ */

/* ===== БАЗОВЫЕ СТИЛИ ===== */

body { 
    font-family: Arial, sans-serif; 
    background: #f5f5f5; 
    color: #333; 
    line-height: 1.0; 
}

/* ===== ШАПКА РЕДАКТОРА ===== */
.header { 
    background: #2c3e50; 
    color: white; 
    padding: 1rem; 
    display: flex; 
    justify-content: space-between; 
    align-items: center; 
}

.header h1 {
    margin: 0;
    font-size: 24px;
}

.header-actions { 
    display: flex; 
    gap: 0.5rem; 
}

/* ===== ОСНОВНЫЕ КНОПКИ ===== */
.btn { 
    background: #3498db; 
    color: white; 
    border: none; 
    padding: 0.5rem 1rem; 
    border-radius: 4px; 
    cursor: pointer; 
    text-decoration: none; 
    display: inline-block; 
}

.btn:hover { 
    background: #2980b9; 
}

.btn-success { 
    background: #27ae60; 
}

.btn-success:hover { 
    background: #219a52; 
}

/* ===== ОСНОВНОЙ КОНТЕЙНЕР ===== */
.container { 
    max-width: 1200px; 
    margin: 2rem auto; 
    padding: 0 1rem; 
}

/* ===== СООБЩЕНИЯ ===== */
.message { 
    padding: 1rem; 
    margin: 1rem 0; 
    border-radius: 4px; 
}

.message.success { 
    background: #d4edda; 
    color: #155724; 
    border: 1px solid #c3e6cb; 
}

.message.error { 
    background: #f8d7da; 
    color: #721c24; 
    border: 1px solid #f5c6cb; 
}

/* ===== ОТЛАДОЧНАЯ ИНФОРМАЦИЯ ===== */
.debug-info { 
    background: #e3f2fd; 
    padding: 12px; 
    margin: 15px 0; 
    border-radius: 5px; 
    border: 1px solid #90caf9; 
    font-size: 14px; 
}

/* ===== ФОРМА ДОБАВЛЕНИЯ ===== */
.add-form { 
    background: white; 
    padding: 1.5rem; 
    margin: 1rem 0; 
    border-radius: 8px; 
    box-shadow: 0 2px 4px rgba(0,0,0,0.1); 
}

.add-form form {
    display: flex;
    gap: 10px;
    align-items: center;
}

.form-input { 
    padding: 0.5rem; 
    border: 1px solid #ddd; 
    border-radius: 4px; 
    margin-right: 0.5rem; 
    width: 300px; 
}

.form-input:focus {
    border-color: #3498db;
    outline: none;
    box-shadow: 0 0 0 2px rgba(52, 152, 219, 0.2);
}

/* ===== ДЕРЕВО МЕНЮ ===== */
.menu-tree { 
    background: white; 
    border-radius: 8px; 
    padding: 1rem; 
    box-shadow: 0 2px 4px rgba(0,0,0,0.1); 
}

.menu-item { 
    border: 1px solid #e0e0e0; 
    border-radius: 6px; 
    margin: 0.5rem 0; 
    padding: 1rem; 
    transition: all 0.2s ease;
}

.menu-item:hover {
    background: #e9ecef;
    border-color: #ced4da;
}

.menu-item.level-1 { 
    margin-left: 0; 
    background: #f8f9fa; 
}

.menu-item.level-2 { 
    margin-left: 2rem; 
    background: #ffffff; 
}

.menu-item.level-3 { 
    margin-left: 4rem; 
    background: #fafafa; 
}

.item-content { 
    display: flex; 
    justify-content: space-between; 
    align-items: center; 
    margin-bottom: 0.5rem; 
}

.item-title { 
    font-weight: bold; 
    font-size: 1.1rem; 
    color: #2c3e50;
}

.item-url { 
    color: #666; 
    font-size: 0.9rem; 
    margin-left: 1rem; 
    font-family: monospace;
    background: #f1f1f1;
    padding: 4px 8px;
    border-radius: 3px;
    border: 1px solid #ddd;
}

/* ===== КНОПКИ РЕДАКТОРА МЕНЮ (25x25px) ===== */
.item-actions { 
    display: flex; 
    gap: 0.25rem; 
    flex-wrap: wrap; 
}

.item-actions button { 
    width: 25px;
    height: 25px;
    border: none; 
    border-radius: 3px; 
    cursor: pointer; 
    font-size: 0.8rem; 
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
}

.item-actions button:hover { 
    opacity: 0.8; 
    transform: translateY(-1px);
}

.item-actions button:disabled { 
    opacity: 0.5; 
    cursor: not-allowed; 
}

/* Цвета кнопок */
.item-actions button:nth-child(1) { background: #3498db; } /* ➕ */
.item-actions button:nth-child(2) { background: #8e44ad; } /* ⬆️ */
.item-actions button:nth-child(3) { background: #9b59b6; } /* ⬇️ */
.item-actions button:nth-child(4) { background: #f39c12; } /* ✏️ */
.item-actions button:nth-child(5) { background: #27ae60; } /* 💾 */
.item-actions button:nth-child(6) { background: #e67e22; } /* 📁 */
.item-actions button:nth-child(7) { background: #e74c3c; } /* 🗑️ */

.item-children { 
    margin-top: 1rem; 
    border-left: 3px solid #bdc3c7; 
    padding-left: 1rem; 
}

/* ===== ФАЙЛОВЫЙ МЕНЕДЖЕР ===== */
.modal-overlay { 
    position: fixed; 
    top: 0; 
    left: 0; 
    width: 100%; 
    height: 100%; 
    background: rgba(0,0,0,0.5); 
    display: none; 
    z-index: 1000; 
    align-items: center; 
    justify-content: center;
}

.modal-content { 
    background: white; 
    width: 95%; 
    height: 90%; 
    border-radius: 10px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.3); 
    display: flex; 
    flex-direction: column;
}

.modal-header { 
    background: #2c3e50; 
    color: white; 
    padding: 1rem 1.5rem; 
    display: flex; 
    justify-content: space-between; 
    align-items: center;
    border-radius: 10px 10px 0 0;
}

.modal-title {
    display: flex;
    align-items: center;
    gap: 10px;
}

.close-modal { 
    background: none; 
    border: none; 
    color: white; 
    font-size: 1.5rem; 
    cursor: pointer; 
    padding: 0; 
    width: 30px; 
    height: 30px;
}

.file-manager-layout { 
    display: flex; 
    flex: 1; 
    overflow: hidden;
    height: 600px;
}

.upload-section { 
    flex: 1; 
    display: flex; 
    flex-direction: column; 
    border-right: 1px solid #ddd;
}

.preview-section { 
    flex: 1; 
    display: flex; 
    flex-direction: column;
    min-height: 500px;
}

.file-upload-area { 
    border: 2px dashed #ccc; 
    padding: 40px; 
    text-align: center; 
    margin: 15px;
    cursor: pointer; 
    transition: all 0.3s; 
    border-radius: 5px;
}

.file-upload-area:hover { 
    border-color: #5ba2b8; 
    background: #f8f9fa;
}

.file-upload-area.dragover { 
    border-color: #27ae60; 
    background: #f8fff8;
}

.upload-icon { 
    font-size: 48px; 
    margin-bottom: 10px; 
}

.upload-text {
    font-weight: 600;
    margin-bottom: 5px;
}

.upload-hint {
    font-size: 12px;
    color: #666;
}

.file-list-container { 
    flex: 1; 
    display: flex; 
    flex-direction: column; 
}

.file-list-header { 
    background: #f8f9fa; 
    padding: 12px 15px; 
    border-bottom: 1px solid #ddd;
    display: flex; 
    justify-content: space-between; 
    align-items: center;
}

.header-actions {
    display: flex;
    gap: 6px;
}

.header-btn, .refresh-button {
    width: 32px;
    height: 32px;
    background: #9b59b6;
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
}

.header-btn:hover, .refresh-button:hover {
    opacity: 0.9;
    transform: scale(1.05);
}

.refresh-button {
    background: #27ae60;
}

.file-list { 
    flex: 1; 
    overflow-y: auto; 
    padding: 10px; 
}

.file-item-list { 
    display: flex; 
    justify-content: space-between; 
    padding: 10px;
    border-bottom: 1px solid #eee; 
    cursor: pointer; 
    align-items: center;
}

.file-item-list:hover { 
    background: #f0f8ff; 
}

.file-item-list.active { 
    background: #e3f2fd; 
}

.file-item-list.folder {
    background: #fff3e0;
}

.file-item-list.folder:hover {
    background: #ffe0b2;
}

.file-info {
    display: flex;
    align-items: center;
    gap: 10px;
    flex: 1;
}

.file-name {
    font-weight: 500;
    flex: 1;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.file-size, .file-modified {
    color: #666;
    font-size: 11px;
    min-width: 70px;
    text-align: right;
}

.file-actions {
    display: flex;
    gap: 5px;
    align-items: center;
}

/* ===== УНИВЕРСАЛЬНЫЙ ПРОСМОТР ФАЙЛОВ ===== */
.preview-container { 
    flex: 1;
    border: 1px solid #ddd;
    border-radius: 6px;
    background: #fafafa;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    min-height: 400px;
}

#filePreview {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 350px;
}

.preview-placeholder { 
    text-align: center; 
    padding: 60px 20px; 
    color: #666;
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    min-height: 350px;
}

.placeholder-icon { 
    font-size: 48px; 
    margin-bottom: 15px; 
    opacity: 0.5;
}

.preview-header {
    padding: 15px;
    border-bottom: 1px solid #ddd;
    background: white;
    flex-shrink: 0;
}

.preview-header h3 {
    margin: 0;
    font-size: 16px;
}

.file-path {
    font-size: 12px;
    color: #666;
    margin-top: 5px;
}

/* Универсальный контейнер контента */
.preview-content-container {
    flex: 1;
    display: flex;
    flex-direction: column;
    background: white;
    min-height: 250px;
}

.file-preview-iframe {
    width: 100%;
    height: 100%;
    border: none;
    flex: 1;
    min-height: 250px;
}

.iframe-preview-container {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 250px;
}

/* ===== ТЕКСТОВЫЙ РЕДАКТОР ===== */
.text-editor-container {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 250px;
}

#inlineTextEditor {
    width: 100%;
    height: calc(100vh - 350px) !important;
    min-height: 250px;
    max-height: 70vh;
    resize: vertical;
    font-family: 'Courier New', monospace;
    font-size: 14px;
    line-height: 1.4;
    padding: 15px;
    border: 1px solid #ccc;
    border-radius: 6px;
    background: #fafafa;
    flex: 1;
}

#inlineTextEditor:focus {
    background: white;
    outline: none;
}

.editor-status {
    margin-top: 10px;
    padding: 8px 12px;
    background: #f8f9fa;
    border-radius: 4px;
    font-size: 12px;
    color: #666;
    border: 1px solid #e9ecef;
    flex-shrink: 0;
}

/* ===== КНОПКИ ПРОСМОТРА ===== */
.preview-actions {
    padding: 15px;
    border-top: 1px solid #eee;
    background: white;
    display: flex;
    gap: 10px;
    justify-content: center;
    flex-wrap: wrap;
    flex-shrink: 0;
}

.preview-action-btn {
    padding: 8px 16px;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
    background: #3498db;
    color: white;
    transition: all 0.2s ease;
}

.preview-action-btn:hover {
    opacity: 0.9;
    transform: translateY(-1px);
}

.preview-action-btn:last-child {
    background: #27ae60;
}

.loading-preview {
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    color: #666;
    min-height: 350px;
}

.loading-spinner {
    font-size: 24px;
    margin-bottom: 10px;
}

/* ===== СТИЛИ ДЛЯ СГЕНЕРИРОВАННЫХ СТРАНИЦ ===== */

/* Хлебные крошки */
.breadcrumbs {
    margin: 20px 0;
    font-size: 14px;
    color: #666;
    border-bottom: 1px solid #eee;
    padding-bottom: 15px;
}

.breadcrumbs a {
    color: #796602;
    text-decoration: none;
}

.breadcrumbs a:hover {
    text-decoration: underline;
}

/* Списки файлов */
.file-list {
    list-style: none;
    padding: 0;
}

.file-list li {
    margin: 8px 0;
    padding: 8px 12px;
    background: #dceff3;
    border-radius: 4px;
    border-left: 3px solid #477899;
}

.file-list a {
    color: #003f53;
    text-decoration: none;
    font-weight: 500;
}

.file-list a:hover {
    text-decoration: underline;
    color: #002a38;
}

/* PDF фрейм */
.pdf-frame {
    width: 100%;
    height: 1400px;
    border: 2px solid #405668;
    border-radius: 8px;
    margin: 20px 0;
    display: none; /* Показывается через JS при клике на PDF */
}

/* ===== PDF.JS VIEWER STYLES ===== */

/* Основной контейнер для PDF viewer */
.pdfjs-viewer-container {
    width: 100%;
    height: 1400px;
    border: 2px solid #405668;
    border-radius: 8px;
    margin: 20px 0;
    background: #f8f9fa;
    display: none; /* Показывается через JS */
}

/* Стили для внутренних элементов PDF.js */
.pdfjs-viewer-container .pdfViewer .page {
    margin: 10px auto;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
    border: 1px solid #dee2e6;
}

.pdfjs-viewer-container .pdfViewer .canvasWrapper {
    overflow: visible;
}

.pdfjs-viewer-container .toolbar {
    padding: 12px;
    background: #2c3e50;
    border-bottom: 1px solid #34495e;
    display: flex;
    gap: 8px;
    align-items: center;
    flex-wrap: wrap;
}

.pdfjs-viewer-container .toolbarButton {
    min-width: 44px;
    height: 44px;
    background: #3498db;
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
    transition: all 0.2s ease;
}

.pdfjs-viewer-container .toolbarButton:hover {
    background: #2980b9;
    transform: translateY(-1px);
}

.pdfjs-viewer-container .textLayer {
    transform-origin: 0 0;
}

/* ===== АДАПТИВНОСТЬ ===== */
@media (max-width: 767px) {
    .header {
        flex-direction: column;
        gap: 15px;
        text-align: center;
    }
    
    .header-actions {
        width: 100%;
        justify-content: center;
    }
    
    .add-form form {
        flex-direction: column;
    }
    
    .form-input {
        width: 100%;
        margin-right: 0;
        margin-bottom: 10px;
    }
    
    .item-content {
        flex-direction: column;
        align-items: flex-start;
        gap: 10px;
    }
    
    .item-actions {
        width: 100%;
        justify-content: center;
    }
    
    .file-manager-layout {
        flex-direction: column;
        height: auto;
    }
    
    .upload-section, .preview-section {
        flex: none;
        min-height: 400px;
    }
    
    .menu-item.level-2 { margin-left: 1rem; }
    .menu-item.level-3 { margin-left: 2rem; }
    
    /* Адаптивность для сгенерированных страниц */
    .breadcrumbs {
        font-size: 12px;
        padding: 10px 0;
    }
    
    .file-list li {
        padding: 6px 10px;
        font-size: 14px;
    }
    
    /* АДАПТИВНЫЕ ТАБЛИЦЫ ДЛЯ ВСЕХ ТАБЛИЦ */
    /* ИСПРАВЛЕННЫЕ АДАПТИВНЫЕ ТАБЛИЦЫ */
    table {
        display: block !important;
        width: 100% !important;
        border: none !important;
        background: transparent !important;
    }
    
    table thead {
        display: none !important;
    }
    
    table tr {
        display: block !important;
        margin-bottom: 10px !important;
        border: 1px solid #ddd !important;
        border-radius: 6px !important;
        padding: 8px !important;
        background: transparent !important;
    }
    
    table td,
    table th {
        display: block !important;
        width: 100% !important;
        box-sizing: border-box !important;
        text-align: left !important;
        padding: 8px 6px !important;
        border: none !important;
        border-bottom: 1px solid #e0e0e0 !important;
        font-size: 13px !important;
        line-height: 1.3 !important;
        background: transparent !important;
        height: auto !important;
        min-height: auto !important;
        white-space: normal !important;
        overflow: visible !important;
    }
    
    table td:last-child,
    table th:last-child {
        border-bottom: none !important;
    }
    
    /* ПСЕВДО-ЗАГОЛОВКИ ДЛЯ ЯЧЕЕК */
 /*   table td::before,
    table th::before {
        content: attr(data-label);
        font-weight: bold;
        color: #333;
        background: #ecf0f1;
        padding: 4px 8px;
        border-radius: 4px;
        margin-right: 10px;
        min-width: 80px;
        text-align: left;
        font-size: 12px;
        display: inline-block;
        float: left;
        margin-bottom: 5px;
    }*/
    
    table td[width],
    table th[width] {
        width: 100% !important;
    }
    
    table td[style*="text-align:center"],
    table td[style*="text-align:right"],
    table th[style*="text-align:center"],
    table th[style*="text-align:right"] {
        text-align: left !important;
    }
    
    /* Фрейм скрыт для мобильных - используется PDF.js viewer */
    .pdf-frame {
        display: none !important;
        height: 500px;
    }
    
    /* PDF.js viewer для мобильных */
    .pdfjs-viewer-container {
        display: block !important;
        height: 600px;
    }
    
    /* Убираем левый блок навигации в PDF.js для мобильных */
    .pdfjs-viewer-container .secondaryToolbar,
    .pdfjs-viewer-container .sidebar,
    .pdfjs-viewer-container .toolbarSidebar {
        display: none !important;
    }
    
    /* ДЕТАЛЬНЫЕ НАСТРОЙКИ PDF.JS ДЛЯ МОБИЛЬНЫХ */
    .pdfjs-viewer-container .pdfViewer .page {
        margin: 5px auto;
        box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    }
    
    .pdfjs-viewer-container .toolbar {
        padding: 8px;
        gap: 4px;
    }
    
    .pdfjs-viewer-container .toolbarButton {
        min-width: 35px;
        height: 35px;
        font-size: 11px;
    }
    
    .pdfjs-viewer-container .textLayer {
        transform: scale(0.7);
    }
}


/* 🔥 СТИЛИ ДЛЯ ВЫДЕЛЕНИЯ И ЧЕКБОКСОВ В ФАЙЛОВОМ МЕНЕДЖЕРЕ */

.file-checkbox {
    margin-right: 8px;
    width: 16px;
    height: 16px;
    cursor: pointer;
    flex-shrink: 0;
}

.file-item-list.selected {
    background: #e3f2fd !important;
    border: 2px solid #2196f3 !important;
}

.file-item-list.selected.folder {
    background: #fff3e0 !important;
    border: 2px solid #ff9800 !important;
}

/* 🔥 КОМПАКТНЫЕ КНОПКИ ЗАГОЛОВКА ФАЙЛОВОГО МЕНЕДЖЕРА */

.file-list-header .header-actions {
    display: flex;
    gap: 6px;
    align-items: center;
}

.file-list-header .header-btn {
    width: 32px;
    height: 32px;
    background: #9b59b6;
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    padding: 0;
}

.file-list-header .header-btn:hover {
    opacity: 0.9;
    transform: scale(1.05);
}

.file-list-header .header-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
}

.file-list-header .header-btn:disabled:hover {
    opacity: 0.5;
    transform: none;
}

/* 🔥 ЦВЕТА ДЛЯ РАЗНЫХ ТИПОВ КНОПОК */
.file-list-header .header-btn.select-all {
    background: #3498db;
}

.file-list-header .header-btn.clear-selection {
    background: #95a5a6;
}

.file-list-header .header-btn.copy-action {
    background: #9b59b6;
}

.file-list-header .header-btn.paste-action {
    background: #27ae60;
}

.file-list-header .header-btn.delete-selected {
    background: #e74c3c;
}

.file-list-header .refresh-button {
    background: #f39c12;
    width: 32px;
    height: 32px;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
}

.file-list-header .refresh-button:hover {
    background: #e67e22;
    transform: scale(1.05);
}

/* 🔥 ПОДСКАЗКИ ДЛЯ КНОПОК */
.file-list-header .header-btn[title],
.file-list-header .refresh-button[title] {
    position: relative;
}

.file-list-header .header-btn[title]:hover::after,
.file-list-header .refresh-button[title]:hover::after {
    content: attr(title);
    position: absolute;
    bottom: -35px;
    left: 50%;
    transform: translateX(-50%);
    background: #2c3e50;
    color: white;
    padding: 5px 10px;
    border-radius: 4px;
    font-size: 12px;
    white-space: nowrap;
    z-index: 1000;
    pointer-events: none;
}