/* =========================================
   PRIMETY – chat.css  (AI chat widget)
   ========================================= */

#prmty-chat-btn {
  position: fixed;
  bottom: 28px;
  right: 28px;
  z-index: 9000;
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: linear-gradient(135deg, #6366f1 0%, #7c3aed 100%);
  border: none;
  cursor: pointer;
  box-shadow: 0 4px 24px rgba(99,102,241,.5);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform .25s cubic-bezier(.34,1.56,.64,1), box-shadow .25s ease;
  color: #fff;
}

#prmty-chat-btn:hover {
  transform: scale(1.1);
  box-shadow: 0 6px 32px rgba(99,102,241,.65);
}

#prmty-chat-btn svg {
  width: 26px;
  height: 26px;
  transition: opacity .2s;
}

#prmty-chat-btn .icon-close { display: none; }

#prmty-chat-btn.open .icon-chat  { display: none; }
#prmty-chat-btn.open .icon-close { display: block; }

/* ---- Chat window ---- */
#prmty-chat-panel {
  position: fixed;
  bottom: 96px;
  right: 28px;
  z-index: 8999;
  width: 360px;
  max-width: calc(100vw - 40px);
  height: 520px;
  max-height: calc(100vh - 120px);
  background: #0f1225;
  border: 1px solid rgba(99,102,241,.25);
  border-radius: 20px;
  box-shadow: 0 24px 64px rgba(0,0,0,.55);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  transform: scale(.9) translateY(16px);
  opacity: 0;
  pointer-events: none;
  transition: transform .28s cubic-bezier(.34,1.56,.64,1), opacity .22s ease;
}

#prmty-chat-panel.open {
  transform: scale(1) translateY(0);
  opacity: 1;
  pointer-events: all;
}

/* Header */
.prmty-chat-header {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 18px;
  background: linear-gradient(135deg, rgba(99,102,241,.18) 0%, rgba(124,58,237,.14) 100%);
  border-bottom: 1px solid rgba(99,102,241,.18);
  flex-shrink: 0;
}

.prmty-chat-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: linear-gradient(135deg, #6366f1, #7c3aed);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.prmty-chat-avatar svg { width: 18px; height: 18px; color: #fff; }

.prmty-chat-info { flex: 1; min-width: 0; }

.prmty-chat-name {
  font-size: .85rem;
  font-weight: 700;
  color: #e2e8f0;
  font-family: 'Space Grotesk', sans-serif;
}

.prmty-chat-status {
  font-size: .72rem;
  color: #a78bfa;
  display: flex;
  align-items: center;
  gap: 5px;
}

.prmty-chat-status::before {
  content: '';
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #34d399;
  flex-shrink: 0;
}

/* Messages area */
.prmty-chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  scroll-behavior: smooth;
}

.prmty-chat-messages::-webkit-scrollbar { width: 4px; }
.prmty-chat-messages::-webkit-scrollbar-track { background: transparent; }
.prmty-chat-messages::-webkit-scrollbar-thumb { background: rgba(99,102,241,.3); border-radius: 99px; }

/* Message bubbles */
.prmty-msg {
  display: flex;
  flex-direction: column;
  max-width: 88%;
  animation: msgIn .2s ease;
}

@keyframes msgIn {
  from { opacity: 0; transform: translateY(6px); }
  to   { opacity: 1; transform: translateY(0); }
}

.prmty-msg.user { align-self: flex-end; align-items: flex-end; }
.prmty-msg.bot  { align-self: flex-start; align-items: flex-start; }

.prmty-msg-bubble {
  padding: 10px 14px;
  border-radius: 14px;
  font-size: .84rem;
  line-height: 1.55;
  white-space: pre-wrap;
  word-break: break-word;
}

.prmty-msg.user .prmty-msg-bubble {
  background: linear-gradient(135deg, #6366f1, #7c3aed);
  color: #fff;
  border-bottom-right-radius: 4px;
}

.prmty-msg.bot .prmty-msg-bubble {
  background: rgba(255,255,255,.07);
  border: 1px solid rgba(255,255,255,.08);
  color: #cbd5e1;
  border-bottom-left-radius: 4px;
}

/* Typing indicator */
.prmty-typing .prmty-msg-bubble {
  padding: 12px 16px;
  display: flex;
  gap: 5px;
  align-items: center;
}

.prmty-typing-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #6366f1;
  animation: typingBounce .9s infinite ease-in-out;
}
.prmty-typing-dot:nth-child(2) { animation-delay: .15s; }
.prmty-typing-dot:nth-child(3) { animation-delay: .3s; }

@keyframes typingBounce {
  0%, 80%, 100% { transform: translateY(0); opacity: .5; }
  40%           { transform: translateY(-5px); opacity: 1; }
}

/* Input area */
.prmty-chat-input-wrap {
  display: flex;
  align-items: flex-end;
  gap: 8px;
  padding: 12px 14px;
  border-top: 1px solid rgba(255,255,255,.07);
  flex-shrink: 0;
  background: rgba(0,0,0,.2);
}

#prmty-chat-input {
  flex: 1;
  resize: none;
  background: rgba(255,255,255,.07);
  border: 1px solid rgba(99,102,241,.25);
  border-radius: 12px;
  padding: 9px 12px;
  color: #e2e8f0;
  font-size: .84rem;
  font-family: 'Plus Jakarta Sans', sans-serif;
  line-height: 1.5;
  max-height: 100px;
  outline: none;
  transition: border-color .2s;
  overflow-y: auto;
}

#prmty-chat-input::placeholder { color: rgba(148,163,184,.5); }

#prmty-chat-input:focus { border-color: rgba(99,102,241,.6); }

#prmty-chat-send {
  width: 38px;
  height: 38px;
  border-radius: 10px;
  background: linear-gradient(135deg, #6366f1, #7c3aed);
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: opacity .2s, transform .2s;
  color: #fff;
}

#prmty-chat-send:hover:not(:disabled) { opacity: .88; transform: scale(1.05); }

#prmty-chat-send:disabled { opacity: .45; cursor: default; }

#prmty-chat-send svg { width: 17px; height: 17px; }

/* Quick-reply chips */
.prmty-chat-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 8px;
}

.prmty-chip {
  background: transparent;
  border: 1px solid rgba(99,102,241,.4);
  color: #a78bfa;
  border-radius: 999px;
  padding: 4px 11px;
  font-size: .76rem;
  font-family: 'Plus Jakarta Sans', sans-serif;
  cursor: pointer;
  transition: background .18s, border-color .18s;
  white-space: nowrap;
}

.prmty-chip:hover {
  background: rgba(99,102,241,.15);
  border-color: rgba(99,102,241,.7);
}

/* Error message */
.prmty-chat-error {
  font-size: .78rem;
  color: #f87171;
  text-align: center;
  padding: 4px 0;
}

/* Mobile */
@media (max-width: 420px) {
  #prmty-chat-panel {
    right: 12px;
    bottom: 84px;
    width: calc(100vw - 24px);
    max-width: none;
    height: 460px;
  }
  #prmty-chat-btn { right: 16px; bottom: 20px; }
}
