/* أنماط الودجت */

#farid-chat-widget {
    position: fixed;
    z-index: 9999;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
}

#farid-chat-widget.farid-position-bottom-right {
    bottom: 20px;
    right: 20px;
}

#farid-chat-widget.farid-position-bottom-left {
    bottom: 20px;
    left: 20px;
}

/* أيقونة الودجت */
.farid-chat-icon {
    width: 60px;
    height: 60px;
    background-color: #007bff;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    transition: all 0.3s ease;
}

.farid-chat-icon:hover {
    background-color: #0056b3;
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.2);
    transform: scale(1.1);
}

.farid-chat-icon img {
    width: 40px;
    height: 40px;
    object-fit: contain;
}

/* نافذة المحادثة */
.farid-chat-window {
    position: absolute;
    bottom: 80px;
    right: 0;
    width: 350px;
    height: 500px;
    background-color: #ffffff;
    border-radius: 12px;
    box-shadow: 0 5px 40px rgba(0, 0, 0, 0.16);
    display: flex;
    flex-direction: column;
    animation: slideUp 0.3s ease;
}

#farid-chat-widget.farid-position-bottom-left .farid-chat-window {
    right: auto;
    left: 0;
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* رأس النافذة */
.farid-chat-header {
    background: linear-gradient(135deg, #007bff 0%, #0056b3 100%);
    color: #ffffff;
    padding: 16px;
    border-radius: 12px 12px 0 0;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.farid-chat-header h3 {
    margin: 0;
    font-size: 18px;
    font-weight: 600;
}

.farid-close-btn {
    background: none;
    border: none;
    color: #ffffff;
    font-size: 24px;
    cursor: pointer;
    padding: 0;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.2s ease;
}

.farid-close-btn:hover {
    transform: rotate(90deg);
}

/* جسم النافذة */
.farid-chat-body {
    flex: 1;
    display: flex;
    flex-direction: column;
    padding: 16px;
    overflow-y: auto;
}

/* اختيار اللغة */
.farid-language-selection {
    margin-bottom: 16px;
}

.farid-language-selection label {
    display: block;
    font-size: 14px;
    font-weight: 500;
    margin-bottom: 8px;
    color: #333333;
}

.farid-language-select {
    width: 100%;
    padding: 10px;
    border: 1px solid #e0e0e0;
    border-radius: 6px;
    font-size: 14px;
    background-color: #ffffff;
    cursor: pointer;
    transition: border-color 0.2s ease;
}

.farid-language-select:focus {
    outline: none;
    border-color: #007bff;
    box-shadow: 0 0 0 3px rgba(0, 123, 255, 0.1);
}

/* بيانات المستخدم */
.farid-user-info {
    margin-bottom: 16px;
}

.farid-input {
    width: 100%;
    padding: 10px;
    margin-bottom: 8px;
    border: 1px solid #e0e0e0;
    border-radius: 6px;
    font-size: 14px;
    transition: border-color 0.2s ease;
    box-sizing: border-box;
}

.farid-input:focus {
    outline: none;
    border-color: #007bff;
    box-shadow: 0 0 0 3px rgba(0, 123, 255, 0.1);
}

/* منطقة الرسائل */
.farid-messages-container {
    flex: 1;
    overflow-y: auto;
    margin-bottom: 16px;
    padding: 8px 0;
}

.farid-message {
    margin-bottom: 12px;
    padding: 10px;
    border-radius: 8px;
    font-size: 14px;
    line-height: 1.4;
}

.farid-message-visitor {
    background-color: #e3f2fd;
    border-left: 4px solid #007bff;
}

.farid-message-admin {
    background-color: #f5f5f5;
    border-left: 4px solid #666666;
}

.farid-message-header {
    font-weight: 600;
    margin-bottom: 4px;
    color: #333333;
}

.farid-message-time {
    font-size: 12px;
    color: #999999;
    margin-left: 8px;
}

.farid-message-body {
    color: #333333;
}

.farid-message-body p {
    margin: 0;
}

.farid-translated {
    margin-top: 8px;
    padding-top: 8px;
    border-top: 1px solid rgba(0, 0, 0, 0.1);
    font-style: italic;
    color: #666666;
}

/* منطقة الإدخال */
.farid-input-area {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-bottom: 12px;
}

.farid-text-input {
    display: flex;
    gap: 8px;
}

.farid-text-input .farid-input {
    flex: 1;
    margin-bottom: 0;
}

.farid-send-btn,
.farid-voice-btn {
    padding: 10px 16px;
    background-color: #007bff;
    color: #ffffff;
    border: none;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: background-color 0.2s ease;
}

.farid-send-btn:hover,
.farid-voice-btn:hover {
    background-color: #0056b3;
}

.farid-send-btn:active,
.farid-voice-btn:active {
    transform: scale(0.98);
}

.farid-voice-btn.recording {
    background-color: #dc3545;
}

/* خيارات الحفظ */
.farid-save-options {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.farid-save-btn,
.farid-end-btn {
    padding: 10px;
    background-color: #28a745;
    color: #ffffff;
    border: none;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: background-color 0.2s ease;
}

.farid-save-btn:hover {
    background-color: #218838;
}

.farid-end-btn {
    background-color: #dc3545;
}

.farid-end-btn:hover {
    background-color: #c82333;
}

/* استجابة الجوال */
@media (max-width: 480px) {
    .farid-chat-window {
        width: 100vw;
        height: 100vh;
        bottom: 0;
        right: 0;
        border-radius: 0;
        max-width: 100%;
        max-height: 100%;
    }

    #farid-chat-widget.farid-position-bottom-left .farid-chat-window {
        left: 0;
    }

    #farid-chat-widget {
        bottom: 0;
        right: 0;
    }

    #farid-chat-widget.farid-position-bottom-left {
        left: 0;
        right: auto;
    }

    .farid-chat-icon {
        width: 50px;
        height: 50px;
    }

    .farid-chat-icon img {
        width: 30px;
        height: 30px;
    }
}

/* شريط التمرير المخصص */
.farid-messages-container::-webkit-scrollbar {
    width: 6px;
}

.farid-messages-container::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 10px;
}

.farid-messages-container::-webkit-scrollbar-thumb {
    background: #888;
    border-radius: 10px;
}

.farid-messages-container::-webkit-scrollbar-thumb:hover {
    background: #555;
}

/* حالات التحميل */
.farid-loading {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 16px;
}

.farid-spinner {
    border: 3px solid #f3f3f3;
    border-top: 3px solid #007bff;
    border-radius: 50%;
    width: 20px;
    height: 20px;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* رسائل الخطأ */
.farid-error {
    background-color: #f8d7da;
    color: #721c24;
    padding: 12px;
    border-radius: 6px;
    margin-bottom: 12px;
    border-left: 4px solid #dc3545;
}

/* رسائل النجاح */
.farid-success {
    background-color: #d4edda;
    color: #155724;
    padding: 12px;
    border-radius: 6px;
    margin-bottom: 12px;
    border-left: 4px solid #28a745;
}
