/*
  Hand-written CSS3 for the pieces Tailwind's utility classes don't cover:
  keyframe animations (shimmer sweep, message rise, typing dots, background
  blobs) and small cross-browser resets. Everything else (layout, color,
  spacing, dark mode) lives as Tailwind utility classes directly on the
  markup in index.html / app.js.
*/

html,
body {
  height: 100%;
  margin: 0;
  -webkit-tap-highlight-color: transparent;
}

#chat {
  overscroll-behavior-y: contain;
  scroll-behavior: smooth;
}

/* Scripts render with their own native font where available. */
body.lang-si {
  font-family: "Noto Sans Sinhala", "Noto Sans", system-ui, sans-serif;
}

body.lang-ta {
  font-family: "Noto Sans Tamil", "Noto Sans", system-ui, sans-serif;
}

/* Custom scrollbar for the chat log -- thin and accent-tinted rather than
   the bulky OS default, on browsers that support it. */
#chat::-webkit-scrollbar {
  width: 6px;
}

#chat::-webkit-scrollbar-thumb {
  background: rgba(230, 134, 51, 0.35);
  border-radius: 999px;
}

#chat::-webkit-scrollbar-track {
  background: transparent;
}

::selection {
  background: rgba(230, 134, 51, 0.35);
}

/* ---------------------------------------------------------------------- */

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

.screen-fade {
  animation: fadeIn 0.35s ease both;
}

@keyframes shimmer {
  0% { background-position: -150% 0; }
  100% { background-position: 250% 0; }
}

/* A soft diagonal light sweep across the language buttons/logo frame --
   purely decorative, gives the CTA row a premium, "alive" feel. */
.shimmer-sweep {
  position: absolute;
  inset: 0;
  border-radius: inherit;
  pointer-events: none;
  background: linear-gradient(120deg, transparent 30%, rgba(255, 255, 255, 0.45) 50%, transparent 70%);
  background-size: 220% 100%;
  animation: shimmer 2.6s linear infinite;
}

@keyframes messageRise {
  from {
    opacity: 0;
    transform: translateY(10px) scale(0.98);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

/* Every chat bubble/source card row uses this so new content settles into
   place instead of popping in abruptly. */
.msg-rise {
  animation: messageRise 0.4s cubic-bezier(0.2, 0.7, 0.3, 1) both;
}

@keyframes dotPulse {
  0%, 80%, 100% {
    transform: scale(0.6);
    opacity: 0.4;
  }
  40% {
    transform: scale(1);
    opacity: 1;
  }
}

/* Three-dot "typing" indicator shown while the RAG pipeline is searching. */
.typing-dot {
  width: 6px;
  height: 6px;
  border-radius: 999px;
  background: currentColor;
  display: inline-block;
  animation: dotPulse 1.2s ease-in-out infinite;
}

.typing-dot:nth-child(2) {
  animation-delay: 0.15s;
}

.typing-dot:nth-child(3) {
  animation-delay: 0.3s;
}

@keyframes blobFloat {
  0%, 100% { transform: translate(0, 0) scale(1); }
  33% { transform: translate(20px, -30px) scale(1.08); }
  66% { transform: translate(-15px, 15px) scale(0.94); }
}

.blob {
  animation: blobFloat 14s ease-in-out infinite;
}

.blob-delay {
  animation-delay: 5s;
}

@media (prefers-reduced-motion: reduce) {
  .shimmer-sweep,
  .msg-rise,
  .typing-dot,
  .blob,
  .screen-fade {
    animation: none !important;
  }
}
