/*
 * Yazan Chat UX Patch 1.0.0
 * Navy + gold styling matching Yazan Estate visual identity.
 */

.yep-chatbot-root {
    --yazan-chat-mobile-bottom: 88px;
}

/* Helper notification */
.yep-chatbot-root .yazan-chat-helper-tip {
    position: absolute;
    right: 0;
    bottom: calc(100% + 12px);
    width: min(248px, calc(100vw - 32px));
    background: #ffffff;
    color: #10213f;
    border: 1px solid rgba(215, 173, 80, .52);
    border-radius: 16px;
    box-shadow: 0 14px 38px rgba(5, 19, 45, .22);
    padding: 5px;
    z-index: 1000001;
    animation: yazanChatTipIn .28s ease-out both;
}

.yep-chatbot-left .yazan-chat-helper-tip {
    left: 0;
    right: auto;
}

.yazan-chat-helper-content {
    display: block;
    width: 100%;
    border: 0;
    background: transparent;
    color: inherit;
    text-align: right;
    direction: rtl;
    padding: 10px 34px 10px 10px;
    cursor: pointer;
    font: inherit;
}

[dir="ltr"].yazan-chat-helper-tip .yazan-chat-helper-content {
    text-align: left;
    direction: ltr;
    padding: 10px 10px 10px 34px;
}

.yazan-chat-helper-content strong {
    display: block;
    color: #071a3c;
    font-size: 14px;
    font-weight: 900;
    margin-bottom: 3px;
}

.yazan-chat-helper-content span {
    display: block;
    color: #53627a;
    font-size: 12px;
    line-height: 1.55;
}

.yazan-chat-helper-dismiss {
    position: absolute;
    top: 7px;
    right: 8px;
    width: 26px;
    height: 26px;
    border: 0;
    border-radius: 50%;
    background: #f2f5f9;
    color: #6d7888;
    cursor: pointer;
    font-size: 17px;
    line-height: 1;
    display: grid;
    place-items: center;
}

[dir="ltr"].yazan-chat-helper-tip .yazan-chat-helper-dismiss {
    right: auto;
    left: 8px;
}

.yazan-chat-helper-arrow {
    position: absolute;
    bottom: -7px;
    right: 24px;
    width: 14px;
    height: 14px;
    background: #fff;
    border-right: 1px solid rgba(215, 173, 80, .52);
    border-bottom: 1px solid rgba(215, 173, 80, .52);
    transform: rotate(45deg);
}

.yep-chatbot-left .yazan-chat-helper-arrow {
    right: auto;
    left: 24px;
}

/* Small visual attention only — no sound, browser notification or vibration. */
.yep-chat-launch.yazan-chat-attention {
    animation: yazanChatPulse 1.05s ease-in-out 2;
}

@keyframes yazanChatPulse {
    0%, 100% {
        transform: translateZ(0) scale(1);
        box-shadow: 0 12px 35px rgba(5, 19, 45, .28);
    }
    50% {
        transform: translateZ(0) scale(1.06);
        box-shadow:
            0 12px 35px rgba(5, 19, 45, .28),
            0 0 0 8px rgba(215, 173, 80, .14);
    }
}

@keyframes yazanChatTipIn {
    from {
        opacity: 0;
        transform: translateY(6px) scale(.98);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

/* Mobile: keep the bot above the site's fixed Contact / WhatsApp bar. */
@media (max-width: 767px) {
    .yep-chatbot-root {
        bottom: max(var(--yazan-chat-mobile-bottom), calc(env(safe-area-inset-bottom) + 76px)) !important;
        max-width: calc(100vw - 20px);
    }

    .yep-chatbot-right {
        right: 14px !important;
    }

    .yep-chatbot-left {
        left: 14px !important;
    }

    .yep-chatbot-root .yazan-chat-helper-tip {
        width: min(232px, calc(100vw - 42px));
        bottom: calc(100% + 10px);
    }

    /*
     * When the visitor opens chat, keep the panel above the fixed bottom action bar too.
     * This avoids covering "اتصال / واتساب / اطلب عقارك".
     */
    .yep-chatbot-root .yep-chat-panel {
        inset: auto 8px max(72px, calc(env(safe-area-inset-bottom) + 62px)) 8px !important;
        max-height: calc(100dvh - 154px) !important;
    }
}

/* Desktop stays close to the original position. */
@media (min-width: 768px) {
    .yep-chatbot-root {
        bottom: 24px !important;
    }
}

/* Respect reduced-motion preferences. */
@media (prefers-reduced-motion: reduce) {
    .yep-chat-launch.yazan-chat-attention,
    .yep-chatbot-root .yazan-chat-helper-tip {
        animation: none !important;
    }
}
