/* الحاوية المطلقة المثبتة في أسفل اليسار */
.whatsapp-container-wrapper {
    position: fixed;
    bottom: 30px;
    left: 30px;
    display: flex;
    align-items: center;
    gap: 15px;
    z-index: 9999; /* بقاء المكون فوق كل شيء */
    direction: rtl; /* دعم الترتيب العربي */
}

/* 🌟 تصميم الزر الأساسي */
.whatsapp-sticky-btn {
    width: 65px;
    height: 65px;
    background-color: #25d366;
    color: #ffffff;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2.3rem;
    box-shadow: 0 6px 20px rgba(37, 211, 102, 0.4);
    text-decoration: none;
    position: relative;
    transition: transform 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.whatsapp-sticky-btn:hover {
    transform: scale(1.12) rotate(10deg);
    background-color: #20ba5a;
    box-shadow: 0 10px 25px rgba(37, 211, 102, 0.6);
	    text-decoration: none;
		    color: #147539;

}

/* حلقات التوهج والنبض الذاتي */
.glow-ring {
    position: absolute;
    top: 0; left: 0; width: 100%; height: 100%;
    background-color: #25d366;
    border-radius: 50%;
    z-index: -1;
    opacity: 0.6;
}
.glow-ring.r1 { animation: whatsappGlow 2.5s ease-out infinite; }
.glow-ring.r2 { animation: whatsappGlow 2.5s ease-out infinite; animation-delay: 1.25s; }

.whatsapp-sticky-btn:hover .glow-ring {
    animation-play-state: paused;
    opacity: 0.2;
}

@keyframes whatsappGlow {
    0% { transform: scale(1); opacity: 0.6; }
    100% { transform: scale(1.6); opacity: 0; }
}

/* 🌟 تصميم الفقاعة النصية المنبثقة الذكية */
.whatsapp-chat-bubble {
    background-color: #ffffff;
    border: 1px solid #e2e8f0;
    padding: 12px 35px 12px 18px; /* مساحة يمين إضافية لزر الإغلاق */
    border-radius: 14px;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.08);
    position: relative;
    white-space: nowrap; /* منع انقسام النص لسطرين */
    
    /* 👈 إخفاء افتراضي مع إزاحة حركية */
    opacity: 0;
    transform: translateX(-20px); 
    visibility: hidden;
    transition: opacity 0.5s ease, transform 0.5s cubic-bezier(0.4, 0, 0.2, 1), visibility 0.5s;
}

/* كلاس التفعيل البرمجي للظهور */
.whatsapp-chat-bubble.show {
    opacity: 1;
    transform: translateX(0);
    visibility: visible;
}

/* المثلث الصغير الممتد من الفقاعة باتجاه الأيقونة (جهة اليسار) */
.whatsapp-chat-bubble::after {
    content: "";
    position: absolute;
    left: -8px;
    top: 50%;
    transform: translateY(-50%);
    border-width: 8px 8px 8px 0;
    border-style: solid;
    border-color: transparent #ffffff transparent transparent;
    display: block;
    width: 0;
    z-index: 1;
}

/* قشرة حماية للمثلث لمحاكاة الـ border الخلفي للفقاعة */
.whatsapp-chat-bubble::before {
    content: "";
    position: absolute;
    left: -9px;
    top: 50%;
    transform: translateY(-50%);
    border-width: 8.5px 8.5px 8.5px 0;
    border-style: solid;
    border-color: transparent #e2e8f0 transparent transparent;
    display: block;
    width: 0;
    z-index: 0;
}

/* تنسيق ونوع الخطوط داخل الفقاعة */
.bubble-text-content {
    display: flex;
    flex-direction: column;
    font-family: 'cairo', sans-serif;
    text-align: right;
}

.bubble-greeting {
    font-size: 0.95rem;
    font-weight: 700;
    color: #1e293b;
    margin-bottom: 2px;
}

.bubble-action {
    font-size: 0.85rem;
    color: #64748b;
}

/* ❌ تصميم زر الإغلاق الصغير */
.close-bubble-btn {
    position: absolute;
    top: 50%;
    right: 10px;
    transform: translateY(-50%);
    background: none;
    border: none;
    color: #94a3b8;
    font-size: 1.2rem;
    cursor: pointer;
    padding: 0;
    line-height: 1;
    transition: color 0.2s ease;
}

.close-bubble-btn:hover {
    color: #ef4444; /* يتحول للأحمر عند رغبة العميل بالإغلاق */
}

/* 📱 التوافق والتجاوب في شاشات الجوال */
@media (max-width: 768px) {
    .whatsapp-container-wrapper {
        bottom: 20px;
        left: 20px;
        gap: 10px;
    }
    .whatsapp-sticky-btn {
        width: 55px;
        height: 55px;
        font-size: 2rem;
    }
    .whatsapp-chat-bubble {
        padding: 8px 30px 8px 14px;
    }
    .bubble-greeting { font-size: 0.85rem; }
    .bubble-action { font-size: 0.75rem; }
}
