/* ============================================================
   CodeRoom — Custom styles
   Tailwind (via CDN) handles layout/spacing utility classes.
   This file holds the things Tailwind can't: fonts, glass effect,
   custom keyframe animations, and the message list scrollbar.
   ============================================================ */

:root {
  --color-ink: #0f1b3d;      /* deep blue-black for headings */
  --color-brand: #1e40af;    /* primary blue */
  --color-brand-2: #2563eb;  /* secondary blue */
  --color-sky: #38bdf8;      /* accent sky blue */
  --color-mist: #f4f8ff;     /* page background tint */
}

* {
  font-family: "Inter", system-ui, -apple-system, sans-serif;
}

.font-display {
  font-family: "Sora", "Inter", system-ui, sans-serif;
}

body {
  background: linear-gradient(180deg, #eef4ff 0%, #f8fbff 45%, #ffffff 100%);
  background-attachment: fixed;
}

/* Chat page: use dynamic viewport height so mobile browser toolbars
   (which resize on scroll) never push the message input off-screen. */
body.h-\[100dvh\] {
  height: 100vh; /* fallback for older browsers */
  height: 100dvh;
}

/* ---------- Glassmorphism ---------- */
.glass {
  background: rgba(255, 255, 255, 0.6);
  backdrop-filter: blur(16px) saturate(160%);
  -webkit-backdrop-filter: blur(16px) saturate(160%);
  border: 1px solid rgba(255, 255, 255, 0.5);
}

.glass-dark {
  background: rgba(15, 27, 61, 0.85);
  backdrop-filter: blur(16px) saturate(160%);
  -webkit-backdrop-filter: blur(16px) saturate(160%);
  border: 1px solid rgba(255, 255, 255, 0.08);
}

/* ---------- Ambient background blobs (landing page) ---------- */
.blob {
  position: absolute;
  border-radius: 9999px;
  filter: blur(70px);
  opacity: 0.35;
  z-index: 0;
  animation: float 14s ease-in-out infinite;
}

@keyframes float {
  0%, 100% { transform: translate(0, 0) scale(1); }
  50% { transform: translate(20px, -30px) scale(1.08); }
}

/* ---------- Fade / rise-in for cards ---------- */
.rise-in {
  animation: riseIn 0.6s cubic-bezier(0.16, 1, 0.3, 1) both;
}

@keyframes riseIn {
  from { opacity: 0; transform: translateY(16px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ---------- Toast animations ---------- */
.animate-toast-in { animation: toastIn 0.25s ease-out both; }
.animate-toast-out { animation: toastOut 0.25s ease-in both; }

@keyframes toastIn {
  from { opacity: 0; transform: translateY(10px) scale(0.96); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}
@keyframes toastOut {
  from { opacity: 1; transform: scale(1); }
  to { opacity: 0; transform: scale(0.96); }
}

/* ---------- Chat bubble entrance ---------- */
.bubble-in {
  animation: bubbleIn 0.28s cubic-bezier(0.16, 1, 0.3, 1) both;
}

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

/* ---------- Typing / connection dot pulse ---------- */
.pulse-dot {
  animation: pulseDot 1.6s ease-in-out infinite;
}

@keyframes pulseDot {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.35; }
}

/* ---------- Custom scrollbar for the message list ---------- */
.chat-scroll::-webkit-scrollbar {
  width: 6px;
}
.chat-scroll::-webkit-scrollbar-track {
  background: transparent;
}
.chat-scroll::-webkit-scrollbar-thumb {
  background: rgba(30, 64, 175, 0.25);
  border-radius: 999px;
}
.chat-scroll {
  scrollbar-width: thin;
  scrollbar-color: rgba(30, 64, 175, 0.25) transparent;
}

/* ---------- Loading spinner ---------- */
.spinner {
  border: 3px solid rgba(30, 64, 175, 0.15);
  border-top-color: var(--color-brand);
  border-radius: 50%;
  width: 28px;
  height: 28px;
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* ---------- Typing indicator dots ---------- */
.typing-dots {
  display: inline-flex;
  align-items: center;
  gap: 3px;
}
.typing-dots span {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--color-brand-2);
  animation: typingBounce 1.2s infinite ease-in-out;
}
.typing-dots span:nth-child(2) { animation-delay: 0.15s; }
.typing-dots span:nth-child(3) { animation-delay: 0.3s; }

@keyframes typingBounce {
  0%, 60%, 100% { transform: translateY(0); opacity: 0.5; }
  30% { transform: translateY(-4px); opacity: 1; }
}

/* ---------- Skeleton loading bars ---------- */
.skeleton {
  background: linear-gradient(90deg, #e9f0ff 25%, #f5f9ff 37%, #e9f0ff 63%);
  background-size: 400% 100%;
  animation: skeletonWave 1.4s ease infinite;
}

@keyframes skeletonWave {
  0% { background-position: 100% 50%; }
  100% { background-position: 0 50%; }
}
