/* StartBlok - Tawk Flex v17
   One stable StartBlok launcher controls the real Tawk window.
   No iframe tracking, no scroll recalculation, no detached close button.
*/

.tawk-flex {
    --tawk-launcher-size: 58px;
    --tawk-dismiss-size: 22px;
    --tawk-safe-left: max(18px, env(safe-area-inset-left));
    --tawk-safe-bottom: max(18px, env(safe-area-inset-bottom));

    position: fixed;
    left: var(--tawk-safe-left);
    bottom: var(--tawk-safe-bottom);
    width: calc(var(--tawk-launcher-size) + 8px);
    height: calc(var(--tawk-launcher-size) + 8px);
    z-index: 1400;

    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transform: translateY(6px) scale(.97);
    transform-origin: bottom left;
    transition:
        opacity .18s ease,
        transform .18s ease,
        visibility 0s linear .18s;
}

.tawk-flex.is-visible {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
    transform: translateY(0) scale(1);
    transition-delay: 0s;
}

.tawk-flex__open,
.tawk-flex__dismiss {
    -webkit-tap-highlight-color: transparent;
    appearance: none;
    cursor: pointer;
}

.tawk-flex__open {
    position: absolute;
    left: 0;
    bottom: 0;
    display: grid;
    place-items: center;
    width: var(--tawk-launcher-size);
    height: var(--tawk-launcher-size);
    padding: 0;
    border: 1px solid rgba(255, 255, 255, .9);
    border-radius: 50%;
    background: #fff;
    color: #090909;
    box-shadow:
        0 12px 30px rgba(0, 0, 0, .28),
        0 2px 8px rgba(0, 0, 0, .16);
    font-size: 23px;
    line-height: 1;
    transition: transform .16s ease, box-shadow .16s ease, background-color .16s ease;
}

.tawk-flex__open i {
    pointer-events: none;
}

.tawk-flex__dismiss {
    position: absolute;
    top: 0;
    right: 0;
    z-index: 2;
    display: grid;
    place-items: center;
    width: var(--tawk-dismiss-size);
    height: var(--tawk-dismiss-size);
    padding: 0;
    border: 1px solid rgba(255, 255, 255, .32);
    border-radius: 50%;
    background: #111;
    color: rgba(255, 255, 255, .92);
    box-shadow: 0 4px 12px rgba(0, 0, 0, .32);
    transition: transform .14s ease, background-color .14s ease, color .14s ease;
}

.tawk-flex__dismiss::before,
.tawk-flex__dismiss::after {
    content: '';
    position: absolute;
    width: 8px;
    height: 1.25px;
    border-radius: 999px;
    background: currentColor;
}

.tawk-flex__dismiss::before { transform: rotate(45deg); }
.tawk-flex__dismiss::after { transform: rotate(-45deg); }

@media (hover: hover) and (pointer: fine) {
    .tawk-flex__open:hover {
        transform: translateY(-2px) scale(1.025);
        box-shadow:
            0 16px 38px rgba(0, 0, 0, .32),
            0 0 0 4px rgba(199, 255, 0, .09);
    }

    .tawk-flex__dismiss:hover {
        transform: scale(1.08);
        background: #1c1c1c;
        color: #fff;
    }
}

.tawk-flex__open:focus-visible,
.tawk-flex__dismiss:focus-visible {
    outline: 2px solid #c7ff00;
    outline-offset: 3px;
}

/* Site modal UX: the chat launcher stays below StartBlok dialogs. */
body.sb4-estimator-open .tawk-flex,
body.is-modal-open .tawk-flex {
    z-index: 1400;
}

/* Mobile navigation is the active task. The launcher is fully removed from
   interaction while the bottom sheet is open. The real Tawk window is hidden
   through the API and also sits below this sheet via its configured z-index. */
@media (max-width: 900px) {
    .tawk-flex {
        --tawk-launcher-size: 54px;
        --tawk-dismiss-size: 20px;
        --tawk-safe-left: max(14px, env(safe-area-inset-left));
        --tawk-safe-bottom: max(14px, env(safe-area-inset-bottom));
        width: calc(var(--tawk-launcher-size) + 7px);
        height: calc(var(--tawk-launcher-size) + 7px);
    }

    .tawk-flex__open {
        font-size: 21px;
    }

    #bottomSheet.active {
        z-index: 1600 !important;
    }

}

@media (max-width: 420px) {
    .tawk-flex {
        --tawk-launcher-size: 52px;
        --tawk-dismiss-size: 19px;
        --tawk-safe-left: max(12px, env(safe-area-inset-left));
        --tawk-safe-bottom: max(12px, env(safe-area-inset-bottom));
    }
}

@media (prefers-reduced-motion: reduce) {
    .tawk-flex,
    .tawk-flex__open,
    .tawk-flex__dismiss {
        transition: none;
    }
}
