/*
 * Mohamed Saleh V2 — Floating Chat Widget
 * Version: 1.0.2
 */

.ms-chat-fab {
    position: fixed;

    inset-inline-start: 22px;
    inset-block-end: 22px;

    z-index: 99990;

    direction: rtl;

    font-family: inherit;
}


.ms-chat-fab__menu {
    position: absolute;

    inset-inline-start: 0;
    inset-block-end: calc(100% + 12px);

    min-width: 230px;

    display: flex;
    flex-direction: column;

    gap: 8px;

    margin: 0;
    padding: 10px;

    border: 1px solid #DCE3EA;
    border-radius: 14px;

    background: rgba(255, 255, 255, .98);

    box-shadow:
        0 14px 36px
        rgba(27, 36, 48, .16);

    opacity: 0;
    visibility: hidden;

    transform:
        translateY(8px)
        scale(.98);

    transform-origin:
        bottom left;

    transition:
        opacity .18s ease,
        visibility .18s ease,
        transform .18s ease;
}


.ms-chat-fab.is-open
.ms-chat-fab__menu {
    opacity: 1;
    visibility: visible;

    transform:
        translateY(0)
        scale(1);
}


.ms-chat-fab__label {
    margin: 0;
    padding: 3px 5px 6px;

    color: #6A7888;

    font-size: 11px;
    font-weight: 700;

    line-height: 1.4;
}


.ms-chat-fab__option {
    display: grid;

    grid-template-columns:
        42px minmax(0, 1fr);

    gap: 10px;

    align-items: center;

    min-height: 52px;

    padding: 6px 8px;

    border: 1px solid transparent;
    border-radius: 10px;

    background: #FFFFFF;

    color: #1B2430 !important;

    text-decoration: none !important;

    transition:
        background .18s ease,
        border-color .18s ease,
        transform .18s ease;
}


.ms-chat-fab__option:hover {
    border-color: #E1E7ED;

    background: #F7F9FC;

    transform:
        translateX(-2px);
}


.ms-chat-fab__option-icon {
    width: 42px;
    height: 42px;

    display: inline-flex;

    align-items: center;
    justify-content: center;

    border-radius: 50%;

    color: #FFFFFF;
}


.ms-chat-fab__option-icon svg {
    width: 23px;
    height: 23px;

    display: block;

    fill: currentColor;
}


.ms-chat-fab__option--messenger
.ms-chat-fab__option-icon {
    background: #168AFF;
}


.ms-chat-fab__option--telegram
.ms-chat-fab__option-icon {
    background: #229ED9;
}


.ms-chat-fab__option--whatsapp
.ms-chat-fab__option-icon {
    background: #25D366;
}


.ms-chat-fab__option-copy {
    min-width: 0;
}


.ms-chat-fab__option-title {
    display: block;

    color: #1B2430;

    font-size: 13px;
    font-weight: 800;

    line-height: 1.45;
}


.ms-chat-fab__option-subtitle {
    display: block;

    margin-top: 2px;

    color: #7B8794;

    font-size: 10.5px;
    font-weight: 500;

    line-height: 1.4;
}


/* Main floating button */

.ms-chat-fab__toggle {
    width: 58px;
    height: 58px;

    display: inline-flex;

    align-items: center;
    justify-content: center;

    margin: 0;
    padding: 0;

    border: 0;
    border-radius: 50%;

    background:
        linear-gradient(
            145deg,
            #4A7CC6 0%,
            #356CB8 100%
        );

    color: #FFFFFF;

    cursor: pointer;

    box-shadow:
        0 10px 26px
        rgba(53, 108, 184, .28);

    transition:
        transform .18s ease,
        box-shadow .18s ease,
        background .18s ease;
}


.ms-chat-fab__toggle:hover {
    transform:
        translateY(-2px);

    box-shadow:
        0 13px 30px
        rgba(53, 108, 184, .34);
}


.ms-chat-fab__toggle:focus-visible,
.ms-chat-fab__option:focus-visible {
    outline:
        3px solid rgba(247, 154, 16, .42);

    outline-offset:
        3px;
}


.ms-chat-fab__toggle svg {
    width: 27px;
    height: 27px;

    display: block;

    fill: currentColor;

    transition:
        transform .18s ease,
        opacity .18s ease;
}


.ms-chat-fab__toggle-icon--close {
    position: absolute;

    opacity: 0;

    transform:
        rotate(-45deg)
        scale(.8);
}


.ms-chat-fab.is-open
.ms-chat-fab__toggle-icon--chat {
    opacity: 0;

    transform:
        rotate(45deg)
        scale(.8);
}


.ms-chat-fab.is-open
.ms-chat-fab__toggle-icon--close {
    opacity: 1;

    transform:
        rotate(0)
        scale(1);
}


.ms-chat-fab__pulse {
    position: absolute;

    inset-inline-end: 2px;
    inset-block-start: 2px;

    width: 12px;
    height: 12px;

    border: 2px solid #FFFFFF;
    border-radius: 50%;

    background: #25D366;
}


/* Motion accessibility */

@media (prefers-reduced-motion: reduce) {

    .ms-chat-fab__menu,
    .ms-chat-fab__toggle,
    .ms-chat-fab__option,
    .ms-chat-fab__toggle svg {
        transition: none !important;
    }

}


/* Mobile */

@media (max-width: 600px) {

    .ms-chat-fab {
        inset-inline-start: 14px;
        inset-block-end: 14px;
    }


    .ms-chat-fab__toggle {
        width: 54px;
        height: 54px;
    }


    .ms-chat-fab__menu {
        min-width:
            min(230px, calc(100vw - 28px));
    }

}

/* ==========================================================
   CHAT FAB ARABIC LABELS
   Version: 1.0.1
   Main trigger becomes a labeled pill: "تواصل معي"
   ========================================================== */

.ms-chat-fab__toggle {
    width:
        auto !important;

    min-width:
        122px;

    height:
        54px !important;

    gap:
        8px;

    padding:
        0 16px !important;

    border-radius:
        999px !important;
}


.ms-chat-fab__toggle-text {
    display:
        inline-block;

    color:
        #FFFFFF;

    font-size:
        13px;

    font-weight:
        800;

    line-height:
        1;

    white-space:
        nowrap;
}


.ms-chat-fab__toggle
.ms-chat-fab__toggle-icon--chat {
    position:
        static;

    width:
        23px;

    height:
        23px;
}


.ms-chat-fab__toggle
.ms-chat-fab__toggle-icon--close {
    inset-inline-start:
        15px;

    width:
        22px;

    height:
        22px;
}


.ms-chat-fab.is-open
.ms-chat-fab__toggle-text {
    opacity:
        .94;
}


/* Keep menu Arabic-first and visually compact. */

.ms-chat-fab__option-title {
    font-size:
        13px;

    font-weight:
        850;
}


.ms-chat-fab__option-subtitle {
    font-size:
        10.5px;
}


@media (max-width: 600px) {

    .ms-chat-fab__toggle {
        min-width:
            116px;

        height:
            52px !important;

        padding:
            0 14px !important;
    }


    .ms-chat-fab__toggle-text {
        font-size:
            12.5px;
    }

}

/* ==========================================================
   TUTOR / ACCOUNT PAGE SAFETY
   Version: 1.0.2
   ========================================================== */

/*
 * Native hidden state is also controlled by JS.
 * This keeps the menu completely out of layout before JS opens it,
 * including on Tutor / account / registration templates.
 */
.ms-chat-fab__menu[hidden] {
    display: none !important;
}


/*
 * Defensive sizing in case another plugin/theme applies global SVG rules.
 */
.ms-chat-fab svg {
    max-width: 100%;
    max-height: 100%;
    flex: 0 0 auto;
}


/*
 * Prevent Tutor / form styles from stretching chat links or buttons.
 */
.ms-chat-fab__option {
    width: 100%;
    box-sizing: border-box;
}


.ms-chat-fab__toggle {
    box-sizing: border-box;
}


