/* ── Chat Widget ─────────────────────────────── */
.chat-widget-btn {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 9999;
  width: 60px;
  height: 60px;
  border-radius: 50%;
  background: linear-gradient(135deg, #1a2a3a, #2c4a6a);
  border: none;
  cursor: pointer;
  box-shadow: 0 4px 20px rgba(0,0,0,0.25);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.2s, box-shadow 0.2s;
}
.chat-widget-btn:hover {
  transform: scale(1.08);
  box-shadow: 0 6px 28px rgba(0,0,0,0.35);
}
.chat-widget-btn svg {
  width: 28px;
  height: 28px;
  fill: #fff;
}

/* Container */
.chat-widget {
  position: fixed;
  bottom: 96px;
  right: 24px;
  z-index: 9998;
  width: 400px;
  max-width: calc(100vw - 32px);
  height: 560px;
  max-height: calc(100vh - 120px);
  background: #fff;
  border-radius: 16px;
  box-shadow: 0 8px 40px rgba(0,0,0,0.18);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  opacity: 0;
  transform: translateY(20px) scale(0.95);
  pointer-events: none;
  transition: opacity 0.25s, transform 0.25s;
  font-family: "Archivo", system-ui, sans-serif;
}
.chat-widget.open {
  opacity: 1;
  transform: translateY(0) scale(1);
  pointer-events: auto;
}

/* Header */
.chat-header {
  background: linear-gradient(135deg, #1a2a3a, #2c4a6a);
  color: #fff;
  padding: 18px 20px;
  display: flex;
  align-items: center;
  gap: 12px;
  flex-shrink: 0;
}
.chat-header-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: rgba(255,255,255,0.15);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.chat-header-avatar svg {
  width: 20px;
  height: 20px;
  fill: #fff;
}
.chat-header-info h3 {
  margin: 0;
  font-size: 15px;
  font-weight: 600;
  letter-spacing: 0.01em;
}
.chat-header-info p {
  margin: 2px 0 0;
  font-size: 12px;
  opacity: 0.75;
}
.chat-close-btn {
  margin-left: auto;
  background: none;
  border: none;
  color: #fff;
  cursor: pointer;
  padding: 4px;
  opacity: 0.7;
  transition: opacity 0.15s;
}
.chat-close-btn:hover { opacity: 1; }
.chat-close-btn svg {
  width: 20px;
  height: 20px;
  fill: currentColor;
}

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

/* Message bubbles */
.chat-msg {
  max-width: 85%;
  padding: 10px 14px;
  border-radius: 14px;
  font-size: 14px;
  line-height: 1.5;
  word-wrap: break-word;
  white-space: pre-wrap;
}
.chat-msg.assistant {
  align-self: flex-start;
  background: #fff;
  color: #1a2a3a;
  border: 1px solid #e5e7eb;
  border-bottom-left-radius: 4px;
}
.chat-msg.user {
  align-self: flex-end;
  background: linear-gradient(135deg, #1a2a3a, #2c4a6a);
  color: #fff;
  border-bottom-right-radius: 4px;
}

/* Welcome message */
.chat-welcome {
  text-align: center;
  padding: 24px 16px;
  color: #6b7280;
  font-size: 13px;
  line-height: 1.6;
}
.chat-welcome strong {
  display: block;
  font-size: 15px;
  color: #1a2a3a;
  margin-bottom: 6px;
}

/* Typing indicator */
.chat-typing {
  align-self: flex-start;
  display: flex;
  gap: 4px;
  padding: 12px 16px;
  background: #fff;
  border-radius: 14px;
  border: 1px solid #e5e7eb;
  border-bottom-left-radius: 4px;
}
.chat-typing span {
  width: 7px;
  height: 7px;
  background: #9ca3af;
  border-radius: 50%;
  animation: chatBounce 1.4s infinite ease-in-out both;
}
.chat-typing span:nth-child(1) { animation-delay: 0s; }
.chat-typing span:nth-child(2) { animation-delay: 0.16s; }
.chat-typing span:nth-child(3) { animation-delay: 0.32s; }
@keyframes chatBounce {
  0%, 80%, 100% { transform: scale(0.6); opacity: 0.4; }
  40% { transform: scale(1); opacity: 1; }
}

/* Input area */
.chat-input-area {
  padding: 12px 16px;
  border-top: 1px solid #e5e7eb;
  display: flex;
  gap: 8px;
  align-items: flex-end;
  background: #fff;
  flex-shrink: 0;
}
.chat-input {
  flex: 1;
  border: 1px solid #d1d5db;
  border-radius: 12px;
  padding: 10px 14px;
  font-size: 14px;
  font-family: inherit;
  resize: none;
  outline: none;
  max-height: 100px;
  line-height: 1.4;
  transition: border-color 0.15s;
  background: #f9fafb;
}
.chat-input:focus {
  border-color: #2c4a6a;
  background: #fff;
}
.chat-input::placeholder { color: #9ca3af; }
.chat-send-btn {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: none;
  background: linear-gradient(135deg, #1a2a3a, #2c4a6a);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: opacity 0.15s, transform 0.15s;
}
.chat-send-btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}
.chat-send-btn:not(:disabled):hover {
  transform: scale(1.05);
}
.chat-send-btn svg {
  width: 18px;
  height: 18px;
  fill: #fff;
}

/* Suggested prompts */
.chat-suggestions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding: 0 16px 12px;
  background: #f7f8fa;
}
.chat-suggestion-btn {
  padding: 6px 12px;
  border-radius: 20px;
  border: 1px solid #d1d5db;
  background: #fff;
  color: #374151;
  font-size: 12px;
  font-family: inherit;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s;
}
.chat-suggestion-btn:hover {
  background: #f0f4f8;
  border-color: #2c4a6a;
}

/* Mobile */
@media (max-width: 480px) {
  .chat-widget {
    bottom: 0;
    right: 0;
    width: 100vw;
    height: 100vh;
    max-height: 100vh;
    border-radius: 0;
  }
  .chat-widget-btn {
    bottom: 16px;
    right: 16px;
  }
}
