/* ==========================================================================
   RAMSTAT Interactive Tour (Обучение по аналитике WB)
   Стиль: flows.sh tour example
   ========================================================================== */

/* Оверлей затемнения страницы - еще на 10% темнее */
.wb-tour-backdrop {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(15, 23, 42, 0.82);
    z-index: 99990;
    opacity: 0;
    pointer-events: auto;
    transition: opacity 0.25s ease;
}

.wb-tour-backdrop.is-active {
    display: block;
    opacity: 1;
}

/* Фокусировочная рамка (Spotlight) - аккуратная, тонкая (для шага «Применить») */
.wb-tour-spotlight {
    display: none;
    position: absolute;
    z-index: 99999 !important;
    border-radius: 18px;
    border: 1.5px solid #ff6d00;
    box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.35),
                0 3px 12px rgba(255, 109, 0, 0.28);
    background: transparent;
    pointer-events: none;
    opacity: 0;
    box-sizing: border-box !important;
    transition: opacity 0.22s ease;
}

.wb-tour-spotlight.is-visible {
    opacity: 1;
}

/* Поднимаем подсвеченный элемент НАД затемнением */
.wb-tour-target-active {
    position: relative !important;
    z-index: 99993 !important;
    background-color: #ffffff !important;
}

/* Блокировка кликов во время обучения:
   Пользователь не должен случайно нажимать «Применить», сброс, чекбоксы или кнопки в фильтрах */
body.wb-tour-running .wb-tour-target-active,
body.wb-tour-running #categoryForm,
body.wb-tour-running .filter-card-new,
body.wb-tour-running #settingsPopover {
    pointer-events: none !important;
    user-select: none !important;
}

/* Разрешаем кликать на элементы управления самого тура и на кнопку справки ИИ-бота */
.wb-tour-backdrop,
.wb-tour-card,
.wb-tour-card *,
.wb-tour-launcher,
.wb-tour-launcher *,
#settingsPopoverBot,
#settingsPopoverBot * {
    pointer-events: auto !important;
}

/* Шаг 2: Полностью белый блок формы фильтрации только на шаге фильтров */
body[data-wb-tour-step="step-filters"] #categoryForm.wb-tour-target-active,
body[data-wb-tour-step="step-filters"] .filter-card-new.wb-tour-target-active {
    position: relative !important;
    z-index: 99993 !important;
    background: #ffffff !important;
    background-image: none !important;
}

/* Шаги 5 и 6: Скругление и отступы для выделяемой белой области Визуализации и Аналитики */
#visualization-block.wb-tour-target-active,
#analysis-ui.wb-tour-target-active,
.section-title--ai.wb-tour-target-active {
    border-radius: 20px !important;
    padding: 24px !important;
    box-sizing: border-box !important;
}

/* Поднятие окна настроек анализа над элементами фильтров и страницы:
   Сайдбар (#mainSidebar) намеренно НЕ поднимается, чтобы оставаться затемненным во время тура
   и не перекрывать шапку сайта (header z-index: 15000). */
body.popover-open #smartHeader,
#smartHeader {
    z-index: 15000 !important;
}

body.popover-open .sidebar-container,
.sidebar-container.popover-open,
.sidebar-container:has(#settingsPopover:not(.hidden)) {
    z-index: 2000;
    overflow: visible;
}

.settings-popover,
#settingsPopover {
    border-radius: 24px !important;
    overflow: hidden !important;
    z-index: 99998 !important;
}

body.popover-open .filter-card-new .fcn-toolbar,
.sidebar-container:has(#settingsPopover:not(.hidden)) ~ .main-content .filter-card-new .fcn-toolbar {
    z-index: 1 !important;
}

.settings-popover .popover-header-compact {
    position: relative;
    border-top-left-radius: 24px;
    border-top-right-radius: 24px;
}

/* Поднятие сайдбара над оверлеем на шаге 4:
   Сайдбар и страница затемнены, а фокус (отсутствие затемнения) остается ИСКЛЮЧИТЕЛЬНО на блоке «Обработка».
   Шапка сайта (#smartHeader) остается затемненной под оверлеем (z-index оверлея 99990 > шапки 15000). */
body[data-wb-tour-step="step-sidebar-overview"] .sidebar-container,
body[data-wb-tour-step="step-sidebar-overview"] #mainSidebar {
    z-index: 99993 !important;
}

body[data-wb-tour-step="step-sidebar-overview"] .sidebar-container {
    background: transparent !important;
}

body[data-wb-tour-step="step-sidebar-overview"] #mainSidebar {
    background: rgba(15, 23, 42, 0.82) !important;
    border-right-color: rgba(255, 255, 255, 0.08) !important;
    transition: background 0.25s ease;
}

/* Приглушаем все остальные разделы сайдбара, сливая их с общим затемнением страницы */
body[data-wb-tour-step="step-sidebar-overview"] #mainSidebar .sidebar-header,
body[data-wb-tour-step="step-sidebar-overview"] #mainSidebar .btn-tariffs-lava,
body[data-wb-tour-step="step-sidebar-overview"] #mainSidebar .nav-title-main,
body[data-wb-tour-step="step-sidebar-overview"] #mainSidebar .nav-section:not(.processing-container),
body[data-wb-tour-step="step-sidebar-overview"] #mainSidebar .sidebar-view--collapsed {
    opacity: 0.15 !important;
    filter: grayscale(0.8) !important;
    pointer-events: none !important;
    transition: opacity 0.25s ease, filter 0.25s ease;
}

/* Полностью затемняем нижнюю панель («Калькулятор», «В сервис RAMSTAT» и др.) */
body[data-wb-tour-step="step-sidebar-overview"] #mainSidebar .section-bottom {
    background: transparent !important;
    border-top: none !important;
    border-color: transparent !important;
}

body[data-wb-tour-step="step-sidebar-overview"] #mainSidebar .section-bottom,
body[data-wb-tour-step="step-sidebar-overview"] #mainSidebar .section-bottom *,
body[data-wb-tour-step="step-sidebar-overview"] #mainSidebar .sidebar-group--bottom,
body[data-wb-tour-step="step-sidebar-overview"] #mainSidebar .sidebar-group--bottom * {
    opacity: 0.1 !important;
    filter: grayscale(1) !important;
    color: rgba(255, 255, 255, 0.2) !important;
    pointer-events: none !important;
}

body[data-wb-tour-step="step-sidebar-overview"] #mainSidebar .section-bottom svg,
body[data-wb-tour-step="step-sidebar-overview"] #mainSidebar .section-bottom path {
    stroke: rgba(255, 255, 255, 0.2) !important;
    color: rgba(255, 255, 255, 0.2) !important;
    fill: none !important;
}

body[data-wb-tour-step="step-sidebar-overview"] #mainSidebar .section-bottom .bottom-link--calculator::before {
    background-color: rgba(255, 255, 255, 0.2) !important;
}

/* Белый фокус ТОЛЬКО на блоке «Обработка» без рыжей обводки */
body[data-wb-tour-step="step-sidebar-overview"] #mainSidebar .nav-section.processing-container {
    position: relative !important;
    z-index: 10 !important;
    background: #ffffff !important;
    border-radius: 16px !important;
    padding: 12px 14px !important;
    margin: 8px 0 !important;
    border: none !important;
    outline: none !important;
    box-shadow: 0 12px 32px rgba(0, 0, 0, 0.4) !important;
    opacity: 1 !important;
    filter: none !important;
    transition: all 0.25s ease;
}

body[data-wb-tour-step="step-sidebar-overview"] #mainSidebar .processing-container .section-title-black span,
body[data-wb-tour-step="step-sidebar-overview"] #mainSidebar .processing-container .section-title-black {
    color: #0f172a !important;
    font-weight: 600 !important;
}

body[data-wb-tour-step="step-sidebar-overview"] #mainSidebar .processing-container .processing-label-muted {
    color: #1e293b !important;
    font-weight: 500 !important;
}

body.wb-tour-running[data-wb-tour-step="step-sidebar-overview"] #mainSidebar {
    pointer-events: none !important;
}

/* Стилизация строки «Отчеты и анализ» на шаге 4 */
body[data-wb-tour-step="step-sidebar-overview"] #analyzeToggleItem {
    position: relative;
    border-radius: 10px;
    padding: 6px 8px;
    margin: 2px -4px;
    transition: background 0.2s ease, transform 0.15s ease;
}

body[data-wb-tour-step="step-sidebar-overview"] #analyzeToggleItem.wb-tour-toggle-pressed {
    background: rgba(255, 109, 0, 0.18) !important;
    transform: scale(0.98);
}

body[data-wb-tour-step="step-sidebar-overview"] #analyzeToggleItem.wb-tour-toggle-active {
    background: rgba(255, 109, 0, 0.08) !important;
}

body[data-wb-tour-step="step-sidebar-overview"] #analyzeToggleItem.wb-tour-check-active .checkbox-engine {
    border-color: #ff9500 !important;
}

body[data-wb-tour-step="step-sidebar-overview"] #analyzeToggleItem.wb-tour-check-active .checkbox-engine::after {
    transform: scale(1) !important;
    opacity: 1 !important;
    clip-path: none !important;
    border-radius: 30% !important;
    background-color: #ff9500 !important;
    animation: checkbox-zoom 0.15s ease-out !important;
}

/* Зацикленная подсветка и мягкое продавливание кнопки при нажатии пальчика */
#analyzeToggleItem.wb-tour-toggle-looping {
    animation: wbTourTogglePressLoop 2.4s ease infinite;
}

@keyframes wbTourTogglePressLoop {
    0%, 34% {
        background: rgba(255, 109, 0, 0.05);
        transform: scale(1);
    }
    38% {
        background: rgba(255, 109, 0, 0.22);
        transform: scale(0.98);
    }
    50% {
        background: rgba(255, 109, 0, 0.1);
        transform: scale(1);
    }
    100% {
        background: rgba(255, 109, 0, 0.05);
        transform: scale(1);
    }
}

/* Зацикленный анимированный пальчик (hand pointer) */
.wb-tour-sidebar-pointer {
    position: absolute;
    left: 8px;
    top: 10px;
    pointer-events: none;
    z-index: 100;
    filter: drop-shadow(0 4px 10px rgba(0, 0, 0, 0.45));
    transform-origin: 11px 3px;
    will-change: transform, opacity;
}

.wb-tour-sidebar-pointer.is-looping {
    animation: wbTourPointerTapLoop 2.4s cubic-bezier(0.22, 1, 0.36, 1) infinite;
}

@keyframes wbTourPointerTapLoop {
    0% {
        transform: translate(44px, 20px) scale(1.05);
        opacity: 0;
    }
    18% {
        transform: translate(12px, 6px) scale(1);
        opacity: 1;
    }
    32% {
        transform: translate(10px, 4px) scale(1);
        opacity: 1;
    }
    38% {
        /* Нажатие (клик / tap) пальчиком по чекбоксу */
        transform: translate(8px, 6px) scale(0.84);
        opacity: 1;
    }
    48% {
        /* Отпускание кнопки */
        transform: translate(10px, 4px) scale(0.98);
        opacity: 1;
    }
    68% {
        /* Задержка после нажатия */
        transform: translate(11px, 5px) scale(1);
        opacity: 1;
    }
    85% {
        /* Плавный отлет перед началом следующего цикла */
        transform: translate(38px, 16px) scale(0.95);
        opacity: 0.3;
    }
    100% {
        transform: translate(44px, 20px) scale(1.05);
        opacity: 0;
    }
}

/* Зацикленный ripple-эффект от нажатия пальчика */
.wb-tour-sidebar-ripple {
    position: absolute;
    left: 18px;
    top: 50%;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: rgba(255, 109, 0, 0.65);
    transform: translate(-50%, -50%) scale(0);
    opacity: 0;
    pointer-events: none;
    z-index: 90;
    will-change: transform, opacity;
}

.wb-tour-sidebar-ripple.is-looping {
    animation: wbTourRippleLoop 2.4s ease-out infinite;
}

@keyframes wbTourRippleLoop {
    0%, 36% {
        transform: translate(-50%, -50%) scale(0);
        opacity: 0;
    }
    38% {
        transform: translate(-50%, -50%) scale(0.2);
        opacity: 0.95;
    }
    54% {
        transform: translate(-50%, -50%) scale(5.5);
        opacity: 0;
    }
    100% {
        transform: translate(-50%, -50%) scale(0);
        opacity: 0;
    }
}

/* Окно настроек анализа СТРОГО скрыто во время тура, пока не произойдет клик мышки */
body.wb-tour-running #settingsPopover.hidden,
body.wb-tour-running[data-wb-tour-step="step-sidebar-overview"] #settingsPopover:not(.wb-tour-popover-open) {
    display: none !important;
    opacity: 0 !important;
    visibility: hidden !important;
    pointer-events: none !important;
}

#settingsPopover.wb-tour-popover-open {
    position: fixed !important;
    top: 80px !important;
    left: calc(var(--sidebar-width, 260px) + 20px) !important;
    width: 340px !important;
    display: flex !important;
    visibility: visible !important;
    z-index: 99998 !important;
    background: #ffffff !important;
    box-shadow: 0 15px 45px rgba(0, 0, 0, 0.25) !important;
    border-radius: 24px !important;
    overflow: hidden !important;
}

#settingsPopover.wb-tour-popover-open:not(.wb-tour-popover-animated) {
    opacity: 1 !important;
    transform: none !important;
}

#settingsPopover.wb-tour-popover-open.wb-tour-popover-animated {
    animation: wbTourPopoverSlideIn 0.42s cubic-bezier(0.16, 1, 0.3, 1) forwards !important;
}

@keyframes wbTourPopoverSlideIn {
    0% {
        opacity: 0;
        transform: translateX(-40px) scale(0.96);
        box-shadow: 0 4px 14px rgba(0, 0, 0, 0.05);
    }
    100% {
        opacity: 1;
        transform: translateX(0) scale(1);
        box-shadow: 0 15px 45px rgba(0, 0, 0, 0.25);
    }
}

/* Адаптив для мобильных и узких экранов (шаг 4) */
@media (max-width: 768px) {
    #settingsPopover.wb-tour-popover-open {
        top: 60px !important;
        left: 50% !important;
        right: auto !important;
        width: min(340px, calc(100vw - 28px)) !important;
        max-width: calc(100vw - 28px) !important;
        max-height: calc(100dvh - 240px) !important;
        border-radius: 24px !important;
        overflow: hidden !important;
        z-index: 99998 !important;
    }

    #settingsPopover.wb-tour-popover-open:not(.wb-tour-popover-animated) {
        transform: translateX(-50%) !important;
        opacity: 1 !important;
    }

    #settingsPopover.wb-tour-popover-open.wb-tour-popover-animated {
        animation: wbTourPopoverSlideInMobile 0.42s cubic-bezier(0.16, 1, 0.3, 1) forwards !important;
    }

    @keyframes wbTourPopoverSlideInMobile {
        0% {
            opacity: 0;
            transform: translate(-50%, -24px) scale(0.95);
        }
        100% {
            opacity: 1;
            transform: translate(-50%, 0) scale(1);
        }
    }
}

/* Смайлик ИИ-помощника в правом верхнем углу блока настроек:
   Выглядывает по диагонали из угла блока и обрезается скругленной границей (overflow: hidden) */
.settings-popover-bot-btn {
    position: absolute;
    top: -6px;
    right: -6px;
    width: 46px;
    height: 46px;
    padding: 0;
    margin: 0;
    border: none;
    background: transparent;
    cursor: pointer !important;
    z-index: 99999 !important;
    outline: none;
    -webkit-tap-highlight-color: transparent;
    display: flex;
    align-items: center;
    justify-content: center;
    pointer-events: auto !important;
    transition: transform 0.2s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.settings-popover-bot-btn:hover {
    transform: scale(1.08);
}

.settings-popover-bot-shell {
    pointer-events: auto !important;
    cursor: pointer !important;
    width: 46px !important;
    height: 46px !important;
    transform: rotate(135deg);
    filter: drop-shadow(0 2px 6px rgba(255, 109, 0, 0.35)) !important;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.25s ease;
}

.svc-ai-avatar-face {
    position: relative;
    display: block;
    width: 46px;
    height: 46px;
    border-radius: 50%;
    transform-origin: center bottom;
}

.settings-popover-bot-shell .svc-ai-avatar {
    width: 46px;
    height: 46px;
    display: block;
    border-radius: 50%;
}

/* Веки для естественной анимации моргания глаз:
   Синхронизированы с 10-секундным циклом смайлика так, чтобы моргание не попадало на прыжок (0% - 24%).
   Прыжок идет отдельно с открытыми глазами, а моргания происходят в спокойном состоянии (на ~4 сек и ~7-7.5 сек). */
.svc-ai-eyelid {
    position: absolute;
    width: 8%;
    height: 16%;
    top: 35.8%;
    background: linear-gradient(to bottom, #f08247, #ee783a);
    border-radius: 999px;
    opacity: 0;
    transform: scaleY(0);
    transform-origin: center center;
    pointer-events: none;
    box-sizing: border-box;
    box-shadow: 0 1px 0 rgba(28, 5, 0, 0.75);
    animation: botEyesBlink 10s ease-in-out infinite;
}

.svc-ai-eyelid--left {
    left: 36.3%;
}

.svc-ai-eyelid--right {
    left: 54.0%;
}

@keyframes botEyesBlink {
    /* 0% - 28%: Прыжок смайлика идет отдельно — глаза полностью открыты (0.0s - 2.8s) */
    0%, 28% {
        opacity: 0;
        transform: scaleY(0);
    }
    /* 31% - 34%: Моргание #1 (~3.2s) */
    31% {
        opacity: 0;
        transform: scaleY(0);
    }
    32.5% {
        opacity: 1;
        transform: scaleY(1);
    }
    34% {
        opacity: 0;
        transform: scaleY(0);
    }
    /* 59% - 62%: Моргание #2 (~6.0s - через 2.8s после первого) */
    59% {
        opacity: 0;
        transform: scaleY(0);
    }
    60.5% {
        opacity: 1;
        transform: scaleY(1);
    }
    62% {
        opacity: 0;
        transform: scaleY(0);
    }
    /* 87% - 90%: Моргание #3 (~8.8s - через 2.8s после второго) */
    87% {
        opacity: 0;
        transform: scaleY(0);
    }
    88.5% {
        opacity: 1;
        transform: scaleY(1);
    }
    90% {
        opacity: 0;
        transform: scaleY(0);
    }
    /* 91% - 100%: Глаза спокойно открыты перед следующим прыжком (9.1s - 10.0s) */
    100% {
        opacity: 0;
        transform: scaleY(0);
    }
}

/* В статическом режиме (без режима обучения) смайлик в верхней части плавно подпрыгивает два раза каждые 10 секунд */
#settingsPopover:not(.wb-tour-popover-open) .settings-popover-bot-shell .svc-ai-avatar-face,
#settingsPopover:not(.wb-tour-popover-open) .settings-popover-bot-shell .svc-ai-avatar {
    animation: botAvatarDoubleBounce 10s ease-in-out infinite;
    transform-origin: center bottom;
}

@keyframes botAvatarDoubleBounce {
    0%, 16%, 100% {
        transform: translateY(0) scale(1);
    }
    3% {
        transform: translateY(-7px) scale(1.06);
    }
    6% {
        transform: translateY(0) scale(0.98);
    }
    9% {
        transform: translateY(-5px) scale(1.04);
    }
    12% {
        transform: translateY(0) scale(0.99);
    }
    14% {
        transform: translateY(-1.5px) scale(1.01);
    }
}

/* При обучении на шаге 4: игривая выглядывающая диагональная анимация */
#settingsPopover.wb-tour-popover-open .settings-popover-bot-shell {
    animation: botTourPeekDiagonal 1.6s ease-in-out infinite;
}

@keyframes botTourPeekDiagonal {
    0%, 100% {
        transform: rotate(135deg) translate(0, 0) scale(1);
    }
    25% {
        transform: rotate(142deg) translate(-4px, -4px) scale(1.08);
    }
    50% {
        transform: rotate(135deg) translate(2px, 2px) scale(0.96);
    }
    75% {
        transform: rotate(128deg) translate(-3px, -3px) scale(1.05);
    }
}

/* Календарь периода поверх блока настроек */
.analysis-calendar-popover {
    z-index: 100050 !important;
}

/* Группы модулей анализа */
.analysis-module-group {
    display: block;
    margin-bottom: 8px;
    border-radius: 14px;
    transition: all 0.2s ease;
}

/* Активное выделение модуля (ряд переключателя + меню настроек) одинарной аккуратной линией */
.analysis-module-group.wb-tour-target-active {
    position: relative !important;
    z-index: 10 !important;
    box-shadow: 0 0 0 1.5px #ff6d00, 0 4px 16px rgba(255, 109, 0, 0.16) !important;
    border-radius: 14px !important;
    padding: 3px !important;
    margin: -3px -3px 5px -3px !important;
    background: rgba(255, 109, 0, 0.04) !important;
    transition: all 0.25s ease !important;
}

.analysis-module-group.wb-tour-target-active .analysis-setting-row,
.analysis-module-group.wb-tour-target-active .analyze-cfg-sub {
    box-shadow: none !important;
}

.analysis-setting-row.wb-tour-target-active,
.analyze-cfg-sub.wb-tour-target-active {
    box-shadow: 0 0 0 1.5px #ff6d00 !important;
    background: #fff7ed !important;
    border-radius: 12px !important;
    transition: all 0.25s ease !important;
}

/* Карточка тура (модалка и тултип) */
.wb-tour-card {
    display: none;
    position: absolute;
    z-index: 100000 !important;
    background: #ffffff;
    border-radius: 18px;
    box-shadow: 0 20px 45px -10px rgba(0, 0, 0, 0.32),
                0 0 0 1px rgba(0, 0, 0, 0.08);
    width: 400px;
    max-width: min(92vw, 420px);
    font-family: 'Onest', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    box-sizing: border-box;
    opacity: 0;
    transform: scale(0.96);
    transition: opacity 0.22s ease, transform 0.22s ease;
    color: #111827;
    overflow: hidden;
}

.wb-tour-card.is-visible {
    display: block;
    opacity: 1;
    transform: scale(1);
}

/* Модальный режим (заставка и прощание) */
.wb-tour-card.is-modal {
    position: fixed !important;
    top: 50% !important;
    left: 50% !important;
    transform: translate(-50%, -50%) scale(0.96) !important;
}

.wb-tour-card.is-modal.is-visible {
    transform: translate(-50%, -50%) scale(1) !important;
}

/* Стрелочка тултипа */
.wb-tour-arrow {
    position: absolute;
    width: 14px;
    height: 14px;
    background: #ffffff;
    transform: rotate(45deg);
    z-index: -1;
    border: 1px solid rgba(0, 0, 0, 0.08);
}

.wb-tour-arrow[data-placement="top"] {
    bottom: -7px;
    left: calc(50% - 7px);
    border-top: none;
    border-left: none;
}

.wb-tour-arrow[data-placement="bottom"] {
    top: -7px;
    left: calc(50% - 7px);
    border-bottom: none;
    border-right: none;
}

.wb-tour-arrow[data-placement="left"] {
    right: -7px;
    top: calc(50% - 7px);
    border-bottom: none;
    border-left: none;
}

.wb-tour-arrow[data-placement="right"] {
    left: -7px;
    top: calc(50% - 7px);
    border-top: none;
    border-right: none;
}

/* Шапка карточки для заставки/прощания */
.wb-tour-hero-banner {
    position: relative;
    height: 100px;
    background: linear-gradient(135deg, #ff1d25 0%, #ff6b00 60%, #ffa133 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

.wb-tour-hero-pattern {
    position: absolute;
    inset: 0;
    opacity: 0.12;
    background-image: radial-gradient(#ffffff 2px, transparent 2px);
    background-size: 16px 16px;
}

.wb-tour-hero-icon-box {
    position: relative;
    width: 52px;
    height: 52px;
    border-radius: 14px;
    background: rgba(255, 255, 255, 0.22);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    display: flex;
    align-items: center;
    justify-content: center;
    color: #ffffff;
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.15),
                inset 0 1px 0 rgba(255, 255, 255, 0.4);
}

.wb-tour-hero-icon-box svg {
    width: 28px;
    height: 28px;
}

/* Кнопка закрытия (крестик) */
.wb-tour-close-btn {
    position: absolute;
    top: 12px;
    right: 12px;
    width: 30px;
    height: 30px;
    border-radius: 8px;
    border: none;
    background: rgba(0, 0, 0, 0.05);
    color: #6b7280;
    font-size: 18px;
    line-height: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    z-index: 10;
    transition: background 0.2s, color 0.2s, transform 0.15s;
}

.wb-tour-card.is-modal .wb-tour-close-btn {
    background: rgba(255, 255, 255, 0.25);
    color: #ffffff;
}

.wb-tour-close-btn:hover {
    background: rgba(0, 0, 0, 0.12);
    color: #111827;
    transform: scale(1.05);
}

.wb-tour-card.is-modal .wb-tour-close-btn:hover {
    background: rgba(255, 255, 255, 0.45);
    color: #ffffff;
}

/* Контент карточки */
.wb-tour-content {
    padding: 20px 22px;
}

.wb-tour-title {
    font-size: 18px;
    font-weight: 700;
    color: #111827;
    margin: 0 0 8px;
    line-height: 1.3;
    padding-right: 24px;
}

.wb-tour-text {
    font-size: 14px;
    line-height: 1.5;
    color: #4b5563;
    margin: 0 0 16px;
}

.wb-tour-text a,
.wb-tour-link {
    color: #ff6b00;
    text-decoration: underline;
    font-weight: 600;
}

.wb-tour-text a:hover,
.wb-tour-link:hover {
    color: #e05500;
}

.wb-tour-text strong {
    font-weight: 700;
    color: #111827;
}

.wb-tour-hint-anchor {
    position: relative;
    display: inline;
}

/* Направляющие тонкие и плавные извилистые стрелочки-подсказки */
.wb-tour-hint-arrows-layer {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    pointer-events: none;
    z-index: 100002 !important;
    overflow: visible;
}

.wb-tour-hint-path {
    fill: none;
    stroke: url(#wbTourHintArrowGrad);
    stroke-width: 1.8px;
    stroke-linecap: round;
    stroke-linejoin: round;
    marker-end: url(#wbTourHintArrowHead);
    filter: drop-shadow(0 2px 5px rgba(255, 109, 0, 0.32));
    opacity: 0;
    transition: opacity 0.22s ease;
}

.wb-tour-hint-path.is-visible {
    opacity: 1;
}

.wb-tour-hint-dot {
    fill: #ff6d00;
    filter: drop-shadow(0 1px 3px rgba(255, 109, 0, 0.4));
    opacity: 0;
    transition: opacity 0.22s ease;
}

.wb-tour-hint-dot.is-visible {
    opacity: 1;
}

/* Футер: пагинация и кнопки */
.wb-tour-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding-top: 14px;
    border-top: 1px solid #f3f4f6;
}

/* Точки пагинации */
.wb-tour-dots {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-wrap: wrap;
    max-width: 220px;
}

.wb-tour-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #e5e7eb;
    border: none;
    padding: 0;
    cursor: pointer;
    transition: all 0.2s ease;
}

.wb-tour-dot:hover {
    background: #9ca3af;
    transform: scale(1.25);
}

.wb-tour-dot.is-active {
    background: #ff6b00;
    width: 18px;
    border-radius: 4px;
}

/* Кнопки действий */
.wb-tour-actions {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-left: auto;
}

.wb-tour-btn-secondary {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 8px 14px;
    font-size: 13px;
    font-weight: 600;
    color: #374151;
    background: #ffffff;
    border: 1px solid #d1d5db;
    border-radius: 8px;
    cursor: pointer;
    transition: background 0.15s, border-color 0.15s;
    user-select: none;
}

.wb-tour-btn-secondary:hover {
    background: #f9fafb;
    border-color: #9ca3af;
}

.wb-tour-btn-primary {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 8px 18px;
    font-size: 13px;
    font-weight: 600;
    color: #ffffff;
    background: #111827;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    transition: background 0.2s, transform 0.1s;
    user-select: none;
}

.wb-tour-btn-primary:hover {
    background: #000000;
    transform: translateY(-1px);
}

/* Кнопка-виджет в правом верхнем углу (Launcher) */
.wb-tour-launcher {
    position: fixed;
    top: 96px;
    right: 0;
    z-index: 99980;
    display: flex;
    align-items: center;
    background: linear-gradient(135deg, #ff1d25, #ff6b00);
    color: #ffffff;
    padding: 9px 15px 9px 12px;
    border-radius: 20px 0 0 20px;
    box-shadow: -3px 4px 16px rgba(255, 107, 0, 0.35);
    cursor: pointer;
    border: none;
    font-family: 'Onest', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    font-size: 13px;
    font-weight: 600;
    gap: 8px;
    transform: translateX(calc(100% - 40px));
    transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1),
                box-shadow 0.25s ease,
                background 0.25s ease;
}

.wb-tour-launcher:hover,
.wb-tour-launcher.is-peeking {
    transform: translateX(0) !important;
    box-shadow: -4px 6px 22px rgba(255, 107, 0, 0.5) !important;
}

/* На телефонах и маленьких экранах убираем иконку wb-tour-launcher при открытии сайдбара */
body.sidebar-mobile-open .wb-tour-launcher,
body.mobile-menu-open .wb-tour-launcher,
body.sidebar-open .wb-tour-launcher {
    display: none !important;
    opacity: 0 !important;
    visibility: hidden !important;
    pointer-events: none !important;
    transform: translateX(100%) !important;
}

@media (max-width: 768px) {
    body.sidebar-mobile-open .wb-tour-launcher,
    body:has(#mainSidebar:not(.collapsed)) .wb-tour-launcher,
    body:has(.sidebar:not(.collapsed)) .wb-tour-launcher,
    body:has([data-sidebar-mobile-backdrop]:not([hidden])) .wb-tour-launcher,
    body:has(.sidebar-mobile-backdrop:not([hidden])) .wb-tour-launcher {
        display: none !important;
        opacity: 0 !important;
        visibility: hidden !important;
        pointer-events: none !important;
        transform: translateX(100%) !important;
    }
}

/* Шаг «Применить»: кнопка в настройках анализа обводится черным */
body[data-wb-tour-step="step-analysis-apply"] .wb-tour-spotlight {
    border: 2px solid #000000 !important;
    border-radius: 16px !important;
    box-sizing: border-box !important;
    box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.5), 0 3px 14px rgba(0, 0, 0, 0.4) !important;
}

body[data-wb-tour-step="step-analysis-apply"] #settingsPopover button[type="submit"],
#settingsPopover button[type="submit"].wb-tour-target-active {
    background: linear-gradient(135deg, #ff6d00 0%, #ff9e00 100%) !important;
    color: #ffffff !important;
}

/* Подсветка плашки БЕЛЫМ на финальном экране */
.wb-tour-launcher.wb-tour-launcher-highlighted {
    z-index: 99997 !important;
    background: #ffffff !important;
    color: #ff6b00 !important;
    border: 2px solid #ff6b00 !important;
    box-shadow: -4px 6px 25px rgba(255, 107, 0, 0.45) !important;
    transform: translateX(0) !important;
    animation: none !important;
}

.wb-tour-launcher.wb-tour-launcher-highlighted .wb-tour-launcher-text {
    color: #111827 !important;
    font-weight: 700 !important;
}

.wb-tour-launcher.wb-tour-launcher-highlighted svg {
    stroke: #ff6b00 !important;
}

.wb-tour-launcher-arrow {
    display: flex;
    align-items: center;
    justify-content: center;
}

.wb-tour-launcher-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 20px;
    height: 20px;
}

.wb-tour-launcher-text {
    white-space: nowrap;
}

/* Демо-анимация фильтра с крестиком и курсором мыши */
.wb-tour-demo-filter-wrap {
    display: inline-flex;
    align-items: center;
    position: relative;
    padding: 4px 28px 4px 10px;
    background: #fff3eb;
    border: 1px solid #ffd8bf;
    border-radius: 8px;
    font-size: 13px;
    color: #d4380d;
    font-weight: 500;
    margin: 4px 0;
    user-select: none;
}

.wb-tour-demo-filter-wrap.is-struck {
    text-decoration: line-through;
    opacity: 0.45;
    background: #f5f5f5;
    border-color: #d9d9d9;
    color: #8c8c8c;
    transition: all 0.3s ease;
}

.wb-tour-demo-close-x {
    position: absolute;
    right: 7px;
    top: 50%;
    transform: translateY(-50%);
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: rgba(212, 56, 13, 0.15);
    color: #d4380d;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 11px;
    line-height: 1;
}

.wb-tour-demo-cursor {
    position: absolute;
    width: 22px;
    height: 22px;
    z-index: 5;
    pointer-events: none;
    transform-origin: top left;
    filter: drop-shadow(0 2px 4px rgba(0,0,0,0.25));
}

@keyframes wbTourCursorClickLoop {
    0% {
        top: 36px;
        left: -20px;
        opacity: 0;
        transform: scale(1);
    }
    15% {
        opacity: 1;
    }
    48% {
        top: calc(50% - 4px);
        left: calc(100% - 14px);
        transform: scale(1);
    }
    58% {
        top: calc(50% - 4px);
        left: calc(100% - 14px);
        transform: scale(0.85);
    }
    68% {
        top: calc(50% - 4px);
        left: calc(100% - 14px);
        transform: scale(1);
    }
    85% {
        opacity: 1;
    }
    100% {
        top: calc(50% - 4px);
        left: calc(100% - 14px);
        opacity: 0;
        transform: scale(1);
    }
}

.wb-tour-demo-cursor.is-animated {
    animation: wbTourCursorClickLoop 3.6s infinite ease-in-out;
}

/* Адаптивность */
@media (max-width: 768px) {
    body.sidebar-mobile-open .wb-tour-launcher,
    body:has(#mainSidebar:not(.collapsed)) .wb-tour-launcher {
        display: none !important;
        opacity: 0 !important;
        visibility: hidden !important;
        pointer-events: none !important;
    }
}

@media (max-width: 600px) {
    .wb-tour-card {
        width: calc(100vw - 20px);
        border-radius: 14px;
    }
    .wb-tour-content {
        padding: 16px 14px;
    }
    .wb-tour-title {
        font-size: 16px;
    }
    .wb-tour-text {
        font-size: 13px;
        margin-bottom: 12px;
    }
    .wb-tour-dots {
        max-width: 130px;
    }
    .wb-tour-launcher {
        top: 76px;
        font-size: 12px;
    }
}
