/* ═══════════════════════════════════════════════════════
   Floating Call Widget — OneBank AI Assistant (Dark Theme)
   ═══════════════════════════════════════════════════════ */

.cw-container {
  position: fixed;
  bottom: 28px;
  right: 28px;
  z-index: 500;
}

/* ── FAB (Floating Action Button) with pulsing glow ── */
.cw-fab {
  width: 60px;
  height: 60px;
  border-radius: 50%;
  background: var(--ob-accent);
  color: #0d0d12;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow:
    0 4px 16px rgba(0, 226, 160, 0.4),
    0 0 20px rgba(0, 226, 160, 0.3);
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  animation: cwGlow 2.5s ease-in-out infinite;
}

.cw-fab:hover {
  transform: scale(1.08);
  box-shadow:
    0 6px 24px rgba(0, 226, 160, 0.5),
    0 0 30px rgba(0, 226, 160, 0.4);
}

.cw-fab.hidden { display: none; }
.cw-container.hidden { display: none; }

/* Default pulsing glow */
@keyframes cwGlow {
  0%, 100% {
    box-shadow:
      0 4px 16px rgba(0, 226, 160, 0.4),
      0 0 20px rgba(0, 226, 160, 0.2);
  }
  50% {
    box-shadow:
      0 4px 24px rgba(0, 226, 160, 0.6),
      0 0 40px rgba(0, 226, 160, 0.35),
      0 0 60px rgba(0, 226, 160, 0.15);
  }
}

/* Active call pulse — more intense */
.cw-fab.calling {
  background: var(--ob-success);
  animation: cwPulse 2s infinite;
}

@keyframes cwPulse {
  0%, 100% {
    box-shadow:
      0 4px 16px rgba(0, 226, 160, 0.4),
      0 0 20px rgba(0, 226, 160, 0.3);
  }
  50% {
    box-shadow:
      0 4px 24px rgba(0, 226, 160, 0.7),
      0 0 0 8px rgba(0, 226, 160, 0.15),
      0 0 40px rgba(0, 226, 160, 0.3);
  }
}

/* ── Expanded Panel ── */
.cw-panel {
  position: absolute;
  bottom: 72px;
  right: 0;
  width: 340px;
  background: var(--ob-bg-secondary);
  border: 1px solid var(--ob-surface-border);
  border-radius: 20px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.5), 0 2px 8px rgba(0, 0, 0, 0.3);
  overflow: hidden;
  opacity: 0;
  transform: translateY(12px) scale(0.95);
  pointer-events: none;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.cw-panel.open {
  opacity: 1;
  transform: translateY(0) scale(1);
  pointer-events: all;
}

/* ── Header — Green gradient ── */
.cw-panel-header {
  background: linear-gradient(135deg, #00e2a0 0%, #00c78a 50%, #13AA52 100%);
  color: #0d0d12;
  padding: 20px 24px;
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
}

.cw-header-content {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.cw-header-label {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  color: rgba(0, 0, 0, 0.5);
  font-family: var(--ob-font);
}

.cw-panel-header h3 {
  font-size: 18px;
  font-weight: 700;
  font-family: var(--ob-font);
  color: #0d0d12;
}

.cw-close {
  background: rgba(0, 0, 0, 0.1);
  border: none;
  color: rgba(0, 0, 0, 0.6);
  font-size: 20px;
  cursor: pointer;
  padding: 0;
  line-height: 1;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
}

.cw-close:hover {
  background: rgba(0, 0, 0, 0.2);
  color: rgba(0, 0, 0, 0.8);
}

/* ── AI Avatar area ── */
.cw-avatar-area {
  display: flex;
  justify-content: center;
  padding: 24px 24px 0;
}

.cw-avatar-img {
  width: 80px;
  height: 80px;
  border-radius: 50%;
  object-fit: cover;
  border: 3px solid var(--ob-accent);
  box-shadow: 0 0 20px rgba(0, 226, 160, 0.2);
}

/* ── Panel Body ── */
.cw-panel-body {
  padding: 16px 24px 8px;
  text-align: center;
}

.cw-welcome-text {
  font-size: 13px;
  line-height: 1.6;
  color: var(--ob-text-secondary);
  margin-bottom: 16px;
}

.cw-status {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-size: 12px;
  font-weight: 500;
  color: var(--ob-text-muted);
  margin-top: 4px;
}


.cw-status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}

.cw-status-dot.idle { background: var(--ob-accent); }
.cw-status-dot.connecting { background: var(--ob-warning); animation: cwBlink 1s infinite; }
.cw-status-dot.connected { background: var(--ob-success); }
.cw-status-dot.ended { background: var(--ob-danger); }

@keyframes cwBlink {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.3; }
}

.cw-timer {
  text-align: center;
  font-size: 32px;
  font-weight: 300;
  color: var(--ob-text);
  margin-bottom: 12px;
  font-variant-numeric: tabular-nums;
}

/* ── Panel Actions ── */
.cw-panel-actions {
  padding: 12px 24px 24px;
  display: flex;
  gap: 8px;
}

.cw-call-btn {
  flex: 1;
  padding: 14px;
  background: var(--ob-accent);
  color: #0d0d12;
  border: none;
  border-radius: 12px;
  font-size: 15px;
  font-weight: 700;
  font-family: var(--ob-font);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  transition: var(--ob-transition);
}

.cw-call-btn:hover { background: #00c78a; }
.cw-call-btn:disabled { opacity: 0.5; cursor: not-allowed; }

.cw-hangup-btn {
  flex: 1;
  padding: 14px;
  background: var(--ob-danger);
  color: white;
  border: none;
  border-radius: 12px;
  font-size: 14px;
  font-weight: 600;
  font-family: var(--ob-font);
  cursor: pointer;
  transition: var(--ob-transition);
}

.cw-hangup-btn:hover { background: #e04470; }

.cw-mute-btn {
  padding: 14px 16px;
  background: rgba(255, 255, 255, 0.06);
  color: var(--ob-text);
  border: 1px solid var(--ob-surface-border);
  border-radius: 12px;
  font-size: 13px;
  font-weight: 500;
  font-family: var(--ob-font);
  cursor: pointer;
  transition: var(--ob-transition);
}

.cw-mute-btn:hover { background: var(--ob-surface-hover); }
.cw-mute-btn.muted {
  background: var(--ob-danger-light);
  color: var(--ob-danger);
  border-color: var(--ob-danger);
}

/* ═══════════════════════════════════════════════════════
   JP Cognigy WebRTC Widget host
   Shown when resolveInstance(currentUser) === "JP".
   Same bottom-right anchor as the Twilio widget so only one is
   visible at a time.
   ═══════════════════════════════════════════════════════ */
.cw-jp-container {
  position: fixed;
  bottom: 28px;
  right: 28px;
  z-index: 500;
}
.cw-jp-container.hidden { display: none; }

/* Placeholder card shown until a real Cognigy WebRTC embed is dropped
   into #cw-jp-mount. The embed itself replaces this card. */
.cw-jp-placeholder {
  width: 280px;
  padding: 16px 18px;
  background: var(--ob-bg-secondary);
  border: 1px dashed var(--ob-border-strong, rgba(255,255,255,0.2));
  border-radius: 12px;
  color: var(--ob-text-secondary);
  font-size: 12px;
  line-height: 1.5;
}
.cw-jp-placeholder-title {
  color: var(--ob-text);
  font-size: 14px;
  font-weight: 600;
  margin-bottom: 4px;
}
.cw-jp-placeholder code {
  background: var(--ob-surface);
  padding: 1px 6px;
  border-radius: 4px;
  font-family: SFMono-Regular, Menlo, monospace;
  font-size: 11px;
  color: var(--ob-text);
}
