/* ═══════════════════════════════════════════════════════════════
   SMART ASSISTANT WIDGET — assistant.css
   نظام الاتصالات الإدارية — المساعد الذكي
   ═══════════════════════════════════════════════════════════════ */

/* ── Floating Button ── */
#assistantBtn {
  position: fixed;
  bottom: 28px;
  left: 28px;
  width: 58px;
  height: 58px;
  border-radius: 50%;
  background: linear-gradient(135deg, #4f46e5 0%, #7c3aed 100%);
  border: none;
  box-shadow: 0 4px 20px rgba(79, 70, 229, 0.45);
  cursor: pointer;
  z-index: 9990;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform .25s, box-shadow .25s;
  color: #fff;
  font-size: 24px;
}
#assistantBtn:hover {
  transform: scale(1.1);
  box-shadow: 0 6px 28px rgba(79, 70, 229, 0.6);
}
#assistantBtn .badge-dot {
  position: absolute;
  top: 6px;
  right: 6px;
  width: 12px;
  height: 12px;
  background: #22c55e;
  border-radius: 50%;
  border: 2px solid #fff;
  animation: pulseDot 2s infinite;
}
@keyframes pulseDot {
  0%, 100% { transform: scale(1); opacity: 1; }
  50% { transform: scale(1.3); opacity: .7; }
}

/* ── Chat Panel ── */
#assistantPanel {
  position: fixed;
  bottom: 100px;
  left: 28px;
  width: 380px;
  max-height: 580px;
  background: #fff;
  border-radius: 20px;
  box-shadow: 0 12px 48px rgba(0,0,0,.18);
  z-index: 9991;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  transform: scale(.85) translateY(30px);
  opacity: 0;
  pointer-events: none;
  transition: transform .3s cubic-bezier(.34,1.56,.64,1), opacity .25s;
  direction: rtl;
}
#assistantPanel.open {
  transform: scale(1) translateY(0);
  opacity: 1;
  pointer-events: all;
}

/* Panel Header */
.asst-header {
  background: linear-gradient(135deg, #4f46e5 0%, #7c3aed 100%);
  padding: 16px 18px;
  display: flex;
  align-items: center;
  gap: 12px;
  flex-shrink: 0;
}
.asst-avatar {
  width: 40px;
  height: 40px;
  background: rgba(255,255,255,.2);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  flex-shrink: 0;
}
.asst-header-text h6 {
  color: #fff;
  margin: 0;
  font-size: 15px;
  font-weight: 700;
}
.asst-header-text small {
  color: rgba(255,255,255,.75);
  font-size: 12px;
}
.asst-header-actions {
  margin-right: auto;
  display: flex;
  gap: 6px;
}
.asst-header-actions button {
  background: rgba(255,255,255,.15);
  border: none;
  color: #fff;
  width: 30px;
  height: 30px;
  border-radius: 8px;
  cursor: pointer;
  font-size: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background .2s;
}
.asst-header-actions button:hover { background: rgba(255,255,255,.3); }

/* Messages area */
.asst-messages {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  background: #f8f7ff;
}
.asst-messages::-webkit-scrollbar { width: 4px; }
.asst-messages::-webkit-scrollbar-thumb { background: #d1d5db; border-radius: 4px; }

/* Message bubbles */
.asst-msg {
  display: flex;
  gap: 8px;
  align-items: flex-start;
  animation: msgIn .3s ease;
}
@keyframes msgIn {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: translateY(0); }
}
.asst-msg.user { flex-direction: row-reverse; }
.asst-msg-icon {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  flex-shrink: 0;
}
.asst-msg.bot .asst-msg-icon { background: #ede9fe; color: #7c3aed; }
.asst-msg.user .asst-msg-icon { background: #dbeafe; color: #2563eb; }
.asst-msg-bubble {
  max-width: 80%;
  padding: 10px 14px;
  border-radius: 14px;
  font-size: 13.5px;
  line-height: 1.6;
}
.asst-msg.bot .asst-msg-bubble {
  background: #fff;
  color: #1e1b4b;
  border-radius: 4px 14px 14px 14px;
  box-shadow: 0 1px 4px rgba(0,0,0,.07);
}
.asst-msg.user .asst-msg-bubble {
  background: #4f46e5;
  color: #fff;
  border-radius: 14px 4px 14px 14px;
}

/* Suggested questions chips */
.asst-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 4px;
}
.asst-chip {
  background: #ede9fe;
  color: #4f46e5;
  border: 1px solid #c4b5fd;
  border-radius: 20px;
  padding: 5px 12px;
  font-size: 12px;
  cursor: pointer;
  transition: background .2s, transform .15s;
  white-space: nowrap;
}
.asst-chip:hover {
  background: #4f46e5;
  color: #fff;
  transform: translateY(-1px);
}

/* Category tabs */
.asst-cats {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  padding: 10px 16px;
  background: #fff;
  border-bottom: 1px solid #e5e7eb;
  flex-shrink: 0;
}
.asst-cat-btn {
  background: #f3f4f6;
  border: none;
  border-radius: 20px;
  padding: 4px 12px;
  font-size: 12px;
  cursor: pointer;
  color: #374151;
  transition: background .2s, color .2s;
}
.asst-cat-btn.active, .asst-cat-btn:hover {
  background: #4f46e5;
  color: #fff;
}

/* Input area */
.asst-input-area {
  padding: 12px 14px;
  background: #fff;
  border-top: 1px solid #e5e7eb;
  display: flex;
  gap: 8px;
  align-items: center;
  flex-shrink: 0;
}
.asst-input-area input {
  flex: 1;
  border: 1.5px solid #e5e7eb;
  border-radius: 12px;
  padding: 8px 14px;
  font-size: 13px;
  outline: none;
  font-family: 'Cairo', sans-serif;
  direction: rtl;
  transition: border-color .2s;
}
.asst-input-area input:focus { border-color: #4f46e5; }
.asst-send-btn {
  width: 38px;
  height: 38px;
  border-radius: 10px;
  background: #4f46e5;
  border: none;
  color: #fff;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  transition: background .2s, transform .15s;
  flex-shrink: 0;
}
.asst-send-btn:hover { background: #4338ca; transform: scale(1.05); }

/* ── SPOTLIGHT OVERLAY ── */
#asstSpotlight {
  position: fixed;
  inset: 0;
  z-index: 9980;
  pointer-events: none;
  display: none;
}
#asstSpotlight.active { display: block; pointer-events: all; }

/* Dark overlay with hole */
.spotlight-overlay {
  position: absolute;
  inset: 0;
  background: rgba(15, 10, 40, 0.72);
  transition: all .4s;
}

/* The "hole" — transparent cutout showing the target element */
.spotlight-hole {
  position: absolute;
  border-radius: 10px;
  box-shadow:
    0 0 0 4px #a78bfa,
    0 0 0 8px rgba(167,139,250,.3),
    0 0 0 9999px rgba(15,10,40,.72);
  background: transparent;
  transition: all .4s cubic-bezier(.34,1.2,.64,1);
  pointer-events: none;
  z-index: 9982;
}

/* Pulse ring around hole */
.spotlight-hole::after {
  content: '';
  position: absolute;
  inset: -8px;
  border-radius: 14px;
  border: 2px solid #a78bfa;
  animation: spotPulse 1.5s infinite;
}
@keyframes spotPulse {
  0%   { transform: scale(1);   opacity: .9; }
  50%  { transform: scale(1.06); opacity: .4; }
  100% { transform: scale(1);   opacity: .9; }
}

/* ── TOOLTIP ── */
.asst-tooltip {
  position: absolute;
  background: #fff;
  border-radius: 14px;
  padding: 14px 16px;
  box-shadow: 0 8px 32px rgba(0,0,0,.2);
  max-width: 280px;
  min-width: 200px;
  z-index: 9985;
  direction: rtl;
  animation: tooltipIn .35s cubic-bezier(.34,1.56,.64,1);
  pointer-events: all;
}
@keyframes tooltipIn {
  from { opacity: 0; transform: scale(.85) translateY(8px); }
  to   { opacity: 1; transform: scale(1)   translateY(0); }
}
.asst-tooltip::before {
  content: '';
  position: absolute;
  width: 12px;
  height: 12px;
  background: #fff;
  transform: rotate(45deg);
}
.asst-tooltip.arrow-top::before    { top: -6px; right: 24px; }
.asst-tooltip.arrow-bottom::before { bottom: -6px; right: 24px; }
.asst-tooltip.arrow-left::before   { left: -6px; top: 20px; }
.asst-tooltip.arrow-right::before  { right: -6px; top: 20px; }

.asst-tooltip-step {
  font-size: 11px;
  color: #7c3aed;
  font-weight: 700;
  margin-bottom: 4px;
  display: flex;
  align-items: center;
  gap: 6px;
}
.asst-tooltip-step-dots {
  display: flex;
  gap: 4px;
}
.asst-tooltip-step-dots span {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #d1d5db;
  transition: background .3s;
}
.asst-tooltip-step-dots span.done  { background: #22c55e; }
.asst-tooltip-step-dots span.active { background: #7c3aed; }

.asst-tooltip-title {
  font-size: 14px;
  font-weight: 700;
  color: #1e1b4b;
  margin-bottom: 6px;
}
.asst-tooltip-desc {
  font-size: 12.5px;
  color: #4b5563;
  line-height: 1.6;
  margin-bottom: 10px;
}
.asst-tooltip-actions {
  display: flex;
  gap: 8px;
  justify-content: flex-end;
}
.asst-tooltip-skip {
  background: none;
  border: none;
  color: #9ca3af;
  font-size: 12px;
  cursor: pointer;
  padding: 4px 8px;
  border-radius: 6px;
  transition: color .2s;
}
.asst-tooltip-skip:hover { color: #ef4444; }
.asst-tooltip-next {
  background: #4f46e5;
  color: #fff;
  border: none;
  border-radius: 8px;
  padding: 6px 14px;
  font-size: 12px;
  cursor: pointer;
  font-family: 'Cairo', sans-serif;
  font-weight: 600;
  transition: background .2s, transform .15s;
  display: flex;
  align-items: center;
  gap: 4px;
}
.asst-tooltip-next:hover { background: #4338ca; transform: translateY(-1px); }

/* ── PROGRESS BAR ── */
.asst-progress-bar {
  position: fixed;
  top: 60px;
  left: 0;
  right: 0;
  height: 3px;
  background: rgba(167,139,250,.2);
  z-index: 9983;
  display: none;
}
.asst-progress-bar.active { display: block; }
.asst-progress-fill {
  height: 100%;
  background: linear-gradient(90deg, #4f46e5, #a78bfa);
  transition: width .4s ease;
  border-radius: 0 2px 2px 0;
}

/* ── TOUR BADGE (top-right indicator) ── */
.asst-tour-badge {
  position: fixed;
  top: 70px;
  left: 50%;
  transform: translateX(-50%);
  background: #4f46e5;
  color: #fff;
  border-radius: 20px;
  padding: 6px 18px;
  font-size: 13px;
  font-weight: 600;
  z-index: 9984;
  display: none;
  align-items: center;
  gap: 8px;
  box-shadow: 0 4px 16px rgba(79,70,229,.4);
  direction: rtl;
  animation: badgeIn .3s ease;
}
@keyframes badgeIn {
  from { opacity: 0; transform: translateX(-50%) translateY(-10px); }
  to   { opacity: 1; transform: translateX(-50%) translateY(0); }
}
.asst-tour-badge.active { display: flex; }
.asst-tour-badge .tour-close {
  background: rgba(255,255,255,.2);
  border: none;
  color: #fff;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  cursor: pointer;
  font-size: 11px;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* ── SUCCESS MESSAGE ── */
.asst-success {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 20px;
  text-align: center;
  gap: 8px;
}
.asst-success-icon {
  width: 56px;
  height: 56px;
  background: #dcfce7;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 28px;
  animation: successPop .5s cubic-bezier(.34,1.56,.64,1);
}
@keyframes successPop {
  from { transform: scale(0); }
  to   { transform: scale(1); }
}
.asst-success h6 { color: #166534; font-weight: 700; margin: 0; }
.asst-success p  { color: #4b5563; font-size: 13px; margin: 0; }

/* ── Typing indicator ── */
.asst-typing {
  display: flex;
  gap: 4px;
  padding: 10px 14px;
  background: #fff;
  border-radius: 4px 14px 14px 14px;
  width: fit-content;
  box-shadow: 0 1px 4px rgba(0,0,0,.07);
}
.asst-typing span {
  width: 7px;
  height: 7px;
  background: #a78bfa;
  border-radius: 50%;
  animation: typingDot 1.2s infinite;
}
.asst-typing span:nth-child(2) { animation-delay: .2s; }
.asst-typing span:nth-child(3) { animation-delay: .4s; }
@keyframes typingDot {
  0%, 60%, 100% { transform: translateY(0); opacity: .6; }
  30% { transform: translateY(-6px); opacity: 1; }
}

/* Scrollbar for messages */
.asst-messages { scrollbar-width: thin; scrollbar-color: #d1d5db transparent; }

/* Mobile adjustments */
@media (max-width: 480px) {
  #assistantPanel { width: calc(100vw - 32px); left: 16px; bottom: 90px; }
  #assistantBtn   { left: 16px; bottom: 16px; }
}
