/* AI ChatBot Widget CSS */
/* تصميم احترافي متوافق مع Elementor */

#aicb-chatbot-container {
  position: fixed;
  z-index: 999999;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen,
    Ubuntu, Cantarell, sans-serif;
  direction: rtl;
  text-align: right;
}

/* مواقع الأيقونة */
.aicb-position-bottom-right {
  bottom: 20px;
  right: 20px;
}

.aicb-position-bottom-left {
  bottom: 20px;
  left: 20px;
}

.aicb-position-top-right {
  top: 20px;
  right: 20px;
}

.aicb-position-top-left {
  top: 20px;
  left: 20px;
}

/* أيقونة الشات */
#aicb-chat-toggle {
  width: 60px;
  height: 60px;
  border-radius: 50%;
  background-color: #007cba;
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
  transition: all 0.3s ease;
  position: relative;
  overflow: hidden;
}

#aicb-chat-toggle:hover {
  transform: scale(1.1);
  box-shadow: 0 6px 25px rgba(0, 0, 0, 0.2);
}

#aicb-chat-toggle:before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: radial-gradient(
    circle at center,
    rgba(255, 255, 255, 0.3) 0%,
    transparent 70%
  );
  opacity: 0;
  transition: opacity 0.3s ease;
}

#aicb-chat-toggle:hover:before {
  opacity: 1;
}

#aicb-close-icon {
  font-size: 20px;
  font-weight: bold;
}

/* نافذة الشات */
#aicb-chat-window {
  position: absolute;
  bottom: 70px;
  right: 0;
  width: 350px;
  height: 500px;
  background: white;
  border-radius: 15px;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
  overflow: hidden;
  opacity: 0;
  transform: translateY(20px) scale(0.95);
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  border: 1px solid #e1e5e9;
}

#aicb-chat-window.show {
  opacity: 1;
  transform: translateY(0) scale(1);
}

/* تعديل للمواقع المختلفة */
.aicb-position-bottom-left #aicb-chat-window {
  left: 0;
  right: auto;
}

.aicb-position-top-right #aicb-chat-window,
.aicb-position-top-left #aicb-chat-window {
  top: 70px;
  bottom: auto;
}

/* هيدر الشات */
.aicb-chat-header {
  background: #007cba;
  color: white;
  padding: 15px 20px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-radius: 15px 15px 0 0;
}

.aicb-chat-header h4 {
  margin: 0;
  font-size: 16px;
  font-weight: 600;
}

#aicb-minimize {
  cursor: pointer;
  font-size: 18px;
  width: 25px;
  height: 25px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  transition: background-color 0.2s ease;
}

#aicb-minimize:hover {
  background-color: rgba(255, 255, 255, 0.2);
}

/* نموذج المعلومات */
#aicb-user-info-form {
  padding: 25px 20px;
  text-align: center;
}

.aicb-form-content p {
  margin: 0 0 20px 0;
  color: #555;
  font-size: 14px;
}

#aicb-user-info-form input {
  width: 100%;
  padding: 12px 15px;
  margin: 8px 0;
  border: 2px solid #e1e5e9;
  border-radius: 10px;
  font-size: 14px;
  transition: border-color 0.3s ease;
  box-sizing: border-box;
  font-family: inherit;
}

#aicb-user-info-form input:focus {
  outline: none;
  border-color: #007cba;
  box-shadow: 0 0 0 3px rgba(0, 124, 186, 0.1);
}

#aicb-start-chat {
  width: 100%;
  padding: 12px;
  background: #007cba;
  color: white;
  border: none;
  border-radius: 10px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: background-color 0.3s ease;
  margin-top: 10px;
}

#aicb-start-chat:hover {
  background: #005a87;
}

#aicb-start-chat:disabled {
  background: #ccc;
  cursor: not-allowed;
}

/* منطقة المحادثة */
#aicb-chat-content {
  height: 320px;
  overflow-y: auto;
  padding: 0;
}

#aicb-messages {
  padding: 15px;
  min-height: 280px;
}

/* رسائل المحادثة */
.aicb-message {
  margin: 15px 0;
  display: flex;
  align-items: flex-end;
  animation: messageSlide 0.3s ease-out;
}

@keyframes messageSlide {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.aicb-message-user {
  justify-content: flex-end;
}

.aicb-message-bot {
  justify-content: flex-start;
}

.aicb-message-content {
  max-width: 80%;
  padding: 10px 15px;
  border-radius: 18px;
  font-size: 14px;
  line-height: 1.4;
  word-wrap: break-word;
}

.aicb-message-user .aicb-message-content {
  background: #007cba;
  color: white;
  border-bottom-right-radius: 5px;
}

.aicb-message-bot .aicb-message-content {
  background: #f1f3f5;
  color: #333;
  border-bottom-left-radius: 5px;
}

/* مؤشر الكتابة */
#aicb-typing-indicator {
  padding: 15px;
  display: flex;
  align-items: center;
  justify-content: flex-start;
}

.aicb-typing-dots {
  display: flex;
  margin-left: 10px;
}

.aicb-typing-dots span {
  height: 8px;
  width: 8px;
  background-color: #999;
  border-radius: 50%;
  display: inline-block;
  margin: 0 2px;
  animation: typingDots 1.4s infinite ease-in-out;
}

.aicb-typing-dots span:nth-child(1) {
  animation-delay: -0.32s;
}

.aicb-typing-dots span:nth-child(2) {
  animation-delay: -0.16s;
}

@keyframes typingDots {
  0%,
  80%,
  100% {
    transform: scale(0.8);
    opacity: 0.5;
  }
  40% {
    transform: scale(1);
    opacity: 1;
  }
}

.aicb-typing-text {
  color: #666;
  font-size: 13px;
  font-style: italic;
}

/* صندوق الإدخال */
#aicb-input-area {
  padding: 15px;
  border-top: 1px solid #e1e5e9;
  background: white;
  border-radius: 0 0 15px 15px;
}

.aicb-input-container {
  display: flex;
  align-items: center;
  background: #f8f9fa;
  border-radius: 25px;
  padding: 5px;
}

#aicb-message-input {
  flex: 1;
  border: none;
  background: transparent;
  padding: 10px 15px;
  font-size: 14px;
  outline: none;
  font-family: inherit;
}

#aicb-message-input::placeholder {
  color: #999;
}

#aicb-send-button {
  width: 40px;
  height: 40px;
  border: none;
  background: #007cba;
  color: white;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.3s ease;
  margin-left: 5px;
}

#aicb-send-button:hover {
  background: #005a87;
  transform: scale(1.05);
}

#aicb-send-button:disabled {
  background: #ccc;
  cursor: not-allowed;
  transform: none;
}

/* التمرير المخصص */
#aicb-chat-content::-webkit-scrollbar {
  width: 6px;
}

#aicb-chat-content::-webkit-scrollbar-track {
  background: #f1f1f1;
}

#aicb-chat-content::-webkit-scrollbar-thumb {
  background: #c1c1c1;
  border-radius: 3px;
}

#aicb-chat-content::-webkit-scrollbar-thumb:hover {
  background: #a8a8a8;
}

/* تأثيرات متحركة إضافية */
.aicb-pulse {
  animation: pulse 2s infinite;
}

@keyframes pulse {
  0% {
    box-shadow: 0 4px 20px rgba(0, 124, 186, 0.3);
  }
  50% {
    box-shadow: 0 4px 20px rgba(0, 124, 186, 0.6);
  }
  100% {
    box-shadow: 0 4px 20px rgba(0, 124, 186, 0.3);
  }
}

/* Responsive Design */
@media (max-width: 480px) {
  #aicb-chat-window {
    width: 300px;
    height: 450px;
  }

  .aicb-position-bottom-right,
  .aicb-position-bottom-left {
    bottom: 10px;
  }

  .aicb-position-bottom-right {
    right: 10px;
  }

  .aicb-position-bottom-left {
    left: 10px;
  }

  .aicb-message-content {
    max-width: 85%;
  }
}

/* إخفاء التداخل مع Elementor */
.elementor-widget-container #aicb-chatbot-container {
  position: fixed !important;
}

/* حماية من تأثير الثيمات الأخرى */
#aicb-chatbot-container * {
  box-sizing: border-box;
}

#aicb-chatbot-container button:focus,
#aicb-chatbot-container input:focus {
  outline: none !important;
}

/* تأثير الإشعار */
.aicb-notification {
  position: absolute;
  top: -5px;
  right: -5px;
  background: #ff4757;
  color: white;
  border-radius: 50%;
  width: 20px;
  height: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: bold;
  animation: notificationBounce 1s infinite;
}

@keyframes notificationBounce {
  0%,
  20%,
  50%,
  80%,
  100% {
    transform: translateY(0);
  }
  40% {
    transform: translateY(-10px);
  }
  60% {
    transform: translateY(-5px);
  }
}
