 body { font-family: 'SF Pro Display', sans-serif; }
/* ========================================== */
        /* 1. النافذة الرئيسية وتأثيرات الإخفاء       */
        /* ========================================== */
        .vision-glass-main {
            position: fixed !important;  /* 👈 الكود المضاف */
            z-index: 999999 !important;
            background: #f8f8f8;
            border: 1px solid rgba(255, 255, 255, 0.574);
            box-shadow: 0 10px 15px rgba(0, 0, 0, 0.08);
            border-radius: 40px;
            transform-origin: bottom right;
            height: 500px !important; 
            transition: height 0.4s cubic-bezier(0.25, 1, 0.5, 1), opacity 0.3s ease, transform 0.4s cubic-bezier(0.34, 1.56, 0.64, 1) !important;
            
            /* 🚀 تفعيل المعالجة عبر كارت الشاشة (GPU) مباشرة */
            will-change: transform, opacity, height;
            -webkit-backface-visibility: hidden;
            backface-visibility: hidden;
            transform: translateZ(0);
        }
        
        .vision-glass-main.is-chatting { height: 650px !important; }

       .window-hidden { 
            opacity: 0 !important; 
            visibility: hidden !important;
            transform: scale(0.1) translate3d(20px, 20px, 0) !important; 
            pointer-events: none; box-shadow: none !important; 
        }

        /* 🚀 إيقاف أي أنيميشن (مثل الموجة الصوتية) بداخل النافذة وهي مغلقة لتوفير البطارية */
        .window-hidden * { animation-play-state: paused !important; }
        .window-hidden .ai-tooltip { animation-play-state: paused !important; }

        /* ========================================== */
        /* 2. العناصر الداخلية وأزرار الإدخال         */
        /* ========================================== */
        .vision-inner-element {
            background: rgba(255, 255, 255, 0.85); 
            border: 1px solid rgba(255, 255, 255, 0.9);
            box-shadow: 0 4px 15px rgba(0, 0, 0, 0.03);
        }

        .vision-input-area {
            background: rgba(255, 255, 255, 0.6);
            border: 1px solid rgba(255, 255, 255, 0.6);
            box-shadow: inset 0 2px 5px rgba(0, 0, 0, 0.02), 0 1px 0 rgba(255, 255, 255, 0.9);
            transition: all 0.3s ease;
            resize: none; 
        }
        .vision-input-area:focus {
            background: rgba(255, 255, 255, 0.95);
            border-color: rgba(255, 255, 255, 0.3);
            box-shadow: 0 4px 20px rgba(255, 255, 255, 0.06), 0 0 0 3px rgba(255, 255, 255, 0.1);
        }

       .vision-send-btn {
            background: rgba(255, 255, 255, 0.8);
            border: 1px solid rgba(255, 255, 255, 0.8);
            box-shadow: inset 0 2px 5px rgba(0, 0, 0, 0.02), 0 4px 10px rgba(0, 0, 0, 0.04);
            color: #0000008f; 
            transition: all 0.3s ease;
        }
        .vision-send-btn:hover {
            background: rgba(255, 255, 255, 0.95);
            border-color: rgba(112, 112, 112, 0.3);
            transform: scale(1.05);
        }
        .vision-send-btn:disabled {
            opacity: 0.5; color: #86868B; background: rgba(255, 255, 255, 0.4); transform: scale(1);
        }

        /* ========================================== */
        /* 3. الأفاتار، الغمزة، والزر العائم          */
        /* ========================================== */
        .ai-avatar-container { 
            position: relative; display: flex; justify-content: center; align-items: center; 
        }

        .protected-img {
            position: absolute; top: 0; left: 0; width: 100%; height: 100%; object-fit: cover;
            border-radius: 50%;
            border: 1px solid rgba(255, 255, 255, 0.4);
            box-shadow: 0 4px 12px rgba(0,0,0,0.15);
            user-select: none; -webkit-user-select: none;
            -webkit-user-drag: none; -webkit-touch-callout: none;
            pointer-events: none;
        }

    

        .avatar-lg { width: 90px; height: 90px; }
        .avatar-sm { width: 40px; height: 40px; }
        .avatar-float { width: 46px; height: 46px; } 
        
        #evolve-floating-btn {
            width: 56px !important; height: 56px !important; 
            background: #ffffff; border: 1px solid rgba(0,0,0,0.05);
            box-shadow: 0 12px 30px rgba(0,0,0,0.12);
            transition: transform 0.3s ease, box-shadow 0.3s ease, opacity 0.4s ease;
        }

        .welcome-avatar-img {
            border: none !important; box-shadow: none !important; background: transparent !important;
        }

        /* تصميم فقاعة المحادثة الذكية (Tooltip) */
        .ai-tooltip {
            position: absolute; 
            right: 0; 
            bottom: calc(100% + 14px); 
            background: #ffffff;
            padding: 8px 14px; 
            border-radius: 16px 16px 4px 16px; 
            font-size: 12px; font-weight: 600; color: #1C1C1E; 
            border: 1px solid rgba(0,0,0,0.06);
            box-shadow: 0 8px 20px rgba(0,0,0,0.08); 
            white-space: nowrap; pointer-events: none;
            transition: opacity 0.3s ease, transform 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
            transform-origin: bottom right;
        }
        
        .ai-tooltip::after {
            content: ''; position: absolute; right: 18px; bottom: -6px; transform: rotate(45deg);
            width: 10px; height: 10px; background: #ffffff;
            border-bottom: 1px solid rgba(0,0,0,0.06); border-right: 1px solid rgba(0,0,0,0.06);
        }
        
        .tooltip-hidden {
            opacity: 0 !important; transform: scale(0.8) translate3d(0, 10px, 0) !important;
        }
        
        /* الكود الجديد: إيقاف الأنيميشن الشبح لتوفير البطارية */
        .tooltip-hidden .tooltip-cursor::after {
            animation: none !important;
            display: none !important;
        }
        
        .tooltip-cursor::after {
            content: '|'; animation: blink-cursor 1s step-end infinite; color: #007AFF; margin-left: 2px; font-weight: 800;
        }

        /* ========================================== */
        /* 4. تنسيقات النصوص والشات                   */
        /* ========================================== */
        .msg-bubble-content strong { font-weight: 800; color: inherit; }
        
        .ai-header {
            font-size: 15px; font-weight: 800; color: #001c3b; margin: 14px 0 8px 0; display: flex; align-items: center; gap: 8px;
        }
        .ai-header::before {
            content: ''; display: inline-block; width: 4px; height: 14px; background: linear-gradient(135deg, #007AFF, #32ADE6); border-radius: 4px;
        }

        .ai-list-item {
            display: flex; align-items: flex-start; gap: 8px; margin-bottom: 8px; padding: 8px 12px;
            background: rgba(0,0,0,0.03); border-radius: 12px; border: 1px solid rgba(0,0,0,0.02); line-height: 1.5;
        }
        .ai-list-item .bullet-icon { color: #003e81; font-size: 14px; margin-top: 1px; flex-shrink: 0; }

        .social-action-btn {
            display: inline-flex; align-items: center; gap: 6px;
            background: #ffffff; border: 1px solid rgba(0,0,0,0.06);
            padding: 8px 14px; border-radius: 12px;
            font-size: 13px; font-weight: 600; color: #1C1C1E;
            text-decoration: none; transition: all 0.2s ease;
            box-shadow: 0 2px 6px rgba(0,0,0,0.03);
        }
        .social-action-btn:hover { transform: translateY(-2px); box-shadow: 0 4px 12px rgba(0,0,0,0.08); border-color: rgba(0,0,0,0.1); }

        .chat-scroll-area { 
            -webkit-overflow-scrolling: touch; 
            overscroll-behavior-y: contain; 
            transform: translateZ(0);
            will-change: scroll-position;
            /* 🚀 عزل مساحة الشات تماماً لكي لا يؤثر النزول والطلوع على باقي أجزاء الموقع */
            contain: content;
        }
        .custom-scrollbar { scrollbar-width: thin; scrollbar-color: rgba(0,0,0,0.15) transparent; }
        .custom-scrollbar::-webkit-scrollbar { width: 5px; }
        .custom-scrollbar::-webkit-scrollbar-thumb { background: rgba(0,0,0,0.15); border-radius: 10px; }
        
        textarea, input { font-size: 16px !important; }
        .msg-bubble-content { unicode-bidi: plaintext; text-align: start; line-height: 1.6; }
        .msg-bubble-content p { margin-bottom: 8px; }
        .msg-bubble-content p:last-child { margin-bottom: 0; }

        .msg-bubble { 
            animation: slide-up 0.3s cubic-bezier(0.34, 1.56, 0.64, 1) forwards; 
            -webkit-backface-visibility: hidden; backface-visibility: hidden;
        }
        @keyframes slide-up { from { opacity: 0; transform: translate3d(0, 15px, 0) scale(0.98); } to { opacity: 1; transform: translate3d(0, 0, 0) scale(1); } }

        .typing-cursor::after { content: '|'; animation: blink-cursor 1s step-end infinite; color: #007AFF; font-weight: bold; margin-right: 2px; }
        @keyframes blink-cursor { 50% { opacity: 0; } }

        .welcome-state { transition: all 0.5s cubic-bezier(0.25, 1, 0.5, 1); }
        .is-chatting .welcome-state { opacity: 0; transform: translate3d(0, -30px, 0) scale(0.95); pointer-events: none; position: absolute; }
        .header-state { opacity: 0; transform: translate3d(0, -15px, 0); transition: all 0.5s cubic-bezier(0.25, 1, 0.5, 1); pointer-events: none; }
        .is-chatting .header-state { opacity: 1; transform: translate3d(0, 0, 0); pointer-events: auto; }
        .chat-area { opacity: 0; transition: opacity 0.4s ease 0.1s; }
        .is-chatting .chat-area { opacity: 1; }
       /* منع تعليق الأزرار على الهواتف بعد الضغط عليها (Sticky Hover Fix) */
        @media (hover: hover) and (pointer: fine) {
            .vision-send-btn:hover {
                background: rgba(255, 255, 255, 0.95);
                border-color: rgba(112, 112, 112, 0.3);
                transform: scale(1.05);
            }
            .social-action-btn:hover { 
                transform: translateY(-2px); 
                box-shadow: 0 4px 12px rgba(0,0,0,0.08); 
                border-color: rgba(0,0,0,0.1); 
            }
        }

        /* ========================================== */
        /* تأثيرات شريط الإدخال الحي وزر الإرسال      */
        /* ========================================== */
        .send-btn-wrapper {
            width: 0px;
            opacity: 0;
            transform: scale(0.5) rotate(-45deg);
            transition: all 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
            overflow: hidden;
        }
       #input-container.is-typing .send-btn-wrapper {
            width: 38px; /* عرض الزر الجديد متناسق مع الشريط */
            opacity: 1;
            transform: scale(1) rotate(0deg);
            margin-left: 4px;
        }
        /* إخفاء شريط التمرير الافتراضي للـ textarea ليكون أنظف */
        #evolve-user-input::-webkit-scrollbar { width: 0px; }
       /* ========================================== */
        /* نظام المايكروفون والمشغل الصوتي المخصص (Premium) */
        /* ========================================== */
        .action-buttons-wrapper { display: flex; align-items: center; justify-content: center; gap: 4px; position: relative; }
        
        #mic-wrapper { 
            width: 38px; opacity: 1; transform: scale(1); 
            transition: all 0.4s cubic-bezier(0.34, 1.56, 0.64, 1); overflow: hidden; display: flex; justify-content: center;
        }
        
        #input-container.is-typing #mic-wrapper { width: 0px; opacity: 0; transform: scale(0.5); margin: 0; pointer-events: none; }
        
        /* 🌟 1. نبض زر الإرسال أثناء التسجيل (أزرق فخم بدل الأحمر) */
        @keyframes pulse-premium-blue {
            0% { box-shadow: 0 0 0 0 rgba(0, 122, 255, 0.4); transform: scale(1); }
            70% { box-shadow: 0 0 0 12px rgba(0, 122, 255, 0); transform: scale(1.05); }
            100% { box-shadow: 0 0 0 0 rgba(0, 122, 255, 0); transform: scale(1); }
        }
        .recording-pulse-premium {
            animation: pulse-premium-blue 1.5s infinite;
            background: linear-gradient(135deg, #007AFF, #32ADE6) !important;
            color: #FFFFFF !important;
        }

        /* 🌟 2. شريط التسجيل العائم والموجة الصوتية */
       #recording-bar-container {
            display: none; position: absolute; top: 0; left: 0; right: 0; bottom: 0;
            background: rgba(255, 255, 255, 0.98); 
            z-index: 50; border-radius: 24px; padding: 4px 6px;
            align-items: center; justify-content: space-between;
            box-shadow: 0 -4px 15px rgba(0,0,0,0.03); border: 1px solid rgba(0,122,255,0.05);
        }
        #recording-bar-container.active { display: flex; }
        
        .live-sound-wave { display: flex; align-items: center; gap: 3px; height: 18px; margin: 0 10px; }
        .live-sound-wave .bar { width: 3px; border-radius: 2px; background: #007AFF; animation: wave-bounce 1s ease-in-out infinite; }
        .live-sound-wave .bar:nth-child(1) { animation-delay: 0.0s; height: 40%; }
        .live-sound-wave .bar:nth-child(2) { animation-delay: 0.1s; height: 80%; }
        .live-sound-wave .bar:nth-child(3) { animation-delay: 0.2s; height: 100%; }
        .live-sound-wave .bar:nth-child(4) { animation-delay: 0.3s; height: 60%; }
        .live-sound-wave .bar:nth-child(5) { animation-delay: 0.4s; height: 40%; }
        @keyframes wave-bounce { 0%, 100% { transform: scaleY(0.4); opacity: 0.5; } 50% { transform: scaleY(1); opacity: 1; } }

        #recording-timer { font-family: 'SF Pro Display', monospace; font-size: 15px; font-weight: 800; color: #007AFF; letter-spacing: 0.5px; }

       /* 🌟 3. الموجة الصوتية للمشغل المخصص (مُحسنة للـ GPU) */
        .audio-waveform { display: flex; align-items: center; gap: 2px; height: 24px; margin: 0 8px; }
        .audio-waveform span { 
            display: block; width: 3px; background-color: #86868B; border-radius: 2px; 
            height: 20px; /* الارتفاع يجب أن يكون ثابتاً */
            transform-origin: center; transform: scaleY(0.2); /* نصغرها بالـ Transform لتسريع الأداء */
            transition: transform 0.2s, background-color 0.3s; opacity: 0.4;
            will-change: transform;
        }
        .audio-waveform.paused span { transform: scaleY(0.2) !important; animation: none !important; }
        
        .audio-waveform.playing span { opacity: 1; animation: playing-wave 1s ease-in-out infinite alternate; background-color: #007AFF; }
        .audio-waveform.playing span:nth-child(odd) { animation-duration: 0.6s; }
        .audio-waveform.playing span:nth-child(even) { animation-duration: 0.8s; }
        .audio-waveform.playing span:nth-child(3n) { animation-duration: 1.1s; }
        
        /* 🚀 استخدام scaleY يمنع إعادة رسم الصفحة ويوفر البطارية */
        @keyframes playing-wave { 0% { transform: scaleY(0.2); } 100% { transform: scaleY(1); } }
        
        
        /* ========================================== */
        /* 5. إعدادات الموبايل                        */
        /* ========================================== */
        @media (max-width: 480px) {
            .vision-glass-main { 
                width: calc(100vw - 32px) !important; 
                height: 60svh !important; 
                max-height: 500px !important; 
                bottom: 16px !important; 
                right: 16px !important; 
                border-radius: 35px !important; 
                background: #f8f8f8 !important;
                backdrop-filter: none !important;
                -webkit-backdrop-filter: none !important;
                transition: height 0.4s cubic-bezier(0.25, 1, 0.5, 1), opacity 0.4s ease, transform 0.5s cubic-bezier(0.34, 1.56, 0.64, 1) !important;
            }
            .vision-glass-main.is-chatting { height: 75dvh !important; max-height: 800px !important; bottom: 16px !important; }
            .vision-inner-element, .vision-send-btn { background: rgba(255, 255, 255, 0.98) !important; box-shadow: none !important; }
            .header-state { background: transparent !important; border: none !important; box-shadow: none !important; }            
            /* أزرار ورسالة الموبايل مفصولة بشكل صحيح هنا */
            #evolve-floating-btn { width: 50px !important; height: 50px !important; bottom: 20px !important; right: 20px !important; }
            .avatar-float { width: 40px; height: 40px; }
            .ai-tooltip { right: 0; bottom: calc(100% + 10px); padding: 6px 12px; font-size: 11px; }
        }
        /* ========================================== */
/* 🛡️ درع الحماية ضد تكسير المتصفحات (Bulletproof Shield) 🛡️ */
/* ========================================== */

/* 1. حماية أيقونة التوثيق (الصح الزرقاء) من التضخم */
img[alt="Verified"] {
    width: 14px !important;
    height: 14px !important;
    min-width: 14px !important;
    max-width: 14px !important;
    object-fit: contain;
    flex-shrink: 0;
}

/* 2. حماية صورة الأفاتار من التشوه */
.header-state .ai-avatar-container,
.welcome-state .ai-avatar-container {
    flex-shrink: 0 !important;
    overflow: hidden;
}

.header-state .ai-avatar-container img,
.welcome-state .ai-avatar-container img {
    width: 100% !important;
    height: 100% !important;
    object-fit: cover !important;
}

/* 3. حماية الهيكل الأساسي للنافذة (لكي لا تنهار قبل تحميل Tailwind) */
.header-state {
    display: flex !important;
    flex-direction: column !important;
    align-items: center !important;
    width: 100%;
}

.welcome-state {
    display: flex !important;
    flex-direction: column !important;
    align-items: center !important;
    justify-content: center !important;
}

/* 4. إجبار النافذة على الالتزام بحواف الشاشة في الهواتف */
@media (max-width: 768px) {
    #evolve-chat-widget {
        max-width: calc(100vw - 32px) !important;
        overflow-x: hidden !important;
    }
}
/* ========================================== */
/* 🚀 طبقة العزل الضبابية الشاملة (Focus Mode) 🚀 */
/* ========================================== */
.mobile-chat-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.45); /* لون أسود مريح للعين لعزل الخلفية */
    backdrop-filter: blur(12px); /* عزل زجاجي قوي جداً */
    -webkit-backdrop-filter: blur(12px);
    z-index: 999998; /* تحت نافذة الذكاء الاصطناعي مباشرة */
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.4s ease, visibility 0.4s ease;
    pointer-events: none; /* لمنع التداخل وهي مخفية */
}

/* عندما يتفعل الشات، تظهر طبقة العزل وتغطي الشاشة */
body.chat-mobile-active .mobile-chat-overlay {
    opacity: 1;
    visibility: visible;
    pointer-events: auto; /* تفعيل الضغط على الخلفية لإغلاق الشات */
}

/* قفل سكرول الصفحة الخلفية بسلاسة بدون قفز */
body.chat-mobile-active {
    overflow: hidden !important;
}