/* Floating resume chat */
#chat-fab {
  position: fixed;
  bottom: 20px;
  right: 20px;
  height: 50px;
  padding: 0 18px;
  border-radius: 25px;
  border: none;
  background: var(--primary);
  color: white;
  font: 600 0.95rem 'Inter', sans-serif;
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  box-shadow: var(--shadow-lg);
  z-index: 1001;
  transition: background 0.2s ease, transform 0.2s ease;
}
#chat-fab:hover { background: var(--primary-dark); transform: translateY(-2px); }
#chat-fab .chat-fab-icon { font-size: 1.2rem; }

#chat-panel {
  position: fixed;
  bottom: 84px;
  right: 20px;
  width: 370px;
  max-width: calc(100vw - 32px);
  height: 520px;
  max-height: calc(100vh - 110px);
  background: var(--card-bg);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 16px;
  box-shadow: 0 20px 40px -8px rgba(0, 0, 0, 0.35);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  z-index: 1002;
  opacity: 0;
  visibility: hidden;
  transform: translateY(12px);
  transition: opacity 0.2s ease, transform 0.2s ease, visibility 0.2s;
}
#chat-panel.open { opacity: 1; visibility: visible; transform: translateY(0); }

.chat-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px;
  background: linear-gradient(135deg, #0f172a 0%, #1e293b 100%);
  color: white;
}
.chat-head strong { display: block; font-size: 0.95rem; }
.chat-head span { font-size: 0.78rem; opacity: 0.75; }
.chat-head-actions { display: flex; gap: 4px; }
.chat-head button {
  background: transparent;
  border: none;
  color: white;
  opacity: 0.75;
  cursor: pointer;
  font-size: 1rem;
  padding: 4px 8px;
  border-radius: 6px;
}
.chat-head button:hover { opacity: 1; background: rgba(255, 255, 255, 0.1); }

.chat-log {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.chat-msg {
  max-width: 85%;
  padding: 9px 13px;
  border-radius: 14px;
  font-size: 0.9rem;
  line-height: 1.5;
  word-wrap: break-word;
}
.chat-msg.bot { align-self: flex-start; background: var(--bg); border: 1px solid var(--border); border-bottom-left-radius: 4px; }
.chat-msg.user { align-self: flex-end; background: var(--primary); color: white; border-bottom-right-radius: 4px; }
.chat-msg.error { border-color: #ef4444; color: #ef4444; }
.chat-msg a { color: var(--primary); }
.chat-msg ul { margin: 4px 0 0 18px; }

.chat-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chat-chips button {
  background: transparent;
  border: 1px solid var(--primary);
  color: var(--primary);
  border-radius: 999px;
  padding: 5px 11px;
  font: 500 0.8rem 'Inter', sans-serif;
  cursor: pointer;
}
.chat-chips button:hover { background: var(--primary); color: white; }

.chat-typing { display: inline-flex; gap: 4px; padding: 4px 0; }
.chat-typing i { width: 6px; height: 6px; border-radius: 50%; background: var(--text-light); animation: chat-bounce 1.2s infinite; }
.chat-typing i:nth-child(2) { animation-delay: 0.15s; }
.chat-typing i:nth-child(3) { animation-delay: 0.3s; }
@keyframes chat-bounce { 0%, 60%, 100% { transform: translateY(0); opacity: 0.4; } 30% { transform: translateY(-4px); opacity: 1; } }

.chat-form { display: flex; gap: 8px; padding: 10px 12px; border-top: 1px solid var(--border); }
.chat-form input {
  flex: 1;
  min-width: 0;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--bg);
  color: var(--text);
  font: 0.9rem 'Inter', sans-serif;
}
.chat-form input:focus { outline: 2px solid var(--primary); outline-offset: -1px; }
.chat-form button {
  border: none;
  background: var(--primary);
  color: white;
  border-radius: 10px;
  padding: 0 14px;
  font-weight: 600;
  cursor: pointer;
}
.chat-form button:disabled { opacity: 0.5; cursor: default; }
.chat-note { font-size: 0.72rem; color: var(--text-light); text-align: center; padding: 0 12px 10px; }

@media (max-width: 600px) {
  #chat-fab .chat-fab-label { display: none; }
  #chat-fab { width: 50px; padding: 0; justify-content: center; }
  #chat-panel { right: 16px; bottom: 80px; height: calc(100vh - 110px); }
}
