/* Wymiary z Figmy (Symfonia Praga, IKONA, węzeł 1155:5597), kolor #4F1813 od klienta. Wejście i cień jak w #rcci-button. */
#rpci-button {
    position: fixed;
    /* Figma ma 50 px, telefon 48 px: right 29 daje wspólną oś pionową */
    right: 29px;
    height: 50px;
    min-width: 50px;
    max-width: 50px;
    padding: 0 5.662px 0 0;
    border-radius: 28px;
    display: flex;
    align-items: center;
    justify-content: flex-end;
    background-color: #4F1813;
    color: #ffffff;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    z-index: 9998;
    text-decoration: none;
    cursor: pointer;
    box-sizing: border-box;
    animation: rpci-enter 0.8s cubic-bezier(0.175, 0.885, 0.32, 1.275) 0.6s backwards;
    transition:
        height 0.3s ease,
        margin-bottom 0.3s ease,
        padding 0.3s ease,
        max-width 0.4s cubic-bezier(0.25, 1, 0.5, 1),
        box-shadow 0.3s ease;
}

@keyframes rpci-enter {
    from {
        opacity: 0;
        transform: translateX(120px) scale(0.9);
    }
}

/* Tailwind animate-ping za przyciskiem. Ten sam kolor i kształt, więc w spoczynku go nie widać.
   z-index -1 w kontekście przycisku: nad jego tłem, pod kopertą. Start po wejściu (0.6s + 0.8s). */
#rpci-button::before {
    content: "";
    position: absolute;
    inset: 0;
    z-index: -1;
    border-radius: inherit;
    background-color: inherit;
    opacity: 0.75;
    pointer-events: none;
    animation: rpci-ping 1s cubic-bezier(0, 0, 0.2, 1) 1.4s infinite;
}

@keyframes rpci-ping {
    75%,
    100% {
        transform: scale(2);
        opacity: 0;
    }
}

/* Rozwinięty przycisk powiększony dwa razy wychodziłby poza ekran */
#rpci-button:hover::before,
#rpci-button:focus-visible::before {
    animation: none;
}

/* Rośnie do 56 px po 3 px w górę i w dół, koperta nie skacze w pionie */
#rpci-button:hover,
#rpci-button:focus-visible {
    height: 56px;
    max-width: 339px;
    margin-bottom: -3px;
    padding-right: 9px;
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.22);
}

#rpci-button .rpci-icon-wrap {
    width: 38.676px;
    height: 38.676px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

#rpci-button .rpci-icon {
    position: relative;
    display: block;
    width: 31.579px;
    height: 31.579px;
    overflow: hidden;
    transition: transform 0.3s ease;
}

#rpci-button:hover .rpci-icon,
#rpci-button:focus-visible .rpci-icon {
    transform: rotate(15deg);
}

#rpci-button .rpci-icon img {
    position: absolute;
    left: 2.63px;
    top: 5.264px;
    display: block;
    max-width: none;
}

#rpci-button .rpci-text {
    max-width: 0;
    opacity: 0;
    overflow: hidden;
    white-space: nowrap;
    color: inherit;
    font-family: Poppins, sans-serif;
    font-size: 18px;
    font-weight: 600;
    line-height: 1.2;
    transition:
        max-width 0.4s cubic-bezier(0.25, 1, 0.5, 1),
        opacity 0.3s ease,
        margin 0.4s ease;
}

#rpci-button:hover .rpci-text,
#rpci-button:focus-visible .rpci-text {
    max-width: 255px;
    opacity: 1;
    margin-left: 23px;
    margin-right: 13.158px;
}

@media (max-width: 768px) {
    #rpci-button {
        right: 20px;
        height: 42px;
        min-width: 42px;
        max-width: 42px;
        padding-right: 5px;
        /* Nad telefonem: 74px (jego pozycja) + 42px wysokości + 12px odstępu */
        bottom: 128px !important;
    }

    #rpci-button:hover,
    #rpci-button:focus-visible {
        height: 48px;
        max-width: min(339px, calc(100vw - 40px));
        padding-right: 8px;
    }

    #rpci-button .rpci-icon-wrap {
        width: 32px;
        height: 32px;
    }

    /* Figma ma tylko wersję 50 px, a telefon ma tu 42 px: 42 / 50 = 0.84 */
    #rpci-button .rpci-icon {
        flex-shrink: 0;
        transform: scale(0.84);
    }

    #rpci-button:hover .rpci-icon,
    #rpci-button:focus-visible .rpci-icon {
        transform: rotate(15deg) scale(0.84);
    }

    #rpci-button .rpci-text {
        font-size: 16px;
    }

    #rpci-button:hover .rpci-text,
    #rpci-button:focus-visible .rpci-text {
        max-width: min(255px, calc(100vw - 108px));
        margin-left: 18px;
        margin-right: 10px;
    }
}

@media (prefers-reduced-motion: reduce) {
    #rpci-button::before {
        animation: none;
    }
}
