#ai-chat-container {
    max-width: 450px;
    margin: 20px auto;
    background: #ffffff;
    border-radius: 16px;
    box-shadow: 0 8px 30px rgba(0,0,0,0.1);
    font-family: 'Inter', -apple-system, sans-serif;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

/* Header */
.ai-header {
    background: #007bff;
    color: white;
    padding: 15px 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.ai-status-dot {
    width: 8px;
    height: 8px;
    background: #28a745;
    border-radius: 50%;
    display: inline-block;
    margin-right: 5px;
}

/* Chat Body */
#ai-messages {
    height: 400px;
    overflow-y: auto;
    padding: 20px;
    background: #f7f9fb;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

/* Bubbles */
.msg-row { display: flex; width: 100%; }
.msg-user { justify-content: flex-end; }
.msg-ai { justify-content: flex-start; }

.bubble {
    max-width: 80%;
    padding: 12px 16px;
    border-radius: 18px;
    font-size: 14px;
    line-height: 1.5;
    position: relative;
}

.msg-user .bubble {
    background: #007bff;
    color: white;
    border-bottom-right-radius: 4px;
}

.msg-ai .bubble {
    background: #ffffff;
    color: #333;
    border-bottom-left-radius: 4px;
    box-shadow: 0 2px 5px rgba(0,0,0,0.05);
}

/* Live Transcription */
#ai-live-preview {
    padding: 5px 20px;
    font-size: 12px;
    color: #666;
    height: 20px;
    background: #f7f9fb;
}

/* Footer Input Area */
.ai-footer {
    padding: 15px;
    background: white;
    display: flex;
    align-items: center;
    gap: 10px;
    border-top: 1px solid #eee;
}

#ai-input {
    flex: 1;
    border: 1px solid #e0e0e0;
    padding: 10px 15px;
    border-radius: 25px;
    outline: none;
    transition: 0.2s;
}

#ai-input:focus { border-color: #007bff; }

/* Voice Button Animation */
#ai-voice-btn {
    width: 42px;
    height: 42px;
    border-radius: 50%;
    border: none;
    background: #007bff;
    color: white;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: 0.3s;
}

.is-listening {
    background: #ff4d4d !important;
    animation: pulse 1.5s infinite;
}

@keyframes pulse {
    0% { transform: scale(1); box-shadow: 0 0 0 0 rgba(255, 77, 77, 0.7); }
    70% { transform: scale(1.1); box-shadow: 0 0 0 10px rgba(255, 77, 77, 0); }
    100% { transform: scale(1); box-shadow: 0 0 0 0 rgba(255, 77, 77, 0); }
}

/* Core Container */
#ai-chat-container {
    max-width: 400px;
    margin: 20px auto;
    background: #fff;
    border-radius: 15px;
    box-shadow: 0 10px 25px rgba(0,0,0,0.1);
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

/* Header */
.ai-header {
    background: #007bff;
    color: white;
    padding: 15px;
    font-weight: bold;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

/* Chat Body */
#ai-messages {
    height: 350px;
    overflow-y: auto;
    padding: 15px;
    background: #f9f9f9;
    display: flex;
    flex-direction: column;
}

/* Bubbles */
.msg-row { margin-bottom: 15px; display: flex; width: 100%; }
.msg-user { justify-content: flex-end; }
.msg-ai { justify-content: flex-start; }

.bubble {
    max-width: 80%;
    padding: 10px 15px;
    border-radius: 18px;
    font-size: 14px;
    line-height: 1.4;
}

.msg-user .bubble {
    background: #007bff;
    color: white;
    border-bottom-right-radius: 2px;
}

.msg-ai .bubble {
    background: #e9e9eb;
    color: #333;
    border-bottom-left-radius: 2px;
}

/* Live Text Preview */
#ai-live-preview {
    padding: 0 15px;
    height: 20px;
    font-size: 12px;
    color: #007bff;
    font-style: italic;
}

/* Footer */
.ai-footer {
    padding: 10px;
    border-top: 1px solid #eee;
    display: flex;
    gap: 10px;
    align-items: center;
}

#ai-input {
    flex: 1;
    border: 1px solid #ddd;
    padding: 10px;
    border-radius: 20px;
    outline: none;
}

#ai-voice-btn {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    border: none;
    background: #007bff;
    color: white;
    cursor: pointer;
    font-size: 18px;padding: 10px;
}

.is-listening {
    background: #dc3545 !important;
    animation: pulse-red 1.5s infinite;
}
/* Pulsing Avatar for Call Mode */
.caller-avatar {
    animation: ring-pulse 2s infinite;
}

@keyframes ring-pulse {
    0% { transform: scale(1); box-shadow: 0 0 0 0 rgba(0, 123, 255, 0.7); }
    70% { transform: scale(1.1); box-shadow: 0 0 0 20px rgba(0, 123, 255, 0); }
    100% { transform: scale(1); box-shadow: 0 0 0 0 rgba(0, 123, 255, 0); }
}

/* Hang up button hover effect */
#hang-up-btn:hover {
    background: #a71d2a !important;
    transform: scale(1.1);
}

/* Live Preview Text Color */
#ai-live-preview {
    color: #007bff;
    font-style: italic;
    min-height: 20px;
    padding: 5px 15px;
}
@keyframes pulse-red {
    0% { box-shadow: 0 0 0 0 rgba(220, 53, 69, 0.4); }
    70% { box-shadow: 0 0 0 10px rgba(220, 53, 69, 0); }
    100% { box-shadow: 0 0 0 0 rgba(220, 53, 69, 0); }
}
@keyframes radio-static {
    0% { filter: contrast(100%) brightness(100%); }
    50% { filter: contrast(110%) brightness(1.1) grayscale(0.2); }
    100% { filter: contrast(100%) brightness(100%); }
}

/* Apply this class in your updateStatus('speaking') function */
.ai-speaking-active {
    animation: radio-static 0.2s infinite;
}