/* HRM AI Chat Widget */
.hrm-chat-widget {
  position: fixed;
  right: 22px;
  bottom: 22px;
  z-index: 9998;
  font-family: "Inter", system-ui, sans-serif;
}

.hrm-chat-button {
  width: 62px;
  height: 62px;
  border-radius: 999px;
  border: 0;
  background: linear-gradient(135deg, var(--primary), #2563eb, var(--accent));
  color: #ffffff;
  display: grid;
  place-items: center;
  font-size: 24px;
  cursor: pointer;
  box-shadow: 0 20px 45px rgba(16, 42, 67, 0.25);
}

.hrm-chat-panel {
  position: absolute;
  right: 0;
  bottom: 78px;
  width: min(390px, calc(100vw - 28px));
  height: min(620px, calc(100vh - 130px));
  background: #ffffff;
  border-radius: 24px;
  overflow: hidden;
  border: 1px solid rgba(16, 42, 67, 0.12);
  box-shadow: 0 28px 80px rgba(16, 42, 67, 0.24);
  display: none;
  grid-template-rows: auto 1fr auto;
}

.hrm-chat-widget.open .hrm-chat-panel {
  display: grid;
}

.hrm-chat-header {
  padding: 18px;
  background: linear-gradient(135deg, #102A43, #173B5F);
  color: white;
  display: flex;
  justify-content: space-between;
  gap: 14px;
  align-items: center;
}

.hrm-chat-header strong {
  display: block;
  font-size: 16px;
}

.hrm-chat-header span {
  display: block;
  font-size: 12px;
  color: rgba(255,255,255,0.72);
}

.hrm-chat-close {
  width: 34px;
  height: 34px;
  border-radius: 999px;
  border: 0;
  background: rgba(255,255,255,0.12);
  color: white;
  cursor: pointer;
}

.hrm-chat-messages {
  padding: 18px;
  overflow-y: auto;
  background: #f8fbff;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.hrm-chat-message {
  max-width: 88%;
  border-radius: 18px;
  padding: 12px 14px;
  font-size: 14px;
  line-height: 1.55;
  white-space: pre-wrap;
}

.hrm-chat-message.assistant {
  background: #ffffff;
  border: 1px solid rgba(16, 42, 67, 0.08);
  color: var(--primary);
  align-self: flex-start;
}

.hrm-chat-message.user {
  background: var(--accent);
  color: #ffffff;
  align-self: flex-end;
}

.hrm-chat-form {
  padding: 14px;
  background: #ffffff;
  border-top: 1px solid rgba(16, 42, 67, 0.08);
  display: grid;
  gap: 10px;
}

.hrm-chat-input-row {
  display: grid;
  grid-template-columns: 1fr 44px;
  gap: 8px;
}

.hrm-chat-form textarea {
  resize: none;
  min-height: 44px;
  max-height: 90px;
  border: 1px solid rgba(16, 42, 67, 0.12);
  border-radius: 14px;
  padding: 12px 13px;
  font-family: inherit;
  outline: none;
}

.hrm-chat-form textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 4px rgba(237,116,16,0.10);
}

.hrm-chat-send {
  width: 44px;
  height: 44px;
  border-radius: 14px;
  border: 0;
  background: var(--accent);
  color: white;
  cursor: pointer;
}

.hrm-chat-note {
  font-size: 11px;
  color: var(--muted);
  text-align: center;
}

.hrm-chat-honeypot {
  position: absolute;
  left: -9999px;
  opacity: 0;
}

.hrm-chat-typing {
  font-size: 12px;
  color: var(--muted);
  padding-left: 4px;
}

@media (max-width: 560px) {
  .hrm-chat-widget {
    right: 14px;
    bottom: 14px;
  }

  .hrm-chat-panel {
    position: fixed;
    right: 14px;
    left: 14px;
    bottom: 88px;
    width: auto;
    height: min(610px, calc(100vh - 110px));
  }
}


/* CHAT TYPING ANIMATION UPDATE */
.hrm-chat-typing {
  align-self: flex-start;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  max-width: 88%;
  border-radius: 18px;
  padding: 12px 14px;
  background: #ffffff;
  border: 1px solid rgba(16, 42, 67, 0.08);
  color: var(--muted);
  font-size: 13px;
  box-shadow: 0 8px 20px rgba(16,42,67,0.04);
}

.hrm-chat-typing .typing-avatar {
  width: 24px;
  height: 24px;
  border-radius: 999px;
  display: grid;
  place-items: center;
  background: rgba(237,116,16,0.12);
  color: var(--accent);
  font-size: 12px;
  flex: 0 0 auto;
}

.hrm-chat-typing .typing-copy {
  margin-right: 4px;
  white-space: nowrap;
}

.hrm-chat-typing .typing-dots {
  display: inline-flex;
  align-items: center;
  gap: 3px;
}

.hrm-chat-typing .typing-dots span {
  width: 6px;
  height: 6px;
  border-radius: 999px;
  background: var(--accent);
  opacity: 0.35;
  animation: hrmTypingPulse 1s infinite ease-in-out;
}

.hrm-chat-typing .typing-dots span:nth-child(2) {
  animation-delay: 0.15s;
}

.hrm-chat-typing .typing-dots span:nth-child(3) {
  animation-delay: 0.3s;
}

@keyframes hrmTypingPulse {
  0%, 80%, 100% {
    transform: translateY(0);
    opacity: 0.35;
  }
  40% {
    transform: translateY(-4px);
    opacity: 1;
  }
}

.hrm-chat-message {
  animation: hrmChatBubbleIn 0.18s ease both;
}

@keyframes hrmChatBubbleIn {
  from {
    opacity: 0;
    transform: translateY(6px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}


/* RIVS BUTTON-FIRST FLOW */
.hrm-chat-buttons {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-self: flex-start;
  max-width: 100%;
  animation: hrmChatBubbleIn 0.18s ease both;
}

.hrm-chat-quick-btn {
  border: 1px solid rgba(237,116,16,0.25);
  background: #ffffff;
  color: var(--primary);
  border-radius: 999px;
  padding: 9px 12px;
  font-size: 13px;
  font-weight: 800;
  cursor: pointer;
  box-shadow: 0 8px 18px rgba(16,42,67,0.05);
  transition: 0.18s ease;
}

.hrm-chat-quick-btn:hover {
  background: var(--accent);
  border-color: var(--accent);
  color: #ffffff;
  transform: translateY(-1px);
}

.hrm-chat-message.assistant {
  position: relative;
}
