/*==============================================================
  Aadhunik chat assistant
==============================================================*/
.awm-chat {
  --chat-navy: #141a44;
  --chat-accent: #3f4296;
  --chat-soft: #eef0f8;
  position: fixed;
  right: 20px;
  bottom: 20px;
  z-index: 99990;
  font-family: var(--default-font, system-ui, sans-serif);
}

/* Keep the template's scroll-to-top button clear of the chat button */
.scroll-top {
  bottom: 92px !important;
  right: 28px !important;
}

.awm-chat-toggle {
  width: 60px;
  height: 60px;
  border-radius: 50%;
  border: 0;
  background: var(--chat-accent);
  color: #fff;
  font-size: 26px;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 10px 28px rgba(20, 26, 68, .35);
  cursor: pointer;
  transition: transform .2s, background .2s;
}

.awm-chat-toggle:hover {
  transform: scale(1.06);
  background: var(--chat-navy);
}

.awm-chat-toggle .icon-close,
.awm-chat.is-open .awm-chat-toggle .icon-open {
  display: none;
}

.awm-chat.is-open .awm-chat-toggle .icon-close {
  display: inline;
  font-size: 22px;
}

/* Teaser bubble */
.awm-chat-teaser {
  position: absolute;
  right: 0;
  bottom: 74px;
  width: 240px;
  background: #fff;
  color: var(--chat-navy);
  border-radius: 12px 12px 2px 12px;
  padding: 14px 30px 14px 16px;
  font-size: 14px;
  font-weight: 500;
  box-shadow: 0 10px 30px rgba(20, 26, 68, .2);
  animation: awm-pop .3s ease-out;
}

.awm-chat-teaser span {
  cursor: pointer;
}

.awm-chat-teaser-close {
  position: absolute;
  top: 4px;
  right: 6px;
  border: 0;
  background: none;
  font-size: 18px;
  line-height: 1;
  color: #8a8fa8;
  cursor: pointer;
}

/* Panel */
.awm-chat-panel {
  position: absolute;
  right: 0;
  bottom: 74px;
  width: 370px;
  height: 560px;
  max-height: calc(100vh - 110px);
  background: #fff;
  border-radius: 14px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  box-shadow: 0 18px 50px rgba(20, 26, 68, .3);
  animation: awm-pop .25s ease-out;
}

.awm-chat-panel[hidden] {
  display: none;
}

@keyframes awm-pop {
  from {
    opacity: 0;
    transform: translateY(12px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

.awm-chat-head {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 16px;
  background: linear-gradient(90deg, var(--chat-navy), var(--chat-accent));
  color: #fff;
}

.awm-chat-avatar {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  background: #fff;
  object-fit: contain;
  padding: 3px;
}

.awm-chat-title {
  flex-grow: 1;
  line-height: 1.3;
}

.awm-chat-title strong {
  display: block;
  font-family: var(--heading-font, sans-serif);
  font-size: 15px;
}

.awm-chat-title span {
  font-size: 12px;
  opacity: .85;
}

.awm-chat-title span i {
  font-size: 8px;
  color: #3ee08f;
  vertical-align: middle;
}

.awm-chat-close {
  border: 0;
  background: rgba(255, 255, 255, .12);
  color: #fff;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  cursor: pointer;
}

.awm-chat-close:hover {
  background: rgba(255, 255, 255, .25);
}

.awm-chat-body {
  flex-grow: 1;
  overflow-y: auto;
  padding: 16px 14px;
  background: var(--chat-soft);
  display: flex;
  flex-direction: column;
  gap: 8px;
  overscroll-behavior: contain;
}

/* Messages */
.awm-msg {
  display: flex;
}

.awm-msg-user {
  justify-content: flex-end;
}

.awm-bubble {
  max-width: 85%;
  padding: 10px 13px;
  border-radius: 14px;
  font-size: 14px;
  line-height: 1.45;
  white-space: pre-wrap;
  word-wrap: break-word;
}

.awm-msg-bot .awm-bubble {
  background: #fff;
  color: #2d3250;
  border-bottom-left-radius: 4px;
  box-shadow: 0 1px 2px rgba(20, 26, 68, .08);
}

.awm-msg-user .awm-bubble {
  background: var(--chat-accent);
  color: #fff;
  border-bottom-right-radius: 4px;
}

.awm-msg-form .awm-bubble {
  max-width: 100%;
  width: 100%;
  white-space: normal;
}

/* Typing indicator */
.awm-typing .awm-bubble {
  display: flex;
  gap: 4px;
  padding: 13px 14px;
}

.awm-typing span {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #a3a7c4;
  animation: awm-blink 1s infinite;
}

.awm-typing span:nth-child(2) {
  animation-delay: .15s;
}

.awm-typing span:nth-child(3) {
  animation-delay: .3s;
}

@keyframes awm-blink {
  0%, 80%, 100% {
    opacity: .3;
  }
  40% {
    opacity: 1;
  }
}

/* Quick replies */
.awm-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin: 2px 0 4px;
}

.awm-chip {
  border: 1px solid var(--chat-accent);
  background: #fff;
  color: var(--chat-accent);
  border-radius: 18px;
  padding: 6px 12px;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  text-decoration: none;
  transition: .2s;
}

.awm-chip:hover {
  background: var(--chat-accent);
  color: #fff;
}

.awm-chip .bi-whatsapp {
  color: #25d366;
}

.awm-chip:hover .bi-whatsapp {
  color: #fff;
}

.awm-chips.is-used .awm-chip {
  opacity: .45;
  pointer-events: none;
}

.awm-chips.is-used .awm-chip[href] {
  opacity: 1;
  pointer-events: auto;
}

/* Link lists inside bot messages */
.awm-links {
  display: flex;
  flex-direction: column;
  gap: 6px;
  white-space: normal;
}

.awm-links p {
  margin: 0 0 2px;
}

.awm-links a {
  display: block;
  padding: 7px 10px;
  border-radius: 8px;
  background: var(--chat-soft);
  color: var(--chat-navy);
  text-decoration: none;
  font-size: 13.5px;
}

.awm-links a:hover {
  background: #dfe2f3;
}

.awm-links a small {
  display: block;
  color: #7b8098;
  font-size: 12px;
}

.awm-muted {
  color: #5d6280;
  font-size: 13px;
}

/* Lead form */
.awm-lead {
  display: flex;
  flex-direction: column;
  gap: 9px;
}

.awm-lead label {
  display: flex;
  flex-direction: column;
  gap: 3px;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--chat-navy);
}

.awm-lead input {
  border: 1px solid #d5d8e8;
  border-radius: 8px;
  padding: 9px 11px;
  font-size: 14px;
  font-weight: 400;
  outline: none;
}

.awm-lead input:focus {
  border-color: var(--chat-accent);
  box-shadow: 0 0 0 3px rgba(63, 66, 150, .15);
}

.awm-lead .awm-hp {
  position: absolute;
  left: -9999px;
  width: 1px;
  height: 1px;
  opacity: 0;
}

.awm-lead button {
  margin-top: 2px;
  border: 0;
  border-radius: 8px;
  background: var(--chat-accent);
  color: #fff;
  padding: 10px;
  font-weight: 600;
  cursor: pointer;
}

.awm-lead button:disabled {
  opacity: .7;
  cursor: default;
}

.awm-lead small {
  color: #7b8098;
  font-size: 11.5px;
  text-align: center;
}

.awm-lead-error {
  margin: 0;
  color: #c0392b;
  font-size: 12.5px;
}

/* Input row */
.awm-chat-input {
  display: flex;
  gap: 8px;
  padding: 10px 12px;
  border-top: 1px solid #e6e8f2;
  background: #fff;
}

.awm-chat-input[hidden] {
  display: none;
}

.awm-chat-input input {
  flex-grow: 1;
  border: 1px solid #d5d8e8;
  border-radius: 20px;
  padding: 9px 14px;
  font-size: 14px;
  outline: none;
}

.awm-chat-input input:focus {
  border-color: var(--chat-accent);
}

.awm-chat-input button {
  width: 40px;
  height: 40px;
  flex-shrink: 0;
  border: 0;
  border-radius: 50%;
  background: var(--chat-accent);
  color: #fff;
  cursor: pointer;
}

.awm-chat-wa {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px;
  background: #25d366;
  color: #fff;
  font-weight: 600;
  font-size: 14px;
  text-decoration: none;
}

.awm-chat-wa:hover {
  background: #1ebe5b;
  color: #fff;
}

.awm-chat-wa[hidden] {
  display: none;
}

/* Phones: full-screen panel */
@media (max-width: 575px) {
  .awm-chat {
    right: 14px;
    bottom: 14px;
  }

  .awm-chat-panel {
    position: fixed;
    inset: 0;
    width: auto;
    height: auto;
    max-height: none;
    border-radius: 0;
  }

  .awm-chat.is-open .awm-chat-toggle {
    display: none;
  }

  .awm-chat-teaser {
    width: 210px;
  }
}
