/* ========================================
   🎨 استايلات البلوكات - الاتصال والدردشة
   النسخة: 1.5.0
   ======================================== */

/* الحاوية الرئيسية للبلوك */
.ccb-block-container {
    max-width: 420px;
    margin: 20px auto;
    clear: both;
    direction: rtl;
}

/* البلوك نفسه */
.ccb-block {
    display: flex;
    gap: 8px;
    width: 100%;
    border: 1px solid #ddd;
    border-radius: 8px;
    padding: 10px 8px;
    background: #fff;
    box-shadow: 0 1px 2px rgba(0,0,0,0.05);
    font-family: 'Cairo', sans-serif;
}

/* الأزرار داخل البلوك */
.ccb-block-btn {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 10px 0;
    border-radius: 8px;
    text-decoration: none;
    font-size: 15px;
    font-weight: 600;
    color: #fff;
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
    cursor: pointer;
}

/* تأثير الهوفر */
.ccb-block-btn:hover {
    transform: scale(1.05);
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
}

/* تأثير اللمعة */
.ccb-block-btn::after {
    content: '';
    position: absolute;
    top: 0;
    left: -60%;
    width: 50%;
    height: 100%;
    background: linear-gradient(120deg, rgba(255,255,255,0) 0%, rgba(255,255,255,0.7) 50%, rgba(255,255,255,0) 100%);
    transform: skewX(-20deg);
    animation: ccb-shine 2.5s infinite;
}

@keyframes ccb-shine {
    0% { left: -60%; }
    50% { left: 120%; }
    100% { left: 120%; }
}

/* تأثير التوهج */
.ccb-block-btn {
    animation: ccb-glow 2.5s infinite ease-in-out;
}

@keyframes ccb-glow {
    0% { box-shadow: 0 0 0 rgba(255,255,255,0); }
    50% { box-shadow: 0 0 15px 5px rgba(255,255,255,0.9); }
    100% { box-shadow: 0 0 0 rgba(255,255,255,0); }
}

/* الأيقونات SVG */
.ccb-block-btn svg {
    width: 20px;
    height: 20px;
    fill: currentColor;
    flex-shrink: 0;
}

/* النص داخل الزر */
.ccb-block-btn span {
    white-space: nowrap;
}

/* تنسيق زر واحد فقط (عندما يكون اتصال فقط أو واتساب فقط) */
.ccb-block.ccb-single-btn .ccb-block-btn {
    max-width: 300px;
    margin: 0 auto;
}

/* ========================================
   📱 Responsive - للموبايل
   ======================================== */

@media (max-width: 480px) {
    .ccb-block-container {
        margin: 15px auto;
    }
    
    .ccb-block {
        padding: 8px 6px;
    }
    
    .ccb-block-btn {
        font-size: 14px;
        padding: 8px 0;
    }
    
    .ccb-block-btn svg {
        width: 18px;
        height: 18px;
    }
}

/* ========================================
   🎯 تنسيقات خاصة للموضع
   ======================================== */

/* عندما يكون في أول المقال */
.ccb-block-container.ccb-position-top {
    margin-bottom: 30px;
}

/* عندما يكون في منتصف المقال */
.ccb-block-container.ccb-position-middle {
    margin: 30px auto;
}

/* عندما يكون في كليهما */
.ccb-block-container.ccb-position-both {
    margin: 20px auto;
}

/* ========================================
   🌐 RTL Support
   ======================================== */

[dir="rtl"] .ccb-block-btn svg {
    margin-left: 0;
    margin-right: 0;
}

/* ========================================
   🎨 تنسيقات الألوان الافتراضية
   ======================================== */

/* سيتم تطبيق اللون المخصص من الإعدادات inline */
/* هذا فقط احتياطي */
.ccb-block-btn:not([style*="background"]) {
    background: #177b65;
}

.ccb-block-btn:not([style*="background"]):hover {
    background: #0f5f4d;
}

/* ========================================
   ♿ Accessibility
   ======================================== */

.ccb-block-btn:focus {
    outline: 2px solid #177b65;
    outline-offset: 2px;
}

.ccb-block-btn:active {
    transform: scale(0.98);
}

/* ========================================
   🖨️ Print Styles
   ======================================== */

@media print {
    .ccb-block-container {
        display: none;
    }
}

/* ========================================
   🎭 تأثيرات إضافية (اختيارية)
   ======================================== */

/* إيقاف الأنيميشن للمستخدمين الذين يفضلون تقليل الحركة */
@media (prefers-reduced-motion: reduce) {
    .ccb-block-btn {
        animation: none;
        transition: none;
    }
    
    .ccb-block-btn::after {
        animation: none;
    }
    
    .ccb-block-btn:hover {
        transform: none;
    }
}

/* ========================================
   🔧 تنسيقات المحرر (للمعاينة في الإعدادات)
   ======================================== */

.ccb-block-preview .ccb-block {
    margin: 0;
}

/* ========================================
   📊 تنسيقات خاصة للإحصائيات
   ======================================== */

/* شارة البلوك في الإحصائيات */
.ccb-source-block {
    background: linear-gradient(135deg, #f3e5f5 0%, #ce93d8 100%);
    color: #6a1b9a;
    border: 2px solid #8e24aa;
    padding: 5px 14px;
    border-radius: 20px;
    font-size: 13px;
    font-weight: 700;
    display: inline-block;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    transition: all 0.3s ease;
}

.ccb-source-block:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0,0,0,0.15);
}

/* ========================================
   ✨ تحسينات إضافية
   ======================================== */

/* التوافق مع القوالب المختلفة */
.entry-content .ccb-block-container,
.post-content .ccb-block-container,
article .ccb-block-container {
    max-width: 420px;
    margin-left: auto;
    margin-right: auto;
}

/* إزالة أي margin من القوالب */
.ccb-block-container p {
    margin: 0;
}

/* التأكد من عدم تداخل البلوك مع عناصر أخرى */
.ccb-block-container {
    position: relative;
    z-index: 1;
}

/* تحسين العرض على الأجهزة اللوحية */
@media (min-width: 481px) and (max-width: 768px) {
    .ccb-block-container {
        max-width: 380px;
    }
}

/* تحسين العرض على الشاشات الكبيرة */
@media (min-width: 1200px) {
    .ccb-block-container {
        max-width: 450px;
    }
}