/* Chat window */
.chat-window {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  background: white;
  border-radius: 16px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
  display: flex;
  flex-direction: column;
  height: 400px;
  transition: height 0.1s ease;
}

/* Resize handle */
.resize-handle {
  height: 20px;
  background: #f8f9fa;
  cursor: ns-resize;
  display: flex;
  align-items: center;
  justify-content: center;
  border-top-left-radius: 16px;
  border-top-right-radius: 16px;
  transition: background-color 0.2s ease;
  position: relative;
  border-bottom: 1px solid #e9ecef;
  z-index: 10;
  width: 100%;
}

.resize-handle:hover {
  background: #e9ecef;
}

.resize-indicator {
  width: 100%;
  height: 6px;
  background: #b0b0b0;
  border-radius: 3px;
  transition: background-color 0.2s ease;
  position: absolute;
  top: 50%;
  left: 0;
  transform: translateY(-50%);
}

.resize-handle:hover .resize-indicator {
  background: #666;
}

.resize-dots {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  display: flex;
  gap: 2px;
  z-index: 11;
  pointer-events: none;
}

.resize-dots span {
  font-size: 8px;
  color: #6c757d;
  opacity: 0.7;
}

.resize-handle:hover .resize-dots span {
  opacity: 1;
  color: #495057;
}

.resize-text {
  position: absolute;
  right: 15px;
  font-size: 10px;
  color: #6c757d;
  opacity: 0.7;
  pointer-events: none;
  z-index: 11;
}

.resize-handle:hover .resize-text {
  opacity: 1;
  color: #495057;
}

.chat-window:active .resize-handle {
  background: rgba(0, 0, 0, 0.1);
}

/* Resizing state */
.chat-window.resizing {
  user-select: none;
  cursor: ns-resize;
}

.chat-window.resizing .resize-handle {
  background: rgba(0, 0, 0, 0.1);
}

.chat-window.resizing .resize-indicator {
  background: #666;
}

.chat-window.resizing .chat-messages {
  pointer-events: none;
}

.chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  min-height: 0; /* Ensure flex child can shrink */
}

.chat-messages > div {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.chat-message {
  max-width: 80%;
  padding: 12px 16px;
  border-radius: 12px;
  font-size: 14px;
  line-height: 1.5;
  animation: slideIn 0.2s ease-out;
}

.chat-message.sent {
  align-self: flex-end;
  background: #4096ff;
  color: white;
  border-bottom-right-radius: 4px;
}

.chat-message.received {
  align-self: flex-start;
  background: #f0f2f5;
  color: #1a1a1a;
  border-bottom-left-radius: 4px;
}

.chat-message.system {
  align-self: center;
  background: #f8f9fa;
  color: #6c757d;
  border: 1px solid #e9ecef;
  font-size: 11px;
  padding: 4px 8px;
  border-radius: 12px;
  max-width: 80%;
  text-align: center;
  opacity: 0.8;
  margin: 0 auto;
}

.chat-message.system.audio_start {
  background: #e8f5e8;
  color: #2e7d32;
  border-color: #4caf50;
}

.chat-message.system.audio_end {
  background: #fff3cd;
  color: #856404;
  border-color: #ffc107;
}

.chat-message.system.video_start {
  background: #e1f5fe;
  color: #0277bd;
  border-color: #03a9f4;
}

.chat-message.system.video_end {
  background: #fce4ec;
  color: #c2185b;
  border-color: #e91e63;
}

.chat-message.system.command_send {
  background: #e3f2fd;
  color: #1565c0;
  border-color: #2196f3;
}

.chat-message.system.command_ack {
  background: #f3e5f5;
  color: #7b1fa2;
  border-color: #9c27b0;
}

.chat-message.system.interrupt {
  background: #ffebee;
  color: #c62828;
  border-color: #f44336;
}

.chat-message.system.interrupt_ack {
  background: #fff3e0;
  color: #ef6c00;
  border-color: #ff9800;
}

.chat-message.system.avatar_audio_start {
  background: #e8f5e8;
  color: #2e7d32;
  border-color: #4caf50;
}

.chat-message.system.avatar_audio_end {
  background: #fff3cd;
  color: #856404;
  border-color: #ffc107;
}

.chat-message.system.mic_start {
  background: #f3e5f5;
  color: #7b1fa2;
  border-color: #9c27b0;
}

.chat-message.system.mic_end {
  background: #e0f2f1;
  color: #00695c;
  border-color: #009688;
}

.chat-message.system.camera_start {
  background: #e1f5fe;
  color: #0277bd;
  border-color: #03a9f4;
}

.chat-message.system.camera_end {
  background: #fce4ec;
  color: #c2185b;
  border-color: #e91e63;
}

.chat-message.system.set_params {
  background: #e3f2fd;
  color: #1565c0;
  border-color: #2196f3;
}

.chat-message.system.set_params_ack {
  background: #f3e5f5;
  color: #7b1fa2;
  border-color: #9c27b0;
}

.time-separator {
  text-align: center;
  font-size: 11px;
  color: #6c757d;
  margin: 4px 0;
  opacity: 0.7;
  align-self: center;
}

.chat-input {
  display: flex;
  gap: 12px;
  padding: 16px;
  border-top: 1px solid #f0f0f0;
  background: #fff;
  border-bottom-left-radius: 16px;
  border-bottom-right-radius: 16px;
}

.chat-input input {
  flex: 1;
  padding: 12px 16px;
  border: 1px solid #e0e0e0;
  border-radius: 8px;
  font-size: 14px;
  transition: all 0.2s;
}

.chat-input input:focus {
  outline: none;
  border-color: #4096ff;
  box-shadow: 0 0 0 2px rgba(64, 150, 255, 0.1);
}

.chat-input input.disabled {
  background: #f5f5f5;
  cursor: not-allowed;
  color: #999;
}

.chat-input input.disabled::placeholder {
  color: #999;
}

/* Camera button error state */
.icon-button.error {
  background-color: #ffebee;
  color: #d32f2f;
  border-color: #ffcdd2;
}

.icon-button.error:hover:not(:disabled) {
  background-color: #ffcdd2;
}

/* Noise reduction button styles */
.icon-button.noise-reduction {
  background: linear-gradient(135deg, #f3e5f5, #e1bee7);
  color: #7b1fa2;
  border: 1px solid #ce93d8;
  transition: all 0.3s ease;
  box-shadow: 0 2px 4px rgba(123, 31, 162, 0.1);
}

.icon-button.noise-reduction:hover:not(:disabled) {
  background: linear-gradient(135deg, #e1bee7, #ce93d8);
  color: #6a1b9a;
  border-color: #ba68c8;
  box-shadow: 0 4px 8px rgba(123, 31, 162, 0.2);
  transform: translateY(-1px);
}

.icon-button.noise-reduction.active {
  background: linear-gradient(135deg, #e8f5e8, #c8e6c9);
  color: #2e7d32;
  border-color: #4caf50;
  box-shadow: 0 3px 6px rgba(46, 125, 50, 0.2);
}

.icon-button.noise-reduction.active:hover:not(:disabled) {
  background: linear-gradient(135deg, #c8e6c9, #a5d6a7);
  color: #1b5e20;
  border-color: #388e3c;
  box-shadow: 0 5px 10px rgba(46, 125, 50, 0.3);
  transform: translateY(-1px);
}

/* Disabled state for noise reduction button */
.icon-button.noise-reduction:disabled {
  background: linear-gradient(135deg, #f5f5f5, #eeeeee);
  color: #bdbdbd;
  border-color: #e0e0e0;
  box-shadow: none;
  transform: none;
  cursor: not-allowed;
}

/* Audio dump button styles */
.icon-button.audio-dump {
  background: linear-gradient(135deg, #fff3e0, #ffe0b2);
  color: #ef6c00;
  border: 1px solid #ffb74d;
  transition: all 0.3s ease;
  box-shadow: 0 2px 4px rgba(239, 108, 0, 0.1);
}

.icon-button.audio-dump:hover:not(:disabled) {
  background: linear-gradient(135deg, #ffe0b2, #ffcc80);
  color: #e65100;
  border-color: #ff9800;
  box-shadow: 0 4px 8px rgba(239, 108, 0, 0.2);
  transform: translateY(-1px);
}

.icon-button.audio-dump.dumping {
  background: linear-gradient(135deg, #fff8e1, #ffecb3);
  color: #f57c00;
  border-color: #ffa726;
  box-shadow: 0 3px 6px rgba(245, 124, 0, 0.3);
  animation: dumpPulse 1.2s ease-in-out infinite;
}

/* Disabled state for audio dump button */
.icon-button.audio-dump:disabled {
  background: linear-gradient(135deg, #f5f5f5, #eeeeee);
  color: #bdbdbd;
  border-color: #e0e0e0;
  box-shadow: none;
  transform: none;
  cursor: not-allowed;
}

/* Enhanced pulse animation for dumping state */
@keyframes dumpPulse {
  0% {
    opacity: 1;
    transform: scale(1);
    box-shadow: 0 3px 6px rgba(245, 124, 0, 0.3);
  }
  50% {
    opacity: 0.8;
    transform: scale(1.02);
    box-shadow: 0 5px 12px rgba(245, 124, 0, 0.4);
  }
  100% {
    opacity: 1;
    transform: scale(1);
    box-shadow: 0 3px 6px rgba(245, 124, 0, 0.3);
  }
}

/* Keep the old pulse for backward compatibility */
@keyframes pulse {
  0% {
    opacity: 1;
  }
  50% {
    opacity: 0.7;
  }
  100% {
    opacity: 1;
  }
}

/* Animation for messages */
@keyframes slideIn {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Tooltip styles */
.tooltip {
  pointer-events: none;
  max-width: 400px;
  max-height: 300px;
  overflow: auto;
}

.tooltip-content {
  background: #2c3e50;
  color: #ecf0f1;
  padding: 12px;
  border-radius: 8px;
  font-size: 12px;
  line-height: 1.4;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
  border: 1px solid #34495e;
  white-space: pre-wrap;
  word-break: break-word;
}

.tooltip-content pre {
  margin: 0;
  font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', monospace;
  font-size: 11px;
  color: #bdc3c7;
}

/* Add a subtle hover effect for set-params messages */
.chat-message.system.set_params {
  cursor: help;
  transition: background-color 0.2s ease;
}

.chat-message.system.set_params:hover {
  background: #e3f2fd;
  border-color: #2196f3;
}
