/* =====================================================================
   Edata virtual assistant — floating chat widget
   ===================================================================== */
.edata-chatbot {
  position: fixed;
  right: 24px;
  bottom: 24px;
  z-index: 9998;
  font-family: "Century Gothic", "Trebuchet MS", sans-serif;
}

/* ---- Launcher button ---- */
.chatbot-toggle {
  width: 62px;
  height: 62px;
  border-radius: 50%;
  border: none;
  cursor: pointer;
  background: linear-gradient(135deg, #00549d 0%, #003d73 100%);
  color: #fff;
  box-shadow: 0 10px 26px rgba(0, 84, 157, 0.4);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.25s ease, box-shadow 0.25s ease;
  position: relative;
}

.chatbot-toggle:hover {
  transform: translateY(-3px) scale(1.05);
  box-shadow: 0 14px 32px rgba(0, 84, 157, 0.5);
}

.chatbot-toggle .chatbot-icon-close {
  display: none;
}

.edata-chatbot.open .chatbot-toggle .chatbot-icon-open {
  display: none;
}

.edata-chatbot.open .chatbot-toggle .chatbot-icon-close {
  display: block;
}

/* Gentle attention pulse until first opened */
.chatbot-toggle::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: 50%;
  border: 2px solid rgba(0, 84, 157, 0.5);
  animation: chatbotPulse 2.4s ease-out infinite;
}

.edata-chatbot.open .chatbot-toggle::after,
.edata-chatbot.engaged .chatbot-toggle::after {
  display: none;
}

@keyframes chatbotPulse {
  0% { transform: scale(1); opacity: 0.7; }
  100% { transform: scale(1.6); opacity: 0; }
}

/* ---- Panel ---- */
.chatbot-panel {
  position: absolute;
  right: 0;
  bottom: 78px;
  width: 370px;
  max-width: calc(100vw - 32px);
  height: 520px;
  max-height: calc(100vh - 120px);
  background: #fff;
  border-radius: 16px;
  box-shadow: 0 24px 60px rgba(0, 20, 45, 0.28);
  /* Hidden by default; visibility is driven by the .open class on the root
     so it can't be overridden the way the [hidden] attribute was. */
  display: none;
  flex-direction: column;
  overflow: hidden;
  transform-origin: bottom right;
}

.edata-chatbot.open .chatbot-panel {
  display: flex;
  animation: chatbotIn 0.22s ease;
}

@keyframes chatbotIn {
  from { opacity: 0; transform: translateY(12px) scale(0.96); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}

.chatbot-header {
  background: linear-gradient(135deg, #00549d 0%, #003d73 100%);
  color: #fff;
  padding: 16px 18px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.chatbot-header-info {
  display: flex;
  align-items: center;
  gap: 12px;
}

.chatbot-avatar {
  position: relative;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: #e62d36;
  color: #fff;
  font-weight: 700;
  font-size: 15px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.chatbot-avatar svg {
  display: block;
}

/* Online indicator */
.chatbot-avatar::after {
  content: "";
  position: absolute;
  right: -1px;
  bottom: -1px;
  width: 11px;
  height: 11px;
  border-radius: 50%;
  background: #35d07f;
  border: 2px solid #0a4a86;
}

.chatbot-name {
  margin: 0;
  font-size: 15px;
  font-weight: 700;
}

.chatbot-status {
  margin: 2px 0 0;
  font-size: 12px;
  opacity: 0.85;
}

.chatbot-header-actions {
  display: flex;
  align-items: center;
  gap: 2px;
}

.chatbot-iconbtn {
  background: none;
  border: none;
  color: #fff;
  cursor: pointer;
  opacity: 0.8;
  padding: 5px;
  border-radius: 7px;
  display: inline-flex;
  transition: opacity 0.2s ease, background 0.2s ease;
}

.chatbot-iconbtn:hover {
  opacity: 1;
  background: rgba(255, 255, 255, 0.15);
}

.chatbot-iconbtn svg {
  display: block;
}

.chatbot-close {
  background: none;
  border: none;
  color: #fff;
  font-size: 26px;
  line-height: 1;
  cursor: pointer;
  opacity: 0.85;
  padding: 0 4px;
  transition: opacity 0.2s ease;
}

.chatbot-close:hover {
  opacity: 1;
}

/* ---- Messages ---- */
.chatbot-messages {
  flex: 1;
  overflow-y: auto;
  padding: 18px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  background: #f5f7fa;
}

.chatbot-msg {
  max-width: 85%;
  padding: 11px 14px;
  border-radius: 14px;
  font-size: 14px;
  line-height: 1.55;
  text-align: left;
  word-wrap: break-word;
  overflow-wrap: anywhere;
}

.chatbot-msg.bot {
  background: #fff;
  color: #333;
  border: 1px solid #e6eaf0;
  border-bottom-left-radius: 4px;
  align-self: flex-start;
}

.chatbot-msg.user {
  background: linear-gradient(135deg, #00549d 0%, #0067bd 100%);
  color: #fff;
  border-bottom-right-radius: 4px;
  align-self: flex-end;
}

.chatbot-msg a {
  color: inherit;
  text-decoration: underline;
}

/* Rendered Markdown inside bubbles */
.chatbot-msg strong { font-weight: 700; }
.chatbot-msg em { font-style: italic; }
.chatbot-msg code {
  background: #eef2f6;
  padding: 1px 5px;
  border-radius: 4px;
  font-family: "SFMono-Regular", Consolas, monospace;
  font-size: 12.5px;
}
.chatbot-msg.user code { background: rgba(255, 255, 255, 0.22); }
.chatbot-list {
  margin: 6px 0 2px;
  padding-left: 18px;
}
.chatbot-list li { margin: 3px 0; }

/* Inline links inside a bot bubble */
.chatbot-msg.bot .chatbot-link {
  color: #00549d;
  text-decoration: underline;
  font-weight: 600;
  word-break: break-word;
}

/* Call-to-action links (job posts, apply, contact) rendered as pill buttons */
.chatbot-msg .chatbot-link-btn {
  display: inline-block;
  margin-top: 8px;
  padding: 8px 16px;
  border-radius: 20px;
  background: #e62d36;
  color: #fff !important;
  text-decoration: none !important;
  font-size: 13px;
  font-weight: 700;
  transition: background 0.2s ease, transform 0.2s ease;
}

.chatbot-msg .chatbot-link-btn:hover {
  background: #c41f28;
  transform: translateY(-1px);
}

/* Typing indicator */
.chatbot-typing {
  display: inline-flex;
  gap: 4px;
  align-items: center;
}

.chatbot-typing span {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #9aa7b6;
  animation: chatbotBlink 1.2s infinite ease-in-out both;
}

.chatbot-typing span:nth-child(2) { animation-delay: 0.2s; }
.chatbot-typing span:nth-child(3) { animation-delay: 0.4s; }

@keyframes chatbotBlink {
  0%, 80%, 100% { opacity: 0.3; transform: scale(0.8); }
  40% { opacity: 1; transform: scale(1); }
}

/* ---- Input ---- */
.chatbot-form {
  display: flex;
  gap: 8px;
  padding: 12px;
  border-top: 1px solid #e6eaf0;
  background: #fff;
}

.chatbot-input {
  flex: 1;
  border: 1px solid #cfd6dd;
  border-radius: 22px;
  padding: 11px 16px;
  font-size: 14px;
  font-family: inherit;
  outline: none;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.chatbot-input:focus {
  border-color: #00549d;
  box-shadow: 0 0 0 3px rgba(0, 84, 157, 0.12);
}

.chatbot-send {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: none;
  background: #00549d;
  color: #fff;
  cursor: pointer;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s ease, transform 0.2s ease;
}

.chatbot-send:hover {
  background: #003d73;
  transform: scale(1.05);
}

.chatbot-send:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
}

.chatbot-disclaimer {
  margin: 0;
  padding: 0 12px 10px;
  background: #fff;
  font-size: 10.5px;
  color: #99a3b0;
  text-align: center;
}

@media (max-width: 480px) {
  .edata-chatbot {
    right: 16px;
    bottom: 16px;
  }
  .chatbot-panel {
    width: calc(100vw - 24px);
    height: calc(100vh - 100px);
  }
}

@media (prefers-reduced-motion: reduce) {
  .chatbot-toggle::after { animation: none; }
  .chatbot-panel { animation: none; }
}
