/* Стилі для редактора */

.editor-container {
    display: flex;
    gap: 20px;
    padding: 20px;
    height: calc(100vh - 80px);
}

.preview-pane {
    flex: 1;
    background: white;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
}

.edit-pane {
    width: 400px;
    background: white;
    border-radius: 12px;
    padding: 20px;
    overflow-y: auto;
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
}

.preview-frame {
    width: 100%;
    height: 100%;
    border: none;
}

/* Заголовки редактора */
.edit-pane > h3 {
    margin: 0 0 10px 0;
    color: var(--dark-color);
    display: flex;
    align-items: center;
    gap: 10px;
}

.edit-pane .subtitle {
    color: var(--gray-color);
    margin-bottom: 25px;
}

/* Файлова панель */
.file-panel {
    border: 1px solid #e1e5eb;
    border-radius: 12px;
    margin-bottom: 25px;
    overflow: hidden;
    background: #fff;
    box-shadow: 0 2px 6px rgba(0,0,0,0.05);
}

.file-search {
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 8px;
    margin: 10px 0;
}

.file-search-results {
    max-height: 200px;
    overflow-y: auto;
    border: 1px solid #e1e5eb;
    border-radius: 8px;
    padding: 6px;
    margin-bottom: 10px;
    background: #f8fafc;
}

.search-result-list {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.search-result-item {
    padding: 8px 10px;
    border-radius: 8px;
    background: #fff;
    border: 1px solid #e2e8f0;
    cursor: pointer;
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.search-result-item:hover {
    border-color: #94a3b8;
    box-shadow: 0 2px 6px rgba(0,0,0,0.06);
}

.search-result-item .path {
    font-weight: 700;
    color: #0f172a;
    font-size: 13px;
}

.search-result-item .snippet {
    margin-top: 4px;
    color: #475569;
    font-size: 12px;
    line-height: 1.4;
}

.search-result-item mark {
    background: #fef08a;
    padding: 0 2px;
}

.file-panel .section-header {
    background: linear-gradient(135deg, var(--light-color) 0%, #f8f9fa 100%);
    border-bottom: 1px solid #e1e5eb;
}

.file-panel .section-body {
    padding: 20px;
}

.file-panel .section-footer {
    background: #f8f9fa;
    border-top: 1px solid #e1e5eb;
    display: flex;
    gap: 10px;
    padding: 12px 20px;
}

.file-panel .section-footer .btn {
    flex: 1 1 0;
    min-width: 140px;
    text-align: center;
}

.file-controls {
    display: flex;
    gap: 10px;
    margin-bottom: 15px;
}

.file-controls select {
    flex: 1;
}

.file-tree {
    max-height: 240px;
    overflow: auto;
    border: 1px solid #e1e5eb;
    border-radius: 8px;
    padding: 10px;
    background: #fbfcfe;
    margin-bottom: 15px;
}

.file-tree ul {
    list-style: none;
    padding-left: 16px;
    margin: 0;
}

.file-tree li {
    margin: 4px 0;
    cursor: pointer;
    user-select: none;
}

.file-tree li .name {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 14px;
}

.file-tree li.folder > .name {
    font-weight: 600;
    color: #2c5282;
}

.file-tree li.file > .name {
    color: #2d3748;
}

.file-tree li.active > .name {
    background: #eaf3ff;
    border-radius: 4px;
    padding: 2px 6px;
}

.file-tree .toggle {
    font-size: 12px;
    color: #4a5568;
}

.code-editor,
.form-control.code-editor {
    font-family: 'JetBrains Mono', 'Fira Code', 'Courier New', monospace;
    min-height: 220px;
    resize: vertical;
    background: #1e1e1e;
    color: #e6e6e6;
    border: 1px solid #2d2d2d;
    line-height: 1.5;
    box-shadow: inset 0 0 0 1px rgba(255,255,255,0.02);
    padding: 14px 16px;
    font-size: 14px;
    border-radius: 10px;
}

.code-editor:disabled,
.form-control.code-editor:disabled {
    background: #f7f9fc;
    color: #1f2937;
    border-color: #d7deea;
    opacity: 1;
}

.code-editor::-webkit-scrollbar {
    width: 10px;
}
.code-editor::-webkit-scrollbar-track {
    background: #1a1a1a;
}
.code-editor::-webkit-scrollbar-thumb {
    background: #3a3a3a;
    border-radius: 6px;
}
.code-editor::-webkit-scrollbar-thumb:hover {
    background: #4a4a4a;
}

.file-meta {
    font-size: 12px;
    color: var(--gray-color);
    text-align: right;
}

/* Групи редагування */
.edit-group {
    background: #f8f9fa;
    border: 1px solid #e1e5eb;
    border-radius: 12px;
    margin-bottom: 20px;
    overflow: hidden;
    transition: all 0.3s;
}

.edit-group:hover {
    border-color: var(--primary-color);
    box-shadow: 0 2px 8px rgba(74, 144, 226, 0.1);
}

.edit-group.edit-group-active {
    border-color: var(--primary-color);
    box-shadow: 0 4px 12px rgba(74, 144, 226, 0.25);
    background: #eaf3ff;
}

/* Приховуємо панель блоків редагування */
#editForm {
    display: none;
}

.edit-group-header {
    padding: 15px 20px;
    background: linear-gradient(135deg, var(--light-color) 0%, #f8f9fa 100%);
    border-bottom: 1px solid #e1e5eb;
}

.edit-group-header h4 {
    margin: 0 0 5px 0;
    color: var(--dark-color);
    display: flex;
    align-items: center;
    gap: 10px;
}

.selector {
    color: var(--gray-color);
    font-family: monospace;
    font-size: 12px;
    word-break: break-all;
}

.edit-group-body {
    padding: 20px;
}

.form-control {
    width: 100%;
    padding: 12px 16px;
    border: 1px solid #e1e5eb;
    border-radius: 8px;
    font-size: 0.95rem;
    transition: all 0.3s;
    background: white;
}

.form-control:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(74, 144, 226, 0.1);
}

.form-control.edit-text {
    min-height: 80px;
    resize: vertical;
}

.form-control.edit-code {
    font-family: 'Courier New', monospace;
    font-size: 14px;
    line-height: 1.4;
}

.image-edit {
    text-align: center;
}

.image-preview {
    max-width: 100%;
    max-height: 150px;
    border-radius: 8px;
    margin-bottom: 10px;
    border: 1px solid #e1e5eb;
    background: white;
    padding: 5px;
}

.image-controls {
    display: flex;
    gap: 10px;
    margin-bottom: 10px;
}

.image-controls input {
    flex: 1;
}

.upload-image-btn {
    white-space: nowrap;
}

.edit-group-footer {
    padding: 15px 20px;
    background: #f8f9fa;
    border-top: 1px solid #e1e5eb;
    display: flex;
    gap: 12px;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
}

.edit-group-footer button {
    flex: 1 1 0;
    min-width: 140px;
    text-align: center;
}

.color-panel .color-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
    padding: 16px 20px;
}

.color-panel .color-field {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding: 10px 12px;
    border: 1px solid #e1e5eb;
    border-radius: 10px;
    background: #fff;
}

.color-panel .color-field span {
    font-weight: 600;
    color: var(--dark-color);
}

.color-panel input[type="color"] {
    width: 48px;
    height: 32px;
    border: none;
    padding: 0;
    background: transparent;
    cursor: pointer;
}

.form-actions {
    margin-top: 25px;
    padding-top: 20px;
    border-top: 1px solid #e1e5eb;
}

.btn-block {
    display: block;
    width: 100%;
    text-align: center;
    margin-bottom: 10px;
}

.btn-sm {
    padding: 8px 16px;
    font-size: 0.9rem;
}

/* Поля для завантаження */
.upload-area {
    border: 2px dashed #cbd5e0;
    border-radius: 12px;
    padding: 40px 20px;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s;
    background: #f8fafc;
}

.upload-area:hover {
    border-color: var(--primary-color);
    background: #f0f7ff;
}

.upload-area.dragover {
    border-color: var(--primary-color);
    background: #e6f0ff;
}

.upload-area i {
    font-size: 48px;
    color: var(--primary-color);
    margin-bottom: 15px;
}

.upload-area p {
    margin: 10px 0 5px 0;
    font-weight: 500;
}

.upload-area small {
    color: var(--gray-color);
}

/* Код нотатки */
.code-note {
    display: block;
    color: var(--gray-color);
    font-size: 12px;
    margin-top: 5px;
}

/* Сповіщення */
.notification {
    position: fixed;
    bottom: 20px;
    right: 20px;
    padding: 15px 25px;
    background: var(--primary-color);
    color: white;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
    z-index: 1000;
    max-width: 400px;
    display: none;
    animation: slideInRight 0.3s;
}

@keyframes slideInRight {
    from {
        transform: translateX(100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

/* Додаткові утиліти */
.mt-2 {
    margin-top: 10px;
}

.mb-2 {
    margin-bottom: 10px;
}

/* Адаптивність */
@media (max-width: 1200px) {
    .editor-container {
        flex-direction: column;
        height: auto;
    }
    
    .edit-pane {
        width: 100%;
        order: -1;
    }
    
    .preview-pane {
        height: 500px;
    }
}