/* Chat widget — Claude-powered FitProTech Assistant */
.chat-fab {
  position: fixed;
  bottom: 24px;
  right: 24px;
  width: 60px;
  height: 60px;
  background: linear-gradient(135deg, #D4A853 0%, #B8923F 100%);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  box-shadow: 0 8px 30px rgba(212, 168, 83, 0.4);
  z-index: 1500;
  transition: transform 0.3s, box-shadow 0.3s;
  border: none;
}
.chat-fab:hover { transform: scale(1.08); box-shadow: 0 12px 40px rgba(212, 168, 83, 0.55); }
.chat-fab svg { width: 28px; height: 28px; fill: #152A45; }
.chat-fab .chat-fab-close { display: none; }
.chat-fab.open .chat-fab-open { display: none; }
.chat-fab.open .chat-fab-close { display: block; }

.chat-panel {
  display: none;
  flex-direction: column;
  position: fixed;
  bottom: 100px;
  right: 24px;
  width: 380px;
  max-width: calc(100vw - 32px);
  height: 560px;
  max-height: calc(100vh - 140px);
  background: #FFFFFF;
  border-radius: 16px;
  box-shadow: 0 20px 60px rgba(0,0,0,0.3);
  z-index: 1500;
  overflow: hidden;
  font-family: 'DM Sans', sans-serif;
}
.chat-panel.open { display: flex; }

.chat-header {
  background: linear-gradient(135deg, #152A45 0%, #1E3A5F 100%);
  color: #FFFFFF;
  padding: 16px 20px;
  display: flex;
  align-items: center;
  gap: 12px;
}
.chat-header-avatar {
  width: 36px; height: 36px; border-radius: 8px;
  background: linear-gradient(135deg, #D4A853 0%, #B8923F 100%);
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.chat-header-avatar svg { width: 18px; height: 18px; fill: #152A45; }
.chat-header h4 { font-family: 'Outfit', sans-serif; font-size: 1rem; margin: 0; line-height: 1.2; }
.chat-header p { font-size: 0.78rem; color: rgba(255,255,255,0.7); margin: 0; }

.chat-body {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
  background: #F0F4F8;
  display: flex;
  flex-direction: column;
  gap: 10px;
  scroll-behavior: smooth;
}

.chat-msg { max-width: 85%; padding: 10px 14px; border-radius: 14px; font-size: 0.92rem; line-height: 1.45; word-wrap: break-word; }
.chat-msg.user { align-self: flex-end; background: #1E3A5F; color: #FFFFFF; border-bottom-right-radius: 4px; }
.chat-msg.assistant { align-self: flex-start; background: #FFFFFF; color: #1F2937; border: 1px solid rgba(30,58,95,0.08); border-bottom-left-radius: 4px; }
.chat-msg.assistant strong { color: #152A45; }
.chat-msg.assistant a { color: #B8923F; text-decoration: underline; }
.chat-msg.assistant ul, .chat-msg.assistant ol { padding-left: 18px; margin: 6px 0; }
.chat-msg.assistant li { margin-bottom: 3px; }
.chat-msg.error { align-self: flex-start; background: #FEF2F2; color: #B91C1C; border: 1px solid #FECACA; }

.chat-typing { align-self: flex-start; display: flex; gap: 4px; padding: 12px 14px; background: #FFFFFF; border-radius: 14px; border: 1px solid rgba(30,58,95,0.08); }
.chat-typing span { width: 6px; height: 6px; border-radius: 50%; background: #D4A853; animation: chatPulse 1.2s ease-in-out infinite; }
.chat-typing span:nth-child(2) { animation-delay: 0.15s; }
.chat-typing span:nth-child(3) { animation-delay: 0.3s; }
@keyframes chatPulse { 0%, 60%, 100% { opacity: 0.3; transform: translateY(0); } 30% { opacity: 1; transform: translateY(-3px); } }

.chat-suggestions { display: flex; flex-wrap: wrap; gap: 6px; padding: 8px 14px 4px; }
.chat-suggestions button {
  background: #FFFFFF; border: 1px solid rgba(30,58,95,0.15); color: #1E3A5F;
  padding: 6px 12px; border-radius: 18px; font-size: 0.78rem; font-weight: 500;
  cursor: pointer; font-family: inherit; transition: background 0.2s, border-color 0.2s;
}
.chat-suggestions button:hover { background: #F0F4F8; border-color: #D4A853; }

.chat-input-row {
  display: flex; gap: 8px; padding: 12px;
  background: #FFFFFF; border-top: 1px solid rgba(30,58,95,0.08);
}
.chat-input-row textarea {
  flex: 1; border: 1px solid #E5E7EB; border-radius: 10px; padding: 10px 12px;
  font-family: inherit; font-size: 0.92rem; resize: none; max-height: 120px; min-height: 40px;
  line-height: 1.4;
}
.chat-input-row textarea:focus { outline: none; border-color: #D4A853; box-shadow: 0 0 0 3px rgba(212,168,83,0.15); }
.chat-send {
  background: linear-gradient(135deg, #D4A853 0%, #B8923F 100%);
  color: #152A45; border: none; border-radius: 10px;
  width: 44px; height: 40px; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: transform 0.2s, box-shadow 0.2s;
  flex-shrink: 0;
}
.chat-send:hover:not(:disabled) { transform: translateY(-1px); box-shadow: 0 4px 14px rgba(212,168,83,0.4); }
.chat-send:disabled { opacity: 0.5; cursor: not-allowed; }
.chat-send svg { width: 18px; height: 18px; fill: currentColor; }

.chat-footer-note { font-size: 0.7rem; color: #94A3B8; text-align: center; padding: 0 12px 8px; }

@media (max-width: 480px) {
  .chat-panel { right: 16px; left: 16px; bottom: 88px; width: auto; max-width: none; height: calc(100vh - 110px); }
  .chat-fab { right: 16px; bottom: 16px; }
}
