/* SurferX AI chat widget — shared on Learn Hub, Library, Glossary */

.sx-ai-fab {
  position: fixed;
  bottom: 26px;
  right: 26px;
  z-index: 7990;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 10px;
}

.sx-ai-fab-btn {
  width: 48px;
  height: 48px;
  padding: 0;
  border: none;
  border-radius: 50%;
  cursor: pointer;
  display: grid;
  place-items: center;
  background: linear-gradient(135deg, #0fa8c9, #1de9ff);
  box-shadow: 0 0 22px rgba(29, 233, 255, 0.45), 0 8px 22px rgba(0, 0, 0, 0.35);
  transition: transform 0.22s;
}

.sx-ai-fab-btn:hover {
  transform: scale(1.06);
}

.sx-ai-fab-btn img {
  width: 26px;
  height: 26px;
  display: block;
  border-radius: 50%;
}

.sx-ai-fab-hint {
  font-family: 'Syne', sans-serif;
  font-size: 0.62rem;
  font-weight: 800;
  color: #b9d6e0;
  letter-spacing: 0.04em;
  text-align: right;
  max-width: 120px;
  line-height: 1.25;
  opacity: 0.95;
}

.sx-ai-panel {
  position: fixed;
  bottom: 92px;
  right: 26px;
  z-index: 7990;
  width: min(420px, calc(100vw - 32px));
  max-height: min(88vh, 820px);
  background: rgba(4, 20, 40, 0.98);
  border: 1px solid rgba(29, 233, 255, 0.22);
  border-radius: 20px;
  box-shadow: 0 24px 70px rgba(0, 0, 0, 0.55);
  display: none;
  flex-direction: column;
  overflow: hidden;
}

.sx-ai-panel.show {
  display: flex;
}

.sx-ai-ph {
  padding: 12px 14px 10px;
  background: linear-gradient(135deg, rgba(15, 168, 201, 0.12), rgba(29, 233, 255, 0.05));
  border-bottom: 1px solid rgba(29, 233, 255, 0.1);
  flex-shrink: 0;
}

.sx-ai-pt {
  display: flex;
  align-items: flex-start;
  gap: 10px;
}

.sx-ai-ava {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  flex-shrink: 0;
  background: linear-gradient(135deg, #0fa8c9, #1de9ff);
  overflow: hidden;
}

.sx-ai-ava img {
  width: 22px;
  height: 22px;
}

.sx-ai-title {
  font-family: 'Syne', sans-serif;
  font-size: 0.82rem;
  font-weight: 800;
  color: #e8f4f8;
  line-height: 1.2;
}

.sx-ai-caption {
  font-size: 0.62rem;
  color: #7ab5cc;
  margin-top: 2px;
}

.sx-ai-close {
  margin-left: auto;
  background: none;
  border: none;
  color: #3d7a97;
  cursor: pointer;
  font-size: 1rem;
  padding: 4px;
}

.sx-ai-close:hover {
  color: #ff6b5b;
}

.sx-ai-msgs {
  flex: 1 1 auto;
  min-height: min(42vh, 360px);
  max-height: min(52vh, 480px);
  overflow-y: auto;
  overflow-x: hidden;
  padding: 12px 14px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  scroll-behavior: smooth;
}

.sx-ai-msgs::-webkit-scrollbar {
  width: 4px;
}
.sx-ai-msgs::-webkit-scrollbar-thumb {
  background: rgba(29, 233, 255, 0.2);
  border-radius: 4px;
}

.sx-amsg {
  display: flex;
  gap: 8px;
  align-items: flex-start;
}

.sx-amsg.usr {
  flex-direction: row-reverse;
}

.sx-amava {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  flex-shrink: 0;
  font-size: 0.65rem;
}

.sx-amava.bot {
  background: linear-gradient(135deg, #0fa8c9, #1de9ff);
}
.sx-amava.bot img {
  width: 14px;
  height: 14px;
}

.sx-amava.usr {
  background: rgba(245, 200, 66, 0.1);
  border: 1px solid rgba(245, 200, 66, 0.2);
  color: #f5c842;
}

.sx-ambub {
  max-width: 88%;
  padding: 9px 11px;
  border-radius: 11px;
  font-size: 0.8rem;
  line-height: 1.55;
  color: #b9d6e0;
}

.sx-amsg.bot .sx-ambub {
  background: rgba(6, 50, 86, 0.55);
  border: 1px solid rgba(29, 233, 255, 0.1);
  border-radius: 3px 11px 11px 11px;
}

.sx-amsg.usr .sx-ambub {
  background: rgba(29, 233, 255, 0.09);
  border: 1px solid rgba(29, 233, 255, 0.16);
  border-radius: 11px 3px 11px 11px;
  color: #e8f4f8;
}

.sx-ambub strong {
  color: #e8f4f8;
}
.sx-ambub a {
  color: #0fa8c9;
  text-decoration: underline;
}

.sx-amt {
  font-size: 0.52rem;
  color: #3d7a97;
  font-family: 'Space Mono', monospace;
  margin-top: 2px;
}

.sx-tdots {
  background: rgba(6, 50, 86, 0.5);
  border: 1px solid rgba(29, 233, 255, 0.08);
  border-radius: 3px 11px 11px 11px;
  padding: 9px 12px;
  display: flex;
  gap: 5px;
}

.sx-tdots span {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: #0fa8c9;
  animation: sxTb 1.2s infinite;
}
.sx-tdots span:nth-child(2) {
  animation-delay: 0.2s;
}
.sx-tdots span:nth-child(3) {
  animation-delay: 0.4s;
}
@keyframes sxTb {
  0%,
  80%,
  100% {
    transform: translateY(0);
    opacity: 0.5;
  }
  40% {
    transform: translateY(-4px);
    opacity: 1;
  }
}

.sx-ai-suggs {
  padding: 6px 12px 8px;
  border-top: 1px solid rgba(29, 233, 255, 0.08);
  flex-shrink: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
}

.sx-ais-l {
  width: 100%;
  font-family: 'Space Mono', monospace;
  font-size: 0.52rem;
  color: #3d7a97;
  letter-spacing: 1px;
  margin-bottom: 2px;
}

.sx-sq {
  background: rgba(6, 50, 86, 0.42);
  border: 1px solid rgba(29, 233, 255, 0.12);
  border-radius: 20px;
  padding: 4px 10px;
  font-size: 0.68rem;
  color: #7ab5cc;
  cursor: pointer;
  font-family: 'DM Sans', sans-serif;
}

.sx-sq:hover {
  background: rgba(29, 233, 255, 0.08);
  color: #1de9ff;
}

.sx-ai-in {
  padding: 8px 12px 10px;
  border-top: 1px solid rgba(29, 233, 255, 0.1);
  flex-shrink: 0;
}

.sx-ai-row {
  display: flex;
  gap: 8px;
  align-items: flex-end;
}

.sx-ai-ta {
  flex: 1;
  min-height: 42px;
  max-height: 120px;
  resize: none;
  background: rgba(6, 50, 86, 0.35);
  border: 1px solid rgba(29, 233, 255, 0.12);
  border-radius: 11px;
  padding: 9px 11px;
  color: #e8f4f8;
  font-family: 'DM Sans', sans-serif;
  font-size: 0.82rem;
  outline: none;
}

.sx-ai-send {
  width: 40px;
  height: 40px;
  border: none;
  border-radius: 10px;
  background: linear-gradient(135deg, #0fa8c9, #1de9ff);
  color: #020b18;
  font-weight: 900;
  cursor: pointer;
  flex-shrink: 0;
}

.sx-ai-send:disabled {
  opacity: 0.35;
  cursor: not-allowed;
}

.sx-ai-disc {
  font-size: 0.55rem;
  color: #3d7a97;
  text-align: center;
  margin-top: 6px;
  font-family: 'Space Mono', monospace;
}

@media (max-width: 620px) {
  .sx-ai-panel {
    right: 16px;
    bottom: 88px;
    width: calc(100vw - 24px);
  }
  .sx-ai-fab {
    right: 16px;
    bottom: 20px;
  }
}
