/* Kiara Chat Widget — PDX Group */
#pdx-chat-toggle {
  position: fixed;
  bottom: 24px;
  right: 24px;
  width: 60px;
  height: 60px;
  border-radius: 50%;
  background: #d4752e;
  border: none;
  cursor: pointer;
  box-shadow: 0 4px 20px rgba(212,117,46,0.4);
  z-index: 99999;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.2s, box-shadow 0.2s;
}
#pdx-chat-toggle:hover {
  transform: scale(1.08);
  box-shadow: 0 6px 28px rgba(212,117,46,0.5);
}
#pdx-chat-toggle svg {
  width: 28px;
  height: 28px;
  fill: #ffffff;
  transition: opacity 0.2s;
}
#pdx-chat-toggle .close-icon { display: none; }
#pdx-chat-toggle.open .chat-icon { display: none; }
#pdx-chat-toggle.open .close-icon { display: block; }

#pdx-chat-window {
  position: fixed;
  bottom: 96px;
  right: 24px;
  width: 380px;
  max-height: 520px;
  border-radius: 16px;
  background: #ffffff;
  box-shadow: 0 12px 48px rgba(26,39,68,0.2);
  z-index: 99998;
  display: none;
  flex-direction: column;
  overflow: hidden;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}
#pdx-chat-window.open { display: flex; }

#pdx-chat-header {
  background: #1a2744;
  padding: 18px 20px;
  display: flex;
  align-items: center;
  gap: 12px;
}
#pdx-chat-header .avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: #d4752e;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  color: #ffffff;
  font-size: 16px;
  flex-shrink: 0;
}
#pdx-chat-header .header-text h4 {
  margin: 0;
  color: #ffffff;
  font-size: 15px;
  font-weight: 600;
}
#pdx-chat-header .header-text p {
  margin: 2px 0 0;
  color: rgba(255,255,255,0.6);
  font-size: 12px;
}

#pdx-chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  min-height: 280px;
  max-height: 340px;
  background: #faf8f5;
}
#pdx-chat-messages::-webkit-scrollbar { width: 4px; }
#pdx-chat-messages::-webkit-scrollbar-thumb { background: #ccc; border-radius: 4px; }

.pdx-msg {
  max-width: 85%;
  padding: 10px 14px;
  border-radius: 12px;
  font-size: 14px;
  line-height: 1.5;
  word-wrap: break-word;
}
.pdx-msg.bot {
  background: #ffffff;
  color: #1a2744;
  align-self: flex-start;
  border: 1px solid #e8e4df;
  border-bottom-left-radius: 4px;
}
.pdx-msg.user {
  background: #1a2744;
  color: #ffffff;
  align-self: flex-end;
  border-bottom-right-radius: 4px;
}
.pdx-msg.bot a {
  color: #d4752e;
  text-decoration: underline;
}

.pdx-typing {
  align-self: flex-start;
  display: flex;
  gap: 4px;
  padding: 12px 16px;
  background: #ffffff;
  border-radius: 12px;
  border: 1px solid #e8e4df;
  border-bottom-left-radius: 4px;
}
.pdx-typing span {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #5a6a7a;
  opacity: 0.4;
  animation: pdxBounce 1.2s infinite;
}
.pdx-typing span:nth-child(2) { animation-delay: 0.2s; }
.pdx-typing span:nth-child(3) { animation-delay: 0.4s; }
@keyframes pdxBounce {
  0%, 60%, 100% { transform: translateY(0); opacity: 0.4; }
  30% { transform: translateY(-4px); opacity: 1; }
}

#pdx-chat-input-area {
  padding: 12px 16px;
  border-top: 1px solid #e8e4df;
  display: flex;
  gap: 8px;
  background: #ffffff;
}
#pdx-chat-input {
  flex: 1;
  border: 1px solid #e0dcd7;
  border-radius: 8px;
  padding: 10px 12px;
  font-size: 14px;
  font-family: inherit;
  outline: none;
  transition: border-color 0.2s;
  background: #faf8f5;
  color: #1a2744;
}
#pdx-chat-input:focus { border-color: #d4752e; }
#pdx-chat-input::placeholder { color: #5a6a7a; opacity: 0.6; }

#pdx-chat-send {
  width: 40px;
  height: 40px;
  border-radius: 8px;
  background: #d4752e;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s;
  flex-shrink: 0;
}
#pdx-chat-send:hover { background: #c06828; }
#pdx-chat-send svg { width: 18px; height: 18px; fill: #ffffff; }

#pdx-chat-close-btn {
  position: absolute;
  top: 10px;
  right: 12px;
  background: none;
  border: none;
  cursor: pointer;
  padding: 4px;
  line-height: 1;
  opacity: 0.6;
  transition: opacity 0.2s;
}
#pdx-chat-close-btn:hover { opacity: 1; }

@media (max-width: 480px) {
  #pdx-chat-window {
    width: calc(100vw - 24px);
    right: 12px;
    bottom: 88px;
    max-height: 70vh;
  }
}
