/* editor.css — стили только для редактора */

.editor-shell {
    max-width: 980px;
    margin: 0 auto;
    background: #ffffff;
    padding: 16px;
    border-radius: 10px;
    box-shadow: 0 6px 18px rgba(2, 6, 23, 0.06);
    font-family: Inter, system-ui, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

/* Панель инструментов */
.editor-shell .toolbar {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    align-items: center;
    margin-bottom: 10px;
}

/* Кнопки */
.editor-shell .btn {
    border: 1px solid #e6e9ee;
    background: #fff;
    padding: 6px 10px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 14px;
    user-select: none;
    transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}

.editor-shell .btn:hover {
    background: #f3f4f6;
}

.editor-shell .btn:active {
    transform: translateY(1px);
}

.editor-shell .btn.active {
    background: #2563eb;
    color: #fff;
    border-color: #2563eb;
}

/* Выпадающие списки */
.editor-shell select,
.editor-shell .select {
    padding: 6px;
    border-radius: 6px;
    border: 1px solid #e6e9ee;
    font-size: 14px;
    background: #fff;
}

/* Область редактирования */
.editor-shell .editor-area {
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    padding: 0; /* keep padding inside .editor */
    min-height: 240px;
    background: #fff;
    transition: border-color 0.15s ease;
}

.editor-shell .editor-area:hover {
    border-color: #cbd5e1;
}

/* Сам редактор */
.editor-shell .editor {
    min-height: 180px;
    outline: none;
    padding: 8px;
    border: none;
    background: transparent;
    max-width: 100%;
    box-sizing: border-box;
}

/* Ensure editor content wraps and does not create horizontal scroll */
.editor-shell,
.editor {
    max-width: 100%;
    box-sizing: border-box;
}

.editor,
.editor * {
    overflow-wrap: anywhere; /* aggressively break long words */
    word-break: break-word;
}

/* Small-screen adjustments */
@media (max-width: 600px) {
    .editor-shell { padding: 6px; }
    .editor { padding: 8px; min-height: 120px; }
}

/* Make editor fill its area with uniform padding and prevent overflow */

.editor-area {
    width: 100%;
    padding: 0; /* keep padding on .editor only */
    box-sizing: border-box;
}

.editor {
    display: block;
    width: 100%;
    padding: 12px;
    margin: 0;
    box-sizing: border-box;
    background: transparent;
    border: none;
}

/* Prevent common media from overflowing the editor area */
.editor img,
.editor video,
.editor table,
.editor pre,
.editor iframe {
    max-width: 100% !important;
    width: auto !important;
    height: auto !important;
    display: block;
}

.editor { white-space: normal; }

.editor > * {
    max-width: 100%;
    box-sizing: border-box;
}

.editor p { margin: 0 0 0.6rem 0; line-height: 1.45; }

/* Медиа-блоки */
.editor-shell .media-block {
    margin: 8px 0;
}

.editor-shell img,
.editor-shell video {
    max-width: 100%;
    height: auto;
    border-radius: 6px;
    display: block;
}

/* Статусная строка и мелкий текст */
.editor-shell .status {
    margin-left: auto;
    color: #6b7280;
    font-size: 13px;
}

.editor-shell .small {
    font-size: 13px;
    color: #6b7280;
}

/* Код и цитаты */
.editor-shell pre {
    background: #0f172a;
    color: #e6eef8;
    padding: 12px;
    border-radius: 6px;
    overflow: auto;
    font-family: Consolas, "Courier New", monospace;
    font-size: 14px;
}

.editor-shell blockquote {
    border-left: 4px solid #e2e8f0;
    padding: 8px 12px;
    background: #fbfdff;
    border-radius: 4px;
    margin: 10px 0;
}

/* Разделители */
.editor-shell hr {
    border: none;
    border-top: 1px solid #eef2f7;
    margin: 14px 0;
}

/* Панель управления */
.editor-shell .controls {
    display: flex;
    gap: 8px;
    margin-top: 12px;
}

/* Цветовые пикеры */
.editor-shell input[type="color"] {
    width: 30px;
    height: 30px;
    padding: 0;
    border: none;
    background: none;
    cursor: pointer;
}

/* Убираем любые контуры фокуса */
.editor-shell *:focus {
    outline: none;
    box-shadow: none;
}


.editor ul,
.editor ol {
    margin: 0 0 0.8rem 1.4rem; /* отступ слева для маркеров, безопасный */
    padding-left: 1.2rem; /* внутренняя indent для маркеров */
    max-width: 100%;
    box-sizing: border-box;
}

.editor li {
    margin: 0.3rem 0;
    word-wrap: break-word;
    overflow-wrap: anywhere;
}

/* Если внутри списка есть вложенные элементы — пусть тоже вписываются */
.editor ul ul,
.editor ol ol {
    margin-left: 1.2rem;
}