/* chiyar-ai-chat.css — ویجت شناور «دستیار هوشمند چیار» (CHIYAR AI) — فاز ۴
   فایل جدا و افزودنی؛ به style.css اصلی دست نمی‌زنه.
   نکته: دکمه‌ی راهنمای «؟» (chiyar-help-fab) سمت چپ‌پایینه؛ این دکمه عمداً
   سمت راست‌پایین گذاشته شده تا تداخل نداشته باشن. */

.chiyar-ai-fab {
  position: fixed;
  bottom: 20px;
  right: 20px;
  width: 54px;
  height: 54px;
  border-radius: 50%;
  background: linear-gradient(135deg, #c9a227, #ddb62e);
  color: #0f0f13;
  border: none;
  font-size: 22px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  z-index: 9001;
  box-shadow: 0 6px 22px rgba(201, 162, 39, 0.4);
  transition: transform .15s;
}
.chiyar-ai-fab:hover { transform: scale(1.06); }
.chiyar-ai-fab .badge-new {
  position: absolute;
  top: -2px; left: -2px;
  background: #ef4444;
  color: #fff;
  font-size: 9px;
  font-weight: 800;
  border-radius: 50%;
  width: 16px; height: 16px;
  display: flex; align-items: center; justify-content: center;
  border: 2px solid #0f0f13;
}

@media (max-width: 640px) {
  .chiyar-ai-fab { bottom: 76px; right: 14px; width: 48px; height: 48px; font-size: 19px; }
}

/* ── پنجره‌ی چت ── */
.chiyar-ai-panel {
  position: fixed;
  bottom: 88px;
  right: 20px;
  width: 380px;
  max-width: calc(100vw - 28px);
  height: 560px;
  max-height: calc(100vh - 120px);
  background: #16161c;
  border: 1px solid rgba(201, 162, 39, 0.25);
  border-radius: 18px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.55);
  display: none;
  flex-direction: column;
  overflow: hidden;
  z-index: 9002;
  direction: rtl;
  font-family: inherit;
}
.chiyar-ai-panel.open { display: flex; animation: chiyarAiFadeIn .18s ease-out; }
@keyframes chiyarAiFadeIn { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: translateY(0); } }

@media (max-width: 640px) {
  .chiyar-ai-panel { bottom: 0; right: 0; left: 0; width: 100%; max-width: 100%; height: 100%; max-height: 100%; border-radius: 0; }
}

.chiyar-ai-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 16px; border-bottom: 1px solid rgba(255,255,255,0.06);
  background: rgba(201,162,39,0.06);
}
.chiyar-ai-head-title { display: flex; align-items: center; gap: 8px; font-size: 14px; font-weight: 700; color: #ececf2; }
.chiyar-ai-head-title i { color: #c9a227; }
.chiyar-ai-head-actions { display: flex; gap: 6px; }
.chiyar-ai-head-actions button {
  background: none; border: none; color: #6b6b7b; font-size: 13px; cursor: pointer;
  width: 28px; height: 28px; border-radius: 8px; display: flex; align-items: center; justify-content: center;
}
.chiyar-ai-head-actions button:hover { background: rgba(255,255,255,0.06); color: #ececf2; }

.chiyar-ai-modes {
  display: flex; gap: 4px; padding: 8px 10px; border-bottom: 1px solid rgba(255,255,255,0.06);
}
.chiyar-ai-mode-btn {
  flex: 1; background: none; border: 1px solid rgba(255,255,255,0.08); color: #9a9aa8;
  font-size: 11.5px; font-weight: 600; padding: 7px 4px; border-radius: 9px; cursor: pointer;
  font-family: inherit; transition: all .15s;
}
.chiyar-ai-mode-btn.active { background: rgba(201,162,39,0.15); border-color: rgba(201,162,39,0.4); color: #c9a227; }

.chiyar-ai-body {
  flex: 1; overflow-y: auto; padding: 14px 12px; display: flex; flex-direction: column; gap: 10px;
}
.chiyar-ai-empty { text-align: center; color: #6b6b7b; font-size: 12.5px; margin-top: 30px; line-height: 1.9; padding: 0 16px; }
.chiyar-ai-empty i { font-size: 26px; color: rgba(201,162,39,0.5); margin-bottom: 10px; display: block; }

.chiyar-ai-msg { max-width: 86%; padding: 10px 13px; border-radius: 14px; font-size: 12.8px; line-height: 1.85; white-space: pre-wrap; word-break: break-word; }
.chiyar-ai-msg.user { align-self: flex-start; background: rgba(201,162,39,0.15); color: #ececf2; border-bottom-left-radius: 4px; }
.chiyar-ai-msg.assistant { align-self: flex-end; background: #1e1e26; color: #d4d4de; border-bottom-right-radius: 4px; }
.chiyar-ai-msg.typing { align-self: flex-end; background: #1e1e26; padding: 12px 16px; }
.chiyar-ai-dots span { display: inline-block; width: 6px; height: 6px; border-radius: 50%; background: #6b6b7b; margin: 0 2px; animation: chiyarAiBlink 1.2s infinite; }
.chiyar-ai-dots span:nth-child(2) { animation-delay: .2s; }
.chiyar-ai-dots span:nth-child(3) { animation-delay: .4s; }
@keyframes chiyarAiBlink { 0%,80%,100% { opacity: .3; } 40% { opacity: 1; } }

.chiyar-ai-disclaimer {
  font-size: 10.5px; color: #6b6b7b; text-align: center; padding: 6px 14px; border-top: 1px solid rgba(255,255,255,0.05);
}

.chiyar-ai-inputbar {
  display: flex; gap: 8px; padding: 10px; border-top: 1px solid rgba(255,255,255,0.06);
}
.chiyar-ai-inputbar textarea {
  flex: 1; resize: none; background: #1e1e26; border: 1px solid rgba(255,255,255,0.08); border-radius: 12px;
  color: #ececf2; font-family: inherit; font-size: 12.8px; padding: 10px 12px; max-height: 90px; min-height: 40px;
}
.chiyar-ai-inputbar textarea:focus { outline: none; border-color: rgba(201,162,39,0.4); }
.chiyar-ai-send {
  background: #c9a227; color: #0f0f13; border: none; border-radius: 12px; width: 40px; height: 40px;
  display: flex; align-items: center; justify-content: center; cursor: pointer; flex-shrink: 0; font-size: 15px;
}
.chiyar-ai-send:disabled { opacity: .5; cursor: default; }
.chiyar-ai-send:hover:not(:disabled) { background: #ddb62e; }

.chiyar-ai-login-cta {
  padding: 30px 20px; text-align: center;
}
.chiyar-ai-login-cta a {
  display: inline-block; margin-top: 12px; background: #c9a227; color: #0f0f13; font-weight: 700;
  padding: 10px 22px; border-radius: 10px; font-size: 13px; text-decoration: none;
}
