/* إعداد عام */
* {
  box-sizing: border-box;
}
body {
  font-family: "Cairo", "Noto Color Emoji", sans-serif;
  direction: rtl;
  margin: 0;
  padding: 0;
}

/* ✅ فقــــاعة البوت */
#chatbot-bubble {
  position: fixed;
  bottom: 20px;
  left: 20px;
  z-index: 9999;
  cursor: pointer;
  transition: opacity 0.4s ease;
}

.chatbot-avatar-wrap {
  position: absolute;
  top: -50px;
  left: 50%;
  transform: translateX(-50%);
  width: 90px;
  height: 90px;
  z-index: 2;
}

.chatbot-loader-circle {
  width: 90px;
  height: 90px;
  border: 3px solid #f2c94c;
  border-top-color: transparent;
  border-radius: 50%;
  animation: spin 1.2s linear infinite;
  position: absolute;
  top: 0;
  left: 0;
}

.chatbot-avatar {
  width: 80px;
  height: 80px;
  border-radius: 50%;
  border: 3px solid #fff;
  background: #fff;
  padding: 4px;
  position: relative;
  z-index: 2;
}

.chatbot-status {
  position: absolute;
  top: 4px;
  right: 5px;
  width: 12px;
  height: 12px;
  background: #4cd137;
  border-radius: 50%;
  border: 2px solid #fff;
  z-index: 5;
}

.chatbot-bubble-box {
  width: 270px;
  border-radius: 20px;
  overflow: hidden;
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.2);
}

.chatbot-bubble-box .bubble-header {
  background-color: #0f1e39;
  text-align: center;
  padding-top: 2.5rem;
  padding-bottom: 1rem;
}

.chatbot-bubble-box .bubble-header h4 {
  color: #f2c94c;
  font-size: 1.05rem;
  margin: 0;
}

.chatbot-bubble-box .bubble-body {
  background: #fff;
  text-align: center;
  padding: 1rem;
  font-size: 0.9rem;
  color: #333;
}

.chatbot-close-icon {
  position: absolute;
  bottom: -15px;
  right: -15px;
  background: #f2c94c;
  width: 42px;
  height: 42px;
  border-radius: 50%;
  color: #fff;
  font-size: 1.5rem;
  font-weight: bold;
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.2);
  display: flex;
  align-items: center;
  justify-content: center;
}

/* ✅ نافذة البوت */
#chatbot-full {
  display: none;
  position: fixed;
  bottom: 20px;
  left: 20px;
  width: 360px;
  height: 680px;
  background: #fff;
  border-radius: 20px;
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.3);
  z-index: 99999;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.chatbot-main {
  flex: 1;
  overflow-y: auto;
  padding: 1rem;
}

.chatbot-intro {
  padding: 1rem 0 0;
}
.chatbot-intro .intro-content {
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.chatbot-intro .intro-content img {
  width: 65px;
  height: 65px;
  border-radius: 50%;
  border: 2px solid #f2c94c;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.chatbot-intro h3 {
  color: #0f3460;
  margin: 0;
  font-size: 1.2rem;
}
.chatbot-intro p {
  margin: 6px 0 0;
  font-size: 0.95rem;
  color: #444;
}

.chatbot-intro strong {
  color: #f2c94c;
}

.chat-search {
  margin-top: 1.5rem;
  background: #f8f8f8;
  padding: 1rem;
  border-radius: 14px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
}
.chat-search h4 {
  margin: 0;
  font-size: 1rem;
  color: #0f3460;
  text-align: center;
}
.chat-search p {
  font-size: 0.85rem;
  color: #666;
  text-align: center;
  margin: 4px 0 1rem;
}
.chat-search input {
  width: 100%;
  padding: 0.6rem 0.8rem;
  border: 1px solid #ccc;
  border-radius: 10px;
  font-size: 0.9rem;
  background: white;
}

/* ✅ خيارات سريعة */
.chatbot-options {
  margin-top: 1.2rem;
}
.chatbot-options div {
  background: #f6f6f6;
  padding: 1rem;
  border-radius: 12px;
  margin-bottom: 0.8rem;
  cursor: pointer;
  transition: background 0.2s;
}
.chatbot-options div:hover {
  background: #eee;
}

/* ✅ رسائل الشات */
.chatbot-body {
  margin-top: 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.8rem;
}

.user-msg,
.bot-msg {
  display: flex;
  align-items: flex-start;
  gap: 10px;
}
.user-msg {
  justify-content: flex-end;
}
.bot-msg {
  justify-content: flex-start;
}
.chat-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
}
.user-msg span,
.bot-msg span {
  background: #f0f0f0;
  padding: 0.7rem;
  border-radius: 14px;
  max-width: 70%;
  font-size: 0.9rem;
  line-height: 1.4;
  color: #333;
}

/* ✅ إدخال يدوي */
.chatbot-input-wrapper {
  padding: 0.8rem 1rem;
  border-top: 1px solid #eee;
  display: flex;
  gap: 0.6rem;
  background: #fafafa;
}
.chatbot-input-wrapper input {
  flex: 1;
  padding: 0.6rem 0.8rem;
  border-radius: 10px;
  border: 1px solid #ccc;
  font-size: 0.9rem;
}
.chatbot-input-wrapper button {
  background: #0f1e39;
  color: white;
  border: none;
  border-radius: 10px;
  padding: 0 1.2rem;
  font-size: 0.9rem;
  cursor: pointer;
}
.chatbot-input-wrapper button:hover {
  background: #162d57;
}

/* ✅ الفوتر */
.chatbot-footer {
  background: #fafafa;
  padding: 0.6rem 1rem;
  display: flex;
  justify-content: space-around;
  align-items: center;
  border-top: 1px solid #eee;
}
.chatbot-footer img {
  width: 24px;
  height: 24px;
  transition: transform 0.3s;
}
.chatbot-footer img:hover {
  transform: scale(1.2);
}

/* ✅ زر الإغلاق العلوي */
#chatbot-full .close-icon {
  position: absolute;
  top: 10px;
  right: 12px;
  font-size: 1.5rem;
  color: #333;
  cursor: pointer;
  z-index: 9999;
}

/* ✅ دوران */
@keyframes spin {
  0% {
    transform: rotate(0deg);
  }
  100% {
    transform: rotate(360deg);
  }
}
/* ✅ تأثيرات */
#chatbot-bubble:hover {
  opacity: 0.8;
}
#chatbot-full {
  animation: fadeIn 0.3s ease-in-out;
}
@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Quick Reply Buttons */
#quick-replies {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 1rem 1rem 0;
}

.quick-reply {
  background: #f2c94c;
  color: #13284b;
  border: none;
  border-radius: 20px;
  padding: 0.5rem 1rem;
  cursor: pointer;
  font-family: "Cairo", sans-serif;
  transition: 0.3s ease;
}
.quick-reply:hover {
  background: #ffda77;
}

/* Message Timestamp */
.msg-time {
  font-size: 0.7rem;
  color: #aaa;
  text-align: left;
  margin-top: 4px;
}
.message-content {
  display: flex;
  align-items: flex-end;
  gap: 8px;
}
.message-text {
  background: #f7f7f7;
  border-radius: 14px;
  padding: 0.6rem 1rem;
  max-width: 230px;
  position: relative;
  display: flex;
  flex-direction: column;
}

/* ✅ تنسيق الإدخال اليدوي بالشكل الجديد */
.chatbot-manual {
  display: flex;
  gap: 10px;
  padding: 1rem;
  background: #fff;
  border-top: 1px solid #eee;
  flex-direction: row-reverse;
  align-items: center;
}

.chatbot-manual input {
  flex: 1;
  border: none;
  border-radius: 16px;
  padding: 0.8rem 1rem;
  background: #f9f9f9;
  font-size: 0.9rem;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.05);
  outline: none;
  text-align: right;
}

.chatbot-manual button {
  background: #0f1e39;
  color: #fff;
  border: none;
  border-radius: 16px;
  padding: 0.6rem 1.2rem;
  font-size: 0.9rem;
  cursor: pointer;
  transition: background-color 0.2s ease;
}

.chatbot-manual button:hover {
  background: #1b2f53;
}

/* ✅ فقاعات الرسائل محسنة */
.user-msg span {
  background: #f2c94c;
  color: #13284b;
  padding: 0.7rem 1rem;
  border-radius: 20px 20px 0 20px;
  max-width: 75%;
  font-size: 0.9rem;
  line-height: 1.5;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
  text-align: right;
}

.bot-msg span {
  background: #f0f0f0;
  color: #333;
  padding: 0.7rem 1rem;
  border-radius: 20px 20px 20px 0;
  max-width: 75%;
  font-size: 0.9rem;
  line-height: 1.5;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
  text-align: right;
}

.timestamp {
  font-size: 0.7rem;
  color: #888;
  margin-top: 4px;
  text-align: left;
}

/* ✅ فقاعة البوت أثناء الكتابة */
.typing-msg {
  display: flex;
  align-items: flex-start;
  gap: 10px;
}

.typing-msg .typing-bubble {
  background: #f0f0f0;
  padding: 0.6rem 1rem;
  border-radius: 20px 20px 20px 0;
  max-width: 120px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
  display: flex;
  align-items: center;
  gap: 5px;
}

.typing-dot {
  width: 6px;
  height: 6px;
  background: #999;
  border-radius: 50%;
  animation: typingAnim 1.3s infinite ease-in-out;
}

.typing-dot:nth-child(2) {
  animation-delay: 0.2s;
}
.typing-dot:nth-child(3) {
  animation-delay: 0.4s;
}

@keyframes typingAnim {
  0%,
  80%,
  100% {
    transform: scale(0.9);
    opacity: 0.3;
  }
  40% {
    transform: scale(1.2);
    opacity: 1;
  }
}
.chatbot-cards {
  margin: 1rem 0;
  padding: 0 1rem;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.chatbot-card {
  background: #fff;
  border: 1px solid #eee;
  padding: 12px 16px;
  border-radius: 12px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 15px;
  color: #13284b;
  font-weight: bold;
  cursor: pointer;
  transition: all 0.2s ease;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
}
.chatbot-card:hover {
  background: #f9f9f9;
}
.chatbot-card img {
  width: 16px;
  height: 16px;
}

.user-msg span,
.bot-msg span {
  background: #f0f0f0;
  padding: 0.7rem 1rem;
  border-radius: 16px;
  max-width: 100%;
  font-size: 0.95rem;
  line-height: 1.6;
  color: #333;
  display: inline-block;
  word-break: break-word;
  white-space: pre-wrap;
  overflow-wrap: break-word;
  word-break: break-word;
}

.chatbot-close-top {
  position: absolute;
  top: 12px;
  left: 12px;
  width: 36px;
  height: 36px;
  background-color: #f2c94c;
  color: #0f1e39;
  border-radius: 50%;
  font-size: 1.4rem;
  font-weight: bold;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.3s ease;
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.15);
  z-index: 9999;
}

.chatbot-close-top:hover {
  background-color: #ffda77;
  transform: rotate(90deg);
}

@media (max-width: 480px) {
  #chatbot-full {
    width: 100vw;
    height: 100vh;
    bottom: 0;
    left: 0;
    border-radius: 0;
    box-shadow: none;
  }

  .chatbot-main {
    padding: 0.8rem 0.6rem;
  }

  .chatbot-input-wrapper {
    padding: 0.6rem;
    gap: 0.4rem;
  }

  .chatbot-input-wrapper input {
    font-size: 0.85rem;
    padding: 0.5rem 0.6rem;
  }

  .chatbot-input-wrapper button {
    padding: 0 1rem;
    font-size: 0.85rem;
  }

  .chatbot-footer img {
    width: 22px;
    height: 22px;
  }

  .chatbot-intro h3 {
    font-size: 1rem;
  }

  .chatbot-intro p {
    font-size: 0.85rem;
  }

  .chatbot-options div {
    font-size: 0.9rem;
    padding: 0.8rem;
  }

  .chatbot-card {
    font-size: 0.9rem;
  }

  .chatbot-close-top {
    top: 10px;
    left: 10px;
    width: 34px;
    height: 34px;
    font-size: 1.2rem;
  }

  .user-msg span,
  .bot-msg span {
    font-size: 0.85rem;
  }

  .timestamp {
    font-size: 0.7rem;
  }
}
/* ✅ Scrollbar Creative Design */
#chatbot-messages::-webkit-scrollbar {
  width: 12px;
}

#chatbot-messages::-webkit-scrollbar-track {
  background: rgba(255, 255, 255, 0.3);
  border-radius: 10px;
  backdrop-filter: blur(4px);
  box-shadow: inset 0 0 6px rgba(0, 0, 0, 0.1);
}

#chatbot-messages::-webkit-scrollbar-thumb {
  background: linear-gradient(135deg, #0a3c74, #bfa046);
  border-radius: 20px;
  border: 3px solid rgba(255, 255, 255, 0.7);
  box-shadow: inset 0 0 6px rgba(0, 0, 0, 0.1), 0 2px 6px rgba(0, 0, 0, 0.2);
  transition: all 0.3s ease;
}

#chatbot-messages::-webkit-scrollbar-thumb:hover {
  background: linear-gradient(135deg, #0a3c74, #e0be64);
  transform: scaleX(1.05);
}

/* ✅ Firefox دعم */
#chatbot-messages {
  scrollbar-width: thin;
  scrollbar-color: #bfa046 rgba(255, 255, 255, 0.3);
}
