/* ═══════════════════════════════════════════════
   Javaris Voice Layer — FAB + Persona Overlay
   ═══════════════════════════════════════════════ */

/* ── Floating Action Button ── */
.javaris-fab {
  position: fixed;
  bottom: 88px;
  right: 20px;
  width: 60px;
  height: 60px;
  border-radius: 50%;
  border: 2px solid var(--accent);
  background: var(--surface);
  color: var(--accent);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
  box-shadow: 0 4px 20px rgba(0,229,255,.25);
  transition: all .3s ease;
  -webkit-tap-highlight-color: transparent;
}
.javaris-fab:hover {
  transform: scale(1.08);
  box-shadow: 0 6px 28px rgba(0,229,255,.35);
}
.javaris-fab:active {
  transform: scale(0.95);
}

.javaris-fab .close-icon {
  display: none;
}

.javaris-fab.active {
  background: var(--accent);
  color: var(--bg);
  border-color: var(--accent);
  animation: fabPulse 2s ease-in-out infinite;
}
.javaris-fab.active .mic-icon { display: none; }
.javaris-fab.active .close-icon { display: block; }

@keyframes fabPulse {
  0%, 100% { box-shadow: 0 4px 20px rgba(0,229,255,.25); }
  50% { box-shadow: 0 4px 32px rgba(0,229,255,.55); }
}

/* Different states */
.javaris-fab.listening {
  background: var(--success);
  border-color: var(--success);
  color: #fff;
  animation: fabListen 1.2s ease-in-out infinite;
}
@keyframes fabListen {
  0%, 100% { box-shadow: 0 4px 20px rgba(46,213,115,.3); }
  50% { box-shadow: 0 4px 36px rgba(46,213,115,.6); }
}

.javaris-fab.thinking {
  background: #ffa502;
  border-color: #ffa502;
  color: #fff;
  animation: fabThink .6s ease-in-out infinite;
}
@keyframes fabThink {
  0%, 100% { box-shadow: 0 4px 20px rgba(255,165,2,.3); transform: scale(1); }
  50% { box-shadow: 0 4px 30px rgba(255,165,2,.5); transform: scale(1.05); }
}

/* ── Javaris Overlay ── */
#javaris-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.7);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  z-index: 200;
  align-items: center;
  justify-content: center;
}
#javaris-overlay.active { display: flex; }

.jv-persona {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
  animation: personaIn .5s ease;
}
@keyframes personaIn {
  from { opacity: 0; transform: scale(.8) translateY(20px); }
  to { opacity: 1; transform: scale(1) translateY(0); }
}

/* ── Persona Avatar ── */
.jv-avatar {
  width: 140px;
  height: 140px;
  color: var(--accent);
  filter: drop-shadow(0 0 30px rgba(0,229,255,.3));
  transition: all .5s ease;
  position: relative;
}

/* Glow ring animation */
.jv-avatar::before {
  content: '';
  position: absolute;
  inset: -10px;
  border-radius: 50%;
  border: 2px solid var(--accent);
  opacity: .2;
  animation: ringPulse 3s ease-in-out infinite;
}
@keyframes ringPulse {
  0%, 100% { transform: scale(1); opacity: .2; }
  50% { transform: scale(1.08); opacity: .4; }
}

/* Listening: eyes glow, mouth changes */
.jv-listening .jv-avatar svg circle[r="4"]:nth-child(2),
.jv-listening .jv-avatar svg circle[r="4"]:nth-child(3) {
  fill: var(--success);
}

/* Thinking: antenna pulses, color shift */
.jv-thinking .jv-avatar {
  color: #ffa502;
  filter: drop-shadow(0 0 30px rgba(255,165,2,.3));
}
.jv-thinking .jv-avatar::before {
  border-color: #ffa502;
}

/* Speaking: mouth animates */
.jv-speaking .jv-avatar {
  color: var(--accent);
}

/* ── Wave ── */
.jv-wave {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  height: 50px;
}
.jv-wave span {
  width: 5px;
  border-radius: 3px;
  background: var(--accent);
  animation: jvWaveAnim .8s ease-in-out infinite;
}
.jv-wave span:nth-child(1) { animation-delay: 0.0s; height: 12px; }
.jv-wave span:nth-child(2) { animation-delay: 0.1s; height: 22px; }
.jv-wave span:nth-child(3) { animation-delay: 0.2s; height: 34px; }
.jv-wave span:nth-child(4) { animation-delay: 0.3s; height: 44px; }
.jv-wave span:nth-child(5) { animation-delay: 0.4s; height: 50px; }
.jv-wave span:nth-child(6) { animation-delay: 0.3s; height: 44px; }
.jv-wave span:nth-child(7) { animation-delay: 0.2s; height: 34px; }
.jv-wave span:nth-child(8) { animation-delay: 0.1s; height: 22px; }
.jv-wave span:nth-child(9) { animation-delay: 0.0s; height: 12px; }
.jv-wave span:nth-child(10) { animation-delay: 0.05s; height: 16px; }

@keyframes jvWaveAnim {
  0%, 100% { transform: scaleY(0.5); opacity: .4; }
  50% { transform: scaleY(1); opacity: 1; }
}

/* Thinking: orange wave */
.jv-thinking .jv-wave span {
  background: #ffa502;
  animation-duration: .5s;
}

/* Speaking: green wave */
.jv-speaking .jv-wave span {
  background: var(--success);
  animation-duration: .6s;
}

/* Idle: no animation */
.jv-idle .jv-wave span {
  animation: none;
  opacity: .2;
  transform: scaleY(0.3);
}

/* ── Status ── */
.jv-status {
  font-size: 18px;
  font-weight: 600;
  color: var(--text-bright);
  text-align: center;
}
.jv-hint {
  font-size: 13px;
  color: var(--text-dim);
  text-align: center;
  opacity: .7;
}

.jv-exit {
  margin-top: 12px;
  padding: 10px 28px;
  border: 1px solid var(--border);
  border-radius: 24px;
  background: var(--surface);
  color: var(--text-dim);
  font-size: 14px;
  font-family: inherit;
  cursor: pointer;
  transition: all .2s;
}
.jv-exit:hover {
  border-color: var(--danger);
  color: var(--danger);
  background: rgba(255,71,87,.08);
}

/* ── Responsive ── */
@media (max-width: 768px) {
  .javaris-fab {
    bottom: 80px;
    right: 12px;
    width: 56px;
    height: 56px;
  }
  .javaris-fab svg { width: 24px; height: 24px; }
  .jv-avatar { width: 110px; height: 110px; }
  .jv-wave { height: 40px; gap: 4px; }
  .jv-wave span { width: 4px; }
  .jv-status { font-size: 16px; }
}
