/* ===== GT Robotics — Robot Chat Widget ===== */

/* --- Floating robot character --- */
.chat-robot {
  position: fixed;
  bottom: 28px;
  right: 28px;
  z-index: 1500;
  cursor: pointer;
  transition: transform 0.3s ease;
}
.chat-robot:hover { transform: scale(1.08); }
.chat-robot.hidden { display: none; }

.chat-robot-body {
  width: 72px;
  height: 72px;
  position: relative;
}
.chat-robot-body svg {
  width: 100%;
  height: 100%;
  filter: drop-shadow(0 4px 16px rgba(124, 58, 237, 0.3));
}

/* Pulse ring */
.chat-robot-pulse {
  position: absolute;
  inset: -6px;
  border-radius: 50%;
  border: 2px solid rgba(124, 58, 237, 0.4);
  animation: robotPulse 2s ease-in-out infinite;
}
@keyframes robotPulse {
  0%, 100% { transform: scale(1); opacity: 0.6; }
  50% { transform: scale(1.15); opacity: 0; }
}

/* Greeting bubble */
.chat-robot-greeting {
  position: absolute;
  bottom: 80px;
  right: 0;
  background: #fff;
  border: 1px solid #e2e8f0;
  border-radius: 16px 16px 4px 16px;
  padding: 12px 16px;
  font-size: 0.85rem;
  color: #0f172a;
  font-family: 'Inter', sans-serif;
  white-space: nowrap;
  box-shadow: 0 4px 20px rgba(0,0,0,0.08);
  opacity: 0;
  transform: translateY(10px);
  animation: greetAppear 0.4s ease 2s forwards;
}
@keyframes greetAppear {
  to { opacity: 1; transform: translateY(0); }
}
.chat-robot-greeting-close {
  position: absolute;
  top: -6px; right: -6px;
  width: 20px; height: 20px;
  background: #e2e8f0;
  border: none;
  border-radius: 50%;
  font-size: 12px;
  line-height: 20px;
  text-align: center;
  color: #64748b;
  cursor: pointer;
}
.chat-robot-greeting-close:hover { background: #cbd5e1; }

/* --- Chat window --- */
.chat-window {
  position: fixed;
  bottom: 28px;
  right: 28px;
  width: 380px;
  height: 540px;
  background: #fff;
  border-radius: 20px;
  border: 1px solid #e2e8f0;
  box-shadow: 0 12px 48px rgba(0, 0, 0, 0.12);
  z-index: 1600;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  opacity: 0;
  visibility: hidden;
  transform: translateY(20px) scale(0.95);
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}
.chat-window.open {
  opacity: 1;
  visibility: visible;
  transform: translateY(0) scale(1);
}

/* Chat header */
.chat-header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 16px 20px;
  background: linear-gradient(135deg, #00d4ff, #7c3aed);
  color: #fff;
  flex-shrink: 0;
}
.chat-header-avatar {
  width: 40px;
  height: 40px;
  background: rgba(255,255,255,0.2);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.chat-header-avatar svg { width: 24px; height: 24px; }
.chat-header-info { flex: 1; }
.chat-header-name {
  font-family: 'Space Grotesk', sans-serif;
  font-weight: 600;
  font-size: 0.95rem;
}
.chat-header-status {
  font-size: 0.75rem;
  opacity: 0.8;
  display: flex;
  align-items: center;
  gap: 5px;
}
.chat-header-status::before {
  content: '';
  width: 6px; height: 6px;
  background: #4ade80;
  border-radius: 50%;
}
.chat-close {
  background: none;
  border: none;
  color: #fff;
  font-size: 1.3rem;
  cursor: pointer;
  padding: 4px;
  opacity: 0.8;
  transition: 0.2s;
}
.chat-close:hover { opacity: 1; }

/* Chat messages area */
.chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  background: #f8fafc;
}
.chat-messages::-webkit-scrollbar { width: 4px; }
.chat-messages::-webkit-scrollbar-thumb { background: #cbd5e1; border-radius: 2px; }

.chat-msg {
  display: flex;
  gap: 8px;
  max-width: 85%;
  animation: msgAppear 0.3s ease;
}
@keyframes msgAppear {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}
.chat-msg.bot { align-self: flex-start; }
.chat-msg.user { align-self: flex-end; flex-direction: row-reverse; }

.chat-msg-avatar {
  width: 28px; height: 28px;
  border-radius: 50%;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-top: 2px;
}
.chat-msg.bot .chat-msg-avatar { background: #f3e8ff; }
.chat-msg.bot .chat-msg-avatar svg { width: 16px; height: 16px; fill: #7c3aed; }
.chat-msg.user .chat-msg-avatar { background: #e2e8f0; }
.chat-msg.user .chat-msg-avatar svg { width: 16px; height: 16px; fill: #475569; }

.chat-msg-bubble {
  padding: 10px 14px;
  border-radius: 14px;
  font-size: 0.88rem;
  line-height: 1.5;
  font-family: 'Inter', sans-serif;
}
.chat-msg.bot .chat-msg-bubble {
  background: #fff;
  color: #0f172a;
  border: 1px solid #e2e8f0;
  border-bottom-left-radius: 4px;
}
.chat-msg.user .chat-msg-bubble {
  background: linear-gradient(135deg, #00d4ff, #7c3aed);
  color: #fff;
  border-bottom-right-radius: 4px;
}

/* Typing indicator */
.chat-typing {
  display: none;
  align-self: flex-start;
  padding: 10px 16px;
  background: #fff;
  border: 1px solid #e2e8f0;
  border-radius: 14px;
  gap: 4px;
}
.chat-typing.show { display: flex; }
.chat-typing span {
  width: 6px; height: 6px;
  background: #94a3b8;
  border-radius: 50%;
  animation: typing 1.4s infinite;
}
.chat-typing span:nth-child(2) { animation-delay: 0.2s; }
.chat-typing span:nth-child(3) { animation-delay: 0.4s; }
@keyframes typing {
  0%, 60%, 100% { transform: translateY(0); opacity: 0.4; }
  30% { transform: translateY(-4px); opacity: 1; }
}

/* Chat input */
.chat-input-area {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 16px;
  border-top: 1px solid #e2e8f0;
  background: #fff;
  flex-shrink: 0;
}
.chat-input {
  flex: 1;
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  padding: 10px 14px;
  font-size: 0.88rem;
  font-family: 'Inter', sans-serif;
  outline: none;
  color: #0f172a;
  transition: 0.2s;
  background: #f8fafc;
}
.chat-input:focus { border-color: #7c3aed; background: #fff; }
.chat-input::placeholder { color: #94a3b8; }
.chat-send {
  width: 40px; height: 40px;
  background: linear-gradient(135deg, #00d4ff, #7c3aed);
  border: none;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: 0.2s;
  flex-shrink: 0;
}
.chat-send:hover { transform: scale(1.05); box-shadow: 0 4px 12px rgba(124,58,237,0.3); }
.chat-send:disabled { opacity: 0.5; cursor: not-allowed; transform: none; }
.chat-send svg { width: 18px; height: 18px; fill: #fff; }

/* Powered by */
.chat-powered {
  text-align: center;
  padding: 6px;
  font-size: 0.65rem;
  color: #94a3b8;
  background: #fff;
}

/* --- Responsive --- */
@media (max-width: 480px) {
  .chat-window {
    bottom: 0; right: 0;
    width: 100%;
    height: 100%;
    border-radius: 0;
  }
  .chat-robot { bottom: 16px; right: 16px; }
  .chat-robot-body { width: 60px; height: 60px; }
  .chat-robot-greeting { display: none; }
}
