﻿/* ========================================
   XRAY DOCX
   Дополнительные стили микросервиса
   Базовые стили страницы берутся из
   pre-send-check.css
======================================== */


/* ========================================
   РЕЗУЛЬТАТЫ / АВТОПРОКРУТКА
======================================== */

#xrayResults {
    scroll-margin-top: 96px;
}


/* ========================================
   ЗАГОЛОВОК КАРТЫ
======================================== */

.xray-results-header {
    margin-bottom: 18px;
}

    .xray-results-header h2 {
        margin: 0 0 5px;
        font-size: 27px;
        line-height: 1.25;
        font-weight: 700;
        color: #1f4f8f;
    }

    .xray-results-header p {
        margin: 0;
        font-size: 15px;
        line-height: 1.5;
        color: #4f5965;
    }


/* ========================================
   ПАНЕЛЬ "РАЗВЕРНУТЬ / СВЕРНУТЬ"
======================================== */

.xray-tree-toolbar {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 14px;
}

.xray-tree-toolbar-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 7px;
    min-height: 36px;
    padding: 8px 12px;
    border: 1px solid #d3deea;
    border-radius: 7px;
    background: #ffffff;
    color: #2d61a4;
    font-size: 13px;
    font-weight: 600;
    line-height: 1;
    cursor: pointer;
    transition: background-color 0.20s ease, border-color 0.20s ease, color 0.20s ease, transform 0.18s ease, box-shadow 0.18s ease;
}

    .xray-tree-toolbar-button:hover {
        background: #f4f8fd;
        border-color: #b9cbe0;
        transform: translateY(-1px);
        box-shadow: 0 3px 9px rgba(45, 97, 164, 0.10);
    }

    .xray-tree-toolbar-button:active {
        transform: translateY(0);
        box-shadow: none;
    }

    .xray-tree-toolbar-button.active {
        background: rgba(179, 98, 0, 0.10);
        border-color: rgba(179, 98, 0, 0.34);
        color: #9b5700;
    }

        .xray-tree-toolbar-button.active:hover {
            background: rgba(179, 98, 0, 0.14);
        }

    .xray-tree-toolbar-button i {
        transition: transform 0.22s ease;
    }


/* ========================================
   ОСНОВНОЕ ДЕРЕВО
======================================== */

.xray-tree {
    overflow: hidden;
    border: 1px solid #dce5ef;
    border-radius: 10px;
    background: #ffffff;
}

.xray-tree-node {
    position: relative;
}

.xray-tree-row {
    display: flex;
    align-items: flex-start;
    gap: 6px;
    min-height: 38px;
    padding: 7px 11px;
    border-bottom: 1px solid #eef2f6;
    transition: background-color 0.18s ease;
}

.xray-tree-node:last-child > .xray-tree-row {
    border-bottom: none;
}

.xray-tree-node[data-level="1"] > .xray-tree-row {
    background: #f8fbff;
}

    .xray-tree-node[data-level="1"] > .xray-tree-row .xray-tree-title {
        font-weight: 600;
    }


/* ========================================
   КНОПКА РАСКРЫТИЯ ВЕТКИ
======================================== */

.xray-tree-toggle {
    width: 28px;
    height: 28px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex: 0 0 28px;
    border: none;
    border-radius: 6px;
    background: transparent;
    color: #2d61a4;
    cursor: pointer;
    transition: background-color 0.18s ease, color 0.18s ease, transform 0.18s ease;
}

    .xray-tree-toggle:hover:not(:disabled) {
        background: #edf4fc;
    }

    .xray-tree-toggle:active:not(:disabled) {
        transform: scale(0.94);
    }

    .xray-tree-toggle:disabled {
        color: #b9c2cc;
        cursor: default;
    }

    .xray-tree-toggle i {
        transition: transform 0.22s ease;
    }


/* ========================================
   СОДЕРЖИМОЕ СТРОКИ
======================================== */

.xray-tree-content {
    min-width: 0;
    width: 100%;
    padding-top: 3px;
}

.xray-tree-title {
    font-size: 14px;
    line-height: 1.45;
    color: #2d333a;
}

    .xray-tree-title strong {
        color: #1f4f8f;
    }


/* ========================================
   ПЛАВНОЕ СВОРАЧИВАНИЕ ВЕТВЕЙ

   !important нужен временно, потому что
   текущий xray.js ещё вставляет старое
   правило display:none динамически.
   После удаления ensureXRayTreeStyles()
   из JS !important можно убрать.
======================================== */

.xray-tree-children {
    display: block !important;
    margin-left: 21px;
    border-left: 1px solid #dbe5ef;
    overflow: hidden;
    max-height: 12000px;
    opacity: 1;
    visibility: visible;
    transition: max-height 0.32s cubic-bezier(0.4, 0, 0.2, 1), opacity 0.22s ease, visibility 0s linear 0s;
}

.xray-tree-node.collapsed > .xray-tree-children {
    display: block !important;
    max-height: 0;
    opacity: 0;
    visibility: hidden;
    transition: max-height 0.30s cubic-bezier(0.4, 0, 0.2, 1), opacity 0.18s ease, visibility 0s linear 0.30s;
}


/* ========================================
   ПРЕДУПРЕЖДЕНИЕ ОБ ОТСУТСТВУЮЩЕМ РОДИТЕЛЕ
======================================== */

.xray-tree-warning {
    display: flex;
    align-items: center;
    gap: 5px;
    margin-top: 5px;
    font-size: 12px;
    line-height: 1.35;
    color: #a66300;
}


/* ========================================
   КОМПАКТНЫЕ БЕЙДЖИ УЗЛА
======================================== */

.xray-node-summary {
    display: inline-flex;
    flex-wrap: wrap;
    gap: 5px;
    margin-top: 6px;
}

.xray-summary-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    min-height: 24px;
    padding: 4px 8px;
    border: 1px solid #dbe4ee;
    border-radius: 999px;
    background: #ffffff;
    color: #4d6277;
    font-size: 11px;
    font-weight: 600;
    line-height: 1.1;
    cursor: pointer;
    transition: background-color 0.18s ease, border-color 0.18s ease, color 0.18s ease, transform 0.16s ease, box-shadow 0.18s ease;
}

    .xray-summary-badge:hover {
        border-color: #b8c9dc;
        background: #f7faff;
        transform: translateY(-1px);
    }

    .xray-summary-badge:active {
        transform: translateY(0);
    }

    .xray-summary-badge i {
        font-size: 10px;
    }

.xray-summary-figure,
.xray-summary-table {
    color: #315d91;
}

.xray-summary-outgoing,
.xray-summary-incoming {
    color: #4d6277;
}

.xray-summary-warning {
    color: #a66300;
    border-color: #efd8ae;
    background: #fffaf0;
}


/* ========================================
   АКТИВНЫЙ БЕЙДЖ
======================================== */

.xray-summary-badge.active {
    color: #ffffff;
    border-color: #2d61a4;
    background: #2d61a4;
    box-shadow: 0 2px 7px rgba(45, 97, 164, 0.22);
}

.xray-summary-incoming.active {
    border-color: #65579d;
    background: #65579d;
}

.xray-summary-warning.active {
    border-color: #b57916;
    background: #b57916;
}


/* ========================================
   ПАНЕЛЬ ПОДРОБНОСТЕЙ
======================================== */

.xray-node-details {
    margin-top: 8px;
    padding: 9px 11px;
    border: 1px solid #e1e8f0;
    border-radius: 8px;
    background: #fbfcfe;
}

    .xray-node-details.hidden {
        display: none;
    }

.xray-detail-section {
    min-width: 0;
}

    .xray-detail-section.hidden {
        display: none;
    }

.xray-detail-title {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-bottom: 7px;
    font-size: 11px;
    font-weight: 700;
    line-height: 1.25;
    color: #687786;
    text-transform: uppercase;
    letter-spacing: 0.02em;
}


/* ========================================
   РАЗЛИЧИЕ ТИПОВ ПАНЕЛЕЙ
======================================== */

.xray-detail-outgoing {
    padding-left: 10px;
    border-left: 3px solid #2d61a4;
}

.xray-detail-incoming {
    padding-left: 10px;
    border-left: 3px solid #65579d;
}

.xray-detail-unresolved {
    padding-left: 10px;
    border-left: 3px solid #b57916;
}

.xray-detail-figures,
.xray-detail-tables {
    padding-left: 10px;
    border-left: 3px solid #6f8296;
}


/* ========================================
   ОБЪЕКТЫ: РИСУНКИ / ТАБЛИЦЫ
======================================== */

.xray-object {
    display: flex;
    align-items: flex-start;
    gap: 7px;
    padding: 5px 7px;
    border-radius: 6px;
    font-size: 12px;
    line-height: 1.35;
}

    .xray-object + .xray-object {
        margin-top: 3px;
    }

    .xray-object > i {
        width: 14px;
        flex: 0 0 14px;
        margin-top: 2px;
        text-align: center;
    }

.xray-object-figure {
    color: #315d91;
}

.xray-object-table {
    color: #536273;
}

.xray-object strong {
    font-weight: 600;
}


/* ========================================
   ССЫЛКИ
======================================== */

.xray-link-item {
    display: flex;
    align-items: flex-start;
    gap: 6px;
    margin-top: 4px;
    font-size: 12px;
    line-height: 1.35;
}

    .xray-link-item > i {
        width: 13px;
        flex: 0 0 13px;
        margin-top: 2px;
        text-align: center;
    }

.xray-link-resolved {
    color: #315d91;
}

.xray-link-outgoing {
    color: #2d61a4;
}

.xray-link-incoming {
    color: #65579d;
}

.xray-link-external {
    color: #6b6478;
}

.xray-link-unresolved {
    color: #a66300;
}

.xray-link-count {
    color: #7c8792;
    white-space: nowrap;
}


/* ========================================
   ОБЪЕКТЫ ВНЕ РАСПОЗНАННОЙ СТРУКТУРЫ
======================================== */

.xray-unbound-objects {
    margin-top: 14px;
    padding: 12px;
    border: 1px dashed #d5dee8;
    border-radius: 9px;
    background: #fbfcfd;
}

.xray-unbound-title {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-bottom: 8px;
    font-size: 13px;
    color: #687582;
}

.xray-unbound-objects .xray-object + .xray-object {
    margin-top: 5px;
}


/* ========================================
   АДАПТИВ
======================================== */

@media (max-width: 900px) {

    #xrayResults {
        scroll-margin-top: 78px;
    }

    .xray-results-header h2 {
        font-size: 24px;
    }

    .xray-tree-row {
        padding: 7px 8px;
    }

    .xray-tree-children {
        margin-left: 14px;
    }

    .xray-node-summary {
        gap: 4px;
    }

    .xray-summary-badge {
        padding: 4px 7px;
    }
}


@media (max-width: 620px) {

    .xray-tree-toolbar {
        gap: 6px;
    }

    .xray-tree-toolbar-button {
        flex: 1 1 auto;
    }

    .xray-tree-title {
        font-size: 13px;
    }

    .xray-tree-children {
        margin-left: 9px;
    }

    .xray-node-details {
        padding: 8px;
    }
}



/* ========================================
   СЛУЖЕБНЫЕ ОБЛАСТИ DOCX
======================================== */

.xray-service-areas {
    margin-top: 18px;
    padding: 16px;
    border: 1px solid #dce5ef;
    border-radius: 10px;
    background: #ffffff;
}

.xray-service-header {
    margin-bottom: 12px;
}

    .xray-service-header h3 {
        margin: 0 0 4px;
        font-size: 18px;
        line-height: 1.3;
        font-weight: 700;
        color: #1f4f8f;
    }

    .xray-service-header p {
        margin: 0;
        font-size: 13px;
        line-height: 1.45;
        color: #66717d;
    }

.xray-service-toggles {
    display: flex;
    flex-wrap: wrap;
    gap: 7px;
}

.xray-service-toggle {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    min-height: 32px;
    padding: 6px 10px;
    border: 1px solid #d6e0eb;
    border-radius: 999px;
    background: #ffffff;
    color: #4d6277;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    transition: background-color 0.18s ease, border-color 0.18s ease, color 0.18s ease, transform 0.16s ease, box-shadow 0.18s ease;
}

    .xray-service-toggle:hover {
        transform: translateY(-1px);
        border-color: #b8c9dc;
        background: #f7faff;
    }

    .xray-service-toggle strong {
        min-width: 18px;
        height: 18px;
        display: inline-flex;
        align-items: center;
        justify-content: center;
        padding: 0 5px;
        border-radius: 999px;
        background: #eef3f8;
        color: #315d91;
        font-size: 10px;
    }

    .xray-service-toggle.active {
        border-color: #2d61a4;
        background: #2d61a4;
        color: #ffffff;
        box-shadow: 0 2px 7px rgba(45, 97, 164, 0.20);
    }

        .xray-service-toggle.active strong {
            background: rgba(255, 255, 255, 0.18);
            color: #ffffff;
        }

.xray-service-panels {
    margin-top: 10px;
}

.xray-service-panel {
    overflow: hidden;
    border: 1px solid #e2e8ef;
    border-radius: 8px;
    background: #fbfcfe;
}

    .xray-service-panel.hidden {
        display: none;
    }

.xray-service-row {
    display: flex;
    align-items: flex-start;
    gap: 9px;
    padding: 10px 11px;
    border-bottom: 1px solid #e8edf3;
}

    .xray-service-row:last-child {
        border-bottom: none;
    }

    .xray-service-row > i {
        width: 16px;
        flex: 0 0 16px;
        margin-top: 3px;
        text-align: center;
        color: #55779f;
    }

.xray-service-row-body {
    min-width: 0;
}

.xray-service-row-title {
    font-size: 13px;
    line-height: 1.35;
    font-weight: 700;
    color: #2e3945;
}

.xray-service-row-meta {
    margin-top: 2px;
    font-size: 14px;
    line-height: 1.35;
    color: #7a8692;
}

.xray-service-row-text {
    margin-top: 5px;
    font-size: 13px;
    line-height: 1.45;
    color: #4f5b67;
    white-space: pre-wrap;
    overflow-wrap: anywhere;
}

.xray-service-row-note {
    margin-top: 4px;
    font-size: 11px;
    line-height: 1.35;
    color: #7b6b4f;
}

.xray-service-fields {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    margin-top: 6px;
}

.xray-service-field {
    display: inline-flex;
    align-items: center;
    min-height: 20px;
    padding: 3px 6px;
    border: 1px solid #d9e3ed;
    border-radius: 999px;
    background: #ffffff;
    color: #4c637b;
    font-size: 10px;
    line-height: 1;
}




/* ========================================
   СЕКЦИИ WORD
======================================== */

.xray-section-row > i {
    color: #3e6e9f;
}

.xray-section-links {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: 7px;
}

.xray-section-chip {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    min-height: 24px;
    padding: 4px 7px;
    border: 1px solid #d9e4ef;
    border-radius: 6px;
    background: #ffffff;
    color: #526a82;
    font-size: 11px;
    line-height: 1.25;
}

    .xray-section-chip i {
        font-size: 10px;
        color: #4877a8;
    }

.xray-section-empty {
    margin-top: 6px;
    font-size: 11px;
    line-height: 1.35;
    color: #8a949e;
}


/* ========================================
   ПОЛЯ WORD
======================================== */

.xray-field-row > i {
    color: #65579d;
}

.xray-field-instruction {
    margin-top: 5px;
    padding: 6px 8px;
    border: 1px solid #e2e0ec;
    border-radius: 6px;
    background: #ffffff;
    color: #5f5875;
    font-family: Consolas, "Courier New", monospace;
    font-size: 11px;
    line-height: 1.4;
    overflow-wrap: anywhere;
}


@media (max-width: 620px) {

    .xray-service-areas {
        padding: 12px;
    }

    .xray-service-toggle {
        flex: 1 1 auto;
        justify-content: center;
    }
}



/* ========================================
   СНИЖЕНИЕ АНИМАЦИИ ПО НАСТРОЙКЕ ОС
======================================== */

@media (prefers-reduced-motion: reduce) {

    .xray-tree-children,
    .xray-tree-toggle,
    .xray-tree-toggle i,
    .xray-tree-toolbar-button,
    .xray-summary-badge {
        transition: none !important;
    }
}


/* ========================================
   XRAY — КЛИКАБЕЛЬНЫЕ СВЯЗИ
   Добавить В КОНЕЦ текущего xRay.css.

   Важно: этот патч не меняет размеры
   шрифтов 14 px / 13 px, которые уже
   настроены вручную.
======================================== */

.xray-link-clickable {
    cursor: pointer;
    border-radius: 5px;
    transition: background-color 0.18s ease, transform 0.16s ease;
}

    .xray-link-clickable:hover {
        background: rgba(45, 97, 164, 0.07);
    }

    .xray-link-clickable:focus-visible {
        outline: 2px solid rgba(45, 97, 164, 0.35);
        outline-offset: 2px;
    }

    .xray-link-clickable:active {
        transform: translateX(2px);
    }


/* ========================================
   ПОДСВЕТКА ЦЕЛИ ПЕРЕХОДА
======================================== */

.xray-navigation-target {
    animation: xrayNavigationFlash 3.2s ease;
}

@keyframes xrayNavigationFlash {

    0%, 48% {
        background-color: rgba(47, 109, 181, 0.22);
        box-shadow: inset 4px 0 0 rgba(47, 109, 181, 0.82);
    }

    72% {
        background-color: rgba(47, 109, 181, 0.12);
        box-shadow: inset 4px 0 0 rgba(47, 109, 181, 0.52);
    }

    100% {
        background-color: transparent;
        box-shadow: inset 4px 0 0 rgba(47, 109, 181, 0);
    }
}


@media (prefers-reduced-motion: reduce) {

    .xray-navigation-target {
        animation: none;
        outline: 2px solid rgba(47, 109, 181, 0.55);
        outline-offset: 2px;
    }
}

/* ========================================
   XRAY — ИНФОРМАЦИОННЫЙ БЛОК / SEO
======================================== */

.xray-info {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 18px;
    margin-top: 46px;
}

.xray-info-item {
    padding: 22px 24px;
    background: #ffffff;
    border: 1px solid #e0e5eb;
    border-radius: 12px;
    box-shadow: 0 3px 10px rgba(0, 0, 0, 0.045);
}

    .xray-info-item h2 {
        margin: 0 0 10px;
        min-height: 49px;
        font-size: 18px;
        line-height: 1.35;
        font-weight: 700;
        color: #245a9f;
    }

    .xray-info-item p {
        margin: 0;
        font-size: 14px;
        line-height: 1.65;
        color: #596572;
        text-align: justify;
        text-justify: inter-word;
        hyphens: auto;
    }


/* ========================================
   XRAY — SEO / ПЛАНШЕТ
======================================== */

@media (max-width: 850px) {

    .xray-info {
        grid-template-columns: 1fr;
        gap: 14px;
        margin-top: 38px;
    }
}


/* ========================================
   XRAY — SEO / ТЕЛЕФОН
======================================== */

@media (max-width: 600px) {

    .xray-info {
        margin-top: 32px;
    }

    .xray-info-item {
        padding: 18px 20px;
    }

        .xray-info-item h2 {
            min-height: 0;
            font-size: 17px;
        }

        .xray-info-item p {
            font-size: 13.5px;
            text-align: left;
        }
}
