/* public/assets/css/ai-support-bubbles.css */

.ai-support {
  position: relative;
  width: 100%;
  max-width: 100%;
  /* WAS 380px - FIXED */
  height: 100%;
  margin: 0;
  display: flex;
  flex-direction: column;
  z-index: 4;
}

/* Chat Window Container */
.ai-window {
  background: rgba(13, 16, 24, 0.85);
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 24px;
  box-shadow:
    0 20px 50px -10px rgba(0, 0, 0, 0.6),
    0 0 0 1px rgba(255, 255, 255, 0.05);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  height: 100%;
  transform: translateY(0);
  transition: transform 0.3s ease;
}

/* Header */
.ai-header {
  padding: 16px 20px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
  background: rgba(255, 255, 255, 0.02);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.ai-title {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 14px;
  font-weight: 600;
  color: #fff;
}

.ai-avatar {
  width: 32px;
  height: 32px;
  border-radius: 10px;
  background: linear-gradient(135deg, #6366f1, #4fd1c5);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
}

.ai-status {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: rgba(255, 255, 255, 0.6);
}

.status-dot {
  width: 6px;
  height: 6px;
  background: #4fd1c5;
  border-radius: 50%;
  box-shadow: 0 0 0 2px rgba(79, 209, 197, 0.2);
}

/* Chat Body */
.ai-stack {
  flex: 1;
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  overflow-y: auto;
  scrollbar-width: none;
  /* simple hidden scroll */
}

/* Bubbles */
.ai-bubble {
  max-width: 85%;
  padding: 12px 16px;
  border-radius: 18px;
  font-size: 14px;
  line-height: 1.5;
  position: relative;
  opacity: 0;
  transform: translateY(10px);
  transition: opacity 0.3s ease, transform 0.3s ease;
}

.ai-bubble.show {
  opacity: 1;
  transform: translateY(0);
}

.ai-bubble.you {
  align-self: flex-end;
  background: linear-gradient(135deg, #6366f1 0%, #4338ca 100%);
  color: #fff;
  border-bottom-right-radius: 4px;
  box-shadow: 0 4px 12px rgba(99, 102, 241, 0.3);
}

.ai-bubble.ai {
  align-self: flex-start;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.08);
  color: #eef0f3;
  border-bottom-left-radius: 4px;
}

.ai-bubble .ai-text {
  display: block;
}

/* Typing Indicator inside bubble */
.typing {
  display: flex;
  gap: 4px;
  padding: 4px 0;
}

.typing span {
  width: 5px;
  height: 5px;
  background: rgba(255, 255, 255, 0.6);
  border-radius: 50%;
  animation: bounce 1.4s infinite ease-in-out both;
}

.typing span:nth-child(1) {
  animation-delay: -0.32s;
}

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

@keyframes bounce {

  0%,
  80%,
  100% {
    transform: scale(0);
  }

  40% {
    transform: scale(1);
  }
}

/* Input Area */
.ai-composer {
  padding: 16px;
  border-top: 1px solid rgba(255, 255, 255, 0.06);
  background: rgba(0, 0, 0, 0.2);
}

.composer-inner {
  display: flex;
  align-items: center;
  gap: 12px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 14px;
  padding: 8px 8px 8px 16px;
}

.composer-text {
  flex: 1;
  font-size: 14px;
  color: rgba(255, 255, 255, 0.6);
  overflow: hidden;
  white-space: nowrap;
}

.composer-text span {
  display: inline-block;
}

.caret {
  border-right: 2px solid #6366f1;
  animation: blink 1s step-end infinite;
  margin-left: 2px;
  height: 14px;
  vertical-align: middle;
}

@keyframes blink {
  50% {
    border-color: transparent;
  }
}

.send-btn {
  width: 32px;
  height: 32px;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
}

.send-btn.active {
  background: #6366f1;
  color: #fff;
  transform: scale(1.05);
}

.send-btn .arrow {
  width: 0;
  height: 0;
  border-top: 5px solid transparent;
  border-bottom: 5px solid transparent;
  border-left: 8px solid rgba(255, 255, 255, 0.5);
  margin-left: 2px;
}

.send-btn.active .arrow {
  border-left-color: #fff;
}

@media (prefers-reduced-motion: reduce) {
  .ai-support .typing span {
    animation: none;
  }

  .ai-support .ai-bubble {
    transition: none;
  }

  .ai-support .caret {
    animation: none;
  }

  .ai-support .send-btn.pulse.active {
    animation: none;
  }

  .ai-support .pulse-dot {
    animation: none;
  }
}

/* ================================
   FIX: remove typing text mask
   ================================ */

/* allow text to grow naturally while typing */
.ai-support .composer-text {
  overflow: visible !important;
  text-overflow: unset !important;
  white-space: normal !important;
}

/* same for animated span */
.ai-support .composer-display {
  overflow: visible !important;
  text-overflow: unset !important;
  white-space: normal !important;
  max-width: none !important;
}

/* keep composer height stable */
.ai-support .composer-inner {
  align-items: flex-start;
}

/* ================================
   Composer typing: single-line horizontal
   ================================ */

/* keep typing strictly horizontal */
/* keep typing strictly horizontal */
.ai-support .composer-text,
.ai-support .composer-display {
  white-space: nowrap !important;
  /* jedna linia */
  overflow: visible !important;
  /* bez maski */
  text-overflow: unset !important;
  /* brak ellipsis */
  max-width: none !important;
  /* pozwól rosnąć */
}

/* keep layout stable */
.ai-support .composer-inner {
  align-items: center;
  /* jak input */
}

/* caret stays inline */
.ai-support .caret {
  display: inline-block;
}

/* =====================================================
   REMOVE composer fade / mask / overlay (the "dots")
   ===================================================== */

/* remove gradient / mask on composer text */
.ai-support .composer::after,
.ai-support .composer::before,
.ai-support .composer-text::after,
.ai-support .composer-text::before,
.ai-support .composer-inner::after,
.ai-support .composer-inner::before {
  content: none !important;
  display: none !important;
  background: none !important;
  mask: none !important;
  -webkit-mask: none !important;
}

/* make sure text is fully visible */
.ai-support .composer-display {
  background: none !important;
  box-shadow: none !important;
  filter: none !important;
  opacity: 1 !important;
}

/* safety: do NOT affect layout */
.ai-support .composer,
.ai-support .composer-inner,
.ai-support .composer-text {
  overflow: visible !important;
}

/* =====================================================
   REMOVE left-side fade / dot in composer (FINAL FIX)
   ===================================================== */

/* remove any gradient / mask that clips text */
.ai-support .composer,
.ai-support .composer-inner,
.ai-support .composer-text,
.ai-support .composer-display {
  mask-image: none !important;
  -webkit-mask-image: none !important;
  background-image: none !important;
}

/* kill shadow/blur that may look like a dot */
.ai-support .composer-display {
  box-shadow: none !important;
  filter: none !important;
}

/* ensure full visibility of first character */
.ai-support .composer-text {
  overflow: visible !important;
}

/* safety: no pseudo decorative elements */
.ai-support .composer-text::before,
.ai-support .composer-text::after {
  content: none !important;
  display: none !important;
}

/* =====================================================
   Remove chat top bar (Workspace + buttons)
   ===================================================== */

/* hide the entire top bar above chat */
.ai-support+.right-topbar,
.auth-right .right-topbar {
  display: none !important;
}

/* reclaim space so chat moves up cleanly */
.ai-support {
  top: 0 !important;
}

/* =====================================================
   Hide top bar CONTENT without changing layout
   ===================================================== */

/* keep top bar space, but remove its content */
.auth-right .right-topbar {
  visibility: hidden !important;
  /* hides content, keeps height */
  pointer-events: none !important;
}

/* DO NOT move chat */
.ai-support {
  top: auto !important;
}

/* =====================================================
   Reduce gap between user question and AI answer
   ===================================================== */

/* tighten spacing ABOVE the AI answer bubble */
.ai-support .ai-bubble.ai-answer {
  margin-top: -40px !important;
  /* ← zbliża do pytania */
}