/* أنماط الذكاء الاصطناعي */
.ai-chatbot-container {
    position: fixed;
    bottom: 20px;
    right: 20px;
    z-index: 10000;
    font-family: 'Cairo', sans-serif;
}

/* أيقونة الدردشة العائمة */
.ai-chat-icon {
    width: 70px;
    height: 70px;
    background: linear-gradient(135deg, #6a11cb 0%, #2575fc 100%);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: 0 8px 25px rgba(106, 17, 203, 0.3);
    transition: all 0.3s ease;
    position: relative;
    animation: ai-pulse 2s infinite;
}

.ai-chat-icon:hover {
    transform: translateY(-5px);
    box-shadow: 0 12px 35px rgba(106, 17, 203, 0.4);
}

.ai-robot-image {
    animation: ai-bounce 1s ease-in-out infinite alternate;
}

/* تلميح الأيقونة */
.ai-tooltip {
    position: absolute;
    top: 50%;
    right: 80px;
    transform: translateY(-50%);
    background: rgba(0, 0, 0, 0.8);
    color: white;
    padding: 10px 15px;
    border-radius: 20px;
    font-size: 12px;
    white-space: nowrap;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
    pointer-events: none;
    z-index: 10001;
}

.ai-chat-icon:hover .ai-tooltip {
    opacity: 1;
    visibility: visible;
    right: 85px;
}

/* نافذة الدردشة */
.ai-chat-window {
    position: fixed;
    bottom: 100px;
    right: 20px;
    width: 380px;
    height: 500px;
    background: white;
    border-radius: 20px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.15);
    display: none;
    flex-direction: column;
    overflow: hidden;
    transform: translateY(20px) scale(0.95);
    opacity: 0;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.ai-chat-window.active {
    transform: translateY(0) scale(1);
    opacity: 1;
}

/* رأس نافذة الدردشة */
.ai-chat-header {
    background: linear-gradient(135deg, #6a11cb 0%, #2575fc 100%);
    color: white;
    padding: 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.ai-chat-title {
    display: flex;
    align-items: center;
    gap: 12px;
}

.ai-robot-avatar {
    width: 40px;
    height: 40px;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    animation: ai-rotate 3s linear infinite;
}

.ai-chat-title h3 {
    margin: 0;
    font-size: 16px;
    font-weight: 700;
}

.ai-chat-title span {
    font-size: 12px;
    opacity: 0.9;
    display: block;
    margin-top: 2px;
}

.ai-close-btn {
    background: none;
    border: none;
    color: white;
    font-size: 18px;
    cursor: pointer;
    padding: 5px;
    border-radius: 50%;
    transition: all 0.3s ease;
}

.ai-close-btn:hover {
    background: rgba(255, 255, 255, 0.2);
    transform: rotate(90deg);
}

/* منطقة الرسائل */
.ai-chat-messages {
    flex: 1;
    padding: 20px;
    overflow-y: auto;
    background: #f8f9fa;
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.ai-message {
    display: flex;
    margin-bottom: 10px;
}

.user-message {
    justify-content: flex-end;
}

.bot-message {
    justify-content: flex-start;
}

.ai-message-content {
    max-width: 80%;
    padding: 12px 16px;
    border-radius: 18px;
    font-size: 14px;
    line-height: 1.4;
    animation: ai-messageSlide 0.3s ease;
}

.user-message .ai-message-content {
    background: linear-gradient(135deg, #6a11cb 0%, #2575fc 100%);
    color: white;
    border-bottom-right-radius: 5px;
}

.bot-message .ai-message-content {
    background: white;
    color: #333;
    border: 1px solid #e9ecef;
    border-bottom-left-radius: 5px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
}

/* مؤشر الكتابة */
.ai-typing-indicator {
    display: flex;
    gap: 4px;
    padding: 12px 16px;
    background: white;
    border-radius: 18px;
    border-bottom-left-radius: 5px;
    border: 1px solid #e9ecef;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
}

.typing-dot {
    width: 8px;
    height: 8px;
    background: #6a11cb;
    border-radius: 50%;
    animation: ai-typing 1.4s infinite;
}

.typing-dot:nth-child(2) {
    animation-delay: 0.2s;
}

.typing-dot:nth-child(3) {
    animation-delay: 0.4s;
}

/* الأزرار السريعة */
.ai-quick-actions {
    padding: 15px 20px;
    background: white;
    border-top: 1px solid #e9ecef;
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.ai-quick-btn {
    background: linear-gradient(135deg, #6a11cb 0%, #2575fc 100%);
    color: white;
    border: none;
    padding: 8px 12px;
    border-radius: 15px;
    font-size: 12px;
    cursor: pointer;
    transition: all 0.3s ease;
    font-family: 'Cairo', sans-serif;
}

.ai-quick-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(106, 17, 203, 0.3);
}

/* منطقة الإدخال */
.ai-chat-input-container {
    padding: 20px;
    background: white;
    border-top: 1px solid #e9ecef;
    display: flex;
    gap: 10px;
    align-items: center;
}

#ai-chat-input {
    flex: 1;
    padding: 12px 16px;
    border: 2px solid #e9ecef;
    border-radius: 25px;
    font-size: 14px;
    outline: none;
    transition: all 0.3s ease;
    font-family: 'Cairo', sans-serif;
}

#ai-chat-input:focus {
    border-color: #6a11cb;
    box-shadow: 0 0 0 3px rgba(106, 17, 203, 0.1);
}

#ai-send-btn {
    width: 45px;
    height: 45px;
    background: linear-gradient(135deg, #6a11cb 0%, #2575fc 100%);
    color: white;
    border: none;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
}

#ai-send-btn:hover {
    transform: scale(1.1);
    box-shadow: 0 5px 15px rgba(106, 17, 203, 0.3);
}

#ai-send-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

/* الرسوم المتحركة */
@keyframes ai-pulse {
    0% {
        box-shadow: 0 8px 25px rgba(106, 17, 203, 0.3);
    }
    50% {
        box-shadow: 0 8px 25px rgba(106, 17, 203, 0.5), 0 0 0 10px rgba(106, 17, 203, 0.1);
    }
    100% {
        box-shadow: 0 8px 25px rgba(106, 17, 203, 0.3);
    }
}

@keyframes ai-bounce {
    0% {
        transform: translateY(0);
    }
    100% {
        transform: translateY(-3px);
    }
}

@keyframes ai-rotate {
    0% {
        transform: rotate(0deg);
    }
    100% {
        transform: rotate(360deg);
    }
}

@keyframes ai-messageSlide {
    0% {
        opacity: 0;
        transform: translateY(10px);
    }
    100% {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes ai-typing {
    0%, 60%, 100% {
        transform: translateY(0);
    }
    30% {
        transform: translateY(-10px);
    }
}

/* التجاوب مع الشاشات الصغيرة */
@media (max-width: 768px) {
    .ai-chatbot-container {
        bottom: 15px;
        right: 15px;
        /* إلغاء التوسط ليبقى في الزاوية */
        transform: none;
    }

    .ai-chat-icon {
        width: 50px;
        height: 50px;
        box-shadow: 0 4px 15px rgba(106, 17, 203, 0.4);
    }

    .ai-robot-avatar svg {
        width: 30px;
        height: 30px;
    }
    
    .ai-chat-window {
        position: fixed;
        top: 0;
        left: 0;
        width: 100% !important;
        height: 100% !important;
        border-radius: 0;
        bottom: 0;
        right: 0;
        z-index: 10002;
        margin: 0;
        transform: translateY(20px); /* Initial state for animation */
    }
    
    .ai-chat-window.active {
        transform: translateY(0);
    }

    .ai-chat-header {
        padding: 15px;
        border-radius: 0;
    }

    /* إخفاء التلميح في الهاتف */
    .ai-tooltip {
        display: none !important;
    }
    
    /* تكبير زر الإغلاق */
    .ai-close-btn {
        font-size: 22px;
        padding: 8px;
        width: 40px;
        height: 40px;
        display: flex;
        align-items: center;
        justify-content: center;
        background: rgba(255,255,255,0.2);
    }
}