/* ============================================================
   AL SHAMI — CHATBOT STYLES
   ============================================================ */

#shami-chat {
  position: fixed;
  bottom: 2rem;
  left: 2rem;
  z-index: 9999;
  font-family: 'Tajawal', sans-serif;
  direction: rtl;
}

/* ── زرار الفتح ─────────────────────────────────────────── */
#chat-toggle {
  width: 62px; height: 62px; border-radius: 50%;
  background: linear-gradient(135deg, #C8A84B, #8A6F2E);
  border: none; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  font-size: 1.6rem;
  box-shadow: 0 8px 30px rgba(200,168,75,.45);
  transition: transform .25s, box-shadow .25s;
  position: relative;
}
#chat-toggle:hover {
  transform: scale(1.1);
  box-shadow: 0 12px 40px rgba(200,168,75,.6);
}
#chat-toggle.pulse {
  animation: chatPulse 1s ease-in-out 3;
}
@keyframes chatPulse {
  0%,100% { box-shadow: 0 8px 30px rgba(200,168,75,.45); transform: scale(1); }
  50%      { box-shadow: 0 0 0 14px rgba(200,168,75,.15); transform: scale(1.08); }
}

/* badge */
#chat-badge {
  position: absolute; top: -4px; right: -4px;
  width: 20px; height: 20px; border-radius: 50%;
  background: #e53e3e; color: #fff;
  font-size: .72rem; font-weight: 900;
  display: flex !important; align-items: center; justify-content: center;
  border: 2px solid #000;
  animation: badgeBounce .6s ease infinite alternate;
}
@keyframes badgeBounce {
  from { transform: scale(1); }
  to   { transform: scale(1.2); }
}

/* ── نافذة الشات ─────────────────────────────────────────── */
#chat-window {
  position: absolute;
  bottom: 78px; left: 0;
  width: 340px;
  background: #0A0A0A;
  border: 1px solid rgba(200,168,75,.25);
  border-radius: 16px;
  overflow: hidden;
  box-shadow: 0 24px 80px rgba(0,0,0,.7);
  display: flex; flex-direction: column;
  max-height: 520px;
  opacity: 0; transform: translateY(20px) scale(.95);
  pointer-events: none;
  transition: opacity .3s, transform .3s;
}
#chat-window.open {
  opacity: 1; transform: translateY(0) scale(1);
  pointer-events: all;
}

/* ── هيدر ───────────────────────────────────────────────── */
#chat-header {
  background: linear-gradient(135deg, #1a1200, #2a1e00);
  border-bottom: 1px solid rgba(200,168,75,.2);
  padding: 1rem 1.1rem;
  display: flex; align-items: center; justify-content: space-between;
  flex-shrink: 0;
}
#chat-header-info { display: flex; align-items: center; gap: .75rem; }
#chat-avatar {
  width: 42px; height: 42px; border-radius: 50%;
  background: rgba(200,168,75,.15);
  border: 1px solid rgba(200,168,75,.3);
  display: flex; align-items: center; justify-content: center;
  font-size: 1.3rem;
}
#chat-name { font-size: .95rem; font-weight: 700; color: #C8A84B; }
#chat-status {
  font-size: .72rem; color: #888;
  display: flex; align-items: center; gap: .3rem; margin-top: 2px;
}
.status-dot {
  width: 7px; height: 7px; border-radius: 50%;
  background: #48bb78;
  animation: statusPulse 2s ease-in-out infinite;
}
@keyframes statusPulse {
  0%,100% { opacity:1; } 50% { opacity:.4; }
}
#chat-close {
  background: rgba(255,255,255,.08); border: none;
  color: #888; width: 30px; height: 30px; border-radius: 50%;
  cursor: pointer; font-size: .85rem;
  display: flex; align-items: center; justify-content: center;
  transition: background .2s, color .2s;
}
#chat-close:hover { background: rgba(255,255,255,.15); color: #fff; }

/* ── الرسائل ─────────────────────────────────────────────── */
#chat-messages {
  flex: 1; overflow-y: auto; padding: 1rem;
  display: flex; flex-direction: column; gap: .6rem;
  scrollbar-width: thin; scrollbar-color: #333 transparent;
}
#chat-messages::-webkit-scrollbar { width: 4px; }
#chat-messages::-webkit-scrollbar-thumb { background: #333; border-radius: 2px; }

.msg { display: flex; flex-direction: column; max-width: 82%; }
.msg.bot  { align-self: flex-start; align-items: flex-start; }
.msg.user { align-self: flex-end;   align-items: flex-end; }

.msg-bubble {
  padding: .7rem 1rem; border-radius: 14px;
  font-size: .88rem; line-height: 1.7;
}
.msg.bot .msg-bubble {
  background: #1a1a1a;
  border: 1px solid rgba(200,168,75,.15);
  color: #F0EBE0;
  border-radius: 4px 14px 14px 14px;
}
.msg.user .msg-bubble {
  background: linear-gradient(135deg, #C8A84B, #8A6F2E);
  color: #000; font-weight: 600;
  border-radius: 14px 4px 14px 14px;
}
.msg-time { font-size: .68rem; color: #555; margin-top: .25rem; padding: 0 .3rem; }

/* أزرار سريعة */
.quick-btns {
  display: flex; flex-wrap: wrap; gap: .4rem; margin-top: .6rem;
}
.qbtn {
  background: rgba(200,168,75,.1);
  border: 1px solid rgba(200,168,75,.25);
  color: #C8A84B; padding: 6px 12px;
  border-radius: 20px; font-size: .78rem;
  font-family: 'Tajawal', sans-serif;
  cursor: pointer; transition: all .2s;
  white-space: nowrap;
}
.qbtn:hover { background: rgba(200,168,75,.2); border-color: #C8A84B; }

/* typing dots */
.typing {
  display: flex; gap: 5px; align-items: center;
  padding: .8rem 1rem !important;
}
.typing span {
  width: 7px; height: 7px; border-radius: 50%;
  background: #C8A84B; opacity: .4;
  animation: typingDot 1.2s ease-in-out infinite;
}
.typing span:nth-child(2) { animation-delay: .2s; }
.typing span:nth-child(3) { animation-delay: .4s; }
@keyframes typingDot {
  0%,100% { opacity:.4; transform: scale(1); }
  50%      { opacity:1;  transform: scale(1.3); }
}

/* ── إدخال ───────────────────────────────────────────────── */
#chat-input-area {
  display: flex; gap: .5rem; padding: .75rem 1rem;
  background: #111;
  border-top: 1px solid rgba(200,168,75,.12);
  flex-shrink: 0;
}
#chat-input {
  flex: 1; background: #1a1a1a;
  border: 1px solid rgba(200,168,75,.2);
  border-radius: 24px; padding: .65rem 1rem;
  color: #F0EBE0; font-family: 'Tajawal', sans-serif;
  font-size: .88rem; outline: none; direction: rtl;
  transition: border-color .2s;
}
#chat-input:focus { border-color: rgba(200,168,75,.5); }
#chat-input::placeholder { color: #555; }

#chat-send {
  width: 42px; height: 42px; border-radius: 50%;
  background: linear-gradient(135deg, #C8A84B, #8A6F2E);
  border: none; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0; transition: transform .2s, box-shadow .2s;
}
#chat-send:hover { transform: scale(1.1); box-shadow: 0 4px 20px rgba(200,168,75,.4); }
#chat-send svg { width: 16px; height: 16px; color: #000; stroke: #000; }

/* ── موبايل ──────────────────────────────────────────────── */
@media (max-width: 480px) {
  #shami-chat { bottom: 1rem; left: 1rem; }
  #chat-window { width: calc(100vw - 2rem); left: 0; }
}
