/* online assistant widget */
.chat-overlay {
  position: fixed;
  inset: 0;
  z-index: 60;
  background: rgba(5, 12, 20, 0.38);
}

.chat-overlay[hidden],
.chat-panel[hidden] {
  display: none;
}

.chat-launcher {
  position: fixed;
  right: 22px;
  bottom: 22px;
  z-index: 60;
  display: flex;
  align-items: center;
  gap: 10px;
  height: 54px;
  padding: 0 20px 0 16px;
  border: 0;
  border-radius: 999px;
  background: linear-gradient(135deg, #1aa89e, #3ee0d3);
  color: #06121d;
  font-weight: 700;
  font-size: 15px;
  cursor: pointer;
  box-shadow: 0 14px 34px rgba(7, 17, 28, 0.34);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.chat-launcher:hover {
  transform: translateY(-2px);
  box-shadow: 0 18px 40px rgba(7, 17, 28, 0.42);
}

.chat-launcher.is-hidden {
  display: none;
}

.chat-launcher-dot {
  position: absolute;
  top: 6px;
  right: 10px;
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: #ff6b5e;
  box-shadow: 0 0 0 3px rgba(255, 107, 94, 0.28);
}

.chat-panel {
  position: fixed;
  right: 22px;
  bottom: 22px;
  z-index: 61;
  display: none;
  flex-direction: column;
  width: 380px;
  max-width: calc(100vw - 32px);
  height: 588px;
  max-height: calc(100vh - 40px);
  max-height: calc(100dvh - 40px);
  border-radius: 18px;
  overflow: hidden;
  background: #f6f9fb;
  border: 1px solid rgba(7, 17, 28, 0.12);
  box-shadow: 0 26px 64px rgba(7, 17, 28, 0.34);
}

.chat-panel.is-open {
  display: flex;
}

.chat-head {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 16px;
  background: #07111c;
  color: #f8fbfc;
  flex-shrink: 0;
}

.chat-avatar {
  width: 38px;
  height: 38px;
  flex-shrink: 0;
  border-radius: 11px;
  background: linear-gradient(135deg, #1aa89e, #3ee0d3);
  display: grid;
  place-items: center;
  color: #06121d;
  font-weight: 700;
  font-size: 15px;
}

.chat-title {
  display: grid;
  line-height: 1.3;
  flex: 1;
  min-width: 0;
}

.chat-title strong {
  font-size: 15px;
}

.chat-title span {
  font-size: 12px;
  color: rgba(248, 251, 252, 0.6);
}

.chat-online::before {
  content: "";
  display: inline-block;
  width: 7px;
  height: 7px;
  margin-right: 6px;
  border-radius: 50%;
  background: #3ee0d3;
  vertical-align: 1px;
}

.chat-close {
  width: 44px;
  height: 44px;
  flex-shrink: 0;
  border: 0;
  border-radius: 9px;
  background: rgba(255, 255, 255, 0.1);
  color: #f8fbfc;
  font-size: 18px;
  line-height: 1;
  cursor: pointer;
}

.chat-close:hover {
  background: rgba(255, 255, 255, 0.2);
}

.chat-body {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  scroll-behavior: smooth;
}

.chat-msg {
  display: flex;
  gap: 8px;
  max-width: 100%;
}

.chat-msg-bot .chat-bubble {
  background: #fff;
  border: 1px solid #dde6ec;
  color: #122033;
  border-radius: 4px 14px 14px 14px;
}

.chat-msg-user {
  justify-content: flex-end;
}

.chat-msg-user .chat-bubble {
  background: #0f2a40;
  color: #f4f9fb;
  border-radius: 14px 4px 14px 14px;
}

.chat-bubble {
  padding: 10px 13px;
  font-size: 14px;
  line-height: 1.68;
  max-width: 84%;
  word-break: break-word;
  box-shadow: 0 4px 14px rgba(7, 17, 28, 0.06);
}

.chat-bubble p {
  margin: 0 0 6px;
}

.chat-bubble p:last-child {
  margin-bottom: 0;
}

.chat-bubble a {
  color: #08736c;
  text-decoration: underline;
}

.chat-msg-user .chat-bubble a {
  color: #7fe6dc;
}

.chat-bubble strong {
  color: inherit;
}

.chat-typing span {
  display: inline-block;
  width: 6px;
  height: 6px;
  margin-right: 3px;
  border-radius: 50%;
  background: #9fb0bf;
  animation: chat-blink 1.1s infinite;
}

.chat-typing span:nth-child(2) { animation-delay: 0.18s; }
.chat-typing span:nth-child(3) { animation-delay: 0.36s; margin-right: 0; }

@keyframes chat-blink {
  0%, 60%, 100% { opacity: 0.28; transform: translateY(0); }
  30% { opacity: 1; transform: translateY(-3px); }
}

.chat-quick {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  padding: 0 16px 10px;
  flex-shrink: 0;
  max-height: 110px;
  overflow-y: auto;
}

.chat-quick button {
  padding: 7px 12px;
  border: 1px solid #bcd3d9;
  border-radius: 999px;
  background: #fff;
  color: #0f5f5a;
  font-size: 13px;
  cursor: pointer;
  transition: 0.16s ease;
  min-height: 40px;
}

.chat-quick button:hover {
  background: #08736c;
  border-color: #08736c;
  color: #fff;
}

.chat-card {
  background: #fff;
  border: 1px solid #dde6ec;
  border-radius: 14px;
  padding: 14px;
  box-shadow: 0 4px 14px rgba(7, 17, 28, 0.06);
}

.chat-card h4 {
  margin: 0 0 8px;
  font-size: 14px;
  color: #0a1a2f;
}

.chat-card img {
  width: 168px;
  height: 168px;
  display: block;
  margin: 4px auto 8px;
  border-radius: 10px;
  border: 1px solid #e3ebf0;
}

.chat-card p {
  margin: 0;
  font-size: 12.5px;
  color: #4a5b6e;
  line-height: 1.6;
  text-align: center;
}

.chat-actions {
  display: grid;
  gap: 8px;
  margin-top: 10px;
}

.chat-actions a {
  display: block;
  padding: 10px 12px;
  border-radius: 10px;
  background: #07111c;
  color: #f8fbfc;
  font-size: 13.5px;
  font-weight: 600;
  text-align: center;
  color: #f8fbfc;
  text-decoration: none;
}

.chat-actions a.is-teal {
  background: #08736c;
}

.chat-actions a:hover {
  opacity: 0.9;
}

.chat-foot {
  border-top: 1px solid #e1e9ee;
  background: #fff;
  padding: 10px 12px 12px;
  flex-shrink: 0;
}

.chat-input-row {
  display: flex;
  gap: 8px;
  align-items: flex-end;
}

.chat-foot textarea {
  flex: 1;
  min-width: 0;
  min-height: 42px;
  max-height: 108px;
  padding: 10px 12px;
  border: 1px solid #cfdbe4;
  border-radius: 11px;
  font-size: 16px;
  line-height: 1.5;
  resize: none;
  font-family: inherit;
}

.chat-foot textarea:focus {
  outline: 2px solid rgba(26, 168, 158, 0.4);
  border-color: #1aa89e;
}

.chat-send {
  width: 44px;
  height: 42px;
  flex-shrink: 0;
  border: 0;
  border-radius: 11px;
  background: #08736c;
  color: #fff;
  font-size: 17px;
  cursor: pointer;
}

.chat-send:hover {
  background: #148c84;
}

.chat-send:disabled {
  background: #b8c6d0;
  cursor: not-allowed;
}

.chat-tip {
  margin: 7px 2px 0;
  font-size: 11.5px;
  color: #57697b;
  line-height: 1.5;
}

.chat-tip a {
  color: #08736c;
  text-decoration: underline;
}

.chat-input-status {
  color: #a22c2c;
  font-size: 12px;
}

.chat-input-status:empty {
  display: none;
}

.chat-panel :focus-visible,
.chat-launcher:focus-visible {
  outline: 3px solid #08736c;
  outline-offset: 3px;
}

.chat-close:focus-visible {
  outline-color: #3ee0d3;
}

.chat-quick button:disabled {
  opacity: 0.65;
  cursor: wait;
}

@media (max-width: 560px) {
  .chat-panel {
    right: 0;
    top: var(--chat-viewport-top, 0px);
    bottom: auto;
    width: 100%;
    max-width: 100%;
    height: 100vh;
    height: var(--chat-viewport-height, 100dvh);
    max-height: none;
    border-radius: 0;
    border: 0;
  }

  .chat-head {
    padding-top: max(12px, env(safe-area-inset-top));
  }

  .chat-foot {
    padding-bottom: max(12px, env(safe-area-inset-bottom));
  }

  .chat-launcher {
    right: 14px;
    bottom: max(14px, env(safe-area-inset-bottom));
    height: 48px;
    padding: 0 16px 0 14px;
    font-size: 14px;
  }
}

@media (max-height: 520px) {
  .chat-quick {
    flex-wrap: nowrap;
    overflow-x: auto;
    overflow-y: hidden;
    max-height: 50px;
  }
  .chat-quick button {
    flex-shrink: 0;
  }
  .chat-head {
    padding-top: 6px;
    padding-bottom: 6px;
  }
  .chat-tip {
    font-size: 11px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .chat-body {
    scroll-behavior: auto;
  }
  .chat-launcher,
  .chat-quick button,
  .chat-typing span {
    animation: none;
    transition: none;
  }
}
