/* Shared, keyboard-safe form overlays. This file is intentionally framework-neutral. */
:root {
    --form-overlay-height: 100dvh;
    --form-overlay-width: 100vw;
    --form-overlay-top: 0px;
    --form-overlay-left: 0px;
}

[data-form-overlay-panel] {
    min-width: 0;
    max-height: min(var(--form-overlay-height, 100dvh), 100dvh);
    overscroll-behavior: contain;
}

[data-form-overlay-scroll] {
    min-height: 0;
    overflow-x: hidden;
    overflow-y: auto;
    overscroll-behavior: contain;
    scrollbar-gutter: stable;
    -webkit-overflow-scrolling: touch;
}

.modal-dialog-scrollable [data-form-overlay-panel].modal-content {
    overflow-x: hidden;
    overflow-y: auto;
}

.modal-dialog-scrollable [data-form-overlay-panel] > .modal-body {
    overflow: visible;
}

.kaboxx-form-overlay-header,
.kamoney-form-header {
    display: grid;
    grid-template-columns: 44px minmax(0, 1fr) 44px;
    align-items: center;
    gap: 12px;
    width: 100%;
    min-width: 0;
    margin: 0;
    padding: 17px 20px;
    border: 0;
    border-bottom: 1px solid var(--kbx-line, #dfe7ed);
    background: #fff;
}

.kaboxx-form-overlay-header__icon,
.kamoney-form-header__icon {
    display: inline-grid;
    place-items: center;
    width: 44px;
    height: 44px;
    flex: 0 0 44px;
    border-radius: 13px;
    background: #e8f5f2;
    color: #0f766e;
}

.kaboxx-form-overlay-header__icon svg {
    display: block;
    width: 22px;
    height: 22px;
    fill: none;
    stroke: currentColor;
    stroke-linecap: round;
    stroke-linejoin: round;
    stroke-width: 1.9;
}

.kaboxx-form-overlay-header__copy,
.kamoney-form-header__copy {
    display: block;
    min-width: 0;
}

.kaboxx-form-overlay-header :is(h1, h2, h3, h4, .modal-title),
.kamoney-form-header h2 {
    overflow: hidden;
    margin: 0;
    color: #203f51;
    font-size: clamp(17px, 2.2vw, 21px);
    font-weight: 750;
    line-height: 1.25;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.kaboxx-form-overlay-header__subtitle,
.kamoney-form-header p {
    display: block;
    overflow: hidden;
    margin: 4px 0 0 !important;
    color: #6f838e !important;
    font-size: 12px !important;
    font-weight: 500;
    line-height: 1.4 !important;
    text-overflow: ellipsis;
    text-transform: none !important;
    white-space: nowrap;
}

.kaboxx-form-overlay-header__close,
.kaboxx-form-overlay-header :is(.btn-close, [data-bs-dismiss="modal"], [data-form-overlay-close]),
.kamoney-form-header .kamoney-panel-close {
    position: static;
    align-self: center;
    justify-self: end;
    display: inline-grid;
    place-items: center;
    width: 44px;
    min-width: 44px;
    height: 44px;
    min-height: 44px;
    margin: 0;
    padding: 0;
    border-radius: 12px;
}

.kamoney-form-header .kamoney-panel-close svg {
    width: 20px;
    height: 20px;
    fill: none;
    stroke: currentColor;
    stroke-linecap: round;
    stroke-width: 2;
}

.kaboxx-form-overlay-header__close-placeholder {
    width: 44px;
    height: 44px;
}

html.form-overlay-viewport-settling [data-form-overlay-panel] {
    scroll-behavior: auto !important;
    transition-property: opacity, box-shadow, border-color !important;
}

@media (max-width: 767.98px) {
    [data-form-overlay].kamoney-action-overlay,
    [data-form-overlay].pay-deposit-modal {
        inset: auto;
        top: var(--form-overlay-top, 0px);
        left: var(--form-overlay-left, 0px);
        width: var(--form-overlay-width, 100vw);
        height: var(--form-overlay-height, 100dvh);
    }

    [data-form-overlay-panel] {
        max-height: var(--form-overlay-height, 100dvh) !important;
    }

    .kaboxx-form-overlay-header,
    .kamoney-form-header {
        grid-template-columns: 40px minmax(0, 1fr) 44px;
        gap: 10px;
        padding: calc(14px + env(safe-area-inset-top, 0px)) 16px 14px;
    }

    .kaboxx-form-overlay-header__icon,
    .kamoney-form-header__icon {
        width: 40px;
        height: 40px;
        flex-basis: 40px;
    }

    [data-form-overlay-scroll] {
        scroll-padding-block: calc(12px + env(safe-area-inset-top, 0px)) calc(84px + env(safe-area-inset-bottom, 0px));
    }
}

@media (max-width: 359px) {
    .kaboxx-form-overlay-header,
    .kamoney-form-header {
        grid-template-columns: 36px minmax(0, 1fr) 44px;
        gap: 8px;
        padding-inline: 12px;
    }

    .kaboxx-form-overlay-header__icon,
    .kamoney-form-header__icon {
        width: 36px;
        height: 36px;
    }
}

@media (prefers-reduced-motion: reduce) {
    [data-form-overlay], [data-form-overlay] * {
        scroll-behavior: auto !important;
        animation-duration: .01ms !important;
        transition-duration: .01ms !important;
    }
}
