/**
 * JAPI Phone Module
 * Autor modułu: kubaweb.dev by Kuba Pieczewski
 */
.japi-phone-module,
.japi-phone-module * {
    box-sizing: border-box;
}

.japi-phone-module {
    position: fixed;
    z-index: var(--japi-phone-z, 9998);
    font-family: inherit;
    line-height: 1.35;
}

.japi-phone-corner-bottom_right { right: var(--japi-phone-x, 24px); bottom: var(--japi-phone-y, 24px); }
.japi-phone-corner-bottom_left { left: var(--japi-phone-x, 24px); bottom: var(--japi-phone-y, 24px); }
.japi-phone-corner-top_right { right: var(--japi-phone-x, 24px); top: var(--japi-phone-y, 24px); }
.japi-phone-corner-top_left { left: var(--japi-phone-x, 24px); top: var(--japi-phone-y, 24px); }

.japi-phone-relative-above.japi-phone-corner-bottom_right,
.japi-phone-relative-above.japi-phone-corner-bottom_left {
    margin-bottom: calc(var(--japi-wa-size, 62px) + var(--japi-phone-gap, 12px));
}
.japi-phone-relative-below.japi-phone-corner-top_right,
.japi-phone-relative-below.japi-phone-corner-top_left {
    margin-top: calc(var(--japi-wa-size, 62px) + var(--japi-phone-gap, 12px));
}
.japi-phone-relative-below.japi-phone-corner-bottom_right,
.japi-phone-relative-below.japi-phone-corner-bottom_left {
    margin-bottom: calc((var(--japi-wa-size, 62px) + var(--japi-phone-gap, 12px)) * -1);
}
.japi-phone-relative-above.japi-phone-corner-top_right,
.japi-phone-relative-above.japi-phone-corner-top_left {
    margin-top: calc((var(--japi-wa-size, 62px) + var(--japi-phone-gap, 12px)) * -1);
}

.japi-phone-relative-side_auto.japi-phone-corner-bottom_right,
.japi-phone-relative-side_auto.japi-phone-corner-top_right {
    margin-right: calc(var(--japi-wa-size, 62px) + var(--japi-phone-gap, 12px));
}
.japi-phone-relative-side_auto.japi-phone-corner-bottom_left,
.japi-phone-relative-side_auto.japi-phone-corner-top_left {
    margin-left: calc(var(--japi-wa-size, 62px) + var(--japi-phone-gap, 12px));
}

.japi-phone-button {
    min-width: var(--japi-phone-size, 62px);
    height: var(--japi-phone-size, 62px);
    border: 0;
    border-radius: var(--japi-phone-radius, 999px);
    background: var(--japi-phone-bg, #1f7a4d);
    color: var(--japi-phone-color, #fff);
    box-shadow: var(--japi-phone-shadow, 0 12px 30px rgba(0,0,0,.22));
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: 0 20px;
    cursor: pointer;
    text-decoration: none;
    transition: transform .18s ease, background-color .18s ease, box-shadow .18s ease;
    font-weight: 700;
    font-size: 15px;
    white-space: nowrap;
}

.japi-phone-button:hover,
.japi-phone-button:focus-visible {
    background: var(--japi-phone-bg-hover, #145f3a);
    transform: translateY(-2px);
    outline: none;
}

.japi-phone-icon {
    width: calc(var(--japi-phone-size, 62px) * .42);
    height: calc(var(--japi-phone-size, 62px) * .42);
    display: inline-flex;
    flex: 0 0 auto;
}

.japi-phone-icon svg {
    width: 100%;
    height: 100%;
    fill: currentColor;
}

.japi-phone-no-label-desktop .japi-phone-label {
    display: none;
}

.japi-phone-popup {
    position: fixed !important;
    top: 0 !important;
    right: auto !important;
    bottom: auto !important;
    left: 0 !important;
    width: 100vw !important;
    height: 100vh !important;
    z-index: calc(var(--japi-phone-z, 9998) + 1000) !important;
    display: none;
    align-items: center !important;
    justify-content: center !important;
    padding: 18px;
    margin: 0 !important;
    transform: none !important;
    filter: none !important;
    opacity: 1 !important;
    visibility: visible !important;
    pointer-events: none;
}

.japi-phone-popup.is-active {
    display: flex !important;
    pointer-events: auto;
}

.japi-phone-popup-backdrop {
    position: fixed !important;
    inset: 0 !important;
    width: 100vw !important;
    height: 100vh !important;
    background: rgba(0, 0, 0, .48);
    backdrop-filter: blur(3px);
}

.japi-phone-popup-box {
    position: relative !important;
    width: min(460px, calc(100vw - 36px));
    max-height: calc(100vh - 36px);
    overflow: auto;
    margin: auto !important;
    transform: none !important;
    background: #fff;
    color: #222;
    border-radius: 22px;
    box-shadow: 0 24px 90px rgba(0,0,0,.28);
    padding: 28px;
    text-align: center;
}

.japi-phone-popup-box:before {
    content: "";
    position: absolute;
    inset: 0 0 auto 0;
    height: 6px;
    background: var(--japi-phone-bg, #1f7a4d);
}

.japi-phone-popup-x {
    position: absolute;
    right: 12px;
    top: 10px;
    width: 38px;
    height: 38px;
    border: 0;
    border-radius: 999px;
    background: #f1f1f1;
    color: #222;
    cursor: pointer;
    font-size: 28px;
    line-height: 36px;
}

.japi-phone-popup-logo-wrap {
    margin: 8px auto 14px;
}

.japi-phone-popup-logo {
    max-width: 150px;
    max-height: 90px;
    object-fit: contain;
}

.japi-phone-popup-title {
    margin: 4px 34px 14px;
    font-size: 24px;
    font-weight: 800;
    color: #151515;
}

.japi-phone-popup-status {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 999px;
    padding: 7px 13px;
    margin-bottom: 14px;
    font-size: 13px;
    font-weight: 800;
    letter-spacing: .02em;
}

.japi-phone-popup-status-open {
    background: rgba(31, 122, 77, .12);
    color: #17603b;
}

.japi-phone-popup-status-closed,
.japi-phone-popup-status-holiday {
    background: rgba(190, 54, 54, .12);
    color: #9d2525;
}

.japi-phone-popup-text {
    font-size: 16px;
    color: #333;
    margin: 0 auto 14px;
}

.japi-phone-popup-text p:last-child {
    margin-bottom: 0;
}

.japi-phone-popup-hours,
.japi-phone-popup-holiday {
    background: #f7f7f7;
    border: 1px solid #ededed;
    border-radius: 14px;
    padding: 11px 13px;
    margin-top: 10px;
    font-size: 14px;
    color: #333;
}

.japi-phone-popup-actions {
    display: flex;
    gap: 10px;
    justify-content: center;
    flex-wrap: wrap;
    margin-top: 18px;
}

.japi-phone-popup-call,
.japi-phone-popup-close {
    border: 0;
    border-radius: 999px;
    padding: 12px 18px;
    font-weight: 800;
    cursor: pointer;
    text-decoration: none !important;
    min-width: 130px;
}

.japi-phone-popup-call {
    background: var(--japi-phone-bg, #1f7a4d);
    color: var(--japi-phone-color, #fff) !important;
}

.japi-phone-popup-close {
    background: #eeeeee;
    color: #222;
}

.japi-phone-author {
    margin-top: 18px;
    font-size: 11px;
    color: #777;
}

@media (max-width: 767px) {
    .japi-phone-label-desktop.japi-phone-no-label-mobile .japi-phone-label,
    .japi-phone-no-label-mobile .japi-phone-label {
        display: none;
    }
    .japi-phone-label-mobile .japi-phone-label {
        display: inline;
    }
    .japi-phone-button {
        padding: 0 16px;
        font-size: 14px;
    }
    .japi-phone-popup-box {
        padding: 26px 18px 20px;
        border-radius: 18px;
    }
}

.japi-phone-author {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.japi-phone-author-logo {
    width: auto;
    height: 38px;
    max-width: 70px;
    object-fit: contain;
    display: inline-block;
}


/* SP Page Builder compatibility / anty-biały ekran */
.japi-phone-module[data-sppb-compatible="1"] {
    display: block !important;
    visibility: visible !important;
    opacity: 1 !important;
    pointer-events: auto !important;
}
.japi-phone-module[data-sppb-compatible="1"] .japi-phone-button {
    appearance: none;
    -webkit-appearance: none;
    position: relative;
    z-index: 1;
}
.japi-phone-module[data-sppb-compatible="1"] .japi-phone-popup {
    transform: none !important;
    filter: none !important;
}
html.japi-phone-popup-open .sp-pagebuilder-row,
html.japi-phone-popup-open .sppb-row-container {
    transform: none !important;
}


/* v1.0.4: popup zawsze na środku ekranu, niezależnie od pozycji przycisku i wrapperów SPPB */
body > .japi-phone-popup {
    position: fixed !important;
    inset: 0 auto auto 0 !important;
    width: 100vw !important;
    height: 100vh !important;
    display: none;
    align-items: center !important;
    justify-content: center !important;
}
body > .japi-phone-popup.is-active {
    display: flex !important;
}
html.japi-phone-popup-open,
html.japi-phone-popup-open body {
    overflow: hidden !important;
}


/* v1.0.5: usunięty podpis z popupu, logo wyśrodkowane */
.japi-phone-popup-logo-wrap {
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 8px auto 18px;
    width: 100%;
}
.japi-phone-popup-logo {
    display: block;
    margin: 0 auto;
    max-width: 180px;
    max-height: 120px;
    object-fit: contain;
}
.japi-phone-author {
    display: none !important;
}


/* v1.0.10: mobile jako nakładka nad stroną, bez wypychania layoutu */
@media (max-width: 767px) {
    html,
    body {
        max-width: 100% !important;
        overflow-x: hidden !important;
    }

    html body .japi-phone-module[data-mobile-safe="1"],
    html body > .japi-phone-module[data-mobile-safe="1"] {
        position: fixed !important;
        inset: auto var(--japi-phone-mobile-x, 14px) calc(var(--japi-phone-mobile-y, 14px) + var(--japi-phone-mobile-size, 54px) + var(--japi-phone-mobile-gap, 12px)) auto !important;
        left: auto !important;
        top: auto !important;
        width: var(--japi-phone-mobile-size, 54px) !important;
        min-width: var(--japi-phone-mobile-size, 54px) !important;
        max-width: var(--japi-phone-mobile-size, 54px) !important;
        height: var(--japi-phone-mobile-size, 54px) !important;
        min-height: var(--japi-phone-mobile-size, 54px) !important;
        max-height: var(--japi-phone-mobile-size, 54px) !important;
        margin: 0 !important;
        padding: 0 !important;
        transform: none !important;
        translate: none !important;
        float: none !important;
        clear: none !important;
        display: block !important;
        overflow: visible !important;
        contain: layout style paint !important;
        z-index: 2147483000 !important;
        pointer-events: auto !important;
    }

    html body .japi-phone-module[data-mobile-safe="1"] .japi-phone-button {
        width: var(--japi-phone-mobile-size, 54px) !important;
        min-width: var(--japi-phone-mobile-size, 54px) !important;
        max-width: var(--japi-phone-mobile-size, 54px) !important;
        height: var(--japi-phone-mobile-size, 54px) !important;
        min-height: var(--japi-phone-mobile-size, 54px) !important;
        max-height: var(--japi-phone-mobile-size, 54px) !important;
        margin: 0 !important;
        padding: 0 !important;
        border-radius: 999px !important;
        display: flex !important;
        align-items: center !important;
        justify-content: center !important;
        overflow: hidden !important;
        transform: none !important;
        white-space: nowrap !important;
    }

    html body .japi-phone-module[data-mobile-safe="1"] .japi-phone-label {
        display: none !important;
    }

    html body .japi-phone-module[data-mobile-safe="1"] .japi-phone-icon {
        width: calc(var(--japi-phone-mobile-size, 54px) * .45) !important;
        height: calc(var(--japi-phone-mobile-size, 54px) * .45) !important;
        margin: 0 !important;
    }

    html body .japi-phone-module[data-mobile-safe="1"][data-mobile-above-whatsapp="0"] {
        bottom: calc(var(--japi-phone-mobile-y, 14px) + env(safe-area-inset-bottom, 0px)) !important;
    }

    html body .japi-phone-module[data-mobile-safe="1"] .japi-phone-popup {
        position: fixed !important;
        inset: 0 auto auto 0 !important;
        width: 100vw !important;
        height: 100vh !important;
        max-width: 100vw !important;
        max-height: 100vh !important;
        transform: none !important;
        margin: 0 !important;
        contain: none !important;
    }
}


/* v1.0.11: mobile bez cienia/poświaty i bez tła wrappera */
@media (max-width: 767px) {
    html body .japi-phone-module[data-mobile-safe="1"],
    html body > .japi-phone-module[data-mobile-safe="1"] {
        background: transparent !important;
        box-shadow: none !important;
        filter: none !important;
        text-shadow: none !important;
        outline: 0 !important;
        border: 0 !important;
        isolation: isolate !important;
    }

    html body .japi-phone-module[data-mobile-safe="1"]::before,
    html body .japi-phone-module[data-mobile-safe="1"]::after,
    html body .japi-phone-module[data-mobile-safe="1"] .japi-phone-button::before,
    html body .japi-phone-module[data-mobile-safe="1"] .japi-phone-button::after {
        display: none !important;
        content: none !important;
        box-shadow: none !important;
        background: transparent !important;
    }

    html body .japi-phone-module[data-mobile-safe="1"] .japi-phone-button,
    html body .japi-phone-module[data-mobile-safe="1"] .japi-phone-button:hover,
    html body .japi-phone-module[data-mobile-safe="1"] .japi-phone-button:focus,
    html body .japi-phone-module[data-mobile-safe="1"] .japi-phone-button:active,
    html body .japi-phone-module[data-mobile-safe="1"] .japi-phone-button:focus-visible {
        box-shadow: none !important;
        filter: none !important;
        text-shadow: none !important;
        outline: 0 !important;
        transform: none !important;
    }
}


/* v1.0.14: animacja ikony słuchawki */
.japi-phone-icon-anim .japi-phone-icon {
    transform-origin: 50% 50%;
    will-change: transform;
}

.japi-phone-icon-anim-ring .japi-phone-icon {
    animation: japiPhoneRing var(--japi-phone-icon-animation-speed, 3s) ease-in-out infinite;
}

.japi-phone-icon-anim-pulse .japi-phone-icon {
    animation: japiPhoneIconPulse var(--japi-phone-icon-animation-speed, 3s) ease-in-out infinite;
}

.japi-phone-icon-anim-bounce .japi-phone-icon {
    animation: japiPhoneIconBounce var(--japi-phone-icon-animation-speed, 3s) ease-in-out infinite;
}

.japi-phone-icon-anim .japi-phone-button:hover .japi-phone-icon,
.japi-phone-icon-anim .japi-phone-button:focus-visible .japi-phone-icon {
    animation-play-state: paused;
}

@keyframes japiPhoneRing {
    0%, 62%, 100% { transform: rotate(0deg) scale(1); }
    66% { transform: rotate(-14deg) scale(1.08); }
    70% { transform: rotate(14deg) scale(1.08); }
    74% { transform: rotate(-12deg) scale(1.08); }
    78% { transform: rotate(12deg) scale(1.08); }
    82% { transform: rotate(-8deg) scale(1.04); }
    86% { transform: rotate(8deg) scale(1.04); }
    90% { transform: rotate(0deg) scale(1); }
}

@keyframes japiPhoneIconPulse {
    0%, 65%, 100% { transform: scale(1); }
    75% { transform: scale(1.22); }
    85% { transform: scale(1); }
}

@keyframes japiPhoneIconBounce {
    0%, 64%, 100% { transform: translateY(0); }
    72% { transform: translateY(-5px); }
    80% { transform: translateY(0); }
    88% { transform: translateY(-3px); }
    94% { transform: translateY(0); }
}

@media (prefers-reduced-motion: reduce) {
    .japi-phone-icon-anim .japi-phone-icon {
        animation: none !important;
    }
}
