        @import url('https://fonts.googleapis.com/css2?family=Noto Sans Arabic:wght@300;400;700&family=Exo+2:wght@400;600&display=swap');    
        * {
            box-sizing: border-box;
            margin: 0;
            padding: 0;
        }
        
        body {
            font-family: 'Noto Sans Arabic', 'Exo 2', sans-serif;
            line-height: 1.6;
            text-rendering: optimizeLegibility;
            -webkit-font-smoothing: antialiased;
        }

        .english-text {
            font-family: 'Exo 2', sans-serif;
            direction: ltr;
            text-align: left;
            letter-spacing: 0.3px;   
        }

        .arabic-text {
            font-family: 'Noto Sans Arabic', sans-serif;
            letter-spacing: 0; 
        }

        .bilingual-heading {
            font-family: 'Exo 2', 'Noto Sans Arabic', sans-serif;
        }
        
        /* حاوية الدردشة */
        .chat-container {
            position: fixed;
            bottom: 20px;
            right: 20px;
            width: 350px;
            height: 500px;
            border-radius: 16px;
            overflow: hidden;
            box-shadow: 0 5px 25px rgba(0,0,0,0.15);
            background: white;
            display: flex;
            flex-direction: column;
            z-index: 10000;
        }

/* رأس الدردشة */
.chat-header {
    background: linear-gradient(135deg, #4e54c8, #8f64fb);
    color: white;
     padding: 15px 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    position: relative;
}

.chat-title {
            font-weight: 600;
            font-size: 13px;
            display: flex;
            align-items: center;
            position: absolute;
            left: 40%;
            transform: translateX(-50%);
        }
}
.title-container {
    font-size: 4rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 3px;
    margin-bottom: 15px;
}

        .main-title {
            background: linear-gradient(45deg, #FF7E5F 0%, #FEB47B 50%, #FF7E5F 100%);
            -webkit-background-clip: text;
            background-clip: text;
            color: transparent;
            display: inline-block;
            animation: sandFlow ease-in-out infinite alternate;
            text-shadow: 0 2px 4px rgba(0,0,0,0.1);
        }

        .ai-badge {
            background: linear-gradient(45deg, #6DD5FA 0%, #2980B9 50%, #6DD5FA 100%);
            -webkit-background-clip: text;
            background-clip: text;
            color: transparent;
            display: inline-block;
            animation: techPulse ease-in-out infinite alternate;
            position: relative;
        }

        @keyframes sandFlow {
            0% { transform: translateY(0) rotate(0deg); }
            100% { transform: translateY(-5px) rotate(1deg); }
        }

        @keyframes techPulse {
            0% { 
                transform: scale(1);
                text-shadow: 0 0 5px rgba(109, 213, 250, 0.5);
            }
            100% { 
                transform: scale(1.05);
                text-shadow: 0 0 15px rgba(109, 213, 250, 0.8),
                             0 0 25px rgba(109, 213, 250, 0.4);
            }
        }

       .avatar-container {
            width: 43px;
            height: 43px;
            margin-left: 10px;
            position: relative;
        }
    
        .avatar {
            width: 100%;
            height: 100%;
            border-radius: 50%;
            object-fit: cover;
            transition: all 0.3s ease-out;
            box-shadow: 0 0 10px rgba(0,0,0,0.1);
            border: 2px solid rgba(255,255,255,0.3);
            position: relative;
            background-color: #f0f0f0;
        }

        .static-avatar {
            z-index: 2;
            opacity: 1;
        }

        .gif-avatar {
            z-index: 1;
            opacity: 0;
        }

        .speaking .static-avatar {
            opacity: 0;
        }

        .speaking .gif-avatar {
            opacity: 1;
        }

        .chat-options {
            display: flex;
            gap: 10px;
        }

        .option-btn {
            background: transparent;
            border: none;
            color: white;
            font-size: 16px;
            cursor: pointer;
            transition: all 0.2s;
        }

        .option-btn:hover {
            transform: scale(1.1);
            color: #fff;
        }

        /* منطقة الرسائل */
        .chat-messages {
            flex: 1;
            overflow-y: auto;
            padding: 15px;
            background: #f9f9f9;
            scroll-behavior: smooth;
            overscroll-behavior: contain;
        }

        .message {
            margin-bottom: 15px;
            max-width: 85%;
            padding: 12px 16px;
            border-radius: 16px;
            line-height: 1.8;
            word-wrap: break-word;
            font-size: 13px;
            animation: fadeIn 0.3s ease-out;
            position: relative;
        }

        .bot-message {
            background: #f0f4ff;
            border: 1px solid #d6e0ff;
            color: #333;
            border-radius: 16px 16px 4px 16px;
            margin-right: auto;
            margin-left: 0;
        }

        .user-message {
            background: linear-gradient(135deg, #4e54c8, #8f94fb);
            color: white;
            border-radius: 16px 16px 16px 4px;
            margin-left: auto;
            margin-right: 0;
            box-shadow: 0 2px 4px rgba(78, 84, 200, 0.2);
        }

        .message-content {
            white-space: pre-line;
            line-height: 2;
            word-break: break-word;
            font-size: 13px;
            unicode-bidi: plaintext;
            direction: auto;
            text-align: start;
        }

        .message-content[dir="rtl"] {
            text-align: right;
            direction: rtl;
        }

        .message-content[dir="ltr"] {
            text-align: left;
            direction: ltr;
        }

        /* منطقة الإدخال المحسنة */
        .chat-input-container {
            width: 100%;
            padding: 12px;
            background: white;
            border-top: 1px solid #eee;
            display: flex;
            align-items: center;
            gap: 8px;
        }

        .voice-input-container {
            display: flex;
            align-items: center;
            flex: 1;
            gap: 6px;
            background: #f9f9f9;
            border-radius: 24px;
            padding: 4px 12px 4px 4px;
            border: 1px solid #ddd;
            transition: all 0.3s;
        }

        .voice-input-container:focus-within {
            border-color: #4e54c8;
            background: white;
            box-shadow: 0 0 0 2px rgba(78, 84, 200, 0.2);
        }

        .chat-input {
            flex: 1;
            border: none;
            outline: none;
            font-size: 12px;
            background: transparent;
            resize: none;
            min-height: 40px;
            max-height: 100px;
            padding: 8px 0;
            margin: 0;
            direction: rtl;
            text-align: right;
        }

        /* أزرار الإرسال والميكروفون المحسنة */
        .send-btn, .mic-btn, .upload-btn {
            width: 40px;
            height: 40px;
            border-radius: 50%;
            display: flex;
            align-items: center;
            justify-content: center;
            flex-shrink: 0;
            margin: 0;
            padding: 0;
            border: none;
            cursor: pointer;
            transition: all 0.2s;
        }

        .send-btn {
            background: linear-gradient(135deg, #4e54c8, #8f94fb);
            box-shadow: 0 2px 5px rgba(78, 84, 200, 0.3);
            color: white;
        }

        .mic-btn, .upload-btn {
            background: transparent;
            color: #555;
        }

        .send-btn:hover, .mic-btn:hover, .upload-btn:hover {
            transform: scale(1.05);
        }

        .send-btn:active, .mic-btn:active, .upload-btn:active {
            transform: scale(0.95);
        }

        .mic-btn.listening {
            background: #ff6b6b;
            color: white;
            animation: pulse 1.5s infinite;
        }

        @keyframes pulse {
            0% {
                box-shadow: 0 0 0 0 rgba(255, 107, 107, 0.7);
            }
            70% {
                box-shadow: 0 0 0 10px rgba(255, 107, 107, 0);
            }
            100% {
                box-shadow: 0 0 0 0 rgba(255, 107, 107, 0);
            }
        }

        /* عناصر التحكم بالرسائل */
        .message-footer {
            display: flex;
            justify-content: space-between;
            align-items: center;
            margin-top: 10px;
            direction: auto; 
        }

        .message-controls {
            display: flex;
            gap: 8px;
        }

        .feedback-controls {
            display: flex;
            gap: 8px;
        }

        .action-btn, .like-btn, .dislike-btn {
            background: none;
            border: none;
            color: #666;
            cursor: pointer;
            font-size: 14px;
            transition: all 0.2s;
            padding: 2px;
        }

        .action-btn:hover, .like-btn:hover, .dislike-btn:hover {
            color: var(--primary-color);
        }

        .like-btn.active {
            color: var(--secondary-color);
        }

        .dislike-btn.active {
            color: var(--accent-color);
        }

        /* تأثيرات الرسائل */
        @keyframes fadeIn {
            from { opacity: 0; transform: translateY(8px); }
            to { opacity: 1; transform: translateY(0); }
        }

        /* لوحة الإعدادات المعدلة */
        .settings-panel {
            position: absolute;
            top: 100%;
            right: 0;
            background: white;
            padding: 15px;
            border-radius: 0 0 10px 10px;
            box-shadow: 0 5px 15px rgba(0,0,0,0.1);
            z-index: 100;
            display: none;
            width: 100%;
            border-top: 1px solid #eee;
        }

        .settings-panel h3 {
            margin-bottom: 15px;
            text-align: center; 
            color: #333;
        }

        .setting-item {
            margin: 15px 0;
            display: flex;
            justify-content: space-between;
            align-items: center;
            direction: rtl; 
        }

        .toggle-switch {
            position: relative;
            display: inline-block;
            width: 50px;
            height: 24px;
        }

        .toggle-switch input {
            opacity: 0;
            width: 0;
            height: 0;
        }

        .toggle-slider {
            position: absolute;
            cursor: pointer;
            top: 0;
            left: 0;
            right: 0;
            bottom: 0;
            background-color: #ccc;
            transition: .4s;
            border-radius: 24px;
        }

        .toggle-slider:before {
            position: absolute;
            content: "";
            height: 16px;
            width: 16px;
            left: 4px;
            bottom: 4px;
            background-color: white;
            transition: .4s;
            border-radius: 50%;
        }

        input:checked + .toggle-slider {
            background: linear-gradient(135deg, #4e54c8, #8f94fb);
        }

        input:checked + .toggle-slider:before {
            transform: translateX(26px); 
        }

        .close-settings {
            background: linear-gradient(135deg, #4e54c8, #8f94fb);
            color: white;
            border: none;
            padding: 8px 15px;
            border-radius: 20px;
            cursor: pointer;
            margin-top: 10px;
            width: 100%;
            font-weight: bold;
            transition: all 0.2s;
        }

        .close-settings:hover {
            transform: translateY(-2px);
            box-shadow: 0 4px 8px rgba(78, 84, 200, 0.3);
        }

        /* تأثيرات الإرسال */
        .send-btn.clicked {
            transform: scale(0.9);
            box-shadow: 0 1px 3px rgba(78, 84, 200, 0.3);
        }

        /* تأثيرات للرسائل الجديدة */
        .message.new-message {
            animation: newMessageHighlight 1.5s ease-out;
        }

        @keyframes newMessageHighlight {
            0% { box-shadow: 0 0 0 0 rgba(78, 84, 200, 0.7); }
            100% { box-shadow: 0 0 0 10px rgba(78, 84, 200, 0); }
        }

        /* تأثيرات للوضع المحمول */
        @media (max-width: 480px) {
            .chat-container {
                width: 100%;
                height: 100%;
                bottom: 0;
                right: 0;
                border-radius: 0;
            }
        }

        /* مؤشر الكتابة */
        .typing-indicator {
            background: #f0f4ff;
            border: 1px solid #d6e0ff;
            padding: 12px 16px;
            border-radius: 16px;
            display: inline-flex; 
            align-items: center;
            margin-right: auto; 
            margin-left: 0;
        }

        .typing-dot {
            width: 8px;
            height: 8px;
            background-color: #4e54c8;
            border-radius: 50%;
            margin: 0 2px; 
            animation: typingAnimationDots 1.4s infinite ease-in-out;
        }

        .typing-dot:nth-child(1) {
            animation-delay: 0s;
        }

        .typing-dot:nth-child(2) {
            animation-delay: 0.2s;
        }

        .typing-dot:nth-child(3) {
            animation-delay: 0.4s;
        }

        @keyframes typingAnimationDots {
            0%, 60%, 100% { transform: translateY(0); }
            30% { transform: translateY(-5px); }
        }

        @keyframes typingAnimation { 
            50% { opacity: 0.7; }
        }

        /* إشعارات */
        .notification {
            position: fixed;
            bottom: 80px;
            left: 50%;
            transform: translateX(-50%);
            background: rgba(0,0,0,0.7);
            color: white;
            padding: 10px 20px;
            border-radius: 20px;
            font-size: 14px;
            z-index: 10000;
            opacity: 0;
            transition: opacity 0.3s;
            direction: rtl; 
        }

        .notification.show {
            opacity: 1;
        }

        /* أنماط الصور في الرسائل */
        .message-image {
            max-width: 100%;
            max-height: 200px;
            border-radius: 8px;
            margin-bottom: 8px;
            display: block;
            object-fit: contain;
            background: #f0f0f0; 
        }

        .upload-btn {
            background: transparent;
            border: none;
            color: #555;
            font-size: 18px;
            cursor: pointer;
            width: 40px;
            height: 40px;
            display: flex;
            align-items: center;
            justify-content: center;
            border-radius: 50%;
            transition: all 0.2s;
            margin-left: 8px;
        }

        .upload-btn:hover {
            color: #4e54c8;
            transform: scale(1.1);
        }

        #fileInput {
            display: none;
        }

        .image-preview {
            position: relative;
            margin: 10px 15px;
            padding: 10px;
            background: #f5f5f5;
            border-radius: 8px;
            border: 1px dashed #ddd;
        }

        .message-image {
            max-width: 100%;
            max-height: 200px;
            border-radius: 6px;
            display: block;
            margin: 0 auto;
        }

        .remove-image-btn {
            position: absolute;
            top: 5px;
            left: 5px;
            background: rgba(255, 0, 0, 0.7);
            color: white;
            border: none;
            width: 25px;
            height: 25px;
            border-radius: 50%;
            display: flex;
            align-items: center;
            justify-content: center;
            cursor: pointer;
            transition: all 0.2s;
        }

        .remove-image-btn:hover {
            background: rgba(255, 0, 0, 0.9);
            transform: scale(1.1);
        }

        .task-card {
            background: white;
            border-radius: 5px;
            padding: 5px;
            margin-bottom: 10px;
            box-shadow: 0 2px 5px rgba(0,0,0,0.1);
            cursor: pointer;
            transition: all 0.2s;
        }

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

        .task-card h4 {
            margin-bottom: 5px;
            color: #4e54c8;
        }

        .task-card p {
            color: #666;
            font-size: 10px;
        }

        .task-category {
            display: inline-block;
            padding: 2px 8px;
            background: #f0f4ff;
            border-radius: 12px;
            font-size: 10px;
            color: #4e54c8;
            margin-top: 8px;
        }

        /* أنماط القوائم والنقاط */
        ul {
            list-style-type: disc; 
            padding-right: 20px; 
            margin: 8px 0;
            unicode-bidi: plaintext; 
        }

        li {
            margin-bottom: 5px;
            unicode-bidi: plaintext; 
            text-align: start; 
        }

        .inline-code {
            background: #f5f5f5;
            padding: 2px 5px;
            border-radius: 3px;
            font-family: 'Courier New', Courier, monospace; 
            font-size: 0.9em;
            color: #c7254e; 
            direction: auto; 
            unicode-bidi: plaintext;
        }

        /* أنماط الكود البرمجي */
        pre {
            background: #282c34; 
            color: #abb2bf; 
            padding: 15px;
            border-radius: 5px;
            overflow-x: auto; 
            margin: 10px 0;
            text-align: left; 
            direction: auto; 
            font-family: 'Courier New', Courier, monospace; 
            font-size: 14px;
            line-height: 1.5;
            tab-size: 4; 
            white-space: pre; 
            unicode-bidi: plaintext;
        }

        code { 
            font-family: 'Courier New', Courier, monospace;
            direction: auto;
            unicode-bidi: plaintext;
        }

        pre code { 
            background: transparent; 
            padding: 0; 
            color: inherit; 
            font-size: inherit; 
            font-family: inherit;
        }

        /* إخفاء عناصر التحكم بالصوت في رسائل المستخدم */
        .user-message .message-footer,
        .user-message .message-controls,
        .user-message .feedback-controls {
            display: none !important;
        }

        /* إظهار عناصر التحكم بالصوت فقط في رسائل البوت */
        .bot-message .message-footer {
            display: flex;
            justify-content: space-between;
            align-items: center;
            margin-top: 10px;
            direction: ltr;
        }

        .bot-message .message-controls,
        .bot-message .feedback-controls {
            display: flex;
            gap: 8px;
        }

        /* زر محادثة جديدة محسّن */
        .new-conversation-container {
            padding: 10px 15px;
            border-top: 1px solid #eee;
            background: #f9f9f9;
            text-align: center;
        }

        .new-conversation-btn {
            background: linear-gradient(135deg, #4e54c8, #8f94fb);
            color: white;
            border: none;
            padding: 10px 10px;
            border-radius: 20px;
            cursor: pointer;
            font-weight: bold;
            font-size: 12px;
            display: flex;
            align-items: center;
            justify-content: center;
            gap: 8px;
            margin: 0 auto;
            transition: all 0.3s ease;
            box-shadow: 0 2px 5px rgba(78, 84, 200, 0.2);
        }

        .new-conversation-btn:hover {
            transform: translateY(-2px);
            box-shadow: 0 4px 8px rgba(78, 84, 200, 0.3);
            background: linear-gradient(135deg, #3a3f9c, #6a6fc9);
        }

        .new-conversation-btn:active {
            transform: translateY(0);
            box-shadow: 0 2px 3px rgba(78, 84, 200, 0.2);
        }

        .new-conversation-btn i {
            font-size: 16px;
        }

        /* تأثيرات للرسائل عند بدء محادثة جديدة */
        @keyframes fadeOut {
            from { opacity: 1; }
            to { opacity: 0; transform: translateY(20px); }
        }

        @keyframes fadeIn {
            from { opacity: 0; transform: translateY(-20px); }
            to { opacity: 1; transform: translateY(0); }
        }
        body {
    background-image: url('bmbot3.jpg'); /* مسار الصورة */
    background-size: cover;
    background-position: center;
    background-attachment: fixed; /* ثبات الخلفية عند التمرير */
    background-repeat: no-repeat;
    margin: 0;
    padding: 0;
    font-family: 'Exo 2', sans-serif;
    min-height: 100vh;
    position: relative;
}

/* طبقة شبه شفافة لتحسين قراءة النص */
body::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.4); /* لون أسود مع 40% شفافية */
    z-index: -1;
}.
.new-conversation-container {
    padding: 10px 15px 15px;
    border-top: 1px solid rgba(255,255,255,0.1);
    background: rgba(255,255,255,0.05);
    backdrop-filter: blur(10px);
    display: flex;
    flex-direction: column;
    gap: 15px; /* زيادة المسافة بين الأزرار */
}

.new-conversation-btn, .free-chat-btn {
    width: 90%; /* تصغير العرض قليلاً */
    margin: 2 auto; /* توسيط الأزرار */
    padding: 10px; /* تصغير الحشو الداخلي */
    border-radius: 5px; /* تقليل نصف القطر */
    font-size: 12px; /* تصغير حجم الخط */
    /* بقية الخصائص كما هي */
}

/* تصغير تأثيرات الـ hover */
.new-conversation-btn:hover, .free-chat-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
}

/* تصغير الأيقونات */
.new-conversation-btn i, .free-chat-btn i {
    font-size: 14px;
}

/* تعديل تأثير اللمعان ليكون أكثر دقة */
.free-chat-btn:after {
    animation: aiShine 4s infinite linear;
    background: linear-gradient(
        to bottom right,
        rgba(255,255,255,0) 45%,
        rgba(255,255,255,0.1) 50%,
        rgba(255,255,255,0) 55%
    );
}
.new-conversation-container {
    padding: 15px;
    border-top: 1px solid rgba(255,255,255,0.1);
    background: rgba(255,255,255,0.05);
    backdrop-filter: blur(10px);
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.new-conversation-btn, .free-chat-btn {
    width: 80%;
    padding: 12px;
    border-radius: 12px;
    cursor: pointer;
    font-weight: 600;
    font-size: 13px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
    border: none;
    color: white;
    position: relative;
    overflow: hidden;
    z-index: 1;
}

.new-conversation-btn {
    background: linear-gradient(135deg, rgba(78, 84, 200, 0.8), rgba(46, 49, 146, 0.9));
    box-shadow: 0 4px 15px rgba(78, 84, 200, 0.3);
}

.free-chat-btn {
    background: linear-gradient(135deg, rgba(0, 168, 255, 0.8), rgba(0, 117, 255, 0.9));
    box-shadow: 0 4px 15px rgba(0, 117, 255, 0.3);
}

.new-conversation-container {
    padding: 15px;
    border-top: 1px solid rgba(255,255,255,0.1);
    background: rgba(255,255,255,0.05);
    backdrop-filter: blur(10px);
    display: flex;
    flex-direction: column;
    gap: 12px;
    align-items: center; /* توسيط الأزرار */
}

.new-conversation-btn, .free-chat-btn {
    width: 90%; /* نفس العرض */
    max-width: 300px; /* حد أقصى للعرض باش مايكبرش بزاف */
    padding: 12px;
    border-radius: 12px;
    cursor: pointer;
    font-weight: 600;
    font-size: 13px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
    border: none;
    color: white;
    position: relative;
    overflow: hidden;
    z-index: 1;
    margin: 0 auto; /* باش يتوسط */
}

.new-conversation-btn {
    background: linear-gradient(135deg, rgba(78, 84, 200, 0.8), rgba(46, 49, 146, 0.9));
    box-shadow: 0 4px 15px rgba(78, 84, 200, 0.3);
}

.free-chat-btn {
    background: linear-gradient(135deg, rgba(0, 168, 255, 0.8), rgba(0, 117, 255, 0.9));
    box-shadow: 0 4px 15px rgba(0, 117, 255, 0.3);
}

.new-conversation-btn:before, .free-chat-btn:before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, 
                             rgba(255,255,255,0.3), 
                             rgba(255,255,255,0.1));
    z-index: -1;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.new-conversation-btn:hover:before, 
.free-chat-btn:hover:before {
    opacity: 1;
}

.new-conversation-btn:hover, .free-chat-btn:hover {
    transform: translateY(-3px);
    box-shadow: 0 6px 20px rgba(0,0,0,0.15);
}

.new-conversation-btn:active, .free-chat-btn:active {
    transform: translateY(1px);
}

.new-conversation-btn i, .free-chat-btn i {
    font-size: 16px;
    transition: transform 0.3s ease;
}

.new-conversation-btn:hover i, .free-chat-btn:hover i {
    transform: scale(1.1);
}

/* تأثيرات إضافية للذكاء الاصطناعي */
.free-chat-btn:after {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: linear-gradient(
        to bottom right,
        rgba(255,255,255,0) 45%,
        rgba(255,255,255,0.15) 50%,
        rgba(255,255,255,0) 55%
    );
    transform: rotate(30deg);
    animation: aiShine 3s infinite linear;
    z-index: -1;
}

@keyframes aiShine {
    0% { transform: translateX(-100%) rotate(30deg); }
    100% { transform: translateX(100%) rotate(30deg); }
}