/* =====================================================
   MORGAN ANIMATIONS
   - Entrance animations
   - Bubble / chat micro-interactions
   - Status pulse
   - Hover glow
   Bisa dipakai tanpa ubah HTML.
===================================================== */

/* Smooth scroll global */
html {
  scroll-behavior: smooth;
}

/* -----------------------------------------------------
   ENTRANCE ANIMATIONS
----------------------------------------------------- */

/* App container masuk pelan dari bawah */
.app {
  animation: appEntrance 0.55s ease-out;
}

@keyframes appEntrance {
  from {
    opacity: 0;
    transform: translateY(14px) scale(0.99);
    box-shadow: none;
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

/* Sidebar & chat fade-in berurutan */
.sidebar {
  animation: sidebarFloat 0.6s ease-out;
}

.chat {
  animation: chatFadeIn 0.6s ease-out 0.08s backwards;
}

@keyframes sidebarFloat {
  from {
    opacity: 0;
    transform: translateX(-10px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

@keyframes chatFadeIn {
  from {
    opacity: 0;
    transform: translateX(10px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

/* -----------------------------------------------------
   BUBBLE ANIMATIONS
----------------------------------------------------- */

/* Setiap bubble baru pop-in halus */
.bubble {
  animation: bubblePop 0.23s cubic-bezier(0.18, 0.89, 0.32, 1.28);
  transform-origin: bottom left;
}

.bubble-row-user .bubble {
  transform-origin: bottom right;
}

@keyframes bubblePop {
  0% {
    opacity: 0;
    transform: translateY(6px) scale(0.96);
  }
  100% {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

/* Bubble AI punya sedikit glow bernafas */
.bubble-ai {
  position: relative;
}

.bubble-ai::before {
  content: "";
  position: absolute;
  inset: -1px;
  border-radius: inherit;
  border: 1px solid rgba(129, 140, 248, 0.28);
  pointer-events: none;
  opacity: 0;
  animation: bubbleAura 4s ease-in-out infinite;
}

@keyframes bubbleAura {
  0% {
    opacity: 0.1;
  }
  40% {
    opacity: 0.35;
  }
  100% {
    opacity: 0.1;
  }
}

/* Bubble User sedikit bounce ketika di-tap */
.bubble-user {
  transition: transform 0.16s ease-out, box-shadow 0.18s ease-out;
}

.bubble-user:active {
  transform: translateY(1px) scale(0.98);
  box-shadow: 0 8px 20px rgba(21, 128, 61, 0.7);
}

/* -----------------------------------------------------
   STATUS PILL (ONLINE INDICATOR) – PULSE
   (Kalau sebelumnya sudah ada di style.css, ini bisa 
   menggantikan / menyempurnakan, tidak masalah.)
----------------------------------------------------- */

.status {
  animation: statusGlow 4s ease-in-out infinite alternate;
}

.status-dot {
  position: relative;
  animation: dotCore 1.8s ease-in-out infinite;
}

/* Ring yang melebar */
.status-dot::after {
  content: "";
  position: absolute;
  inset: -3px;
  border-radius: inherit;
  border: 2px solid rgba(34, 197, 94, 0.55);
  animation: dotPulseRing 1.8s ease-out infinite;
}

/* Glow pill */
@keyframes statusGlow {
  0% {
    box-shadow:
      0 0 12px rgba(34, 197, 94, 0.6),
      0 0 0 1px rgba(6, 78, 59, 0.9);
    transform: translateY(0);
  }
  50% {
    box-shadow:
      0 0 22px rgba(34, 197, 94, 0.9),
      0 0 0 1px rgba(6, 95, 70, 1);
    transform: translateY(-1px);
  }
  100% {
    box-shadow:
      0 0 14px rgba(34, 197, 94, 0.7),
      0 0 0 1px rgba(6, 78, 59, 0.9);
    transform: translateY(0);
  }
}

/* Titik hijau “bernafas” */
@keyframes dotCore {
  0%   { transform: scale(1); }
  50%  { transform: scale(1.12); }
  100% { transform: scale(1); }
}

/* Ring pulse keluar */
@keyframes dotPulseRing {
  0% {
    transform: scale(0.2);
    opacity: 0.9;
  }
  70% {
    transform: scale(2.1);
    opacity: 0;
  }
  100% {
    opacity: 0;
  }
}

/* -----------------------------------------------------
   BUTTONS & CHIPS MICRO-INTERACTION
----------------------------------------------------- */

/* Semua tombol dan chip punya transition halus */
button,
.chip,
.pill-btn,
.send-btn {
  transition:
    transform 0.16s ease-out,
    box-shadow 0.2s ease-out,
    filter 0.16s ease-out,
    background 0.2s ease-out,
    border-color 0.2s ease-out;
}

/* Hover efek glow ringan (desktop, tapi di HP juga oke) */
.pill-btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 10px 30px rgba(59, 130, 246, 0.45);
}

.chip:hover {
  transform: translateY(-1px);
  box-shadow: 0 8px 22px rgba(59, 130, 246, 0.5);
}

.send-btn:hover {
  transform: translateY(-1px);
}

/* Saat aktif ditekan */
.pill-btn:active,
.chip:active,
.send-btn:active {
  transform: translateY(1px) scale(0.98);
}

/* -----------------------------------------------------
   INPUT & FOCUS FEEL
----------------------------------------------------- */

/* Glow halus saat textarea fokus */
textarea#message:focus {
  outline: none;
  text-shadow: 0 0 12px rgba(148, 163, 184, 0.6);
}

/* -----------------------------------------------------
   OPTIONAL: TYPING INDICATOR (kalau suatu saat dipakai)
   (Tinggal buat elemen dengan class .typing-indicator 
    di HTML / JS kalau mau dipakai)
----------------------------------------------------- */

.typing-indicator {
  display: inline-flex;
  align-items: center;
  gap: 3px;
}

.typing-indicator span {
  width: 5px;
  height: 5px;
  border-radius: 999px;
  background: rgba(248, 250, 252, 0.9);
  animation: typingDot 1.1s infinite ease-in-out;
}

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

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

@keyframes typingDot {
  0%, 60%, 100% {
    transform: translateY(0);
    opacity: 0.4;
  }
  30% {
    transform: translateY(-3px);
    opacity: 1;
  }
}