/* voice-calls.css — Voice messages, voice channels, voice calls, call AI, broadcast */

/* ============================================================
   Voice Messages & Voice Channel
   ============================================================ */

/* Mic button in composer */
.voice-mic-btn {
    border-radius: 0;
    padding: 0 12px;
    font-size: 18px;
    background: var(--bg-hover);
    color: var(--text-secondary);
    border: none;
    border-right: 1px solid var(--border);
    transition: all 0.2s;
}
.voice-mic-btn:hover {
    background: var(--bg-active);
    color: var(--text-primary);
}
.voice-mic-btn.recording {
    background: #4a2020 !important;
    border-color: #f44 !important;
    color: #f44 !important;
    animation: pulse-mic 1s ease-in-out infinite;
}
@keyframes pulse-mic {
    0%, 100% { box-shadow: 0 0 0 0 rgba(255, 68, 68, 0.4); }
    50%      { box-shadow: 0 0 0 8px rgba(255, 68, 68, 0); }
}

/* Voice message player in message bubbles */
.voice-message-player {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 8px;
}
.voice-duration {
    font-size: 12px;
    color: var(--text-muted);
    white-space: nowrap;
}

/* Voice channel panel */
.voice-participant {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
}
.voice-participant-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: var(--bg-hover);
    display: flex;
    align-items: center;
    justify-content: center;
    border: 2px solid transparent;
    transition: border-color 0.2s;
}
.voice-participant-avatar.speaking {
    border-color: var(--color-success);
    box-shadow: 0 0 8px rgba(78, 201, 176, 0.4);
}
.voice-participant-name {
    font-size: 10px;
    color: var(--text-muted);
    max-width: 50px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.voice-controls {
    display: flex;
    gap: 8px;
    justify-content: center;
    flex-shrink: 0;
    padding: 4px 0;
}
.voice-ctrl-btn {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    border: 1px solid var(--border);
    background: var(--bg-hover);
    color: var(--text-primary);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}
.voice-ctrl-btn:hover {
    background: var(--bg-active);
}
.voice-ctrl-btn.voice-ctrl-active {
    background: #4a2020;
    border-color: #f44;
    color: #f44;
}
.voice-ctrl-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}
.voice-ctrl-btn.voice-leave {
    background: #8b2020;
    border-color: #c44;
}
.voice-ctrl-btn.voice-leave:hover {
    background: #a33;
}
/* Broadcast button */
.voice-ctrl-btn.broadcast-btn {
    background: #1a4a1a;
    border-color: #4a4;
    color: #4a4;
}
.voice-ctrl-btn.broadcast-btn:hover {
    background: #2a5a2a;
}
.voice-ctrl-btn.broadcast-btn.voice-ctrl-active {
    background: #e53e3e;
    border-color: #e53e3e;
    color: #fff;
    animation: broadcast-pulse 2s infinite;
}
@keyframes broadcast-pulse {
    0%, 100% { box-shadow: 0 0 0 0 rgba(229, 62, 62, 0.4); }
    50% { box-shadow: 0 0 0 6px rgba(229, 62, 62, 0); }
}

/* Go Live button — active (Stop Live) state */
#goLiveBtn.go-live-active {
    background: #e53e3e !important;
    border-color: #e53e3e !important;
    color: #fff !important;
}
#goLiveBtn.go-live-active:hover {
    background: #c53030 !important;
}
/* Broadcast modal */
.broadcast-modal {
    width: 480px;
    max-width: 90vw;
}
.broadcast-status {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 15px;
    font-weight: 600;
    margin: 0 0 16px 0;
}
.broadcast-status.active {
    color: #e53e3e;
}
.broadcast-status.inactive {
    color: var(--text-muted);
}
.broadcast-status .live-dot {
    width: 10px;
    height: 10px;
    background: #e53e3e;
    border-radius: 50%;
    animation: pulse 1.5s infinite;
}
.broadcast-url-group {
    margin-bottom: 16px;
}
.broadcast-url-group label {
    display: block;
    font-size: 12px;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 6px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}
.broadcast-url-row {
    display: flex;
    gap: 6px;
}
.broadcast-url-input {
    flex: 1;
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: 6px;
    padding: 8px 12px;
    color: var(--text-primary);
    font-size: 13px;
    font-family: monospace;
    outline: none;
}
.broadcast-copy-btn {
    background: var(--bg-hover);
    border: 1px solid var(--border);
    border-radius: 6px;
    color: var(--text-primary);
    padding: 8px 12px;
    cursor: pointer;
    transition: background 0.2s;
}
.broadcast-copy-btn:hover {
    background: var(--accent);
    color: #fff;
}
.broadcast-hint {
    color: var(--text-muted);
    font-size: 13px;
    margin: 0 0 16px 0;
}
.broadcast-start-btn {
    background: #e53e3e;
    color: #fff;
    border: none;
    border-radius: 6px;
    padding: 10px 24px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s;
}
.broadcast-start-btn:hover {
    background: #c53030;
}
.broadcast-stop-btn {
    background: var(--bg-hover);
    color: #e53e3e;
    border: 1px solid #e53e3e;
    border-radius: 6px;
    padding: 10px 24px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    margin-top: 16px;
    transition: background 0.2s;
}
.broadcast-stop-btn:hover {
    background: #e53e3e;
    color: #fff;
}
/* Video grid */
.voice-participants {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    gap: 8px;
    padding: 4px 0;
    max-height: 200px;
    overflow: auto;
}
.voice-participant-video {
    width: 100%;
    aspect-ratio: 16/9;
    border-radius: 6px;
    overflow: hidden;
    background: #111;
    display: flex;
    align-items: center;
    justify-content: center;
}
.voice-video-element {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 6px;
}
.voice-channel-panel {
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding: 8px 12px;
    background: #1a2a1a;
    border-top: 1px solid #2a4a2a;
}

/* Participant panel invite tabs */
.invite-tab {
    flex: 1;
    padding: 8px 12px;
    background: transparent;
    border: none;
    border-bottom: 2px solid transparent;
    color: var(--text-muted);
    font-size: 13px;
    cursor: pointer;
    transition: color 0.15s, border-color 0.15s;
}
.invite-tab:hover {
    color: var(--text-primary);
}
.invite-tab.active-tab {
    color: var(--accent);
    border-bottom-color: var(--accent);
}
#inviteTableContainer .tabulator,
#aiTableContainer .tabulator {
    border: none;
    background: transparent;
}
#inviteTableContainer .tabulator-table,
#aiTableContainer .tabulator-table {
    background: transparent;
}
#inviteTableContainer .tabulator-row,
#aiTableContainer .tabulator-row {
    background: transparent;
    border-bottom: 1px solid var(--border);
}
#inviteTableContainer .tabulator-row:hover,
#aiTableContainer .tabulator-row:hover {
    background: var(--bg-hover);
}
#inviteTableContainer .tabulator-row.tabulator-selected,
#aiTableContainer .tabulator-row.tabulator-selected {
    background: rgba(86, 156, 214, 0.15) !important;
}

/* Collecting spinner animation */
@keyframes spin-pulse {
    0% { transform: rotate(0deg); opacity: 0.8; }
    50% { transform: rotate(180deg); opacity: 0.5; }
    100% { transform: rotate(360deg); opacity: 0.8; }
}
.collecting-spinner {
    animation: spin-pulse 1.5s ease-in-out infinite;
    display: inline-block;
    pointer-events: none;
}

/* Toast notifications */
.toast-notification {
    position: fixed;
    bottom: 20px;
    right: 20px;
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 12px 16px;
    display: flex;
    align-items: center;
    gap: 12px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
    z-index: 10000;
    animation: toast-slide-in 0.3s ease;
    max-width: 400px;
}

.toast-content {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
    color: var(--text-primary);
    word-break: break-word;
}

.toast-close {
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 18px;
    cursor: pointer;
    padding: 0 4px;
    flex-shrink: 0;
}

.toast-close:hover {
    color: var(--text-primary);
}

@keyframes toast-slide-in {
    from {
        transform: translateX(100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

/* ═══════════════════════════════════════════════════════════════════════════
   Voice Call UI
   ═══════════════════════════════════════════════════════════════════════════ */

/* Call button in chat composer */
.voice-call-btn {
    background: var(--bg-hover);
    border: 1px solid var(--border);
    color: var(--text-secondary);
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s;
    flex-shrink: 0;
}
.voice-call-btn:hover {
    background: var(--color-success, #4ec9b0);
    color: #fff;
    border-color: var(--color-success, #4ec9b0);
}
.voice-call-btn.call-active {
    background: #e53e3e;
    border-color: #e53e3e;
    color: #fff;
    animation: call-pulse 1.5s infinite;
}
@keyframes call-pulse {
    0%, 100% { box-shadow: 0 0 0 0 rgba(229, 62, 62, 0.4); }
    50% { box-shadow: 0 0 0 6px rgba(229, 62, 62, 0); }
}

/* Call controls panel (inside voice pane) */
.call-controls {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    padding: 12px;
    background: rgba(0, 0, 0, 0.3);
    border-radius: 8px;
    margin-top: 8px;
}
.call-timer {
    font-family: monospace;
    font-size: 18px;
    font-weight: 600;
    color: var(--text-primary);
    min-width: 60px;
    text-align: center;
}

/* Incoming call popup */
.incoming-call-popup {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 100000;
    animation: call-slide-in 0.3s ease-out;
}
@keyframes call-slide-in {
    from {
        transform: translateX(120%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}
.incoming-call-content {
    background: var(--bg-elevated, #252526);
    border: 2px solid var(--color-success, #4ec9b0);
    border-radius: 12px;
    padding: 16px 20px;
    display: flex;
    align-items: center;
    gap: 16px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
    min-width: 280px;
}
.incoming-call-icon {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background: var(--color-success, #4ec9b0);
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-size: 20px;
    animation: call-ring 1s infinite;
    flex-shrink: 0;
}
@keyframes call-ring {
    0%, 100% { transform: rotate(0deg); }
    10% { transform: rotate(15deg); }
    20% { transform: rotate(-15deg); }
    30% { transform: rotate(10deg); }
    40% { transform: rotate(-10deg); }
    50% { transform: rotate(0deg); }
}
.incoming-call-info {
    flex: 1;
    min-width: 0;
}
.incoming-call-title {
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--color-success, #4ec9b0);
    margin-bottom: 2px;
}
.incoming-call-name {
    font-size: 16px;
    font-weight: 600;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.incoming-call-actions {
    display: flex;
    gap: 10px;
    flex-shrink: 0;
}
.incoming-call-btn {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    border: none;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    cursor: pointer;
    transition: all 0.2s;
}
.incoming-call-accept {
    background: var(--color-success, #4ec9b0);
    color: #fff;
}
.incoming-call-accept:hover {
    background: #3db89e;
    transform: scale(1.1);
}
.incoming-call-decline {
    background: #e53e3e;
    color: #fff;
}
.incoming-call-decline:hover {
    background: #c53030;
    transform: scale(1.1);
}

/* ═══════════════════════════════════════════════════════════════════════════
   Call AI Popup — Full-screen voice call with AI agent
   ═══════════════════════════════════════════════════════════════════════════ */

.call-ai-popup {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 100000;
    background: linear-gradient(135deg, #1a1a2e 0%, #16213e 50%, #0f3460 100%);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: space-between;
    padding: 40px 20px;
    animation: call-ai-fade-in 0.3s ease-out;
}
@keyframes call-ai-fade-in {
    from { opacity: 0; }
    to { opacity: 1; }
}

.call-ai-header {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
}

.call-ai-avatar {
    width: 120px;
    height: 120px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--accent, #569cd6), var(--color-success, #4ec9b0));
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 48px;
    color: #fff;
    animation: call-ai-pulse 2s infinite;
    box-shadow: 0 0 40px rgba(86, 156, 214, 0.3);
}
@keyframes call-ai-pulse {
    0%, 100% { box-shadow: 0 0 40px rgba(86, 156, 214, 0.3); }
    50% { box-shadow: 0 0 60px rgba(86, 156, 214, 0.6); }
}

.call-ai-status {
    font-size: 16px;
    color: rgba(255, 255, 255, 0.8);
    font-weight: 500;
}

.call-ai-timer {
    font-family: monospace;
    font-size: 24px;
    font-weight: 600;
    color: #fff;
    letter-spacing: 2px;
}

.call-ai-transcript {
    flex: 1;
    width: 100%;
    max-width: 600px;
    overflow-y: auto;
    padding: 20px;
    background: rgba(0, 0, 0, 0.2);
    border-radius: 12px;
    margin: 20px 0;
}

.call-ai-transcript-hint {
    text-align: center;
    color: rgba(255, 255, 255, 0.4);
    font-style: italic;
    padding: 40px 0;
}

.call-ai-transcript-line {
    padding: 8px 12px;
    margin-bottom: 8px;
    border-radius: 8px;
    font-size: 14px;
    line-height: 1.5;
    color: rgba(255, 255, 255, 0.9);
}

.call-ai-user {
    background: rgba(86, 156, 214, 0.2);
    border-left: 3px solid var(--accent, #569cd6);
}

.call-ai-assistant {
    background: rgba(78, 201, 176, 0.2);
    border-left: 3px solid var(--color-success, #4ec9b0);
}

.call-ai-controls {
    display: flex;
    gap: 20px;
    align-items: center;
}

.call-ai-ctrl-btn {
    width: 64px;
    height: 64px;
    border-radius: 50%;
    border: none;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    cursor: pointer;
    transition: all 0.2s;
    background: rgba(255, 255, 255, 0.15);
    color: #fff;
}

.call-ai-ctrl-btn:hover {
    background: rgba(255, 255, 255, 0.25);
    transform: scale(1.05);
}

.call-ai-muted {
    background: rgba(229, 62, 62, 0.3) !important;
    color: #e53e3e !important;
}

.call-ai-end-btn {
    background: #e53e3e !important;
    color: #fff !important;
    width: 72px;
    height: 72px;
}

.call-ai-end-btn:hover {
    background: #c53030 !important;
    transform: scale(1.1);
}

/* Calls sidebar section */
.call-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 8px;
    border-radius: 4px;
    cursor: pointer;
    transition: background 0.15s;
    font-size: 12px;
    color: var(--text-primary);
}
.call-item:hover {
    background: var(--bg-hover);
}
.call-item-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    flex-shrink: 0;
}
.call-item-dot.active {
    background: var(--color-success, #4ec9b0);
    animation: call-pulse 1.5s infinite;
}
.call-item-dot.ended {
    background: var(--text-muted);
}
.call-item-info {
    flex: 1;
    min-width: 0;
}
.call-item-name {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    font-weight: 500;
}
.call-item-meta {
    font-size: 11px;
    color: var(--text-muted);
}

/* Contacts table call buttons */
.contacts-call-btn {
    background: var(--color-success, #4ec9b0);
    border: none;
    color: #fff;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 11px;
    transition: all 0.15s;
}
.contacts-call-btn:hover {
    background: #3db89e;
    transform: scale(1.1);
}

.contacts-call-btn-sm {
    background: var(--color-success, #4ec9b0);
    border: none;
    color: #fff;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 10px;
    transition: all 0.15s;
    flex-shrink: 0;
    opacity: 0;
}
.call-item:hover .contacts-call-btn-sm {
    opacity: 1;
}
.contacts-call-btn-sm:hover {
    background: #3db89e;
    transform: scale(1.1);
}

/* Tabulator in sidebar — compact rows */
#calls-contacts-items .tabulator-row {
    min-height: 32px;
}
#calls-contacts-items .tabulator-cell {
    padding: 4px 8px;
    font-size: 12px;
}
