/**
 * أنماط الواجهة الأمامية للشات
 */

/* حاوية الشات */
.wp-chat-webhook-container {
    position: fixed;
    bottom: 20px;
    z-index: 9999;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", sans-serif;
    direction: rtl;
}

/* تحديد موضع الشات حسب الإعدادات */
.wp-chat-webhook-container.right {
    right: 20px;
}

.wp-chat-webhook-container.left {
    left: 20px;
}

/* زر فتح الشات */
.wp-chat-webhook-button {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background-color: var(--wp-chat-webhook-theme-color, #4CAF50);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
    transition: all 0.3s ease;
}

.wp-chat-webhook-button:hover {
    transform: scale(1.05);
    box-shadow: 0 6px 12px rgba(0, 0, 0, 0.3);
}

.wp-chat-webhook-button svg {
    width: 30px;
    height: 30px;
}

/* نافذة الشات */
.wp-chat-webhook-window {
    position: absolute;
    bottom: 80px;
    width: 350px;
    height: 450px;
    background-color: white;
    border-radius: 10px;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.2);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    transition: all 0.3s ease;
    opacity: 0;
    visibility: hidden;
    transform: translateY(20px);
}

/* تحديد موضع نافذة الشات حسب الإعدادات */
.wp-chat-webhook-container.right .wp-chat-webhook-window {
    right: 0;
}

.wp-chat-webhook-container.left .wp-chat-webhook-window {
    left: 0;
}

/* عرض نافذة الشات عند تفعيلها */
.wp-chat-webhook-window.active {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

/* رأس الشات */
.wp-chat-webhook-header {
    background-color: var(--wp-chat-webhook-theme-color, #4CAF50);
    color: white;
    padding: 15px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.wp-chat-webhook-title {
    font-weight: bold;
    font-size: 16px;
}

.wp-chat-webhook-close {
    cursor: pointer;
}

.wp-chat-webhook-close svg {
    width: 20px;
    height: 20px;
}

/* محتوى الشات */
.wp-chat-webhook-content {
    flex: 1;
    overflow-y: auto;
    padding: 15px;
    background-color: #f5f5f5;
}

.wp-chat-webhook-messages {
    display: flex;
    flex-direction: column;
}

/* فقاعات الرسائل */
.wp-chat-webhook-message {
    max-width: 80%;
    padding: 10px 15px;
    border-radius: 18px;
    margin-bottom: 10px;
    word-wrap: break-word;
    position: relative;
}

.wp-chat-webhook-message-user {
    align-self: flex-end;
    background-color: var(--wp-chat-webhook-theme-color, #4CAF50);
    color: white;
    border-bottom-right-radius: 5px;
}

.wp-chat-webhook-message-bot {
    align-self: flex-start;
    background-color: white;
    color: #333;
    border-bottom-left-radius: 5px;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
}

/* وقت الرسالة */
.wp-chat-webhook-message-time {
    font-size: 10px;
    opacity: 0.7;
    margin-top: 5px;
    text-align: right;
}

/* مؤشر الكتابة */
.wp-chat-webhook-typing {
    align-self: flex-start;
    background-color: white;
    color: #333;
    border-radius: 18px;
    padding: 10px 15px;
    margin-bottom: 10px;
    display: flex;
    align-items: center;
}

.wp-chat-webhook-typing-dots {
    display: flex;
}

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

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

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

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

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

/* أسفل الشات */
.wp-chat-webhook-footer {
    padding: 10px;
    border-top: 1px solid #eee;
}

.wp-chat-webhook-form {
    display: flex;
    align-items: center;
}

.wp-chat-webhook-input {
    flex: 1;
    padding: 10px 15px;
    border: 1px solid #ddd;
    border-radius: 20px;
    outline: none;
    font-size: 14px;
}

.wp-chat-webhook-input:focus {
    border-color: var(--wp-chat-webhook-theme-color, #4CAF50);
}

.wp-chat-webhook-send {
    background-color: transparent;
    border: none;
    color: var(--wp-chat-webhook-theme-color, #4CAF50);
    cursor: pointer;
    padding: 5px;
    margin-right: 5px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.wp-chat-webhook-send svg {
    width: 24px;
    height: 24px;
}

.wp-chat-webhook-send:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* تحسينات للأجهزة المحمولة */
@media (max-width: 480px) {
    .wp-chat-webhook-window {
        width: 300px;
        height: 400px;
        bottom: 70px;
    }
    
    .wp-chat-webhook-container.right {
        right: 10px;
    }
    
    .wp-chat-webhook-container.left {
        left: 10px;
    }
    
    .wp-chat-webhook-button {
        width: 50px;
        height: 50px;
    }
    
    .wp-chat-webhook-button svg {
        width: 25px;
        height: 25px;
    }
}

