/* Техническое задание на текст - /text-seo-tools/tehnicheskoe-zadanie-na-tekst
   Значения сняты со struktura-konkurentov.css (та, в свою очередь, с proverka-metategov):
   ритм 8px, текст 12px, карточки radius 8px, разделители --main-gray-color,
   заголовок блока 16px, спиннер 16px. Ничего не «примерно» - те же числа.
   Всё заскоуплено под #tz-calc, чтобы не задеть соседние калькуляторы. */

/* ============ Ручная вставка контента ============ */
#tz-calc .tz-paste {
    margin: 0 0 16px;
    border: 1px solid var(--main-gray-color, #e0e0e0);
    border-radius: 16px;
    padding: 0 16px;
}

#tz-calc .tz-paste__summary {
    padding: 14px 0;
    font-size: 12px;
    color: #555;
    cursor: pointer;
    list-style-position: inside;
}

#tz-calc .tz-paste__summary:hover {
    color: #111;
}

#tz-calc .tz-paste[open] .tz-paste__summary {
    color: #111;
    font-weight: 600;
}

#tz-calc .tz-paste__body {
    padding: 0 0 8px;
}

/* ============ Полноэкранный режим ============ */
/* Кнопка-тоггл в стиле чипа дизайн-системы (Unbounded 12px, radius 16px, height 34px).
   Значения сняты с .rz-chip семантического анализа. */
#tz-calc .tz-fs-toggle {
    width: auto;
    margin: 0 0 12px;
    height: 34px;
    padding: 0 14px;
    font-family: 'Unbounded', serif;
    font-size: 12px;
    color: #000;
    background: #fff;
    border: 1px solid #ddd;
    border-radius: 16px;
    cursor: pointer;
}

#tz-calc .tz-fs-toggle:hover {
    background: #f3f4f6;
}

/* Развёрнутый контейнер: на весь вьюпорт, поверх страницы, со своим скроллом.
   clamp по бокам — на широком экране контент не растягивается в километровую строку. */
#tz-calc.tz-fs {
    position: fixed;
    inset: 0;
    z-index: 9999;
    max-width: none;
    width: auto;
    margin: 0;
    background: #fff;
    overflow: auto;
    padding: 18px clamp(16px, 5vw, 72px) 48px;
    border-radius: 0;
    box-shadow: none;
}

/* Кнопка выхода всегда под рукой сверху при прокрутке */
#tz-calc.tz-fs .tz-fs-toggle {
    position: sticky;
    top: 8px;
    z-index: 5;
}

body.tz-fs-lock {
    overflow: hidden;
}

/* ============ Форма ============ */
#tz-calc .tz-meta {
    display: flex;
    justify-content: flex-end;
    margin: 8px 0 16px;
}

#tz-calc .tz-counter {
    font-size: 12px;
    color: #777;
}

#tz-calc .tz-counter.is-over {
    color: #c0392b;
    font-weight: 600;
}

/* Поле списка URL. Значения скопированы с эталона `#semantic-calc .sa-textarea`
   (семантический анализ) - это канон textarea в разделе.

   ⚠ КЛЮЧЕВОЕ: padding-top 28px. Дизайн-система кладёт label ПОВЕРХ поля
   (`.form-group label { position:absolute; top:10px }`, для textarea правило
   `.form-group:has(textarea) label { top:16px }`). Верхний отступ - это место под
   label. С padding 16px, как было, текст пользователя начинался ровно на строке
   label и наезжал на название поля.

   ⚠ У структуры и метатегов textarea вообще не стилизована (13.3px monospace,
   углы 0) - это их недоделка, а не канон. */
#tz-calc .tz-textarea {
    display: block;
    box-sizing: border-box;
    width: 100%;
    padding: 28px 16px 16px;
    font-family: 'Unbounded', serif;
    font-size: 14px;
    line-height: 1.6;
    color: #000;
    background: #fff;
    border: 1px solid #ddd;
    border-radius: 16px;
    resize: vertical;
}

#tz-calc .tz-textarea:focus {
    outline: none;
    border-color: #000;
}

#tz-calc .calc-error {
    display: none;
    margin: 16px 0;
    padding: 12px 16px;
    border-radius: 8px;
    background: #fdecea;
    color: #c0392b;
    font-size: 12px;
    line-height: 1.5;
}

#tz-calc .tz-loading {
    display: none;
    align-items: center;
    gap: 8px;
    margin: 16px 0;
    font-size: 12px;
    color: #555;
}

#tz-calc .tz-spinner {
    width: 16px;
    height: 16px;
    border: 2px solid #ddd;
    border-top-color: #111;
    border-radius: 50%;
    animation: tz-spin 0.8s linear infinite;
    flex: none;
}

@keyframes tz-spin {
    to { transform: rotate(360deg); }
}

@media (prefers-reduced-motion: reduce) {
    #tz-calc .tz-spinner { animation-duration: 3s; }
}

/* ============ Результаты ============ */
#tz-calc .tz-results {
    margin-top: 24px;
}

#tz-calc .tz-block {
    margin-bottom: 32px;
    padding-top: 24px;
    border-top: 1px solid var(--main-gray-color, #e0e0e0);
}

#tz-calc .tz-block__title {
    font-size: 16px;
    margin: 0 0 16px;
}

#tz-calc .tz-note {
    font-size: 12px;
    color: #777;
    line-height: 1.6;
    margin: 0 0 12px;
}

/* ---- Плашка состава ---- */
#tz-calc .tz-intake {
    margin-bottom: 16px;
    padding: 12px 16px;
    border-radius: 8px;
    background: #fff8e6;
    border: 1px solid #f0dca8;
    font-size: 12px;
    line-height: 1.6;
    color: #6b5600;
}

/* конкурентов мало - цифрам верить уже нельзя, акцент сильнее */
#tz-calc .tz-intake.is-weak {
    background: #fdecea;
    border-color: #f5c6cb;
    color: #c0392b;
}

#tz-calc .tz-intake a {
    color: inherit;
    text-decoration: underline;
}

#tz-calc .tz-intake__warn {
    margin-top: 4px;
    font-weight: 600;
}

/* режим «с нуля»: своей страницы нет, часть блоков не считается - объясняем сразу */
#tz-calc .tz-mode {
    margin-bottom: 16px;
    padding: 12px 16px;
    border-radius: 8px;
    background: #f4f7fb;
    border: 1px solid #d6e2f0;
    font-size: 12px;
    line-height: 1.6;
    color: #2c4a6b;
}

/* ---- Сводка ---- */
#tz-calc .tz-stats {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 16px;
}

#tz-calc .tz-stat {
    flex: 1 1 120px;
    padding: 12px;
    border: 1px solid var(--main-gray-color, #e0e0e0);
    border-radius: 8px;
    text-align: center;
}

#tz-calc .tz-stat__num {
    display: block;
    font-size: 16px;
    font-weight: 600;
}

#tz-calc .tz-stat__label {
    display: block;
    font-size: 12px;
    color: #777;
    margin-top: 4px;
    line-height: 1.4;
}

/* ---- Метатеги ---- */
#tz-calc .tz-meta-card {
    padding: 12px;
    margin-bottom: 8px;
    border: 1px solid var(--main-gray-color, #e0e0e0);
    border-radius: 8px;
}

#tz-calc .tz-meta-card__head {
    display: flex;
    align-items: baseline;
    gap: 8px;
    margin-bottom: 4px;
}

#tz-calc .tz-meta-card__tag {
    flex: none;
    font-size: 11px;
    font-weight: 600;
    color: #777;
    text-transform: uppercase;
}

#tz-calc .tz-meta-card__len {
    flex: none;
    margin-left: auto;
    font-size: 11px;
    color: #777;
    font-variant-numeric: tabular-nums;
}

#tz-calc .tz-meta-card__len.is-long {
    color: #c0392b;
    font-weight: 600;
}

#tz-calc .tz-meta-card__value {
    font-size: 12px;
    line-height: 1.5;
    word-break: break-word;
}

#tz-calc .tz-meta-card__warn {
    margin-top: 8px;
    font-size: 11px;
    line-height: 1.5;
    color: #8a6d00;
}

#tz-calc .tz-copy-inline {
    width: auto;
    margin-top: 8px;
    padding: 4px 8px;
    font-size: 11px;
    border: 1px solid var(--main-gray-color, #e0e0e0);
    border-radius: 4px;
    background: #fff;
    cursor: pointer;
}

#tz-calc .tz-copy-inline:hover {
    border-color: #111;
}

/* ---- Дерево структуры ---- */
#tz-calc .tz-legend {
    font-size: 12px;
    color: #777;
    margin-bottom: 12px;
}

#tz-calc .tz-tree {
    border: 1px solid var(--main-gray-color, #e0e0e0);
    border-radius: 8px;
    overflow: hidden;
}

#tz-calc .tz-node {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px;
    border-bottom: 1px solid var(--main-gray-color, #e0e0e0);
    font-size: 12px;
}

#tz-calc .tz-node:last-child {
    border-bottom: none;
}

#tz-calc .tz-node--h3 {
    padding-left: 32px;
    background: #fafafa;
}

#tz-calc .tz-node__tag {
    flex: none;
    width: 24px;
    font-weight: 600;
    color: #777;
}

#tz-calc .tz-node__title {
    flex: 1 1 auto;
    min-width: 0;
    word-break: break-word;
}

#tz-calc .tz-node.is-must .tz-node__title {
    font-weight: 600;
}

#tz-calc .tz-node__opt {
    flex: none;
    font-size: 11px;
    color: #999;
}

#tz-calc .tz-node__cov {
    flex: none;
    color: #555;
    font-variant-numeric: tabular-nums;
}

#tz-calc .tz-node__bar {
    flex: none;
    width: 64px;
    height: 6px;
    border-radius: 3px;
    background: #eee;
    overflow: hidden;
}

#tz-calc .tz-node__bar i {
    display: block;
    height: 100%;
    background: #111;
}

/* формулировки конкурентов под разделом.
   ⚠ БЕЗ отрицательного margin-top: он затягивал описание на 8px вверх, и текст
   наезжал на разделительную линию узла (жалоба Артёма 20.07.2026). padding-top
   опускает описание под линию с зазором. */
#tz-calc .tz-node__variants {
    padding: 8px 12px 12px 44px;
    font-size: 11px;
    color: #999;
    line-height: 1.5;
    border-bottom: 1px solid var(--main-gray-color, #e0e0e0);
}

/* ---- Пробелы ---- */
#tz-calc .tz-gaps {
    margin: 0;
    padding: 0;
    list-style: none;
}

#tz-calc .tz-gaps li {
    display: flex;
    align-items: baseline;
    gap: 8px;
    padding: 8px 0;
    font-size: 12px;
    border-bottom: 1px solid var(--main-gray-color, #e0e0e0);
}

#tz-calc .tz-gaps li:last-child {
    border-bottom: none;
}

#tz-calc .tz-gaps__cov {
    flex: none;
    font-weight: 600;
    color: #c0392b;
    font-variant-numeric: tabular-nums;
}

/* ---- Таблицы ---- */
#tz-calc .tz-table-wrap {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

#tz-calc .tz-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 12px;
    min-width: 560px;
}

#tz-calc .tz-table th,
#tz-calc .tz-table td {
    padding: 12px 8px;
    text-align: left;
    vertical-align: top;
    border-bottom: 1px solid var(--main-gray-color, #e0e0e0);
}

#tz-calc .tz-table th {
    font-weight: 600;
    color: #555;
    white-space: nowrap;
}

#tz-calc .tz-table td.is-num {
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
}

#tz-calc .tz-table tr.is-own {
    background: #f6f9ff;
}

/* Список слов длинный (до 40 строк). В интерфейсе показываем первые 12, остальные
   раскрываются кнопкой. В Word, Markdown и CSV уходят ВСЕ строки - сворачивание
   касается только экрана. */
#tz-calc .tz-table tr.is-hidden {
    display: none;
}

/* страница не вошла в расчёт, но её состав показан: приглушаем, не прячем */
#tz-calc .tz-table tr.is-excluded {
    background: #fafafa;
    color: #999;
}

/* ---- Бриф для копирайтера ---- */
#tz-calc .tz-brief__actions {
    margin-bottom: 8px;
}

/* Значения сняты с инлайн-стиля <pre> семантического анализа: 13px/1.55,
   padding 12px, border 1px #ddd, radius 12px, фон #fafafa. Тот же вид брифа. */
#tz-calc .tz-brief__text {
    white-space: pre-wrap;
    word-break: break-word;
    font: 13px/1.55 inherit;
    margin: 0;
    padding: 12px;
    border: 1px solid #ddd;
    border-radius: 12px;
    background: #fafafa;
    color: #000;
    max-height: 460px;
    overflow: auto;
}

/* ---- Содержание блоков и повествование ---- */
#tz-calc .tz-sub {
    font-size: 12px;
    font-weight: 600;
    margin: 16px 0 8px;
}

/* Примеры пунктов списка под темой: мелко и приглушённо, это справка */
#tz-calc .tz-sample {
    display: block;
    margin-top: 4px;
    font-size: 11px;
    color: #999;
    line-height: 1.4;
}

#tz-calc .tz-order {
    margin: 0 0 16px;
    padding-left: 20px;
    font-size: 12px;
    line-height: 1.6;
}

#tz-calc .tz-order li {
    padding: 2px 0;
}

/* ---- Статусы слов ---- */
#tz-calc .tz-badge {
    display: inline-block;
    padding: 2px 6px;
    border-radius: 4px;
    background: #eee;
    color: #777;
    font-size: 11px;
    white-space: nowrap;
}

#tz-calc .tz-badge--missing {
    background: #fdecea;
    color: #c0392b;
}

#tz-calc .tz-badge--below {
    background: #fff4e0;
    color: #8a5a00;
}

#tz-calc .tz-badge--over {
    background: #fdecea;
    color: #c0392b;
}

#tz-calc .tz-badge--ok {
    background: #eaf6ec;
    color: #1e7e34;
}

/* ---- Чипы слов ---- */
#tz-calc .tz-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
}

#tz-calc .tz-chip {
    padding: 4px 8px;
    border: 1px solid var(--main-gray-color, #e0e0e0);
    border-radius: 4px;
    font-size: 11px;
    line-height: 1.4;
    background: #fff;
}

#tz-calc .tz-chip b {
    font-weight: 600;
}

#tz-calc .tz-chip__num {
    color: #999;
}

#tz-calc .tz-chip--gap {
    border-color: #f5c6cb;
    background: #fdf3f4;
}

/* слова, которых нет в наших подзаголовках — акцент «дописать в H2-H3» */
#tz-calc .tz-chip__num--lack {
    color: #c0392b;
    font-weight: 600;
}

/* ---- Список требований и FAQ ---- */
#tz-calc .tz-list {
    margin: 0;
    padding: 0;
    list-style: none;
}

#tz-calc .tz-list li {
    padding: 8px 0 8px 16px;
    position: relative;
    font-size: 12px;
    line-height: 1.5;
    border-bottom: 1px solid var(--main-gray-color, #e0e0e0);
}

#tz-calc .tz-list li:last-child {
    border-bottom: none;
}

#tz-calc .tz-list li::before {
    content: "";
    position: absolute;
    left: 0;
    top: 14px;
    width: 4px;
    height: 4px;
    border-radius: 50%;
    background: #111;
}

#tz-calc .tz-faq__cov {
    display: inline-block;
    min-width: 20px;
    margin-right: 4px;
    font-weight: 600;
    color: #1e7e34;
}

/* ---- Под ИИ-поиск ---- */
#tz-calc .tz-ai-tag {
    display: inline-block;
    padding: 1px 6px;
    margin-right: 4px;
    border-radius: 4px;
    font-size: 10px;
    font-weight: 600;
    white-space: nowrap;
    vertical-align: baseline;
}

/* подтверждено утечкой/патентом — зелёный; гипотеза DrMax — жёлтый */
#tz-calc .tz-ai-tag--ok {
    background: #eaf6ec;
    color: #1e7e34;
}

#tz-calc .tz-ai-tag--exp {
    background: #fff4e0;
    color: #8a5a00;
}

#tz-calc .tz-ai-src {
    color: #999;
    font-size: 11px;
}

/* ---- Релевантность ---- */
#tz-calc .tz-rel {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    align-items: center;
    font-size: 12px;
}

#tz-calc .tz-rel__metric {
    padding: 8px 12px;
    border: 1px solid var(--main-gray-color, #e0e0e0);
    border-radius: 8px;
}

#tz-calc .tz-rel__metric b {
    font-variant-numeric: tabular-nums;
}

/* ---- Не разобрано ---- */
#tz-calc .tz-failed {
    margin: 0 0 12px;
    padding: 0;
    list-style: none;
}

#tz-calc .tz-failed li {
    padding: 8px 0;
    font-size: 12px;
    color: #777;
    border-bottom: 1px solid var(--main-gray-color, #e0e0e0);
}

#tz-calc .tz-failed li:last-child {
    border-bottom: none;
}

#tz-calc .tz-failed__host {
    font-weight: 600;
    color: #555;
}

/* ---- Лимит и выгрузка ---- */
#tz-calc .tz-limit {
    font-size: 12px;
    color: #777;
    margin: 0 0 16px;
}

#tz-calc .tz-export {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

/* ⚠ Глобальное .calculator-wrapper button в inputs-style.css ставит width:calc(100%),
   из-за чего кнопки выгрузки встают в столбик. Здесь ширина по содержимому. */
#tz-calc .tz-export__btn {
    width: auto;
    flex: 0 0 auto;
    padding: 8px 16px;
    font-size: 12px;
    border: 1px solid var(--main-gray-color, #e0e0e0);
    border-radius: 8px;
    background: #fff;
    cursor: pointer;
    text-decoration: none;
    color: inherit;
    display: inline-block;
}

#tz-calc .tz-export__btn:hover {
    border-color: #111;
}

/* Word - основная выгрузка файла; бриф - основное быстрое действие «скопировал и
   отдал». Обе акцентные (чёрные), но в разных блоках, не конфликтуют. */
#tz-calc .tz-export__btn--main,
#tz-calc .tz-export__btn--accent {
    border-color: #111;
    background: #111;
    color: #fff;
}

#tz-calc .tz-export__btn--main:hover,
#tz-calc .tz-export__btn--accent:hover {
    opacity: 0.85;
}

@media (max-width: 768px) {
    #tz-calc .tz-block__title { font-size: 14px; }
    #tz-calc .tz-stat { flex: 1 1 45%; }
    #tz-calc .tz-node { flex-wrap: wrap; }
    #tz-calc .tz-node__bar { display: none; }
    #tz-calc .tz-node--h3 { padding-left: 24px; }
    #tz-calc .tz-node__variants { padding-left: 24px; }
}
