/* ===== Voice Call Widget ===== */
#voiceWidget {
    position: fixed;
    bottom: 24px;
    right: 104px;
    z-index: 9999;
    display: flex;
    flex-direction: column;
    align-items: flex-end;
}

/* ===== Bubble button ===== */
.voice-bubble-btn {
    position: relative;
    background: none;
    border: none;
    padding: 0;
    cursor: pointer;
    display: block;
    flex-shrink: 0;
    border-radius: 50%;
    overflow: visible;
    transition: transform .25s ease;
}

.voice-bubble-btn:hover { transform: scale(1.08); }

.voice-bubble-img {
    width: 64px;
    height: 64px;
    border-radius: 50%;
    overflow: hidden;
    display: block;
    object-fit: cover;
    box-shadow: 0 4px 12px rgba(0,0,0,.25);
}

/* Phone badge — bottom-right of the image */
.voice-call-badge {
    position: absolute;
    bottom: 0;
    right: 0;
    width: 22px;
    height: 22px;
    background: #EA580C;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: .6rem;
    color: #fff;
    border: 2px solid #fff;
    pointer-events: none;
}

/* Active call: pulsing ring */
.voice-bubble-btn.in-call .voice-bubble-img {
    box-shadow: 0 0 0 0 rgba(234,88,12,.6);
    animation: voiceRing 1.4s infinite;
}

@keyframes voiceRing {
    0%   { box-shadow: 0 0 0 0   rgba(234,88,12,.6); }
    70%  { box-shadow: 0 0 0 14px rgba(234,88,12,0); }
    100% { box-shadow: 0 0 0 0   rgba(234,88,12,0); }
}

/* ===== Call panel ===== */
.voice-panel {
    width: 300px;
    background: #fff;
    border-radius: 16px;
    box-shadow: 0 8px 40px rgba(6,47,110,.18);
    display: flex;
    flex-direction: column;
    margin-bottom: 12px;
    overflow: hidden;
    animation: chatSlideUp .22s ease;
}

/* reuse existing chatSlideUp keyframe from chat-bubble.css */

.voice-header {
    background: var(--cro-blue);
    color: #fff;
    padding: 14px 14px 12px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-shrink: 0;
}

.voice-header-info {
    display: flex;
    align-items: center;
    gap: 10px;
}

.voice-avatar-wrap {
    position: relative;
    width: 40px;
    height: 40px;
    flex-shrink: 0;
}

.voice-avatar-img {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    object-fit: cover;
    display: block;
}

.voice-pulse {
    position: absolute;
    inset: -4px;
    border-radius: 50%;
    border: 2px solid rgba(255,255,255,.5);
    opacity: 0;
}

.voice-panel.listening  .voice-pulse { animation: voicePulse 1.4s infinite; }
.voice-panel.speaking   .voice-pulse { animation: voicePulse .8s infinite; }

@keyframes voicePulse {
    0%   { opacity: .8; transform: scale(1); }
    100% { opacity: 0;  transform: scale(1.55); }
}

.voice-bot-name   { font-weight: 600; font-size: .88rem; }
.voice-status-txt { font-size: .7rem; opacity: .78; }

.voice-hangup-btn {
    background: #EA580C;
    border: none;
    color: #fff;
    width: 34px;
    height: 34px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: .9rem;
    transition: background .15s;
    flex-shrink: 0;
}

.voice-hangup-btn:hover { background: #C2410C; }

/* ===== Transcript ===== */
.voice-transcript {
    flex: 1;
    overflow-y: auto;
    padding: 12px 14px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    min-height: 120px;
    max-height: 240px;
    scroll-behavior: smooth;
}

.voice-transcript-msg {
    font-size: .84rem;
    line-height: 1.45;
    color: var(--cro-dark, #1a1a2e);
    word-break: break-word;
    white-space: normal;
}

.voice-transcript-msg a {
    color: var(--cro-blue);
    font-weight: 500;
    text-decoration: underline;
    word-break: break-all;
}

.voice-transcript-hint {
    font-size: .78rem;
    color: var(--cro-gray, #6c757d);
    text-align: center;
    padding: 8px 0 4px;
}

.voice-debug-msg {
    font-size: .72rem;
    font-family: monospace;
    color: #888;
    background: #f5f5f5;
    border-left: 2px solid #ccc;
    padding: 2px 6px;
    word-break: break-all;
    white-space: pre-wrap;
}

/* ===== Responsive ===== */
@media (max-width: 420px) {
    #voiceWidget { right: 24px; bottom: 16px; }
    .voice-panel { width: calc(100vw - 48px); min-width: 220px; }
}

/* ===== Unified bubble — hide individual trigger buttons ===== */
#chatBubble,
#voiceBubble { display: none !important; }

/* Push widget panels up above the unified bubble */
#chatWidget  { bottom: 100px; }
#voiceWidget { bottom: 100px; right: 24px; }

/* ===== Unified bubble launcher ===== */
#unifiedBubble {
    position: fixed;
    bottom: 24px;
    right: 24px;
    z-index: 10000;
    display: flex;
    flex-direction: column;
    align-items: flex-end;
}

.unified-bubble-btn {
    width: 64px;
    height: 64px;
    border-radius: 50%;
    border: none;
    padding: 0;
    cursor: pointer;
    overflow: hidden;
    background: none;
    flex-shrink: 0;
    transition: transform .25s ease;
    box-shadow: 0 4px 16px rgba(0,0,0,.28);
}

.unified-bubble-btn:hover { transform: scale(1.08); }

.unified-bubble-img {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    object-fit: cover;
    display: block;
}

/* ===== Popup menu ===== */
#bubbleMenu {
    display: none;
    flex-direction: column;
    gap: 6px;
    margin-bottom: 10px;
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 4px 24px rgba(6,47,110,.18);
    padding: 8px;
    min-width: 130px;
}

#bubbleMenu.open { display: flex; }

.bubble-menu-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 9px 14px;
    border: none;
    border-radius: 8px;
    background: none;
    cursor: pointer;
    font-size: .88rem;
    font-weight: 500;
    color: var(--cro-blue, #062f6e);
    transition: background .14s;
    white-space: nowrap;
}

.bubble-menu-item:hover { background: #f0f4fb; }

.bubble-menu-item i { font-size: 1rem; }
