/* ── Gemi Prime Live Audio Demo Modal ─────────────────────────────────────── */

#gemiLiveOverlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.72);
  backdrop-filter: blur(6px);
  z-index: 9000;
  align-items: center;
  justify-content: center;
}
#gemiLiveOverlay.active { display: flex; }

#gemiLiveModal {
  background: #0f0f1a;
  border: 1px solid rgba(139,92,246,.35);
  border-radius: 20px;
  box-shadow: 0 0 60px rgba(139,92,246,.25), 0 24px 64px rgba(0,0,0,.6);
  width: 90%;
  max-width: 480px;
  max-height: 88vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  animation: gliveSlideUp .25s ease;
}
@keyframes gliveSlideUp {
  from { opacity:0; transform:translateY(24px) scale(.97); }
  to   { opacity:1; transform:translateY(0) scale(1); }
}

/* Header */
.glive-header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 18px 20px 14px;
  border-bottom: 1px solid rgba(255,255,255,.07);
}
.glive-avatar {
  width: 40px; height: 40px;
  border-radius: 50%;
  background: linear-gradient(135deg,#7c3aed,#4f46e5);
  display: flex; align-items: center; justify-content: center;
  font-size: 20px; flex-shrink: 0;
}
.glive-title { flex: 1; }
.glive-title h3 { margin: 0; font-size: 15px; font-weight: 700; color: #fff; line-height: 1.2; }
.glive-title p  { margin: 2px 0 0; font-size: 11px; color: rgba(255,255,255,.45); }
.glive-status-pill {
  display: flex; align-items: center; gap: 6px;
  padding: 4px 10px; border-radius: 20px;
  font-size: 11px; font-weight: 600;
  text-transform: uppercase; letter-spacing: .04em;
  background: rgba(255,255,255,.07); color: rgba(255,255,255,.5);
  transition: all .3s;
}
.glive-status-pill .glive-dot { width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.glive-status-pill.connecting { color:#f59e0b; background:rgba(245,158,11,.12); }
.glive-status-pill.listening  { color:#10b981; background:rgba(16,185,129,.12); }
.glive-status-pill.speaking   { color:#8b5cf6; background:rgba(139,92,246,.18); }
.glive-status-pill.speaking .glive-dot { animation: glivePulse .6s ease infinite alternate; }
.glive-status-pill.error      { color:#ef4444; background:rgba(239,68,68,.12); }
@keyframes glivePulse { from{opacity:.4;transform:scale(.8)} to{opacity:1;transform:scale(1.2)} }
.glive-close {
  background:none; border:none; color:rgba(255,255,255,.4);
  cursor:pointer; font-size:20px; line-height:1; padding:4px;
  border-radius:6px; transition: color .2s, background .2s; flex-shrink:0;
}
.glive-close:hover { color:#fff; background:rgba(255,255,255,.08); }

/* Controls */
.glive-controls {
  display: flex; align-items: center; gap: 10px;
  padding: 14px 20px;
  background: rgba(255,255,255,.03);
  border-bottom: 1px solid rgba(255,255,255,.06);
}
.glive-mic-btn {
  display: flex; align-items: center; gap: 8px;
  padding: 9px 18px; border-radius: 50px; border: none;
  font-size: 13px; font-weight: 600; cursor: pointer; transition: all .2s;
  background: rgba(139,92,246,.18); color: #a78bfa;
  border: 1px solid rgba(139,92,246,.35);
}
.glive-mic-btn:hover { background: rgba(139,92,246,.28); }
.glive-mic-btn.active { background: rgba(16,185,129,.18); color: #34d399; border-color: rgba(16,185,129,.4); }
.glive-mic-btn.muted  { background: rgba(239,68,68,.12); color: #f87171; border-color: rgba(239,68,68,.3); }
.glive-mic-btn.stop-mode { background: rgba(239,68,68,.18); border-color: rgba(239,68,68,.5); color: #f87171; }
.glive-mic-btn.stop-mode:hover { background: rgba(239,68,68,.3); }
.glive-mic-btn.active .glive-mic-icon { animation: gliveMicPulse 1.2s ease infinite; }
@keyframes gliveMicPulse {
  0%,100% { filter: drop-shadow(0 0 0px #34d399); }
  50%      { filter: drop-shadow(0 0 6px #34d399); }
}
.glive-bars {
  display: flex; align-items: flex-end; gap: 3px; height: 22px; flex: 1;
}
.glive-bar { width: 4px; border-radius: 2px; background: rgba(139,92,246,.25); min-height: 3px; }
.glive-bars.agent-speaking .glive-bar:nth-child(1) { animation: gliveBar1 .8s ease infinite; }
.glive-bars.agent-speaking .glive-bar:nth-child(2) { animation: gliveBar2 .9s ease infinite .15s; }
.glive-bars.agent-speaking .glive-bar:nth-child(3) { animation: gliveBar3 .7s ease infinite .05s; }
.glive-bars.agent-speaking .glive-bar:nth-child(4) { animation: gliveBar4 1s ease infinite .25s; }
.glive-bars.agent-speaking .glive-bar:nth-child(5) { animation: gliveBar2 .85s ease infinite .1s; }
.glive-bars.agent-speaking .glive-bar { background: #8b5cf6; }
.glive-bars.user-speaking  .glive-bar { background: #10b981; }
.glive-bars.user-speaking  .glive-bar:nth-child(1) { animation: gliveBar3 .6s ease infinite; }
.glive-bars.user-speaking  .glive-bar:nth-child(2) { animation: gliveBar1 .7s ease infinite .1s; }
.glive-bars.user-speaking  .glive-bar:nth-child(3) { animation: gliveBar4 .5s ease infinite; }
.glive-bars.user-speaking  .glive-bar:nth-child(4) { animation: gliveBar2 .8s ease infinite .2s; }
.glive-bars.user-speaking  .glive-bar:nth-child(5) { animation: gliveBar3 .65s ease infinite .05s; }
@keyframes gliveBar1 { 0%,100%{height:3px} 50%{height:14px} }
@keyframes gliveBar2 { 0%,100%{height:6px} 50%{height:20px} }
@keyframes gliveBar3 { 0%,100%{height:4px} 50%{height:10px} }
@keyframes gliveBar4 { 0%,100%{height:8px} 50%{height:18px} }
.glive-speaker-btn, .glive-end-btn {
  width: 36px; height: 36px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 16px; cursor: pointer; transition: all .2s; flex-shrink: 0;
}
.glive-speaker-btn {
  border: 1px solid rgba(255,255,255,.1);
  background: rgba(255,255,255,.05); color: rgba(255,255,255,.5); border: 1px solid rgba(255,255,255,.1);
}
.glive-speaker-btn:hover { background: rgba(255,255,255,.1); color:#fff; }
.glive-speaker-btn.muted { color: #ef4444; border-color: rgba(239,68,68,.3); }
.glive-end-btn { background: rgba(239,68,68,.15); color: #f87171; border: none; }
.glive-end-btn:hover { background: rgba(239,68,68,.3); color:#fff; }


/* Waveform */
.glive-waveform {
  flex: 1;
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  padding: 20px 20px 16px;
  min-height: 160px;
  background: rgba(0,0,0,.18);
}
#gliveCanvas {
  width: 100%;
  height: 120px;
  display: block;
  border-radius: 6px;
}
.glive-wave-label {
  font-size: 11px; font-weight: 600;
  text-transform: uppercase; letter-spacing: .06em;
  color: rgba(255,255,255,.22);
  margin-top: 12px;
  transition: color .4s;
}
.glive-wave-label.listening { color: rgba(16,185,129,.65); }
.glive-wave-label.speaking  { color: rgba(139,92,246,.85); }

/* Footer */
.glive-footer {
  padding: 10px 20px;
  border-top: 1px solid rgba(255,255,255,.06);
  display: flex; align-items: center; justify-content: center; gap: 6px;
  font-size: 10.5px; color: rgba(255,255,255,.22);
}
.glive-footer a { color: rgba(139,92,246,.6); text-decoration: none; }
.glive-footer a:hover { color: #a78bfa; }

/* Nav button */
.nav-live-btn {
  display: flex; align-items: center; gap: 6px;
  padding: 7px 14px; border-radius: 50px;
  background: none;
  border: none;
  color: #fff; font-size: 13px; font-weight: 600;
  cursor: pointer; text-decoration: none;
  transition: color .2s; white-space: nowrap;
}
.nav-live-btn:hover { color: #00E3AA; }
.nav-live-btn .live-dot {
  width: 7px; height: 7px; border-radius: 50%; background: #00E3AA;
  flex-shrink: 0;
}
@media (max-width: 768px) {
  #gemiLiveModal { max-width: 100%; width: 100%; border-radius: 20px 20px 0 0; }
  #gemiLiveOverlay.active { align-items: flex-end; }
  .nav-live-btn span { display: none; }
}

/* ── Full-width Talk Live button (below chat input) ─────────────────────── */
.gp-talk-live-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  margin: 20px 0 0;
  padding: 12px;
  border-radius: 10px;
  background: #00b389;
  border: none;
  color: #fff;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: all .2s;
  letter-spacing: .02em;
}
.gp-talk-live-btn:hover { background: #00c99a; transform: translateY(-1px); box-shadow: 0 6px 20px rgba(0,227,170,0.3); }
.gp-talk-live-btn .live-dot {
  width: 7px; height: 7px; border-radius: 50%; background: rgba(255,255,255,0.8);
  animation: glivePulse .9s ease infinite alternate;
  flex-shrink: 0;
}

/* ── Direct WebSocket compact audio panel ────────────────────────────────── */
#gliveDirectOverlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.6);
  backdrop-filter: blur(5px);
  z-index: 9500;
  align-items: center;
  justify-content: center;
}
#gliveDirectModal {
  background: #0f0f1a;
  border: 1px solid rgba(139,92,246,.35);
  border-radius: 16px;
  box-shadow: 0 0 50px rgba(139,92,246,.2), 0 20px 60px rgba(0,0,0,.65);
  width: 90%;
  max-width: 360px;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  animation: gliveSlideUp .22s ease;
}
#gliveDirectModal .glive-waveform { min-height: 100px; padding: 14px 16px 10px; }
#gliveDirectModal #gdCanvas { height: 80px; }
@media (max-width: 768px) {
  #gliveDirectModal { max-width: 100%; width: 100%; border-radius: 16px 16px 0 0; }
  #gliveDirectOverlay { align-items: flex-end; }
}
