 /* =========================================================
   WebsDocs Global Chatbot
   Full-window chat mode for desktop + mobile
========================================================= */

#wd-ai-chat {
  position: fixed;
  right: 0;
  bottom: 0;
  z-index: 2147483000;
  font-family: Arial, sans-serif;
}

/* =========================================================
   FLOATING BUBBLE
========================================================= */

.wd-ai-bubble {
  position: fixed;
  right: 24px;
  bottom: 24px;
  width: 88px;
  height: 88px;
  padding: 0;
  margin: 0;
  border: 0;
  background: transparent;
  cursor: pointer;
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0);
  transition: transform 0.22s ease;
  z-index: 2147483001;
}

.wd-ai-bubble:hover {
  transform: scale(1.14);
}

.wd-ai-bubble-face,
.wd-ai-header-face,
.wd-msg-avatar svg {
  width: 100%;
  height: 100%;
  display: block;
}

.wd-ai-bubble-face {
  width: 88px;
  height: 88px;
}

/* =========================================================
   FULL WINDOW PANEL
========================================================= */

.wd-ai-panel {
  position: fixed;
  inset: 0;
  width: 100vw;
  max-width: 100vw;
  height: 100dvh;
  max-height: 100dvh;
  background: #eef4f6;
  border: none;
  border-radius: 0;
  box-shadow: none;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  z-index: 2147483002;
}

/* =========================================================
   HEADER
========================================================= */

.wd-ai-header {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 78px;
  padding: 14px max(18px, calc((100vw - 980px) / 2));
  background: linear-gradient(135deg, #1f5b89, #2e7fb5);
  color: #ffffff;
  flex: 0 0 auto;
}

.wd-ai-header-face {
  width: 50px;
  height: 50px;
  border-radius: 50%;
  overflow: hidden;
  background: #ffffff;
  flex: 0 0 50px;
}

.wd-ai-brand {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.wd-ai-brand strong {
  font-size: 17px;
  line-height: 1.2;
  color: #ffffff;
}

.wd-ai-brand small {
  opacity: 0.92;
  font-size: 12px;
  line-height: 1.3;
  color: #ffffff;
}

#wd-ai-close {
  margin-left: auto;
  border: none;
  background: rgba(255, 255, 255, 0.16);
  color: #ffffff;
  width: 42px;
  height: 42px;
  border-radius: 14px;
  cursor: pointer;
  font-size: 24px;
  line-height: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

#wd-ai-close:hover {
  background: rgba(255, 255, 255, 0.24);
}

/* =========================================================
   MESSAGES AREA
========================================================= */

.wd-ai-messages {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  padding: 28px max(24px, calc((100vw - 980px) / 2));
  background: #eef4f6;
  scroll-behavior: smooth;
  -webkit-overflow-scrolling: touch;
}

.wd-msg-row {
  display: flex;
  gap: 10px;
  margin-bottom: 16px;
  align-items: flex-end;
}

.wd-msg-row.user {
  justify-content: flex-end;
}

.wd-msg-avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  overflow: hidden;
  flex: 0 0 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  font-weight: 700;
}

.wd-msg-avatar-bot {
  background: #ffffff;
  border: 1px solid #d8e4ea;
}

.wd-msg-avatar-user {
  background: #134f74;
  color: #ffffff;
}

.wd-msg {
  max-width: 680px;
  padding: 14px 16px;
  border-radius: 18px;
  line-height: 1.48;
  font-size: 14px;
  box-shadow: 0 3px 10px rgba(18, 53, 71, 0.06);
  word-wrap: break-word;
  overflow-wrap: anywhere;
}

.wd-msg-row.user .wd-msg {
  max-width: 620px;
}

.wd-msg.bot {
  background: #ffffff;
  color: #11384c;
  border: 1px solid #d7e4ea;
  border-bottom-left-radius: 8px;
}

.wd-msg.user {
  background: linear-gradient(135deg, #6dcfe0, #70c9d9);
  color: #083248;
  border-bottom-right-radius: 8px;
}

/* =========================================================
   INPUT AREA
========================================================= */

.wd-ai-input {
  display: flex;
  gap: 10px;
  padding: 18px max(24px, calc((100vw - 980px) / 2));
  border-top: 1px solid #d7e4ea;
  background: #f8fbfc;
  flex: 0 0 auto;
}

#wd-ai-input {
  flex: 1;
  min-width: 0;
  height: 50px;
  border-radius: 16px;
  border: 1px solid #cfe0e6;
  padding: 0 16px;
  outline: none;
  font-size: 15px;
  background: #ffffff;
  color: #10354b;
}

#wd-ai-input::placeholder {
  color: #6d7f88;
}

#wd-ai-input:focus {
  border-color: #2e7fb5;
  box-shadow: 0 0 0 3px rgba(46, 127, 181, 0.12);
}

#wd-ai-send {
  width: 54px;
  height: 50px;
  border: none;
  border-radius: 16px;
  background: #134f74;
  color: #ffffff;
  cursor: pointer;
  font-size: 18px;
  flex: 0 0 54px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

#wd-ai-send:hover {
  background: #0f4161;
}

/* =========================================================
   QUICK CARDS / CHIPS
========================================================= */

.wd-card {
  width: min(100%, 680px);
  margin-top: 10px;
  padding: 13px 14px;
  border-radius: 14px;
  background: #f9fcfd;
  border: 1px solid #cfe0e6;
  cursor: pointer;
  transition: transform 0.16s ease, border-color 0.16s ease, background 0.16s ease;
}

.wd-card:hover {
  transform: translateY(-1px);
  border-color: #a8c9d6;
  background: #ffffff;
}

.wd-card small {
  display: block;
  margin-top: 6px;
  color: #537487;
}

/* =========================================================
   TYPING INDICATOR
========================================================= */

.wd-typing {
  display: flex;
  gap: 6px;
  align-items: center;
  min-width: 62px;
}

.wd-typing-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #7ea0b2;
  animation: wdDot 1s infinite ease-in-out;
}

.wd-typing-dot:nth-child(2) {
  animation-delay: 0.15s;
}

.wd-typing-dot:nth-child(3) {
  animation-delay: 0.3s;
}

@keyframes wdDot {
  0%,
  80%,
  100% {
    transform: scale(0.7);
    opacity: 0.5;
  }

  40% {
    transform: scale(1);
    opacity: 1;
  }
}

/* =========================================================
   TABLET
========================================================= */

@media (max-width: 900px) {
  .wd-ai-bubble {
    right: 20px;
    bottom: 20px;
    width: 78px;
    height: 78px;
  }

  .wd-ai-bubble-face {
    width: 78px;
    height: 78px;
  }

  .wd-ai-header {
    padding-left: 18px;
    padding-right: 18px;
  }

  .wd-ai-messages {
    padding-left: 18px;
    padding-right: 18px;
  }

  .wd-ai-input {
    padding-left: 18px;
    padding-right: 18px;
  }

  .wd-msg {
    max-width: 78%;
  }

  .wd-msg-row.user .wd-msg {
    max-width: 76%;
  }
}

/* =========================================================
   MOBILE FULL SCREEN
========================================================= */

@media (max-width: 640px) {
  #wd-ai-chat {
    right: 0;
    bottom: 0;
    z-index: 2147483000;
  }

  .wd-ai-bubble {
    right: 16px;
    bottom: 16px;
    width: 72px;
    height: 72px;
  }

  .wd-ai-bubble-face {
    width: 72px;
    height: 72px;
  }

  .wd-ai-bubble:hover {
    transform: scale(1.06);
  }

  .wd-ai-panel {
    width: 100vw;
    max-width: 100vw;
    height: 100dvh;
    max-height: 100dvh;
  }

  .wd-ai-header {
    min-height: 72px;
    padding: 12px 14px;
    padding-top: max(12px, env(safe-area-inset-top));
  }

  .wd-ai-header-face {
    width: 42px;
    height: 42px;
    flex-basis: 42px;
  }

  .wd-ai-brand strong {
    font-size: 15px;
  }

  .wd-ai-brand small {
    font-size: 12px;
  }

  #wd-ai-close {
    width: 40px;
    height: 40px;
    border-radius: 12px;
    font-size: 24px;
  }

  .wd-ai-messages {
    padding: 14px 12px 16px;
  }

  .wd-msg-row {
    gap: 8px;
    margin-bottom: 12px;
  }

  .wd-msg-avatar {
    width: 34px;
    height: 34px;
    flex-basis: 34px;
    font-size: 10px;
  }

  .wd-msg {
    max-width: 82%;
    padding: 12px 13px;
    font-size: 14px;
    border-radius: 16px;
  }

  .wd-msg-row.user .wd-msg {
    max-width: 82%;
  }

  .wd-msg.bot {
    border-bottom-left-radius: 7px;
  }

  .wd-msg.user {
    border-bottom-right-radius: 7px;
  }

  .wd-card {
    width: 100%;
    padding: 12px;
    border-radius: 14px;
  }

  .wd-ai-input {
    padding: 10px;
    padding-bottom: max(10px, env(safe-area-inset-bottom));
    gap: 8px;
  }

  #wd-ai-input {
    height: 48px;
    border-radius: 14px;
    font-size: 15px;
    padding: 0 13px;
  }

  #wd-ai-send {
    width: 50px;
    height: 48px;
    flex-basis: 50px;
    border-radius: 14px;
  }
}

/* =========================================================
   SMALL MOBILE
========================================================= */

@media (max-width: 380px) {
  .wd-ai-header {
    gap: 9px;
    padding-left: 10px;
    padding-right: 10px;
  }

  .wd-ai-header-face {
    width: 38px;
    height: 38px;
    flex-basis: 38px;
  }

  .wd-ai-brand strong {
    font-size: 14px;
  }

  .wd-ai-brand small {
    font-size: 11px;
  }

  .wd-ai-messages {
    padding-left: 10px;
    padding-right: 10px;
  }

  .wd-msg {
    max-width: 84%;
    font-size: 13.5px;
  }

  .wd-msg-row.user .wd-msg {
    max-width: 84%;
  }

  #wd-ai-input {
    font-size: 14px;
  }
}