/* =========================================================
   AI VOICE CALL WIDGET — Gani Mobility
   ========================================================= */

/* ── Widget container ──────────────────────────────────── */
.ai-call-widget {
  position: fixed;
  bottom: 1.75rem;
  right: 1.75rem;
  z-index: 9000;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 0.6rem;
}

/* ── Bubble label ──────────────────────────────────────── */
.ai-call-widget__bubble {
  background: #1a1a1a;
  color: #f0f0f0;
  font-size: 0.8rem;
  font-weight: 500;
  padding: 0.45rem 0.9rem;
  border-radius: 999px;
  box-shadow: 0 4px 16px rgba(0,0,0,0.22);
  white-space: nowrap;
  cursor: default;
  border: 1px solid rgba(255,255,255,0.1);
  animation: bubble-in 0.4s cubic-bezier(0.34,1.56,0.64,1) both;
  transition: opacity 0.25s ease, transform 0.25s ease;
}
@keyframes bubble-in {
  from { opacity: 0; transform: translateY(6px) scale(0.95); }
  to   { opacity: 1; transform: translateY(0)  scale(1); }
}
/* Hide bubble during a call */
.ai-call-widget.is-calling .ai-call-widget__bubble {
  opacity: 0;
  pointer-events: none;
  transform: translateY(6px) scale(0.9);
}

/* ── FAB button ────────────────────────────────────────── */
.ai-call-widget__fab {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  border: none;
  background: #1a1a1a;
  color: #ffffff;
  display: grid;
  place-items: center;
  cursor: pointer;
  box-shadow: 0 6px 24px rgba(0,0,0,0.30), 0 0 0 0 rgba(26,26,26,0);
  transition: background 0.25s ease, box-shadow 0.25s ease, transform 0.15s ease;
  position: relative;
}
.ai-call-widget__fab:hover {
  transform: scale(1.07);
  box-shadow: 0 8px 28px rgba(0,0,0,0.35);
}
.ai-call-widget__fab:active { transform: scale(0.96); }

/* Pulse ring when idle */
.ai-call-widget__fab::after {
  content: "";
  position: absolute;
  inset: -4px;
  border-radius: 50%;
  border: 2px solid rgba(26,26,26,0.3);
  animation: fab-pulse 2.5s ease-in-out infinite;
}
@keyframes fab-pulse {
  0%, 100% { transform: scale(1);   opacity: 1; }
  50%       { transform: scale(1.15); opacity: 0; }
}

/* In-call: red hang-up state */
.ai-call-widget.is-calling .ai-call-widget__fab {
  background: #e53e3e;
  box-shadow: 0 6px 24px rgba(229,62,62,0.45);
}
.ai-call-widget.is-calling .ai-call-widget__fab::after {
  border-color: rgba(229,62,62,0.4);
}
.ai-call-widget.is-calling .ai-call-widget__fab:hover {
  background: #c53030;
}

/* Icon visibility toggling */
.ai-call-fab-icon--hangup { display: none; }
.ai-call-widget.is-calling .ai-call-fab-icon--phone  { display: none; }
.ai-call-widget.is-calling .ai-call-fab-icon--hangup { display: block; }

/* ── Call bar ──────────────────────────────────────────── */
.ai-call-bar {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  background: #111111;
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: 999px;
  padding: 0.45rem 0.6rem 0.45rem 0.5rem;
  box-shadow: 0 6px 24px rgba(0,0,0,0.4);
  animation: callbar-in 0.35s cubic-bezier(0.34,1.46,0.64,1) both;
  min-width: 220px;
}
.ai-call-bar[hidden] { display: none; }
@keyframes callbar-in {
  from { opacity: 0; transform: translateY(10px) scale(0.92); }
  to   { opacity: 1; transform: translateY(0)   scale(1); }
}

/* Avatar */
.ai-call-bar__avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: #2a2a2a;
  color: #e0e0e0;
  font-size: 0.8rem;
  font-weight: 700;
  display: grid;
  place-items: center;
  flex-shrink: 0;
  letter-spacing: 0;
}
/* Animated ring on avatar while AI speaks */
.ai-call-bar.is-speaking .ai-call-bar__avatar {
  box-shadow: 0 0 0 3px rgba(110,209,110,0.5);
  animation: avatar-ring 1s ease-in-out infinite;
}
@keyframes avatar-ring {
  0%, 100% { box-shadow: 0 0 0 3px rgba(110,209,110,0.5); }
  50%       { box-shadow: 0 0 0 6px rgba(110,209,110,0.15); }
}

/* Info */
.ai-call-bar__info {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 1px;
  min-width: 0;
}
.ai-call-bar__name {
  font-size: 0.72rem;
  font-weight: 600;
  color: #e8e8e8;
  white-space: nowrap;
}
.ai-call-bar__status {
  font-size: 0.66rem;
  color: #888;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  transition: color 0.2s;
}

/* Status colours */
.ai-call-bar.is-listening .ai-call-bar__status { color: #6ed16e; }
.ai-call-bar.is-thinking  .ai-call-bar__status { color: #c4a25c; }
.ai-call-bar.is-speaking  .ai-call-bar__status { color: #63b3ed; }

/* Sound wave bars */
.ai-call-bar__wave {
  display: flex;
  align-items: center;
  gap: 2px;
  height: 20px;
}
.ai-call-bar__wave span {
  width: 3px;
  background: #444;
  border-radius: 99px;
  height: 4px;
  transition: background 0.2s;
}
/* Animate wave only when AI is speaking */
.ai-call-bar.is-speaking .ai-call-bar__wave span {
  background: #63b3ed;
  animation: wave-bar 0.9s ease-in-out infinite;
}
.ai-call-bar.is-speaking .ai-call-bar__wave span:nth-child(1) { animation-delay: 0.0s; }
.ai-call-bar.is-speaking .ai-call-bar__wave span:nth-child(2) { animation-delay: 0.1s; }
.ai-call-bar.is-speaking .ai-call-bar__wave span:nth-child(3) { animation-delay: 0.2s; }
.ai-call-bar.is-speaking .ai-call-bar__wave span:nth-child(4) { animation-delay: 0.1s; }
.ai-call-bar.is-speaking .ai-call-bar__wave span:nth-child(5) { animation-delay: 0.0s; }
/* Animate wave when listening */
.ai-call-bar.is-listening .ai-call-bar__wave span {
  background: #6ed16e;
  animation: wave-bar 1.4s ease-in-out infinite;
}
.ai-call-bar.is-listening .ai-call-bar__wave span:nth-child(1) { animation-delay: 0.0s; }
.ai-call-bar.is-listening .ai-call-bar__wave span:nth-child(2) { animation-delay: 0.15s; }
.ai-call-bar.is-listening .ai-call-bar__wave span:nth-child(3) { animation-delay: 0.3s; }
.ai-call-bar.is-listening .ai-call-bar__wave span:nth-child(4) { animation-delay: 0.15s; }
.ai-call-bar.is-listening .ai-call-bar__wave span:nth-child(5) { animation-delay: 0.0s; }

@keyframes wave-bar {
  0%, 100% { height: 4px;  opacity: 0.5; }
  50%       { height: 18px; opacity: 1; }
}

/* Mute button */
.ai-call-bar__mute {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  border: 1px solid rgba(255,255,255,0.12);
  background: transparent;
  color: #888;
  display: grid;
  place-items: center;
  cursor: pointer;
  flex-shrink: 0;
  transition: background 0.18s, color 0.18s;
}
.ai-call-bar__mute:hover { background: rgba(255,255,255,0.08); color: #e0e0e0; }
.ai-call-bar__mute.is-muted { background: #e53e3e; color: #fff; border-color: #e53e3e; }

/* ── Unsupported notice ────────────────────────────────── */
.ai-call-widget__unsupported {
  background: #1a1a1a;
  border: 1px solid rgba(255,255,255,0.12);
  border-radius: 14px;
  padding: 0.9rem 1rem;
  max-width: 220px;
  font-size: 0.78rem;
  color: #c0c0c0;
  line-height: 1.5;
  text-align: center;
  box-shadow: 0 6px 24px rgba(0,0,0,0.3);
  position: relative;
}
.ai-call-widget__unsupported[hidden] { display: none; }
.ai-call-widget__unsupported button {
  position: absolute;
  top: 0.4rem;
  right: 0.6rem;
  background: none;
  border: none;
  color: #888;
  font-size: 1rem;
  cursor: pointer;
  line-height: 1;
}

/* ── Mobile ────────────────────────────────────────────── */
@media (max-width: 479px) {
  .ai-call-widget { bottom: 1.25rem; right: 1rem; }
  .ai-call-bar { min-width: 180px; }
}
