/* ============================================================================
   DSchool — оформлення навчального туру (driver.js) + підказки «?» біля полів.
   Гама платформи: emerald #047857, cream #faf8f3, ink #0d1410, amber #f59e0b.
   ========================================================================== */

/* Bootstrap вмикає :root{scroll-behavior:smooth}. driver.js рахує позицію
   підсвітки та попапа одразу після скролу, не чекаючи плавної анімації —
   через це «дірка» в затемненні й плашка з текстом опиняються не на елементі.
   На час туру повертаємо миттєвий скрол. */
html.ds-tour-running,
html.ds-tour-running body {
    scroll-behavior: auto !important;
}

/* ---------------------------------------------------------------- Попап -- */
.driver-popover.ds-pop {
    /* Саме fixed: driver.js позиціонує попап у координатах вікна. Якщо зробити
       relative, плашка стає звичайним блоком у кінці <body> — тягне за собою
       висоту сторінки й опиняється в самому низу, замість того щоб стояти
       біля підсвіченого елемента. */
    position: fixed;
    border-radius: 20px !important;
    padding: 20px 22px 17px !important;
    max-width: 430px !important;
    min-width: 330px !important;
    background: linear-gradient(180deg, #ffffff 0%, #fdfdfb 100%) !important;
    box-shadow:
        0 32px 70px -18px rgba(4, 60, 40, .38),
        0 8px 22px -12px rgba(4, 60, 40, .22),
        0 0 0 1px rgba(13, 20, 16, .06) !important;
    font-family: 'Manrope', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif !important;
    overflow: hidden;
    animation: ds-pop-in .34s cubic-bezier(.22, 1, .36, 1);
}

/* Фірмова смужка згори — попап читається як частина платформи, а не як плагін */
.driver-popover.ds-pop::before {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0;
    height: 3px;
    background: linear-gradient(90deg, #10b981, #047857 55%, #f59e0b);
    border-radius: 20px 20px 0 0;
}

@keyframes ds-pop-in {
    from { opacity: 0; transform: translateY(8px) scale(.985); }
    to   { opacity: 1; transform: translateY(0) scale(1); }
}

/* Затемнення сторінки під час туру.
   БЕЗ backdrop-filter: оверлей — це один SVG на весь екран із вирізаним
   «вікном» під елемент. backdrop-filter розмиває всю площу елемента, а не
   лише зафарбовану частину, тож підсвічений блок теж ставав каламутним.
   Фокус дає саме затемнення (overlayOpacity), і цього достатньо. */
.driver-overlay { backdrop-filter: none; }

/* Картка-обкладинка розділу (крок без прив'язки до елемента) — ширша */
.driver-popover.ds-pop--cover { max-width: 480px !important; }

/* --- Шапка: іконка + група/розділ + номер розділу --- */
.ds-pop__eyebrow {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 13px;
    padding-bottom: 12px;
    border-bottom: 1px solid rgba(13, 20, 16, .08);
}
.ds-pop__icon {
    flex: none;
    display: grid;
    place-items: center;
    width: 38px; height: 38px;
    border-radius: 12px;
    background: linear-gradient(135deg, #10b981, #047857);
    color: #fff;
    box-shadow: 0 6px 16px -6px rgba(4, 120, 87, .55), inset 0 1px 0 rgba(255, 255, 255, .25);
}
.ds-pop__icon svg { width: 19px; height: 19px; }
.ds-pop__eyebrow-text { display: flex; flex-direction: column; min-width: 0; line-height: 1.25; }
.ds-pop__group {
    font-size: 10px;
    font-weight: 800;
    letter-spacing: .1em;
    text-transform: uppercase;
    color: #047857;
}
.ds-pop__section {
    font-size: 13px;
    font-weight: 600;
    color: rgba(13, 20, 16, .55);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.ds-pop__section-no {
    margin-inline-start: auto;
    flex: none;
    font-size: 10.5px;
    font-weight: 700;
    color: rgba(13, 20, 16, .5);
    background: rgba(13, 20, 16, .05);
    border-radius: 100px;
    padding: 4px 10px;
}

/* --- Заголовок і опис --- */
.ds-pop .driver-popover-title {
    font-family: 'Bricolage Grotesque', sans-serif !important;
    font-size: 18px !important;
    font-weight: 700 !important;
    letter-spacing: -.02em !important;
    line-height: 1.28 !important;
    color: #0d1410 !important;
    margin-bottom: 7px !important;
}
.ds-pop .driver-popover-description {
    font-size: 14px !important;
    line-height: 1.55 !important;
    color: rgba(13, 20, 16, .72) !important;
    margin-bottom: 0 !important;
}

/* --- Блок «Навіщо це вам» --- */
.ds-pop__why {
    position: relative;
    margin-top: 13px;
    padding: 12px 14px 12px 16px;
    border-radius: 13px;
    background: linear-gradient(135deg, rgba(16, 185, 129, .09), rgba(16, 185, 129, .045));
    border: 1px solid rgba(4, 120, 87, .15);
    overflow: hidden;
}
/* Акцентна грань зліва — око одразу знаходить головну думку кроку */
.ds-pop__why::before {
    content: '';
    position: absolute;
    left: 0; top: 0; bottom: 0;
    width: 3px;
    background: linear-gradient(180deg, #10b981, #047857);
}
.ds-pop__why-label {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 10.5px;
    font-weight: 800;
    letter-spacing: .08em;
    text-transform: uppercase;
    color: #047857;
    margin-bottom: 5px;
}
.ds-pop__why-label svg { width: 13px; height: 13px; }
.ds-pop__why-text {
    display: block;
    font-size: 13px;
    line-height: 1.55;
    color: rgba(13, 20, 16, .74);
}

/* --- Прогрес --- */
.ds-pop .driver-popover-progress-text {
    display: block !important;
    width: 100%;
    margin: 14px 0 10px !important;
    font-size: 11px !important;
    color: rgba(13, 20, 16, .5) !important;
}
.ds-pop__bar {
    display: block;
    height: 5px;
    border-radius: 100px;
    background: rgba(13, 20, 16, .08);
    overflow: hidden;
    margin-bottom: 7px;
}
.ds-pop__bar-fill {
    display: block;
    height: 100%;
    border-radius: 100px;
    background: linear-gradient(90deg, #10b981, #047857);
    transition: width .35s cubic-bezier(.22, 1, .36, 1);
}
.ds-pop__meta { display: flex; justify-content: space-between; gap: 10px; flex-wrap: wrap; }
.ds-pop__meta-page { font-weight: 700; color: rgba(13, 20, 16, .62); }

/* --- Кнопки --- */
.ds-pop .driver-popover-footer { margin-top: 4px !important; gap: 8px !important; }
.ds-pop .driver-popover-footer button {
    font-family: inherit !important;
    font-size: 13.5px !important;
    font-weight: 700 !important;
    border-radius: 10px !important;
    padding: 9px 18px !important;
    text-shadow: none !important;
    transition: background .15s, border-color .15s, transform .08s;
}
.ds-pop .driver-popover-footer button:active { transform: scale(.97); }
.ds-pop .driver-popover-next-btn {
    background: #047857 !important;
    border: 1px solid #047857 !important;
    color: #fff !important;
}
.ds-pop .driver-popover-next-btn:hover { background: #065f46 !important; }
.ds-pop .driver-popover-prev-btn {
    background: #fff !important;
    border: 1px solid rgba(13, 20, 16, .14) !important;
    color: rgba(13, 20, 16, .7) !important;
}
.ds-pop .driver-popover-prev-btn:hover { border-color: #047857 !important; color: #047857 !important; }
.ds-pop .driver-popover-close-btn { color: rgba(13, 20, 16, .35) !important; }
.ds-pop .driver-popover-close-btn:hover { color: #0d1410 !important; }
.ds-pop .driver-popover-arrow { border-color: #fff !important; }

@media (max-width: 560px) {
    .driver-popover.ds-pop { min-width: 0 !important; max-width: calc(100vw - 24px) !important; }
    .ds-pop__section-no { display: none; }
}

/* ------------------------------------------------- Кнопка «?» у шапці --- */
.ds-tour-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    border: 1px solid rgba(4, 120, 87, .28);
    background: rgba(16, 185, 129, .09);
    color: #047857;
    border-radius: 10px;
    padding: 7px 12px;
    font-size: 12.5px;
    font-weight: 700;
    cursor: pointer;
    transition: background .15s, transform .08s;
}
.ds-tour-btn:hover { background: rgba(16, 185, 129, .16); }
.ds-tour-btn:active { transform: scale(.96); }
.ds-tour-btn svg { width: 15px; height: 15px; }
@media (max-width: 720px) { .ds-tour-btn span { display: none; } .ds-tour-btn { padding: 7px 9px; } }

/* --------------------------------------------- Підказки «?» біля полів --- */
.ds-hint {
    display: inline-grid;
    place-items: center;
    width: 16px; height: 16px;
    margin-inline-start: 5px;
    border-radius: 50%;
    border: 1px solid rgba(4, 120, 87, .35);
    background: rgba(16, 185, 129, .10);
    color: #047857;
    font-size: 10.5px;
    font-weight: 800;
    line-height: 1;
    cursor: pointer;
    vertical-align: middle;
    user-select: none;
    padding: 0;
    transition: background .15s, transform .08s;
}
.ds-hint:hover { background: rgba(16, 185, 129, .2); }
.ds-hint:active { transform: scale(.9); }
.ds-hint[aria-expanded="true"] { background: #047857; color: #fff; border-color: #047857; }

.ds-hint-pop {
    position: absolute;
    z-index: 2000;
    max-width: 320px;
    background: #0d1410;
    color: #f5fdf9;
    font-size: 12.5px;
    line-height: 1.5;
    font-weight: 500;
    border-radius: 11px;
    padding: 10px 13px;
    box-shadow: 0 14px 34px rgba(0, 0, 0, .28);
    opacity: 0;
    transform: translateY(-4px);
    transition: opacity .16s, transform .16s;
    pointer-events: none;
}
.ds-hint-pop.is-open { opacity: 1; transform: translateY(0); pointer-events: auto; }
.ds-hint-pop::after {
    content: '';
    position: absolute;
    top: -5px;
    left: var(--arrow-x, 20px);
    width: 10px; height: 10px;
    background: #0d1410;
    transform: rotate(45deg);
    border-radius: 2px;
}
