/**
 * GAIAI V3 — High-Density B2B Telephony Operations Console & Audio Visualizer
 * Theme: Monochrome / Dark Steel & Zinc-950 Enterprise Telecommunication
 */

/* ==========================================================================
   2-Column Telephony Mission Control Layout
   ========================================================================== */
.telephony-mission-control {
  display: grid;
  grid-template-columns: 360px 1fr;
  height: 100%;
  width: 100%;
  overflow: hidden;
  background-color: var(--bg-canvas);
}

/* ==========================================================================
   Left Column: Active Lead Dossier & In-Call Operational Triggers
   ========================================================================== */
.call-lead-dossier {
  background-color: var(--bg-surface);
  border-right: 1px solid var(--border-subtle);
  overflow-y: auto;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  height: 100%;
}

.dossier-card {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 14px 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  transition: border-color var(--trans-fast), background var(--trans-fast);
}

.dossier-card:hover {
  border-color: var(--border-muted);
}

.dossier-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.dossier-title {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-dim);
}

.dossier-category {
  font-size: 10px;
  font-weight: 600;
  color: var(--text-secondary);
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid var(--border-subtle);
  padding: 2px 7px;
  border-radius: var(--radius-full);
}

/* Call Status & Timer Card */
.call-meta-card {
  background: linear-gradient(180deg, rgba(20, 20, 25, 0.95) 0%, rgba(14, 14, 18, 0.95) 100%);
  border: 1px solid rgba(255, 255, 255, 0.09);
}

.call-meta-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.status-indicator-group {
  display: flex;
  align-items: center;
  gap: 8px;
}

.pulse-ring {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background-color: var(--text-muted);
  box-shadow: 0 0 6px rgba(255, 255, 255, 0.2);
}

.pulse-ring.active {
  background-color: var(--accent-success);
  box-shadow: 0 0 8px rgba(16, 185, 129, 0.8);
  animation: pulse-dot 2s infinite;
}

.pulse-ring.connecting {
  background-color: var(--accent-warning);
  box-shadow: 0 0 8px rgba(245, 158, 11, 0.8);
  animation: pulse-amber 1.5s infinite;
}

.call-status-badge {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  padding: 2px 8px;
  border-radius: var(--radius-full);
}

.call-status-badge.connected,
.call-status-badge.active {
  background: rgba(16, 185, 129, 0.12);
  color: #34d399;
  border: 1px solid rgba(16, 185, 129, 0.3);
}

.call-status-badge.connecting {
  background: rgba(245, 158, 11, 0.12);
  color: #fbbf24;
  border: 1px solid rgba(245, 158, 11, 0.3);
}

.call-status-badge.idle,
.call-status-badge.disconnected,
.call-status-badge.ended {
  background: rgba(255, 255, 255, 0.04);
  color: var(--text-muted);
  border: 1px solid var(--border-subtle);
}

.digital-timer {
  font-family: var(--font-mono);
  font-size: 22px;
  font-weight: 700;
  color: var(--text-muted);
  letter-spacing: 0.04em;
  line-height: 1;
}

.digital-timer.active {
  color: #34d399;
  text-shadow: 0 0 10px rgba(16, 185, 129, 0.35);
}

.call-meta-sub {
  font-size: 11px;
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--text-dim);
  padding-top: 4px;
  border-top: 1px solid rgba(255, 255, 255, 0.04);
}

.call-meta-label {
  font-size: 10px;
  color: var(--text-dim);
}

.session-id-text {
  font-size: 11px;
  letter-spacing: 0.02em;
}

.call-socket-pill {
  margin-left: auto;
  font-size: 9.5px;
  font-weight: 600;
  padding: 1px 6px;
  border-radius: var(--radius-xs);
  letter-spacing: 0.05em;
}

.call-socket-pill.online {
  background: rgba(16, 185, 129, 0.1);
  color: #34d399;
  border: 1px solid rgba(16, 185, 129, 0.25);
}

.call-socket-pill.standby {
  background: rgba(255, 255, 255, 0.04);
  color: var(--text-dim);
  border: 1px solid var(--border-subtle);
}

/* Active Lead Profile Card */
.lead-company-name {
  font-size: 16px;
  font-weight: 700;
  color: var(--text-white);
  letter-spacing: -0.02em;
  line-height: 1.25;
}

.lead-meta-details {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-top: 2px;
}

.meta-row {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 11.5px;
  color: var(--text-secondary);
}

.meta-icon {
  color: var(--text-dim);
  display: flex;
  align-items: center;
  flex-shrink: 0;
}

.no-lead-selected-box {
  padding: 14px 10px;
  border: 1px dashed var(--border-subtle);
  border-radius: var(--radius-sm);
  background: rgba(255, 255, 255, 0.01);
  display: flex;
  flex-direction: column;
  gap: 4px;
}

/* In-Call Real-Time Action Triggers */
.badge-mcp {
  font-size: 9.5px;
  font-family: var(--font-mono);
  font-weight: 700;
  color: #a1a1aa;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border-subtle);
  padding: 2px 6px;
  border-radius: var(--radius-xs);
  letter-spacing: 0.04em;
}

.trigger-buttons-stack {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.btn-trigger {
  width: 100%;
  padding: 10px 12px;
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  gap: 10px;
  text-align: left;
  transition: all var(--trans-fast);
}

.btn-trigger:hover {
  background: var(--bg-card-hover);
  border-color: var(--border-medium);
  transform: translateY(-1px);
}

.btn-trigger.loading {
  opacity: 0.65;
  pointer-events: none;
}

.btn-trigger.success {
  border-color: rgba(16, 185, 129, 0.4);
  background: rgba(16, 185, 129, 0.06);
}

.btn-trigger.success .trigger-text-wrap strong {
  color: #34d399;
}

.btn-trigger.error {
  border-color: rgba(239, 68, 68, 0.4);
  background: rgba(239, 68, 68, 0.06);
}

.trigger-text-wrap {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.trigger-text-wrap strong {
  font-size: 11.5px;
  font-weight: 600;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.trigger-text-wrap span {
  font-size: 10px;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ==========================================================================
   Right Column: Visualizer Studio & Conversation Stream
   ========================================================================== */
.call-workspace {
  display: flex;
  flex-direction: column;
  height: 100%;
  min-width: 0;
  overflow: hidden;
  background-color: var(--bg-canvas);
}

/* Visualizer & Audio HUD Studio */
.visualizer-studio-box {
  background: linear-gradient(180deg, rgba(16, 16, 22, 0.98) 0%, rgba(9, 9, 11, 0.98) 100%);
  border-bottom: 1px solid var(--border-subtle);
  padding: 16px 20px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  flex-shrink: 0;
  position: relative;
}

.studio-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.studio-left {
  display: flex;
  align-items: center;
  gap: 10px;
}

.studio-badge {
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 700;
  color: var(--text-secondary);
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border-subtle);
  padding: 3px 8px;
  border-radius: var(--radius-xs);
  letter-spacing: 0.05em;
}

.audio-specs {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text-dim);
}

.legend-group {
  display: flex;
  align-items: center;
  gap: 14px;
  font-size: 11px;
  color: var(--text-muted);
}

.legend-item {
  display: flex;
  align-items: center;
  gap: 6px;
}

.legend-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
}

.legend-dot.user {
  background-color: #34d399;
  box-shadow: 0 0 6px rgba(52, 211, 153, 0.6);
}

.legend-dot.agent {
  background-color: #818cf8;
  box-shadow: 0 0 6px rgba(129, 140, 248, 0.6);
}

/* Canvas Wrapper */
.canvas-wrapper {
  position: relative;
  width: 100%;
  height: 160px;
  background: rgba(0, 0, 0, 0.6);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  overflow: hidden;
  box-shadow: inset 0 2px 8px rgba(0, 0, 0, 0.7);
}

#voice-canvas {
  width: 100%;
  height: 100%;
  display: block;
}

.barge-in-flash {
  position: absolute;
  inset: 0;
  background: radial-gradient(circle at center, rgba(245, 158, 11, 0.35) 0%, transparent 75%);
  opacity: 0;
  pointer-events: none;
  transition: opacity 120ms ease-out;
  z-index: 5;
}

.barge-in-flash.active {
  animation: flash-fade 250ms ease-out forwards;
}

/* Floating Modern Control Dock */
.telephony-dock {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding-top: 2px;
}

.dock-btn {
  height: 38px;
  padding: 0 16px;
  border-radius: var(--radius-full);
  font-size: 12px;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: var(--bg-card);
  border: 1px solid var(--border-medium);
  color: var(--text-primary);
  box-shadow: var(--shadow-sm);
  transition: all var(--trans-fast);
}

.dock-btn:hover {
  background: var(--bg-card-hover);
  border-color: rgba(255, 255, 255, 0.25);
  transform: translateY(-1px);
}

.dock-btn.muted {
  background: rgba(239, 68, 68, 0.12);
  border-color: rgba(239, 68, 68, 0.35);
  color: #f87171;
}

.dock-btn-barge {
  background: rgba(245, 158, 11, 0.12);
  border-color: rgba(245, 158, 11, 0.35);
  color: #fbbf24;
}

.dock-btn-barge:hover {
  background: rgba(245, 158, 11, 0.2);
  border-color: rgba(245, 158, 11, 0.5);
  box-shadow: 0 0 12px rgba(245, 158, 11, 0.25);
}

.dock-btn-hangup {
  background: linear-gradient(135deg, #ef4444 0%, #dc2626 100%);
  border-color: rgba(239, 68, 68, 0.6);
  color: #ffffff;
  box-shadow: 0 2px 10px rgba(239, 68, 68, 0.3);
}

.dock-btn-hangup:hover {
  background: linear-gradient(135deg, #dc2626 0%, #b91c1c 100%);
  box-shadow: 0 4px 14px rgba(239, 68, 68, 0.45);
}

/* ==========================================================================
   Live Real-Time Conversation Stream
   ========================================================================== */
.conversation-stream-container {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background-color: var(--bg-canvas);
}

.stream-header {
  padding: 10px 20px;
  border-bottom: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: rgba(255, 255, 255, 0.015);
  flex-shrink: 0;
}

.stream-title-group {
  display: flex;
  align-items: center;
  gap: 8px;
}

.stream-title-group h3 {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-primary);
  letter-spacing: 0.01em;
}

.stream-telemetry-badge {
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--text-dim);
  background: rgba(255, 255, 255, 0.03);
  padding: 2px 8px;
  border-radius: var(--radius-xs);
  border: 1px solid var(--border-subtle);
  letter-spacing: 0.04em;
}

.messages-stream {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: 16px 20px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.empty-stream-placeholder {
  margin: auto 0;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding: 30px 20px;
  color: var(--text-dim);
}

.empty-stream-placeholder h4 {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-secondary);
}

.empty-stream-placeholder p {
  font-size: 11.5px;
  max-width: 420px;
  color: var(--text-muted);
  line-height: 1.5;
}

/* Transcript Bubbles (High-Density B2B Style) */
.transcript-bubble {
  display: flex;
  flex-direction: column;
  gap: 5px;
  max-width: 78%;
  padding: 12px 14px;
  border-radius: var(--radius-md);
  position: relative;
  animation: fadeIn 150ms ease-out;
}

.transcript-bubble.user-bubble {
  align-self: flex-start;
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-top-left-radius: 2px;
}

.transcript-bubble.agent-bubble {
  align-self: flex-end;
  background: linear-gradient(135deg, rgba(99, 102, 241, 0.12) 0%, rgba(99, 102, 241, 0.06) 100%);
  border: 1px solid rgba(99, 102, 241, 0.28);
  border-top-right-radius: 2px;
}

.bubble-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.bubble-sender-group {
  display: flex;
  align-items: center;
  gap: 6px;
}

.sender-tag {
  font-size: 9.5px;
  font-weight: 700;
  letter-spacing: 0.06em;
  padding: 1px 6px;
  border-radius: var(--radius-xs);
}

.sender-tag.user {
  background: rgba(255, 255, 255, 0.08);
  color: #e4e4e7;
}

.sender-tag.agent {
  background: rgba(99, 102, 241, 0.22);
  color: #c7d2fe;
}

.bubble-time {
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--text-dim);
}

.bubble-text {
  font-size: 12.5px;
  line-height: 1.55;
  color: var(--text-primary);
  word-break: break-word;
}
