/* Стили для таблицы элементов тура */
.guided-tour-items-table {
    width: 100%;
    border-collapse: collapse;
    border-radius: 4px;
    overflow: hidden;
}

.guided-tour-items-table thead th {
    background-color: #f5f5f5;
    font-weight: bold;
    text-align: left;
    padding: 8px;
    border-bottom: 2px solid #ddd;
}

.guided-tour-items-table tbody tr {
    border-bottom: 1px solid #ddd;
    background-color: #f9f9f9;
}

.guided-tour-items-table tbody tr:last-child {
    border-bottom: none;
}

.guided-tour-items-table tbody tr:hover {
    background-color: #f0f0f0;
}

.guided-tour-items-table tbody tr.active {
    background-color: rgba(33, 150, 243, 0.1);
}

.guided-tour-items-table tbody td {
    padding: 10px 8px;
    vertical-align: middle;
}

/* Стили для порядкового номера */
.guided-tour-items-table .order-number {
    display: inline-block;
    background-color: #4b6eaf;
    color: #fff;
    border-radius: 50%;
    width: 24px;
    height: 24px;
    text-align: center;
    line-height: 24px;
    font-size: 12px;
    margin: 0 auto;
}

/* Стили для имени элемента */
.guided-tour-items-table .item-name {
    font-weight: bold;
    overflow: hidden;
    text-overflow: ellipsis;
    display: block;
    font-size: 12px;
}

/* Стили для описания элемента */
.guided-tour-items-table .item-description {
    margin-top: 5px;
    padding-left: 5px;
    font-size: 12px;
    color: #666;
    max-height: 40px;
    overflow: hidden;
    line-height: 1.3;
}

/* Стили для чекбокса выбора */
.guided-tour-items-table .item-select-checkbox {
    margin: 0;
    position: relative;
    left: 50%;
    transform: translateX(-50%);
}

/* Стили для кнопок действий */
.guided-tour-items-table .item-buttons {
    display: flex;
    flex-wrap: nowrap;
    justify-content: flex-start;
}

.guided-tour-items-table .item-buttons .btn {
    padding: 0 4px;
    margin-right: 5px;
    color: #777;
}

.guided-tour-items-table .item-buttons .btn:hover {
    color: #333;
}

/* Стили для пустого списка */
.list-items-container .no-data {
    padding: 20px;
    text-align: center;
    color: #777;
    font-style: italic;
    background-color: #f9f9f9;
    border-radius: 4px;
    border: 1px solid #ddd;
}

/* Полупрозрачная подложка для редактора */
.guided-tour-editor-backdrop {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgb(147 168 207 / 30%);
    z-index: 1030; /* Ниже, чем у модальных окон CRMP */
}

/* Стили для основного контейнера редактора */
.guided-tour-editor-container {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 450px; /* Фиксированная ширина */
    max-width: 90vw;
    max-height: 600px; /* Ограничение высоты */
    z-index: 1035; /* Ниже модальных окон CRMP */
    background-color: #fff;
    border-radius: 6px;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.5);
    display: flex;
    flex-direction: column; /* Организация flex-контейнера вертикально */
    overflow: hidden; /* Скрытие выходящего за границы контента */
}

/* Улучшение видимости заголовка */
.guided-tour-editor-container .editor-header {
    flex-shrink: 0; /* Запрет на сжатие при нехватке места */
    background-color: #4b6eaf; /* Более заметный цвет заголовка */
    color: #fff;
    padding: 10px 15px;
    font-weight: bold;
    cursor: move;
    display: flex;
    justify-content: space-between;
    align-items: center;
    user-select: none;
}

.guided-tour-editor-container .editor-title {
    font-size: 16px;
    overflow: hidden;
    text-overflow: ellipsis;
    flex: 1;
}

.guided-tour-editor-container .header-buttons {
    display: flex;
}

.guided-tour-editor-container .header-buttons button {
    background: none;
    border: none;
    color: #fff;
    margin-left: 5px;
}

.guided-tour-editor-container .editor-content {
    flex: 1;
    overflow: hidden; /* Убираем прокрутку с основного контейнера */
    padding: 0; /* Убираем общий padding */
    display: flex;
    flex-direction: column;
}

/* Закрепленная панель действий */
.guided-tour-editor-container .editor-actions {
    flex-shrink: 0; /* Запрет на сжатие */
    position: sticky; /* Альтернативный подход */
    top: 0;
    z-index: 10;
    background-color: #fff;
    border-bottom: 1px solid #ddd;
    padding: 10px;
    margin: 0;
}

/* Прокручиваемый контейнер для списка */
.guided-tour-editor-container .items-container {
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
    padding: 0 10px 10px 10px;
}

/* Стили для подвала редактора */
.guided-tour-editor-container .editor-footer {
    flex-shrink: 0; /* Запрет на сжатие при нехватке места */
    padding: 10px;
    background-color: #f5f5f5;
    border-top: 1px solid #ddd;
    display: flex;
    justify-content: space-between;
}

/* Состояние при минимизации */
.guided-tour-editor-container.minimized {
    height: auto;
}

/* Состояние при перетаскивании */
.guided-tour-editor-container.dragging {
    opacity: 0.8;
}

/* Стили для списка в редакторе */
.guided-tour-editor-container .list-info {
    background-color: #4b6eaf;
    color: #fff;
    border-radius: 10px;
    padding: 2px 8px;
    font-size: 12px;
    margin-top: 5px;
    display: inline-block;
}

/* Оверлей для выбора элементов */
.overlay-for-select {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 1030; /* Ниже модальных окон CRMP */
    cursor: pointer;
    background-color: rgba(0, 0, 0, 0.3);
}

/* Стили для выбранного элемента */
.selected-element {
    position: absolute;
    border: 2px solid #4b6eaf;
    background-color: rgba(75, 110, 175, 0.2);
    pointer-events: none;
    z-index: 1031; /* Выше оверлея, но ниже модальных окон */
}

/* Стили для кнопок в выбранном элементе */
.selected-element-buttons {
    display: flex;
    pointer-events: auto; /* Разрешаем события мыши */
    z-index: 1032; /* Выше, чем у выделенного элемента */
}

.selected-element-buttons .btn {
    margin: 2px;
    z-index: 1032; /* Выше, чем у выделенного элемента */
}

.selected-element-buttons .confirm-button {
    margin-right: 5px;
}

/* Стили для контейнера подсветок */
.tour-element-highlights-container {
    position: fixed;
    top: 0;
    left: 0;
    width: 0;
    height: 0;
    z-index: 1032; /* Ниже модальных окон CRMP */
    pointer-events: none;
}

/* Стили для подсветки элементов */
.tour-element-highlight {
    position: absolute;
    border: 2px solid #4b6eaf;
    background-color: rgba(75, 110, 175, 0.2);
    pointer-events: none;
    z-index: 1033; /* Ниже модальных окон CRMP */
}

/* Улучшенные стили для номера шага тура */
.tour-element-order {
    position: absolute;
    background-color: #FFC107; /* Желтый цвет (Amber) */
    color: #212121; /* Темный текст для лучшей читаемости */
    border-radius: 50%;
    width: 24px;
    height: 24px;
    text-align: center;
    line-height: 24px;
    font-size: 12px;
    font-weight: bold;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.3);
    display: block;
    visibility: visible;
    opacity: 1;
    z-index: 2001;
    pointer-events: none;
}

/* Стили для номера шага вне элемента */
.tour-element-order.outside {
    border: 1px solid #fff;
    box-shadow: 0 0 5px rgba(0, 0, 0, 0.5);
}

/* Стили для номера шага сверху */
.tour-element-order.position-top {
    top: -30px;
    left: 50%;
    transform: translateX(-50%);
}

/* Стили для номера шага справа */
.tour-element-order.position-right {
    right: -30px;
    top: 50%;
    transform: translateY(-50%);
}

/* Стили для номера шага снизу */
.tour-element-order.position-bottom {
    bottom: -30px;
    left: 50%;
    transform: translateX(-50%);
}

/* Стили для номера шага слева */
.tour-element-order.position-left {
    left: -30px;
    top: 50%;
    transform: translateY(-50%);
}

/* Адаптивность для маленьких экранов */
@media (max-width: 768px) {
    .guided-tour-editor-container {
        width: 95vw;
    }
}

.guided-tour-items-table tbody tr:has(.invalid-selector) {
    background-color: #ffe6e6 !important; /* Светло-розовый фон */
}

.guided-tour-items-table tbody tr:hover:has(.invalid-selector) {
    background-color: #ffcccc !important; /* Более темный розовый при наведении */
}

/* Для старых браузеров без поддержки :has() */
.guided-tour-items-table tbody .invalid-selector {
    background-color: #ffe6e6;
}

/* Добавить иконку предупреждения рядом с именем */
.guided-tour-items-table .invalid-selector .item-name::before {
    content: "⚠ ";
    color: #d9534f;
    font-weight: bold;
}

/* Подсказка при наведении */
.guided-tour-items-table .invalid-selector .item-name {
    cursor: help;
    position: relative;
}

.guided-tour-items-table .invalid-selector .item-name::after {
    content: "Элемент не найден на странице";
    position: absolute;
    bottom: 100%;
    left: 0;
    background: #333;
    color: #fff;
    padding: 5px 10px;
    border-radius: 3px;
    font-size: 12px;
    white-space: nowrap;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s;
}

.guided-tour-items-table .invalid-selector .item-name:hover::after {
    opacity: 1;
}