.gsts-ai-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 28px;
  border: 1px solid rgba(0, 0, 0, 0.22);
  background: #fff;
  border-radius: 8px;
  padding: 0;
  line-height: 1;
  cursor: pointer;
  transition:
    background 140ms ease,
    border-color 140ms ease,
    box-shadow 140ms ease,
    transform 120ms ease;
}
.gsts-ai-iconImg {
  width: 22px;
  height: 22px;
  object-fit: contain;
  display: block;
}
.gsts-ai-has {
  position: relative;
}
.gsts-ai-has .gsts-ai-btn {
  position: absolute;
  top: 10px;
  right: 10px;
  z-index: 2;
}
.gsts-ai-has[dir="rtl"] .gsts-ai-btn,
[dir="rtl"] .gsts-ai-has .gsts-ai-btn {
  left: 10px;
  right: auto;
}
.gsts-ai-has .gsts-ai-btn:hover,
.gsts-ai-btn:hover {
  background: #fff; /* keep white */
  border-color: rgba(0, 0, 0, 0.45);
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.10), 0 0 0 2px rgba(0, 0, 0, 0.10);
  transform: translateY(-1px);
}
.gsts-ai-icon {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.3px;
}

.gsts-ai-modal[aria-hidden="true"] {
  display: none;
}

/* Quick-only: hide chat form when flag is true (backstop if any legacy markup exists) */
.gsts-ai-modal.gsts-ai-quick-only #gsts-ai-form,
.gsts-ai-modal.gsts-ai-quick-only #gsts-ai-input,
.gsts-ai-modal.gsts-ai-quick-only #gsts-ai-send,
.gsts-ai-modal.gsts-ai-quick-only .gsts-ai-form,
.gsts-ai-modal.gsts-ai-quick-only .gsts-ai-input,
.gsts-ai-modal.gsts-ai-quick-only .gsts-ai-send {
  display: none !important;
}
.gsts-ai-modal[aria-hidden="false"] {
  position: fixed;
  inset: 0;
  z-index: 9999;
  display: block;
}
.gsts-ai-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.55);
}
.gsts-ai-panel {
  position: absolute;
  inset: auto 0 0 0;
  max-width: 720px;
  margin: 0 auto;
  background: #fff;
  border-radius: 18px 18px 0 0;
  box-shadow: 0 -12px 40px rgba(0, 0, 0, 0.16);
  display: flex;
  flex-direction: column;
  max-height: 86vh;
}
@media (min-width: 768px) {
  .gsts-ai-panel {
    inset: 10vh 0 auto 0;
    border-radius: 18px;
    max-height: 80vh;
  }
}
.gsts-ai-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 1rem 1.1rem;
  border-bottom: 1px solid rgba(0, 0, 0, 0.06);
}
.gsts-ai-title {
  font-weight: 700;
  font-size: 1rem;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  padding-right: 44px;
}
.gsts-ai-rtl .gsts-ai-title {
  padding-right: 0;
  padding-left: 44px;
  text-align: right;
}
.gsts-ai-close {
  border: none;
  background: transparent;
  font-size: 1.15rem;
  line-height: 1;
  padding: 0.25rem 0.45rem;
  cursor: pointer;
  opacity: 0.75;
}
.gsts-ai-close:hover {
  opacity: 1;
}

.gsts-ai-messages {
  padding: 1rem 1.1rem;
  overflow: auto;
  flex: 1 1 auto;
  background: #fafafa;
}
.gsts-ai-msg {
  max-width: 92%;
  padding: 0.65rem 0.8rem;
  border-radius: 14px;
  margin: 0 0 0.6rem;
  white-space: pre-wrap;
  word-wrap: break-word;
  border: 1px solid rgba(0, 0, 0, 0.06);
}
.gsts-ai-msg--user {
  margin-left: auto;
  background: #1f2937;
  color: #fff;
  border-color: rgba(0, 0, 0, 0.12);
}
.gsts-ai-msg--assistant {
  margin-right: auto;
  background: rgba(255, 255, 255, 0.85);
  color: #111827;
}
.gsts-ai-msg--assistant:first-child {
  margin-bottom: 1rem;
}

.gsts-ai-typing {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  min-height: 38px;
}
.gsts-ai-typingDots {
  display: inline-flex;
  align-items: center;
  gap: 5px;
}
.gsts-ai-typingDots span {
  width: 6px;
  height: 6px;
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.55);
  display: inline-block;
  animation: gsts-ai-dot 1.1s infinite ease-in-out;
}
.gsts-ai-typingDots span:nth-child(2) { animation-delay: 0.15s; }
.gsts-ai-typingDots span:nth-child(3) { animation-delay: 0.3s; }
@keyframes gsts-ai-dot {
  0%, 80%, 100% { transform: translateY(0); opacity: 0.35; }
  40% { transform: translateY(-2px); opacity: 0.9; }
}

.gsts-ai-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  padding: 0.9rem 1.1rem 0.6rem;
  border-top: 1px solid rgba(0, 0, 0, 0.06);
  background: #fff;
  max-height: 125px;
  overflow-y: auto;
}
.gsts-ai-chip {
  border: 1px solid rgba(0, 0, 0, 0.10);
  background: rgba(0, 0, 0, 0.015);
  border-radius: 999px;
  padding: 0.22rem 0.55rem;
  font-size: 0.78rem;
  font-weight: 500;
  cursor: pointer;
  color: #1f2937;
  white-space: nowrap;
  transition: border-color 120ms ease, background 120ms ease;
}
.gsts-ai-chip:hover {
  background: rgba(0, 0, 0, 0.04);
  border-color: rgba(0, 0, 0, 0.22);
}

.gsts-ai-quick-only-helper {
  margin: 0;
  padding: 0 1.1rem 0.9rem;
  font-size: 0.78rem;
  color: rgba(0, 0, 0, 0.55);
  background: #fff;
}

.gsts-ai-form {
  display: flex;
  gap: 0.5rem;
  padding: 0.8rem 1.1rem 1.05rem;
  border-top: 1px solid rgba(0, 0, 0, 0.06);
  background: #fff;
}
.gsts-ai-input {
  flex: 1 1 auto;
  min-width: 0;
  border: 1px solid rgba(0, 0, 0, 0.18);
  border-radius: 12px;
  padding: 0.65rem 0.75rem;
  outline: none;
  background: #fff;
}
.gsts-ai-input:focus {
  border-color: rgba(0, 0, 0, 0.35);
  box-shadow: 0 0 0 3px rgba(0, 0, 0, 0.06);
}
.gsts-ai-send {
  flex: 0 0 auto;
  border: 1px solid rgba(0, 0, 0, 0.22);
  background: rgba(0, 0, 0, 0.08);
  color: #111827;
  border-radius: 12px;
  padding: 0.5rem 0.7rem;
  font-weight: 500;
  cursor: pointer;
}
.gsts-ai-send:hover {
  border-color: rgba(0, 0, 0, 0.35);
  background: rgba(0, 0, 0, 0.10);
}
.gsts-ai-send:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

/* Subtle scrollbar (optional) */
.gsts-ai-chips::-webkit-scrollbar {
  height: 8px;
  width: 8px;
}
.gsts-ai-chips::-webkit-scrollbar-thumb {
  background: rgba(0, 0, 0, 0.14);
  border-radius: 999px;
}
.gsts-ai-chips::-webkit-scrollbar-track {
  background: transparent;
}

