/* ============================================================
   text-editor.css — стили страницы редактора текста
   Подключается только на странице с шаблоном "Редактор текста"
   ============================================================ */

/* ── Reset & base ─────────────────────────────────────────── */
*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

.te-body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    font-size: 15px;
    line-height: 1.6;
    background: #f4f5f7;
    color: #2c2c2c;
    min-height: 100vh;
}

/* ── Доступ закрыт ────────────────────────────────────────── */
.te-access-denied {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    padding: 24px;
}

.te-access-box {
    background: #fff;
    border-radius: 12px;
    padding: 48px 40px;
    text-align: center;
    max-width: 420px;
    box-shadow: 0 4px 24px rgba(0,0,0,.08);
}

.te-access-box h1 {
    font-size: 22px;
    margin-bottom: 12px;
    color: #1a1a1a;
}

.te-access-box p {
    color: #555;
    margin-bottom: 24px;
}

/* ── Обёртка ──────────────────────────────────────────────── */
.te-wrapper {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px 48px;
}

/* ── Шапка ────────────────────────────────────────────────── */
.te-header {
    background: #fff;
    border-bottom: 1px solid #e2e4e8;
    margin: 0 -20px 28px;
    padding: 0 20px;
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: 0 2px 8px rgba(0,0,0,.05);
}

.te-header-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    height: 60px;
}

.te-heading {
    font-size: 17px;
    font-weight: 600;
    color: #1a1a1a;
}

.te-link-site {
    font-size: 13px;
    color: #555;
    text-decoration: none;
    white-space: nowrap;
}

.te-link-site:hover {
    color: #000;
    text-decoration: underline;
}

/* ── Уведомления ──────────────────────────────────────────── */
.te-notice {
    border-radius: 8px;
    padding: 12px 18px;
    font-size: 14px;
    font-weight: 500;
    margin-bottom: 20px;
}

.te-notice--success {
    background: #e6f7ee;
    color: #1a7a3c;
    border: 1px solid #a8e0bc;
}

.te-notice--error {
    background: #fff0f0;
    color: #b91c1c;
    border: 1px solid #fca5a5;
}

/* ── Двухколоночная сетка ─────────────────────────────────── */
.te-main {
    display: grid;
    grid-template-columns: 1fr 400px;
    gap: 28px;
    align-items: start;
}

@media (max-width: 860px) {
    .te-main {
        grid-template-columns: 1fr;
    }
}

/* ── Форма ────────────────────────────────────────────────── */
.te-form-col {
    background: #fff;
    border-radius: 12px;
    padding: 28px;
    box-shadow: 0 2px 12px rgba(0,0,0,.06);
}

/* ── Счётчик символов ─────────────────────────────────────── */
.te-counter-bar {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 13px;
    color: #555;
    background: #f8f9fa;
    border: 1px solid #e2e4e8;
    border-radius: 8px;
    padding: 10px 14px;
    margin-bottom: 22px;
    flex-wrap: wrap;
}

.te-counter-bar strong {
    font-size: 16px;
    color: #1a1a1a;
    font-weight: 700;
    transition: color .2s;
}

.te-over-limit {
    color: #b91c1c;
    font-weight: 600;
}

/* Когда превышен лимит — весь счётчик краснеет */
.te-counter-bar.te-over {
    background: #fff0f0;
    border-color: #fca5a5;
}

.te-counter-bar.te-over strong {
    color: #b91c1c;
}

/* ── Поля ─────────────────────────────────────────────────── */
.te-field-group {
    margin-bottom: 22px;
}

.te-label {
    display: block;
    font-size: 13px;
    font-weight: 600;
    color: #444;
    margin-bottom: 6px;
    text-transform: uppercase;
    letter-spacing: .04em;
}

.te-hint {
    font-size: 12px;
    color: #888;
    margin-bottom: 10px;
}

.te-input,
.te-textarea {
    width: 100%;
    font-family: inherit;
    font-size: 14px;
    line-height: 1.5;
    color: #1a1a1a;
    background: #fafafa;
    border: 1px solid #d1d5db;
    border-radius: 7px;
    padding: 10px 12px;
    transition: border-color .15s, box-shadow .15s;
    resize: vertical;
}

.te-input:focus,
.te-textarea:focus {
    outline: none;
    border-color: #6366f1;
    box-shadow: 0 0 0 3px rgba(99,102,241,.15);
    background: #fff;
}

/* ── Строки параграфов ────────────────────────────────────── */
.te-para-row {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    margin-bottom: 10px;
}

.te-para-num {
    flex-shrink: 0;
    width: 24px;
    height: 24px;
    line-height: 24px;
    text-align: center;
    background: #e5e7eb;
    border-radius: 50%;
    font-size: 11px;
    font-weight: 700;
    color: #555;
    margin-top: 11px;
}

.te-para-row .te-textarea {
    flex: 1;
}

.te-remove-para {
    flex-shrink: 0;
    width: 28px;
    height: 28px;
    background: none;
    border: 1px solid #e5e7eb;
    border-radius: 6px;
    cursor: pointer;
    color: #999;
    font-size: 12px;
    transition: background .15s, color .15s;
    margin-top: 9px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.te-remove-para:hover {
    background: #fee2e2;
    border-color: #fca5a5;
    color: #b91c1c;
}

/* ── Кнопки ───────────────────────────────────────────────── */
.te-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-family: inherit;
    font-size: 14px;
    font-weight: 600;
    border-radius: 8px;
    padding: 10px 20px;
    cursor: pointer;
    border: none;
    transition: background .15s, transform .1s;
    text-decoration: none;
}

.te-btn:active {
    transform: scale(.98);
}

.te-btn-primary {
    background: #6366f1;
    color: #fff;
}

.te-btn-primary:hover {
    background: #4f52d6;
    color: #fff;
}

.te-btn-secondary {
    background: #f3f4f6;
    color: #374151;
    border: 1px solid #d1d5db;
    margin-top: 4px;
    font-size: 13px;
    padding: 8px 16px;
}

.te-btn-secondary:hover {
    background: #e5e7eb;
}

/* ── Нижние действия ──────────────────────────────────────── */
.te-actions {
    display: flex;
    align-items: center;
    gap: 14px;
    padding-top: 8px;
    border-top: 1px solid #f3f4f6;
    margin-top: 24px;
    flex-wrap: wrap;
}

.te-save-hint {
    font-size: 12px;
    color: #9ca3af;
}

/* ── Предпросмотр ─────────────────────────────────────────── */
.te-preview-col {
    position: sticky;
    top: 76px;
}

.te-preview-heading {
    font-size: 13px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: .06em;
    color: #888;
    margin-bottom: 10px;
}

.te-preview-box {
    background: #1a1a2e;
    border-radius: 12px;
    padding: 28px 24px;
    box-shadow: 0 4px 24px rgba(0,0,0,.15);
    color: #f0f0f0;
    min-height: 300px;
}

.te-preview-subtitle {
    font-size: 13px;
    font-weight: 400;
    color: #a8a8c0;
    letter-spacing: .08em;
    text-transform: uppercase;
    margin-bottom: 4px;
}

.te-preview-title {
    font-size: 28px;
    font-weight: 700;
    color: #fff;
    margin-bottom: 16px;
    line-height: 1.2;
}

.te-preview-description p {
    font-size: 13px;
    color: #c8c8d8;
    margin-bottom: 8px;
    line-height: 1.65;
}

.te-preview-description p:last-child {
    margin-bottom: 0;
}

/* ── Навигация в шапке ────────────────────────────────── */
.te-nav {
    display: flex;
    align-items: center;
    gap: 12px;
}

.te-pages-dropdown {
    position: relative;
}

.te-pages-menu {
    display: none;
    position: absolute;
    right: 0;
    top: calc(100% + 6px);
    background: #fff;
    border: 1px solid #e2e4e8;
    border-radius: 8px;
    box-shadow: 0 4px 16px rgba(0,0,0,.1);
    min-width: 180px;
    z-index: 200;
    overflow: hidden;
}

.te-pages-menu--open {
    display: block;
}

.te-pages-item {
    display: block;
    padding: 10px 16px;
    font-size: 14px;
    color: #374151;
    text-decoration: none;
    transition: background .12s;
}

.te-pages-item:hover {
    background: #f3f4f6;
}

.te-pages-item--active {
    background: #eef2ff;
    color: #6366f1;
    font-weight: 600;
}