@import url('https://fonts.googleapis.com/css2?family=Cairo:wght@300;400;500;600;700&display=swap');

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Cairo', sans-serif;
}

body {
    background: linear-gradient(135deg, #8bc6ec 0%, #9599e2 100%);
    height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
}

.chat-container {
    width: 100%;
    max-width: 400px;
    height: 600px;
    background-color: #fff;
    border-radius: 20px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.chat-header {
    padding: 20px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.profile {
    display: flex;
    align-items: center;
}

.add-btn {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background-color: rgba(255, 255, 255, 0.2);
    color: white;
    border: none;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 18px;
    transition: background-color 0.3s;
    position: absolute;
    top: 10px;
    left: 15px; /* لليسار في الواجهة العربية RTL */
}

.add-btn:hover {
    background-color: rgba(255, 255, 255, 0.3);
}

.avatar {
    width: 80px; /* مضاعفة الحجم بنسبة 100% */
    height: 80px; /* مضاعفة الحجم بنسبة 100% */
    background: #FFFFFF; /* تغيير الخلفية إلى اللون الأبيض */
    border-radius: 50%;
    display: flex;
    justify-content: center;
    align-items: center;
    margin-left: 15px; /* زيادة الهامش لليسار */
    margin-right: 5px; /* إضافة هامش لليمين */
    overflow: hidden; /* لمنع خروج الصورة عن حدود الدائرة */
    box-shadow: 0 3px 8px rgba(0, 0, 0, 0.15); /* زيادة الظل ليتناسب مع الحجم الجديد */
}

.avatar i {
    font-size: 20px;
}

/* تنسيقات صورة اللوجو */
.logo-image {
    width: 100%;
    height: 100%;
    object-fit: cover; /* للتأكد من أن الصورة تملأ المساحة بشكل مناسب */
    transition: transform 0.3s ease;
}

.logo-image:hover {
    transform: scale(1.1); /* تأثير تكبير عند تمرير المؤشر */
}

.chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
    display: flex;
    flex-direction: column;
}

.message {
    margin-bottom: 15px;
    display: flex;
}

.user-message {
    justify-content: flex-start;
}

.bot-message {
    justify-content: flex-end;
}

.message-content {
    max-width: 80%;
    padding: 12px 15px;
    border-radius: 18px;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
    position: relative;
}

.user-message .message-content {
    background-color: #f1f0f0;
    color: #333;
    border-bottom-right-radius: 5px;
}

.bot-message .message-content {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border-bottom-left-radius: 5px;
}

.chat-input {
    display: flex;
    padding: 15px;
    border-top: 1px solid #eee;
    background-color: #fff;
}

.chat-input input {
    flex: 1;
    padding: 12px 15px;
    border: 1px solid #ddd;
    border-radius: 25px;
    outline: none;
    font-size: 16px;
    transition: border-color 0.3s;
    color: #000 !important; /* لون أسود غامق للنص مع الأهمية */
    background-color: #fff !important; /* تأكيد أن الخلفية بيضاء */
    -webkit-text-fill-color: #000 !important; /* للأجهزة التي تستخدم WebKit */
    caret-color: #667eea; /* لون مؤشر الكتابة */
}

/* للتحكم في شكل الإكمال التلقائي على الموبايل */
.chat-input input:-webkit-autofill,
.chat-input input:-webkit-autofill:hover, 
.chat-input input:-webkit-autofill:focus, 
.chat-input input:-webkit-autofill:active {
    -webkit-box-shadow: 0 0 0 30px white inset !important;
    -webkit-text-fill-color: #000 !important;
}

/* للتحكم في لون النص الافتراضي */
.chat-input input::placeholder {
    color: #999;
    opacity: 1;
}

/* أنماط النافذة المنبثقة */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    overflow: auto;
}

.modal-content {
    position: relative;
    background-color: #fefefe;
    margin: 10% auto;
    padding: 20px;
    border-radius: 15px;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.3);
    width: 80%;
    max-width: 500px;
    direction: rtl;
}

.close {
    color: #aaa;
    float: left;
    font-size: 28px;
    font-weight: bold;
    cursor: pointer;
}

.close:hover {
    color: #555;
}

.form-group {
    margin-bottom: 15px;
}

.form-group label {
    display: block;
    margin-bottom: 5px;
    font-weight: bold;
    color: #333;
}

.form-group input,
.form-group textarea {
    width: 100%;
    padding: 10px;
    border: 1px solid #ddd;
    border-radius: 5px;
    font-size: 16px;
    color: #333;
}

.form-group textarea {
    resize: vertical;
}

.form-buttons {
    display: flex;
    justify-content: space-between;
    margin-top: 20px;
}

.submit-btn,
.cancel-btn {
    padding: 10px 20px;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    font-size: 16px;
    transition: background-color 0.3s;
}

.submit-btn {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

.cancel-btn {
    background-color: #f1f1f1;
    color: #333;
}

.submit-btn:hover {
    opacity: 0.9;
}

.cancel-btn:hover {
    background-color: #e0e0e0;
}

.chat-input input:focus {
    border-color: #667eea;
}

.chat-input button {
    width: 45px;
    height: 45px;
    margin-right: 10px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    border-radius: 50%;
    cursor: pointer;
    transition: transform 0.2s;
}

#mic-btn {
    background: linear-gradient(135deg, #65B741 0%, #379237 100%);
}

#mic-btn.recording {
    background: linear-gradient(135deg, #FF6D60 0%, #FF3131 100%);
    animation: pulse 1.5s infinite;
}

@keyframes pulse {
    0% {
        transform: scale(1);
        opacity: 1;
    }
    50% {
        transform: scale(1.05);
        opacity: 0.8;
    }
    100% {
        transform: scale(1);
        opacity: 1;
    }
}

.speech-status {
    text-align: center;
    font-size: 14px;
    margin-top: 5px;
    color: #555;
    height: 20px;
    font-weight: bold;
}

.chat-input button:hover {
    transform: scale(1.05);
}

::-webkit-scrollbar {
    width: 6px;
}

::-webkit-scrollbar-track {
    background: #f1f1f1;
}

::-webkit-scrollbar-thumb {
    background: #888;
    border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
    background: #667eea;
}

/* Styling for typing indicator */
.typing-indicator .message-content p {
    display: flex;
    align-items: center;
}

.typing-indicator .dot {
    display: inline-block;
    margin-right: 2px;
    animation: typing 1.4s infinite both;
    font-size: 20px;
}

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

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

@keyframes typing {
    0% {
        opacity: 0.3;
        transform: translateY(0);
    }
    50% {
        opacity: 1;
        transform: translateY(-2px);
    }
    100% {
        opacity: 0.3;
        transform: translateY(0);
    }
}
