/* ==================================================================
   Задача №405. Обучение по разделам: оформление.

   Подсказки intro.js по умолчанию выглядят как всплывающие окна
   из старого интернета. Здесь — спокойная карточка со скруглением,
   мягким затемнением и крупными кнопками под палец: обучение должно
   ощущаться частью приложения, а не служебным всплытием.
   ================================================================== */

/* ---------- Затемнение и подсветка ---------- */

.introjs-overlay {
    background: rgba(12, 16, 28, .62) !important;
    opacity: 1 !important;
    backdrop-filter: blur(2px);
    -webkit-backdrop-filter: blur(2px);
    animation: mc-tour-fade .28s ease both;
}

.introjs-helperLayer {
    border-radius: 18px !important;
    background: transparent !important;
    box-shadow: 0 0 0 4px rgba(255, 255, 255, .22),
                0 0 0 9999px rgba(12, 16, 28, .62),
                0 18px 44px rgba(0, 0, 0, .3) !important;
    transition: all .32s cubic-bezier(.22, .61, .36, 1) !important;
}

/* Тонкое свечение вокруг выделенного места — взгляд сам идёт туда. */
.introjs-helperLayer::after {
    content: '';
    position: absolute;
    inset: -4px;
    border-radius: 22px;
    border: 1.5px solid rgba(255, 255, 255, .5);
    animation: mc-tour-pulse 2.4s ease-in-out infinite;
    pointer-events: none;
}

.introjs-showElement,
.introjs-showElement * { z-index: auto !important; }

/* ---------- Карточка подсказки ---------- */

.introjs-tooltip.sermTourTip {
    min-width: 288px;
    max-width: min(92vw, 380px);
    padding: 0;
    border: 0;
    border-radius: 22px;
    background: var(--mc-surface, #fff);
    color: var(--mc-ink, #1f2440);
    box-shadow: 0 24px 60px rgba(10, 14, 28, .38);
    animation: mc-tour-pop .34s cubic-bezier(.2, .9, .3, 1.15) both;
    overflow: hidden;
}

.sermTourTip .introjs-tooltiptext {
    padding: 20px 20px 8px;
    font-size: 15.5px;
    line-height: 1.55;
    color: var(--mc-ink, #1f2440);
}

.sermTourTip .introjs-tooltiptext b { font-weight: 700; }

/* Стрелка — маленькая и в цвет карточки, без рамок. */
.sermTourTip .introjs-arrow {
    border-width: 9px;
}

.sermTourTip .introjs-arrow.top { border-bottom-color: var(--mc-surface, #fff); }
.sermTourTip .introjs-arrow.bottom { border-top-color: var(--mc-surface, #fff); }
.sermTourTip .introjs-arrow.left { border-right-color: var(--mc-surface, #fff); }
.sermTourTip .introjs-arrow.right { border-left-color: var(--mc-surface, #fff); }

/* ---------- Низ карточки: прогресс и кнопки ---------- */

.sermTourTip .introjs-tooltipbuttons {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px 16px 16px;
    border-top: 0;
}

.sermTourTip .introjs-button {
    flex: 1;
    min-height: 46px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0 18px;
    border: 0;
    border-radius: 14px;
    background: var(--mc-surface-soft, #f1f4fb);
    color: var(--mc-ink, #1f2440);
    font-size: 15px;
    font-weight: 600;
    text-shadow: none;
    transition: transform .12s ease, filter .2s ease;
}

.sermTourTip .introjs-button:hover,
.sermTourTip .introjs-button:focus { background: var(--mc-surface-soft, #f1f4fb); color: var(--mc-ink, #1f2440); }
.sermTourTip .introjs-button:active { transform: scale(.97); }

.sermTourTip .introjs-nextbutton,
.sermTourTip .introjs-donebutton {
    background: var(--mc-brand, #3b6ef2);
    color: #fff;
    box-shadow: 0 10px 22px rgba(59, 110, 242, .3);
}

.sermTourTip .introjs-nextbutton:hover,
.sermTourTip .introjs-donebutton:hover { background: var(--mc-brand, #3b6ef2); color: #fff; }

.sermTourTip .introjs-disabled,
.sermTourTip .introjs-disabled:hover { opacity: .4; }

/* Точки-шаги: тонкая полоска вместо крупных кругов. */
.sermTourTip .introjs-bullets { padding: 0 20px 4px; }
.sermTourTip .introjs-bullets ul { display: flex; justify-content: center; gap: 6px; }

.sermTourTip .introjs-bullets ul li a {
    width: 6px;
    height: 6px;
    border-radius: 3px;
    background: var(--mc-line, #e2e7f3);
    transition: width .25s ease, background .25s ease;
}

.sermTourTip .introjs-bullets ul li a.active {
    width: 20px;
    background: var(--mc-brand, #3b6ef2);
}

.sermTourTip .introjs-progress { display: none; }

/* ---------- Управление обучением ---------- */

#sermTourBar {
    position: fixed;
    left: 50%;
    right: auto;
    top: calc(10px + env(safe-area-inset-top, 0px));
    bottom: auto;
    transform: translateX(-50%);
    white-space: nowrap;
    z-index: 1000000;
    display: flex;
    gap: 6px;
    padding: 6px;
    border-radius: 999px;
    background: rgba(22, 26, 40, .92);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    box-shadow: 0 14px 34px rgba(0, 0, 0, .35);
    animation: mc-tour-bar .3s ease both;
}

#sermTourBar button {
    min-height: 38px;
    padding: 0 15px;
    white-space: nowrap;
    border: 0;
    border-radius: 999px;
    background: rgba(255, 255, 255, .14);
    color: #fff;
    font-size: 14px;
    font-weight: 600;
}

#sermTourBar #sermTourPause { background: rgba(255, 255, 255, .16); }
#sermTourBar #sermTourStop { background: rgba(255, 255, 255, .08); color: #ffd9d9; }

#sermTourResume {
    position: fixed;
    left: 50%;
    right: auto;
    bottom: calc(78px + env(safe-area-inset-bottom, 0px));
    transform: translateX(-50%);
    z-index: 1000000;
    min-height: 46px;
    padding: 0 20px;
    border: 0;
    border-radius: 999px;
    background: var(--mc-brand, #3b6ef2);
    color: #fff;
    font-size: 14.5px;
    font-weight: 600;
    box-shadow: 0 14px 30px rgba(59, 110, 242, .38);
    animation: mc-tour-chip .3s ease both;
}

/* Кнопка «пропустить» у intro.js своя — она нам не нужна: выход из
   обучения сделан отдельной понятной кнопкой внизу. */
.introjs-skipbutton { display: none !important; }

/* ---------- Тёмная тема ---------- */

@media (prefers-color-scheme: dark) {
    .introjs-tooltip.sermTourTip {
        background: #1b2030;
        color: #eef1f8;
        box-shadow: 0 24px 60px rgba(0, 0, 0, .6);
    }

    .sermTourTip .introjs-tooltiptext { color: #eef1f8; }
    .sermTourTip .introjs-arrow.top { border-bottom-color: #1b2030; }
    .sermTourTip .introjs-arrow.bottom { border-top-color: #1b2030; }
    .sermTourTip .introjs-arrow.left { border-right-color: #1b2030; }
    .sermTourTip .introjs-arrow.right { border-left-color: #1b2030; }

    .sermTourTip .introjs-button { background: #262d40; color: #eef1f8; }
    .sermTourTip .introjs-nextbutton, .sermTourTip .introjs-donebutton { background: #6d97ff; color: #101423; }
}

/* ---------- Движение ---------- */

@keyframes mc-tour-fade { from { opacity: 0; } to { opacity: 1; } }

@keyframes mc-tour-pop {
    0% { opacity: 0; transform: translateY(12px) scale(.96); }
    100% { opacity: 1; transform: none; }
}

@keyframes mc-tour-bar {
    from { opacity: 0; transform: translate(-50%, -14px); }
    to { opacity: 1; transform: translate(-50%, 0); }
}

@keyframes mc-tour-chip {
    from { opacity: 0; transform: translate(-50%, 14px); }
    to { opacity: 1; transform: translate(-50%, 0); }
}

@keyframes mc-tour-pulse {
    0%, 100% { opacity: .55; transform: scale(1); }
    50% { opacity: .15; transform: scale(1.015); }
}

@media (prefers-reduced-motion: reduce) {
    .introjs-overlay,
    .introjs-tooltip.sermTourTip,
    #sermTourBar,
    #sermTourResume { animation: none !important; }

    .introjs-helperLayer::after { animation: none !important; }
}
