.cs-editor-container {
    max-width: 1400px;
    margin: 24px auto;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    color: #333;
}
.cs-editor-container h3 {
    color: #0073aa;
    margin-top: 0;
    margin-bottom: 8px;
}
.cs-editor-container > p {
    color: #555;
    line-height: 1.5;
    margin-bottom: 20px;
    font-size: 15px;
}

/* Wrapper — две колонки на десктопе */
.cs-editor-wrapper {
   
    grid-template-columns: 1fr 1fr;
    gap: 16px;
    align-items: stretch;
}

/* Панели */
.cs-editor-pane {
    border: 1px solid #e1e1e1;
    border-radius: 8px;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    background: #fff;
    box-shadow: 0 1px 4px rgba(0,0,0,0.06);
}

/* Тулбар */
.cs-editor-toolbar {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    padding: 8px 10px;
    background: #f5f5f5;
    border-bottom: 1px solid #e1e1e1;
    align-items: center;
    min-height: 46px;
}
.cs-editor-code-toolbar {
    justify-content: space-between;
}

.cs-editor-tb-group {
    display: flex;
    gap: 2px;
    align-items: center;
    padding-right: 6px;
    border-right: 1px solid #ddd;
    margin-right: 2px;
}
.cs-editor-tb-group:last-child {
    border-right: none;
}

.cs-editor-btn {
    min-width: 34px;
    height: 34px;
    padding: 4px 8px;
    border: 1px solid transparent;
    border-radius: 4px;
    background: transparent;
    cursor: pointer;
    font-size: 15px;
    color: #333;
    transition: background 0.15s, border-color 0.15s;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    white-space: nowrap;
}
.cs-editor-btn:hover {
    background: #e0e0e0;
    border-color: #ccc;
}
.cs-editor-btn:active {
    background: #d0d0d0;
}

.cs-editor-select {
    height: 34px;
    padding: 4px 8px;
    border: 1px solid #ccc;
    border-radius: 4px;
    font-size: 14px;
    cursor: pointer;
    background: #fff;
}

/* Color picker */
.cs-editor-color-wrap {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 34px;
    height: 34px;
    border-radius: 4px;
    cursor: pointer;
    position: relative;
    transition: background 0.15s;
}
.cs-editor-color-wrap:hover {
    background: #e0e0e0;
}
.cs-editor-color-wrap input[type="color"] {
    position: absolute;
    width: 100%;
    height: 100%;
    opacity: 0;
    cursor: pointer;
    top: 0;
    left: 0;
}
.cs-editor-color-icon {
    font-weight: bold;
    font-size: 16px;
    color: #333;
    pointer-events: none;
}
.cs-editor-color-icon-bg {
    font-size: 14px;
    pointer-events: none;
}

.cs-editor-label {
    font-weight: 600;
    font-size: 14px;
    color: #555;
    padding: 0 4px;
}

/* Область редактирования */
#cs-editor-content {
    flex: 1;
    min-height: 420px;
    max-height: 600px;
    overflow-y: auto;
    padding: 20px;
    font-size: 15px;
    line-height: 1.6;
    outline: none;
    background: #fff;
}
#cs-editor-content:focus {
    box-shadow: inset 0 0 0 2px rgba(0,115,170,0.15);
}
#cs-editor-content h1 { font-size: 1.8em; margin: 0.6em 0 0.4em; }
#cs-editor-content h2 { font-size: 1.5em; margin: 0.6em 0 0.4em; }
#cs-editor-content h3 { font-size: 1.25em; margin: 0.6em 0 0.4em; }
#cs-editor-content h4 { font-size: 1.1em; margin: 0.6em 0 0.4em; }
#cs-editor-content p { margin: 0.5em 0; }
#cs-editor-content ul, #cs-editor-content ol { padding-left: 24px; margin: 0.5em 0; }
#cs-editor-content blockquote {
    border-left: 4px solid #0073aa;
    margin: 0.8em 0;
    padding: 6px 16px;
    background: #f9f9f9;
    color: #555;
    font-style: italic;
}
#cs-editor-content pre {
    background: #1e1e1e;
    color: #d4d4d4;
    padding: 12px;
    border-radius: 4px;
    overflow-x: auto;
    font-family: monospace;
    font-size: 14px;
}
#cs-editor-content a { color: #0073aa; }
#cs-editor-content img { max-width: 100%; height: auto; border-radius: 4px; }

/* Вывод кода */
#cs-editor-output {
    flex: 1;
    min-height: 420px;
    max-height: 600px;
    padding: 16px;
    border: none;
    border-top: 1px solid #e1e1e1;
    font-family: "Cascadia Code", "Fira Code", "Consolas", monospace;
    font-size: 13px;
    line-height: 1.5;
    resize: none;
    background: #1e1e1e;
    color: #d4d4d4;
    outline: none;
    white-space: pre-wrap;
    word-break: break-word;
}

/* Модалки */
.cs-editor-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.5);
    z-index: 100000;
    display: flex;
    align-items: center;
    justify-content: center;
}
.cs-editor-modal-content {
    background: #fff;
    border-radius: 8px;
    padding: 24px;
    width: 90%;
    max-width: 420px;
    box-shadow: 0 8px 32px rgba(0,0,0,0.2);
}
.cs-editor-modal-content h4 {
    margin: 0 0 16px;
    color: #0073aa;
    font-size: 18px;
}
.cs-editor-modal-field {
    margin-bottom: 14px;
}
.cs-editor-modal-field label {
    display: block;
    font-weight: 600;
    font-size: 14px;
    margin-bottom: 4px;
    color: #333;
}
.cs-editor-modal-field input[type="url"],
.cs-editor-modal-field input[type="text"] {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid #ccc;
    border-radius: 4px;
    font-size: 14px;
    box-sizing: border-box;
}
.cs-editor-modal-field input[type="checkbox"] {
    margin-right: 6px;
}
/* Инлайн-ошибка валидации URL в модалке */
.cs-editor-modal-error {
    margin: 0 0 12px;
    padding: 8px 10px;
    border-radius: 4px;
    background: #fdecea;
    border: 1px solid #f5c2c0;
    color: #b3261e;
    font-size: 14px;
    line-height: 1.4;
}
.cs-editor-modal-error[hidden] {
    display: none;
}
.cs-editor-modal-actions {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    margin-top: 20px;
}
.cs-editor-modal-actions .cs-editor-btn {
    padding: 10px 20px;
    background: #0073aa;
    color: #fff;
    font-size: 14px;
    font-weight: 600;
}
.cs-editor-modal-actions .cs-editor-btn:hover {
    background: #005a87;
}
.cs-editor-modal-cancel {
    background: #e0e0e0 !important;
    color: #333 !important;
}
.cs-editor-modal-cancel:hover {
    background: #d0d0d0 !important;
}

/* Адаптив */
@media (max-width: 900px) {
    .cs-editor-wrapper {
        grid-template-columns: 1fr;
    }
    #cs-editor-content,
    #cs-editor-output {
        min-height: 300px;
    }
    .cs-editor-toolbar {
        gap: 2px;
    }
    .cs-editor-btn {
        min-width: 30px;
        height: 30px;
        font-size: 13px;
        padding: 2px 6px;
    }
    .cs-editor-tb-group {
        padding-right: 4px;
    }
}
@media (max-width: 500px) {
    .cs-editor-tb-group {
        border-right: none;
        margin-right: 0;
        padding-right: 0;
    }
}
