/* ============================================================
   jchowlabs Voice Assistant — Single Orb UI
   ============================================================ */

/* ---------- Keyframes ---------- */

/* Idle breathing — gentle */
@keyframes va-breathe {
  0%, 100% { transform: scale(1); }
  50%      { transform: scale(1.12); }
}

/* Speaking breathing — more pronounced */
@keyframes va-breathe-speaking {
  0%, 100% { transform: scale(0.96); }
  50%      { transform: scale(1.18); }
}

/* Idle glow */
@keyframes va-glow {
  0%, 100% { box-shadow: 0 0 8px 3px rgba(56, 189, 248, 0.35), 0 0 16px 6px rgba(56, 189, 248, 0.12); }
  50%      { box-shadow: 0 0 14px 6px rgba(56, 189, 248, 0.5), 0 0 28px 10px rgba(56, 189, 248, 0.16); }
}

/* Speaking glow — bigger, brighter, purple-shifted */
@keyframes va-glow-speaking {
  0%, 100% { box-shadow: 0 0 10px 4px rgba(99, 102, 241, 0.4), 0 0 20px 8px rgba(139, 92, 246, 0.15); }
  50%      { box-shadow: 0 0 20px 8px rgba(99, 102, 241, 0.55), 0 0 36px 14px rgba(139, 92, 246, 0.2); }
}

/* Idle ring pulse */
@keyframes va-ring {
  0%   { box-shadow: 0 0 0 0 rgba(56, 189, 248, 0.4); }
  70%  { box-shadow: 0 0 0 8px rgba(56, 189, 248, 0); }
  100% { box-shadow: 0 0 0 0 rgba(56, 189, 248, 0); }
}

/* Speaking ring pulse — wider, stronger */
@keyframes va-ring-speaking {
  0%   { box-shadow: 0 0 0 0 rgba(99, 102, 241, 0.45); }
  70%  { box-shadow: 0 0 0 10px rgba(139, 92, 246, 0); }
  100% { box-shadow: 0 0 0 0 rgba(99, 102, 241, 0); }
}

@keyframes va-shimmer {
  0%   { background-position: 35% 35%; }
  33%  { background-position: 55% 30%; }
  66%  { background-position: 30% 55%; }
  100% { background-position: 35% 35%; }
}

@keyframes va-blink {
  0%, 100% { opacity: 1; }
  50%      { opacity: 0.4; }
}

/* ---------- Pill button ---------- */

.va-pill {
  position: fixed;
  bottom: 24px;
  right: 24px;
  display: flex;
  align-items: center;
  gap: 10px;
  width: 168px;
  padding: 8px 8px 8px 8px;
  border-radius: 999px;
  background: #f5f3ef;
  border: 1px solid rgba(0, 0, 0, 0.06);
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.08);
  cursor: pointer;
  z-index: 9999;
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  user-select: none;
  -webkit-user-select: none;
  transition: box-shadow 0.4s ease;
}

.va-pill:hover {
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.12);
}

/* ---------- Orb ---------- */

.va-pill-orb {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 35%, #7dd3fc, #38bdf8, #2563eb, #6366f1);
  flex-shrink: 0;
  transition: width 0.6s ease, height 0.6s ease, box-shadow 0.6s ease, background 0.6s ease;
}

/* ---------- Label ---------- */

.va-pill-label {
  font-size: 14px;
  font-weight: 500;
  color: #1a1a1a;
  white-space: nowrap;
  overflow: hidden;
  flex: 1;
  opacity: 1;
}

/* ---------- Close button (visible only in active state) ---------- */

.va-pill-close {
  display: none;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  border: none;
  background: #e5e5e5;
  color: #737373;
  font-size: 16px;
  line-height: 1;
  cursor: pointer;
  flex-shrink: 0;
  padding: 0;
  transition: background 0.2s ease, color 0.2s ease;
}

.va-pill-close:hover {
  background: #d4d4d4;
  color: #525252;
}

.va-pill.active:not(.connecting) .va-pill-close {
  display: flex;
}

/* ---------- Active state (session running) ---------- */

.va-pill.active {
  gap: 10px;
  overflow: visible;
}

.va-pill.active:hover {
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.12);
}

.va-pill.active .va-pill-label {
  opacity: 1;
  pointer-events: none;
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.02em;
  text-align: center;
}

.va-pill.active .va-pill-orb {
  width: 36px;
  height: 36px;
  background:
    radial-gradient(circle at 30% 25%, rgba(255,255,255,0.45) 0%, transparent 45%),
    radial-gradient(circle at 35% 35%, #7dd3fc, #38bdf8, #2563eb, #6366f1);
  background-size: 100% 100%;
  animation: va-breathe 2.5s ease-in-out infinite, va-glow 2.5s ease-in-out infinite,
             va-ring 2.5s ease-out infinite, va-shimmer 6s ease-in-out infinite;
}

/* ---------- Connecting state ---------- */

.va-pill.connecting .va-pill-orb {
  animation: va-blink 1.5s ease-in-out infinite;
}

/* ---------- Speaking state (AI talking — faster + more intense) ---------- */

.va-pill.active.speaking .va-pill-orb {
  background:
    radial-gradient(circle at 30% 25%, rgba(255,255,255,0.55) 0%, transparent 40%),
    radial-gradient(circle at 35% 35%, #93c5fd, #60a5fa, #3b82f6, #6366f1, #8b5cf6);
  animation: va-breathe-speaking 0.9s ease-in-out infinite, va-glow-speaking 0.9s ease-in-out infinite,
             va-ring-speaking 1.2s ease-out infinite, va-shimmer 2s ease-in-out infinite;
}

/* ---------- Cookie banner offset ---------- */

.cookie-banner.show ~ .va-pill {
  bottom: 90px;
}

/* ---------- Error state ---------- */

.va-pill.error .va-pill-orb {
  background: radial-gradient(circle at 35% 35%, #e5e5e5, #d4d4d4, #a3a3a3, #737373);
  transition: background 0.4s ease;
}

.va-pill.error .va-pill-label {
  color: #1a1a1a;
}

/* ---------- Responsive ---------- */

@media (max-width: 480px) {
  .va-pill {
    bottom: 16px;
    right: 16px;
  }

  .cookie-banner.show ~ .va-pill {
    bottom: 120px;
  }
}
