/* Chat widget styles */
#chat-widget {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 9999;
  font-family: 'DM Sans', system-ui, sans-serif;
}

#chat-widget-btn-wrap {
  position: relative;
  display: inline-block;
}
#chat-toggle {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  background: linear-gradient(135deg, #F5A623 0%, #e87d00 100%);
  border: none;
  cursor: pointer;
  box-shadow: 0 4px 24px rgba(245, 166, 35, 0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.2s, box-shadow 0.2s;
}
#chat-toggle:hover { transform: scale(1.07); box-shadow: 0 6px 32px rgba(245, 166, 35, 0.7); }
#chat-toggle svg { width: 28px; height: 28px; fill: white; }
.chat-notif-dot {
  position: absolute;
  top: 2px; right: 2px;
  width: 14px; height: 14px;
  background: #ef4444;
  border-radius: 50%;
  border: 2px solid #fff;
  animation: notifPulse 2s ease-in-out infinite;
}
@keyframes notifPulse { 0%,100% { transform: scale(1); opacity: 1; } 50% { transform: scale(1.2); opacity: 0.7; } }

#chat-window {
  display: none;
  width: 380px;
  max-width: calc(100vw - 48px);
  height: 540px;
  max-height: calc(100vh - 100px);
  background: #fff;
  border-radius: 16px;
  box-shadow: 0 8px 40px rgba(0,0,0,0.18);
  flex-direction: column;
  overflow: hidden;
  margin-bottom: 12px;
}
#chat-window.open { display: flex; }

#chat-header {
  background: linear-gradient(135deg, #1a365d 0%, #2d5a8e 100%);
  color: #fff;
  padding: 14px 18px;
  display: flex;
  align-items: center;
  gap: 12px;
}
#chat-header-avatar {
  width: 36px; height: 36px;
  background: rgba(255,255,255,0.15);
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 18px; flex-shrink: 0;
}
#chat-header-info { flex: 1; }
#chat-header-info h3 { margin: 0; font-size: 14px; font-weight: 700; letter-spacing: -0.01em; }
#chat-header-info span { font-size: 11px; opacity: 0.75; }
#chat-close {
  background: none; border: none; cursor: pointer; padding: 4px;
  display: flex; align-items: center; justify-content: center;
}
#chat-close svg { width: 20px; height: 20px; stroke: white; fill: none; }

#chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  scroll-behavior: smooth;
}

.msg {
  max-width: 85%;
  padding: 10px 14px;
  border-radius: 14px;
  font-size: 14px;
  line-height: 1.5;
  animation: msgIn 0.25s ease;
}
@keyframes msgIn { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: translateY(0); } }

.msg.bot { background: #f1f5f9; color: #1e293b; align-self: flex-start; border-bottom-left-radius: 4px; }
.msg.user { background: #1a365d; color: #fff; align-self: flex-end; border-bottom-right-radius: 4px; }

.msg-options {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-top: 6px;
}
.opt-btn {
  background: #fff;
  border: 1.5px solid #cbd5e1;
  border-radius: 8px;
  padding: 8px 12px;
  font-size: 13px;
  cursor: pointer;
  text-align: left;
  transition: border-color 0.15s, background 0.15s;
  font-family: inherit;
}
.opt-btn:hover { border-color: #1a365d; background: #f8fafc; }
.opt-btn.selected { background: #1a365d; color: #fff; border-color: #1a365d; }

.msg-score {
  margin-top: 8px;
  padding: 8px 12px;
  background: #f0fdf4;
  border-radius: 8px;
  font-size: 12px;
}
.score-badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 700;
  margin-left: 4px;
}
.score-badge.hot { background: #ef4444; color: #fff; }
.score-badge.warm { background: #f97316; color: #fff; }
.score-badge.cold { background: #64748b; color: #fff; }

.msg-cta {
  margin-top: 10px;
  display: inline-block;
  padding: 8px 18px;
  background: #1a365d;
  color: #fff;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 600;
  text-decoration: none;
}
.msg-cta:hover { background: #234e82; }

#chat-input-area {
  padding: 12px 16px;
  border-top: 1px solid #e2e8f0;
  display: flex;
  gap: 8px;
}
#chat-input {
  flex: 1;
  padding: 10px 14px;
  border: 1.5px solid #cbd5e1;
  border-radius: 24px;
  font-size: 14px;
  font-family: inherit;
  outline: none;
  transition: border-color 0.15s;
}
#chat-input:focus { border-color: #1a365d; }
#chat-send {
  width: 40px;
  height: 40px;
  background: #1a365d;
  border: none;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
#chat-send svg { width: 18px; height: 18px; stroke: white; fill: none; }

.typing-dot {
  display: inline-flex;
  gap: 3px;
  padding: 4px 0;
}
.typing-dot span {
  width: 6px; height: 6px;
  background: #94a3b8;
  border-radius: 50%;
  animation: bounce 1.2s infinite;
}
.typing-dot span:nth-child(2) { animation-delay: 0.15s; }
.typing-dot span:nth-child(3) { animation-delay: 0.3s; }
@keyframes bounce { 0%, 60%, 100% { transform: translateY(0); } 30% { transform: translateY(-5px); } }

@media (max-width: 480px) {
  #chat-widget { bottom: 16px; right: 16px; }
  #chat-window { width: calc(100vw - 32px); }
}