/* ================================
   Panda Print Magnets
   Premium Chatbot CSS - Fixed
================================ */

.chat-toggle {
  position: fixed;
  bottom: 20px;
  right: 20px;
  width: 58px;
  height: 58px;
  border-radius: 50%;
  z-index: 9999;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, #7c3aed, #22d3ee);
  border: none;
  box-shadow: 0 8px 32px rgba(124, 58, 237, 0.55);
  animation: chatFloat 3s ease-in-out infinite;
  transition: transform 0.25s ease;
}

.chat-toggle:hover {
  transform: scale(1.08);
}

.chat-toggle svg {
  z-index: 2;
  flex-shrink: 0;
}

.chat-pulse {
  position: absolute;
  inset: -6px;
  border-radius: 50%;
  background: linear-gradient(135deg, #7c3aed, #22d3ee);
  opacity: 0.25;
  filter: blur(10px);
  animation: pulsRing 2.5s ease-in-out infinite;
}

.chat-badge {
  position: absolute;
  top: 0px;
  right: 0px;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: #f43f5e;
  border: 2px solid #020617;
  font-size: 0.62rem;
  font-weight: 900;
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
}

@keyframes chatFloat {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-5px); }
}

@keyframes pulsRing {
  0%, 100% { opacity: 0.25; transform: scale(1); }
  50% { opacity: 0.1; transform: scale(1.12); }
}

/* Chat Box */
.chat-box {
  position: fixed;
  bottom: 90px;
  right: 16px;
  width: 320px;
  height: 480px;
  border-radius: 24px;
  z-index: 9998;
  display: none;
  flex-direction: column;
  overflow: hidden;
  background: rgba(6, 11, 24, 0.98);
  backdrop-filter: blur(20px);
  border: 1px solid rgba(103, 232, 249, 0.25);
  box-shadow: 0 30px 80px rgba(0, 0, 0, 0.7);
}

.chat-box.active {
  display: flex;
}

/* Header */
.chat-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 14px 16px;
  background: linear-gradient(135deg, #4c1d95, #0e7490);
  border-bottom: 1px solid rgba(103, 232, 249, 0.2);
  flex-shrink: 0;
}

.chat-agent {
  display: flex;
  align-items: center;
  gap: 10px;
}

.agent-avatar {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.18);
  display: flex;
  align-items: center;
  justify-content: center;
  border: 2px solid rgba(255, 255, 255, 0.3);
  flex-shrink: 0;
}

.agent-info strong {
  display: block;
  color: #ffffff;
  font-size: 0.92rem;
  font-weight: 800;
}

.agent-info small {
  display: flex;
  align-items: center;
  gap: 5px;
  color: rgba(255, 255, 255, 0.8);
  font-size: 0.75rem;
  font-weight: 600;
}

.online-dot {
  width: 7px;
  height: 7px;
  background: #22c55e;
  border-radius: 50%;
  display: inline-block;
  box-shadow: 0 0 6px rgba(34, 197, 94, 0.8);
}

#chat-close {
  width: 30px;
  height: 30px;
  border: none;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.15);
  color: white;
  font-size: 0.9rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s ease;
  flex-shrink: 0;
}

#chat-close:hover {
  background: rgba(255, 255, 255, 0.28);
}

/* Messages */
.chat-messages {
  flex: 1;
  padding: 14px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 8px;
  scrollbar-width: thin;
  scrollbar-color: rgba(103, 232, 249, 0.2) transparent;
}

.chat-message {
  padding: 9px 13px;
  border-radius: 16px;
  max-width: 85%;
  font-size: 0.85rem;
  line-height: 1.5;
  animation: msgIn 0.25s ease both;
}

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

.chat-message.bot {
  background: rgba(255, 255, 255, 0.09);
  color: #e2e8f0;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-bottom-left-radius: 4px;
  align-self: flex-start;
}

.chat-message.user {
  background: linear-gradient(135deg, #7c3aed, #0e7490);
  color: #ffffff;
  border-bottom-right-radius: 4px;
  align-self: flex-end;
  margin-left: auto;
}

/* Typing */
.chat-message.typing {
  background: rgba(255, 255, 255, 0.09);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-bottom-left-radius: 4px;
  align-self: flex-start;
  padding: 12px 16px;
  display: flex;
  align-items: center;
  gap: 4px;
}

.typing span {
  display: inline-block;
  width: 6px;
  height: 6px;
  background: #67e8f9;
  border-radius: 50%;
  animation: typingBounce 1.2s ease-in-out infinite;
}

.typing span:nth-child(2) { animation-delay: 0.18s; }
.typing span:nth-child(3) { animation-delay: 0.36s; }

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

/* Quick Replies */
.quick-replies {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 4px;
  align-self: flex-start;
}

.quick-replies button {
  border: 1px solid rgba(103, 232, 249, 0.35);
  padding: 5px 11px;
  border-radius: 999px;
  background: rgba(103, 232, 249, 0.08);
  color: #67e8f9;
  cursor: pointer;
  font-size: 0.78rem;
  font-weight: 700;
  transition: background 0.2s ease;
}

.quick-replies button:hover {
  background: rgba(103, 232, 249, 0.2);
}

/* Input */
.chat-input-area {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 12px;
  border-top: 1px solid rgba(255, 255, 255, 0.09);
  background: rgba(255, 255, 255, 0.03);
  flex-shrink: 0;
}

#chat-input {
  flex: 1;
  padding: 9px 13px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 999px;
  outline: none;
  background: rgba(255, 255, 255, 0.07);
  color: #f1f5f9;
  font-size: 0.85rem;
}

#chat-input::placeholder {
  color: rgba(226, 232, 240, 0.45);
}

#chat-input:focus {
  border-color: rgba(103, 232, 249, 0.45);
}

#chat-send {
  width: 36px;
  height: 36px;
  border: none;
  border-radius: 50%;
  cursor: pointer;
  background: linear-gradient(135deg, #7c3aed, #22d3ee);
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: transform 0.2s ease;
}

#chat-send:hover {
  transform: scale(1.1);
}

.chat-toggle.attention {
  animation: chatFloat 3s ease-in-out infinite;
}

/* Mobile - fits perfectly without overlapping */
@media (max-width: 480px) {
  .chat-box {
    right: 10px;
    left: 10px;
    width: auto;
    bottom: 84px;
    height: 420px;
    border-radius: 20px;
  }

  .chat-toggle {
    right: 16px;
    bottom: 16px;
    width: 52px;
    height: 52px;
  }
}
