/* ===== توضیح فایل: استایل سکشن دستیار هوش مصنوعی و پنجره‌ی چت ===== */
/* =========================================
   AI ASSISTANT CHATBOT — GOHAR RAVESH SIRJAN
   ========================================= */

.ai-assistant-section {
  position: relative;
  overflow: hidden;
  padding: 80px 0;
  background: linear-gradient(180deg, #0e0f13 0%, #17181f 55%, #0e0f13 100%);
}

.ai-assistant-bg {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 0;
}

.ai-glow {
  position: absolute;
  border-radius: 50%;
  filter: blur(90px);
  opacity: 0.35;
}

.ai-glow-1 {
  width: 420px;
  height: 420px;
  top: -120px;
  right: -80px;
  background: radial-gradient(circle, #e63946 0%, transparent 70%);
}

.ai-glow-2 {
  width: 380px;
  height: 380px;
  bottom: -140px;
  left: -100px;
  background: radial-gradient(circle, #2ec5ce 0%, transparent 70%);
}

.ai-assistant-section .container {
  position: relative;
  z-index: 1;
}

.ai-assistant-subtitle {
  color: #b7b9c3;
  font-size: 15px;
  margin-top: -10px;
}

/* بسته‌بندی کلی: آواتار بالا، جعبه چت پایین */
.ai-chat-wrapper {
  max-width: 700px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  align-items: center;
}

/* آواتار (تصویر دستیار) */
.ai-chat-avatar {
  width: 96px;
  height: 96px;
  border-radius: 50%;
  margin-bottom: 22px;
  padding: 4px;
  background: linear-gradient(135deg, #e63946, #2ec5ce);
  box-shadow: 0 0 0 6px rgba(230, 57, 70, 0.08),
    0 10px 30px rgba(230, 57, 70, 0.25);
  animation: ai-avatar-pulse 3s ease-in-out infinite;
}

.ai-chat-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 50%;
  background: #1b1c24;
  display: block;
}

/* آیکون جایگزین در صورت نبود تصویر آواتار */
.ai-avatar-fallback {
  display: flex;
  align-items: center;
  justify-content: center;
}

.ai-avatar-fallback::after {
  content: "\f544"; /* robot icon (Font Awesome solid) */
  font-family: "Font Awesome 6 Free";
  font-weight: 900;
  font-size: 38px;
  color: #fff;
}

@keyframes ai-avatar-pulse {
  0%,
  100% {
    box-shadow: 0 0 0 6px rgba(230, 57, 70, 0.08),
      0 10px 30px rgba(230, 57, 70, 0.25);
  }
  50% {
    box-shadow: 0 0 0 10px rgba(46, 197, 206, 0.1),
      0 10px 30px rgba(46, 197, 206, 0.25);
  }
}

/* کارت اصلی پنجره چت */
.ai-chatbox {
  width: 100%;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 20px;
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.35);
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

/* لیست پیام‌ها */
.ai-chat-messages {
  height: 400px;
  max-height: 55vh;
  overflow-y: auto;
  padding: 22px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  scroll-behavior: smooth;
}

.ai-chat-messages::-webkit-scrollbar {
  width: 6px;
}
.ai-chat-messages::-webkit-scrollbar-track {
  background: transparent;
}
.ai-chat-messages::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.15);
  border-radius: 10px;
}

.ai-message {
  display: flex;
  max-width: 100%;
}

.ai-message-bot {
  justify-content: flex-start;
}

.ai-message-user {
  justify-content: flex-end;
}

.ai-message-bubble {
  white-space: pre-wrap; /* نمایش خط‌به‌خط پاسخ‌های چندخطی ربات */
  max-width: 78%;
  padding: 12px 16px;
  border-radius: 16px;
  font-size: 14.5px;
  line-height: 1.9;
  word-wrap: break-word;
  animation: ai-msg-in 0.25s ease;
}

.ai-message-bot .ai-message-bubble {
  background: rgba(255, 255, 255, 0.07);
  color: #eceef3;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-bottom-left-radius: 4px;
}

.ai-message-user .ai-message-bubble {
  background: linear-gradient(135deg, #e63946, #c1121f);
  color: #fff;
  border-bottom-right-radius: 4px;
}

@keyframes ai-msg-in {
  from {
    opacity: 0;
    transform: translateY(6px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* نشانگر «در حال تایپ» */
.ai-typing-dots {
  display: inline-flex;
  gap: 4px;
  align-items: center;
  padding: 4px 2px;
}

.ai-typing-dots span {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #b7b9c3;
  animation: ai-typing 1.2s infinite ease-in-out;
}

.ai-typing-dots span:nth-child(2) {
  animation-delay: 0.2s;
}
.ai-typing-dots span:nth-child(3) {
  animation-delay: 0.4s;
}

@keyframes ai-typing {
  0%,
  60%,
  100% {
    transform: translateY(0);
    opacity: 0.5;
  }
  30% {
    transform: translateY(-4px);
    opacity: 1;
  }
}

/* نوار ورودی پیام */
.ai-chat-input-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 16px;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(255, 255, 255, 0.02);
}

.ai-chat-input {
  flex: 1;
  border: 1px solid rgba(255, 255, 255, 0.1);
  background: rgba(255, 255, 255, 0.06);
  color: #fff;
  border-radius: 999px;
  padding: 12px 18px;
  font-size: 14.5px;
  outline: none;
  transition: border-color 0.2s, background 0.2s;
}

.ai-chat-input::placeholder {
  color: #8b8d99;
}

.ai-chat-input:focus {
  border-color: #e63946;
  background: rgba(255, 255, 255, 0.09);
}

.ai-chat-send-btn {
  flex-shrink: 0;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: none;
  background: linear-gradient(135deg, #e63946, #c1121f);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: transform 0.15s, opacity 0.15s;
  font-size: 16px;
}

.ai-chat-send-btn:hover {
  transform: scale(1.06);
}

.ai-chat-send-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
}

/* دکمه‌ی میکروفون (مکالمه صوتی) */
.ai-chat-voice-btn {
  flex-shrink: 0;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: 1px solid rgba(255, 255, 255, 0.14);
  background: rgba(255, 255, 255, 0.06);
  color: #d8d8db;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: transform 0.15s, background 0.2s, border-color 0.2s, color 0.2s;
  font-size: 15px;
  position: relative;
}

.ai-chat-voice-btn:hover {
  border-color: rgba(230, 57, 70, 0.5);
  color: #fff;
  transform: scale(1.06);
}

/* حالت «در حال شنیدن» */
.ai-chat-voice-btn.is-listening {
  background: linear-gradient(135deg, #e63946, #c1121f);
  border-color: transparent;
  color: #fff;
}

.ai-chat-voice-btn.is-listening::before,
.ai-chat-voice-btn.is-listening::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: 50%;
  border: 2px solid rgba(230, 57, 70, 0.6);
  animation: aiVoicePulse 1.6s ease-out infinite;
}

.ai-chat-voice-btn.is-listening::after {
  animation-delay: 0.5s;
}

@keyframes aiVoicePulse {
  0% {
    transform: scale(1);
    opacity: 0.8;
  }
  100% {
    transform: scale(1.9);
    opacity: 0;
  }
}

.ai-chat-voice-btn.is-unsupported {
  opacity: 0.4;
  cursor: not-allowed;
}

/* RTL note: site direction is rtl, the paper-plane icon points visually
   toward the input's leading edge which already matches the reply flow,
   so no flip is required. Uncomment to mirror the icon if desired. */
/* .ai-chat-send-btn i { transform: scaleX(-1); } */

/* ریسپانسیو */
@media (max-width: 767px) {
  .ai-assistant-section {
    padding: 55px 0;
  }

  .ai-chat-avatar {
    width: 76px;
    height: 76px;
  }

  .ai-chat-messages {
    height: 360px;
    padding: 16px;
  }

  .ai-message-bubble {
    max-width: 88%;
    font-size: 14px;
  }

  .ai-chat-input-bar {
    padding: 10px 12px;
  }

  .ai-chat-send-btn,
  .ai-chat-voice-btn {
    width: 40px;
    height: 40px;
  }
}

@media (max-width: 420px) {
  .ai-chatbox {
    border-radius: 16px;
  }

  .ai-chat-messages {
    height: 320px;
  }
}


/* ---------------------- */

#aiAssistantBtn ,
#companyIntroBtn {
  position: relative !important;

  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;

  flex-direction: row !important;
  direction: rtl !important;

  gap: 10px !important;

  padding: 13px 22px !important;
  border-radius: 14px !important;

  color: #fff !important;
  text-decoration: none !important;

  /* =========================
     AI GLASS BACKGROUND
     ========================= */

background: linear-gradient(
  120deg,
  rgba(213, 28, 57, 0.95),
  rgba(213, 28, 57, 0.82),
  rgba(185, 35, 90, 0.75),
  rgba(100, 55, 165, 0.65),
  rgba(0, 150, 125, 0.62),
  rgba(213, 28, 57, 0.95)
) !important;

  background-size: 400% 400% !important;

  /* Glass */
  backdrop-filter: blur(16px) !important;
  -webkit-backdrop-filter: blur(16px) !important;

  /* Border */
  border: 1px solid rgba(255, 255, 255, 0.25) !important;

  /* Glow */
  box-shadow:
    0 8px 30px rgba(0, 117, 74, 0.22),
    0 0 25px rgba(210, 45, 90, 0.08),
    inset 0 1px 1px rgba(255, 255, 255, 0.25) !important;

  overflow: hidden !important;

  /* Animation */
  animation: aiGradient 9s ease infinite !important;

  transition:
    transform 0.35s ease,
    box-shadow 0.35s ease !important;

  /* جلوگیری از عمودی شدن متن */
  white-space: nowrap !important;
  writing-mode: horizontal-tb !important;
}


/* =========================================
   MOVING GRADIENT — گرادیان متحرک (پس‌زمینه رنگی در حال حرکت دکمه چت)
   ========================================= */

@keyframes aiGradient {
  0% {
    background-position: 0% 50%;
  }

  25% {
    background-position: 50% 100%;
  }

  50% {
    background-position: 100% 50%;
  }

  75% {
    background-position: 50% 0%;
  }

  100% {
    background-position: 0% 50%;
  }
}


/* =========================================
   GLASS LIGHT — افکت شیشه‌ای نوردار روی دکمه
   ========================================= */

#aiAssistantBtn::before ,
#companyIntroBtn::before {
  content: "";

  position: absolute;

  top: -100%;
  left: -60%;

  width: 45%;
  height: 300%;

  background: linear-gradient(
    90deg,
    transparent,
    rgba(255, 255, 255, 0.20),
    transparent
  );

  transform: rotate(20deg);

  animation: aiShine 6s ease-in-out infinite;

  pointer-events: none;

  z-index: 1;
}


@keyframes aiShine {
  0% {
    left: -70%;
    opacity: 0;
  }

  20% {
    opacity: 1;
  }

  45% {
    left: 130%;
    opacity: 0;
  }

  100% {
    left: 130%;
    opacity: 0;
  }
}


/* =========================================
   TEXT — استایل متن داخل دکمه شناور چت
   ========================================= */

#aiAssistantBtn > span:not(.ai-icon) ,
#companyIntroBtn > span:not(.ai-icon) {
  position: relative !important;

  display: inline-block !important;

  width: auto !important;
  height: auto !important;

  flex: 0 0 auto !important;

  color: #fff !important;

  white-space: nowrap !important;
  word-break: keep-all !important;
  word-wrap: normal !important;

  writing-mode: horizontal-tb !important;
  text-orientation: mixed !important;

  direction: rtl !important;

  transform: none !important;

  z-index: 2;
}


/* =========================================
   AI ICON — آیکون هوش مصنوعی داخل دکمه
   ========================================= */

#aiAssistantBtn .ai-icon ,
#companyIntroBtn .ai-icon {
  position: relative !important;

  display: inline-flex !important;

  align-items: center !important;
  justify-content: center !important;

  flex: 0 0 20px !important;

  width: 20px !important;
  min-width: 20px !important;
  height: 20px !important;

  writing-mode: horizontal-tb !important;

  z-index: 2;
}


/* جرقه‌ی اصلی آیکون هوش مصنوعی */

#aiAssistantBtn .ai-icon::before ,
#companyIntroBtn .ai-icon::before {
  content: "✦";

  position: absolute;

  top: 50%;
  left: 50%;

  transform: translate(-50%, -50%);

  font-size: 21px;
  line-height: 1;

  color: #fff;

  text-shadow:
    0 0 5px rgba(255, 255, 255, 0.95),
    0 0 12px rgba(255, 100, 160, 0.75),
    0 0 20px rgba(130, 100, 255, 0.45);

  animation: aiPulse 2.5s ease-in-out infinite;
}


/* نقطه‌ی نورانی کوچک کنار آیکون */

#aiAssistantBtn .ai-spark ,
#companyIntroBtn .ai-spark {
  position: absolute;

  width: 5px;
  height: 5px;

  top: 0;
  right: -2px;

  background: #fff;

  border-radius: 50%;

  box-shadow:
    0 0 6px rgba(255, 255, 255, 0.95),
    0 0 12px rgba(255, 80, 140, 0.85),
    0 0 18px rgba(130, 90, 255, 0.5);

  animation: sparkPulse 2s ease-in-out infinite;
}


/* =========================================
   AI ICON ANIMATION — انیمیشن ضربان آیکون هوش مصنوعی
   ========================================= */

@keyframes aiPulse {
  0%,
  100% {
    transform: translate(-50%, -50%) scale(0.9) rotate(0deg);
    opacity: 0.85;
  }

  50% {
    transform: translate(-50%, -50%) scale(1.15) rotate(12deg);
    opacity: 1;
  }
}


@keyframes sparkPulse {
  0%,
  100% {
    transform: scale(0.7);
    opacity: 0.4;
  }

  50% {
    transform: scale(1.3);
    opacity: 1;
  }
}


/* =========================================
   HOVER — استایل هاور (وقتی موس روی دکمه می‌ره)
   ========================================= */

#aiAssistantBtn:hover ,
#companyIntroBtn:hover {
  color: #fff !important;

  transform: translateY(-3px) !important;

  box-shadow:
    0 14px 40px rgba(0, 117, 74, 0.30),
    0 0 30px rgba(210, 45, 90, 0.18),
    0 0 45px rgba(80, 80, 220, 0.12),
    inset 0 1px 1px rgba(255, 255, 255, 0.35) !important;
}


#aiAssistantBtn:hover .ai-icon::before ,
#companyIntroBtn:hover .ai-icon::before {
  animation-duration: 1.3s;
}


/* آیکون و رنگ اختصاصی دکمه‌ی «معرفی شرکت» (متفاوت از ستاره‌ی هوش مصنوعی) */
#companyIntroBtn .ai-icon::before {
  content: "◆";
  font-size: 16px;
  color: #fff;
  text-shadow:
    0 0 5px rgba(255, 255, 255, 0.95),
    0 0 12px rgba(255, 200, 90, 0.85),
    0 0 20px rgba(255, 140, 40, 0.5);
  animation: companyIconSpin 3s ease-in-out infinite;
}

#companyIntroBtn .ai-spark {
  box-shadow:
    0 0 6px rgba(255, 255, 255, 0.95),
    0 0 12px rgba(255, 190, 80, 0.85),
    0 0 18px rgba(255, 140, 40, 0.5);
}

@keyframes companyIconSpin {
  0%,
  100% {
    transform: translate(-50%, -50%) scale(0.9) rotate(0deg);
    opacity: 0.85;
  }

  50% {
    transform: translate(-50%, -50%) scale(1.1) rotate(180deg);
    opacity: 1;
  }
}


/* =========================================
   نسخه‌ی کوچک آیکون هوش مصنوعی برای دکمه‌ی داخل navbar
   ========================================= */

.ai-assistant-nav-btn {
  display: inline-flex !important;
  align-items: center;
  gap: 8px;
}

.ai-assistant-nav-btn .ai-icon {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 14px;
  min-width: 14px;
  height: 14px;
}

.ai-assistant-nav-btn .ai-icon::before {
  content: "✦";
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  font-size: 14px;
  line-height: 1;
  color: #fff;
  text-shadow:
    0 0 4px rgba(255, 255, 255, 0.9),
    0 0 9px rgba(255, 100, 160, 0.7);
  animation: aiPulse 2.5s ease-in-out infinite;
}

.ai-assistant-nav-btn .ai-spark {
  position: absolute;
  width: 3px;
  height: 3px;
  top: -1px;
  right: -1px;
  background: #fff;
  border-radius: 50%;
  box-shadow:
    0 0 4px rgba(255, 255, 255, 0.9),
    0 0 8px rgba(255, 80, 140, 0.8);
  animation: sparkPulse 2s ease-in-out infinite;
}


/* =========================================
   MOBILE — ریسپانسیو موبایل
   ========================================= */

@media (max-width: 576px) {

  #aiAssistantBtn ,
  #companyIntroBtn {
    padding: 12px 18px !important;
    gap: 8px !important;

    font-size: 14px !important;

    border-radius: 13px !important;
  }

  #aiAssistantBtn .ai-icon ,
  #companyIntroBtn .ai-icon {
    flex-basis: 18px !important;
    width: 18px !important;
    min-width: 18px !important;
    height: 18px !important;
  }

  #aiAssistantBtn .ai-icon::before ,
  #companyIntroBtn .ai-icon::before {
    font-size: 19px;
  }
}