/**
 * Takwid Smart Call Buttons — Front-end floating buttons stylesheet.
 *
 * Dynamic per-site colors are injected via two CSS custom properties
 * (--tscb-call-color / --tscb-whats-color) using wp_add_inline_style(),
 * so this file itself stays fully static and cacheable.
 */

.txt-center {
    text-align: center;
}

.txt-center ul li {
    list-style: none;
}

.clear:after,
.clear:before {
    content: " ";
    display: table;
    table-layout: fixed;
}

.clear:after {
    clear: both;
}

.ms-whats-button,
.ms-call-button {
    display: flex;
    position: fixed;
    bottom: 0.3em;
    right: 12px;
    left: auto;
    align-items: center;
    outline: 0;
    cursor: pointer;
    z-index: 9999;
    text-decoration: none;
    direction: rtl;
    filter: drop-shadow(0 5px 12px rgba(15, 23, 42, .14));
    transition: transform .2s ease, filter .2s ease;
}

.tscb-position-left .ms-whats-button,
.tscb-position-left .ms-call-button {
    right: auto;
    left: 12px;
    direction: ltr;
}

.ms-whats-button:hover,
.ms-call-button:hover,
.ms-whats-button:focus-visible,
.ms-call-button:focus-visible {
    filter: drop-shadow(0 8px 16px rgba(15, 23, 42, .22));
    transform: translateY(-2px);
}

.ms-whats-button:focus-visible,
.ms-call-button:focus-visible {
    outline: 3px solid rgba(9, 132, 178, .38);
    outline-offset: 3px;
}

.ms-call-button {
    bottom: 5.2em;
}

.ms-call-icon {
    display: inline-flex;
    position: relative;
    align-items: center;
    justify-content: center;
    width: 58px;
    height: 58px;
    text-align: center;
    border-radius: 16px;
    background-color: var(--tscb-call-color, #146375);
    box-shadow: 0 5px 14px rgba(15, 23, 42, .2);
    animation: call-rotate 2s infinite ease-in-out;
}

/* Compact size: keeps the same visual language while reducing footprint. */
.tscb-size-small .ms-whats-button,
.tscb-size-small .ms-call-button {
    bottom: .3em;
}

.tscb-size-small .ms-call-button {
    bottom: 4.45em;
}

.tscb-size-small .ms-call-icon {
    width: 46px;
    height: 46px;
    border-radius: 13px;
}

.tscb-size-small .ms-call-button .ms-call-icon > svg {
    width: 28px !important;
    height: 42px !important;
}

.tscb-size-small .ms-whats-button .ms-call-icon > svg {
    width: 34px !important;
    height: 38px !important;
}

.tscb-size-small .ms-whats-txt,
.tscb-size-small .ms-call-txt {
    padding: 0 16px 0 25px;
    margin-right: -12px;
    margin-top: 7px;
    min-height: 34px;
    height: 34px;
    line-height: 32px;
    border-radius: 10px;
    font-size: 13px;
}

.tscb-size-small .ms-whats-txt {
    padding: 0 23px 0 27px;
}

.tscb-position-left.tscb-size-small .ms-whats-txt,
.tscb-position-left.tscb-size-small .ms-call-txt {
    margin-right: 0;
    margin-left: -12px;
}

.ms-whats-txt,
.ms-call-txt {
    padding: 0 22px 0 33px;
    font-size: 15px;
    font-weight: 600;
    display: inline-block;
    background: var(--tscb-call-color, #146375);
    color: #fff;
    margin-right: -16px;
    line-height: 40px;
    border-radius: 12px;
    height: 42px;
    box-shadow: 0 4px 12px rgb(0 0 0 / 12%);
    margin-top: 10px;
    text-align: center;
    direction: rtl;
    white-space: nowrap;
}

.tscb-position-left .ms-whats-txt,
.tscb-position-left .ms-call-txt {
    margin-right: 0;
    margin-left: -16px;
}

.ms-whats-button .ms-call-icon {
    background: var(--tscb-whats-color, #87c059);
}

.ms-whats-txt {
    padding: 0 31px 0 35px;
    background: var(--tscb-whats-color, #87c059);
}

.tscb-position-left .ms-call-icon,
.tscb-position-left .ms-whats-txt,
.tscb-position-left .ms-call-txt {
    order: initial;
}

/*
 * Mobile isolation layer (<=560px).
 * Some themes apply !important rules to the legacy .ms-* names. The unique
 * tscb-contact-button* names let the plugin win that cascade without editing
 * the active theme or changing the public HTML contract.
 */
.tscb-buttons-wrapper .tscb-contact-button__icon {
    box-sizing: border-box;
}

@media (max-width: 560px) {
    .tscb-buttons-wrapper .tscb-contact-button {
        position: fixed !important;
        top: auto !important;
        right: auto !important;
        left: auto !important;
        display: flex !important;
        align-items: center !important;
        justify-content: flex-start !important;
        width: auto !important;
        max-width: calc(100vw - 16px) !important;
        height: auto !important;
        min-height: 0 !important;
        gap: 0 !important;
        padding: 0 !important;
        border: 0 !important;
        border-radius: 0 !important;
        background: transparent !important;
        box-shadow: none !important;
        transform: none !important;
    }

    .tscb-buttons-wrapper.tscb-position-right .tscb-contact-button {
        right: 8px !important;
        left: auto !important;
        direction: rtl !important;
    }

    .tscb-buttons-wrapper.tscb-position-left .tscb-contact-button {
        right: auto !important;
        left: 8px !important;
        direction: ltr !important;
    }

    .tscb-buttons-wrapper.tscb-size-large .tscb-contact-button--call {
        bottom: calc(83px + env(safe-area-inset-bottom, 0px)) !important;
    }

    .tscb-buttons-wrapper.tscb-size-large .tscb-contact-button--whatsapp {
        bottom: calc(5px + env(safe-area-inset-bottom, 0px)) !important;
    }

    .tscb-buttons-wrapper .tscb-contact-button .tscb-contact-button__icon {
        position: relative !important;
        display: inline-flex !important;
        align-items: center !important;
        justify-content: center !important;
        box-sizing: border-box !important;
        width: 54px !important;
        height: 54px !important;
        min-width: 54px !important;
        flex: 0 0 54px !important;
        margin: 0 !important;
        padding: 0 !important;
        overflow: visible !important;
        border-radius: 14px !important;
        transform: none !important;
        animation: none !important;
    }

    .tscb-buttons-wrapper .tscb-contact-button--call .tscb-contact-button__icon > svg {
        display: block !important;
        width: 32px !important;
        height: 42px !important;
        max-width: 100% !important;
        max-height: 100% !important;
        transform-origin: center center;
        animation: call-rotate 2s infinite ease-in-out;
    }

    .tscb-buttons-wrapper .tscb-contact-button--whatsapp .tscb-contact-button__icon > svg {
        display: block !important;
        width: 36px !important;
        height: 38px !important;
        max-width: 100% !important;
        max-height: 100% !important;
        transform-origin: center center;
        animation: call-rotate 2s infinite ease-in-out;
    }

    .tscb-buttons-wrapper .tscb-contact-button__text {
        display: inline-flex !important;
        align-items: center !important;
        justify-content: center !important;
        box-sizing: border-box !important;
        width: auto !important;
        min-width: 0 !important;
        max-width: calc(100vw - 76px) !important;
        flex: 0 1 auto !important;
        position: static !important;
        overflow: hidden !important;
        text-overflow: ellipsis !important;
        white-space: nowrap !important;
        height: 42px !important;
        min-height: 42px !important;
        margin: 10px -16px 0 0 !important;
        padding: 0 16px 0 22px !important;
        border-radius: 12px !important;
        font-size: 14px !important;
        font-weight: 600 !important;
        line-height: 40px !important;
        text-align: center !important;
        direction: rtl !important;
    }

    .tscb-buttons-wrapper .tscb-contact-button--call .tscb-contact-button__text {
        background: var(--tscb-call-color, #146375) !important;
    }

    .tscb-buttons-wrapper .tscb-contact-button--whatsapp .tscb-contact-button__text {
        padding: 0 25px 0 28px !important;
        background: var(--tscb-whats-color, #87c059) !important;
    }

    .tscb-buttons-wrapper.tscb-position-left .tscb-contact-button__text {
        margin-right: 0 !important;
        margin-left: -16px !important;
    }

    .tscb-buttons-wrapper .tscb-contact-button:hover,
    .tscb-buttons-wrapper .tscb-contact-button:focus-visible {
        transform: translateY(-2px) !important;
    }

    .tscb-buttons-wrapper .tscb-contact-button:focus-visible {
        outline: 3px solid rgba(9, 132, 178, .38) !important;
        outline-offset: 3px !important;
    }

    /* Small size remains independent from the theme's fixed 170x48 rule. */
    .tscb-buttons-wrapper.tscb-size-small .tscb-contact-button--call {
        bottom: calc(67px + env(safe-area-inset-bottom, 0px)) !important;
    }

    .tscb-buttons-wrapper.tscb-size-small .tscb-contact-button--whatsapp {
        bottom: calc(5px + env(safe-area-inset-bottom, 0px)) !important;
    }

    .tscb-buttons-wrapper.tscb-size-small .tscb-contact-button .tscb-contact-button__icon {
        width: 44px !important;
        height: 44px !important;
        min-width: 44px !important;
        flex-basis: 44px !important;
        border-radius: 12px !important;
    }

    .tscb-buttons-wrapper.tscb-size-small .tscb-contact-button--call .tscb-contact-button__icon > svg {
        width: 27px !important;
        height: 39px !important;
    }

    .tscb-buttons-wrapper.tscb-size-small .tscb-contact-button--whatsapp .tscb-contact-button__icon > svg {
        width: 32px !important;
        height: 36px !important;
    }

    .tscb-buttons-wrapper.tscb-size-small .tscb-contact-button__text {
        max-width: calc(100vw - 64px) !important;
        height: 32px !important;
        min-height: 32px !important;
        margin-top: 6px !important;
        margin-right: -12px !important;
        padding: 0 13px 0 19px !important;
        border-radius: 9px !important;
        font-size: 12px !important;
        line-height: 30px !important;
    }

    .tscb-buttons-wrapper.tscb-position-left.tscb-size-small .tscb-contact-button__text {
        margin-right: 0 !important;
        margin-left: -11px !important;
    }

    .tscb-buttons-wrapper.tscb-size-small .tscb-contact-button--whatsapp .tscb-contact-button__text {
        padding: 0 18px 0 22px !important;
    }
}

@media (max-width: 600px) {
    .ms-whats-button,
    .ms-call-button {
        right: 8px;
    }

    .tscb-position-left .ms-whats-button,
    .tscb-position-left .ms-call-button {
        left: 8px;
    }

    .ms-call-icon {
        width: 54px;
        height: 54px;
        border-radius: 14px;
    }

    .ms-whats-txt,
    .ms-call-txt {
        padding-inline: 16px 22px;
        font-size: 14px;
    }

    .tscb-size-small .ms-call-button {
        bottom: 4.2em;
    }

    .tscb-size-small .ms-call-icon {
        width: 44px;
        height: 44px;
        border-radius: 12px;
    }

    .tscb-size-small .ms-call-button .ms-call-icon > svg {
        width: 27px !important;
        height: 39px !important;
    }

    .tscb-size-small .ms-whats-button .ms-call-icon > svg {
        width: 32px !important;
        height: 36px !important;
    }

    .tscb-size-small .ms-whats-txt,
    .tscb-size-small .ms-call-txt {
        padding-inline: 13px 19px;
        min-height: 32px;
        height: 32px;
        line-height: 30px;
        margin-top: 6px;
        border-radius: 9px;
        font-size: 12px;
    }

    .tscb-size-small .ms-whats-txt {
        padding-inline: 18px 22px;
    }

    .tscb-position-left.tscb-size-small .ms-whats-txt,
    .tscb-position-left.tscb-size-small .ms-call-txt {
        margin-left: -11px;
    }
}

.ms-call-button.active .ms-call-txt,
.ms-whats-button.active .ms-whats-txt,
.ms-call-button:hover .ms-call-txt,
.ms-whats-button:hover .ms-whats-txt {
    -webkit-box-shadow: 0 8px 16px 0 rgba(0, 0, 0, .2), 0 6px 20px 0 rgba(0, 0, 0, .19);
    box-shadow: 0 8px 16px 0 rgba(0, 0, 0, .2), 0 6px 20px 0 rgba(0, 0, 0, .19);
}

@keyframes call-rotate {

    0%,
    100%,
    50% {
        -webkit-transform: rotate(0) scale(1) skew(1deg);
        transform: rotate(0) scale(1) skew(1deg);
    }

    10%,
    30% {
        -webkit-transform: rotate(-25deg) scale(1) skew(1deg);
        transform: rotate(-25deg) scale(1) skew(1deg);
    }

    20%,
    40% {
        -webkit-transform: rotate(25deg) scale(1) skew(1deg);
        transform: rotate(25deg) scale(1) skew(1deg);
    }
}

@media (prefers-reduced-motion: reduce) {
    .ms-call-icon {
        animation: none;
    }
    .tscb-buttons-wrapper .tscb-contact-button__icon > svg {
        animation: none;
    }
    .ms-call-button,
    .ms-whats-button,
    .ms-call-txt,
    .ms-whats-txt {
        transition: none !important;
    }
}
