* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: #f0f2f5;
  color: #1a1a1a;
  height: 100vh;
  display: flex;
  justify-content: center;
  padding: 20px;
}

.container {
  width: 100%;
  max-width: 800px;
  display: flex;
  flex-direction: column;
  height: calc(100vh - 40px);
  background: #fff;
  border-radius: 12px;
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.08);
  overflow: hidden;
}

header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  background: #1a1a2e;
  color: #fff;
}

header h1 {
  font-size: 18px;
  font-weight: 600;
}

.status {
  font-size: 12px;
  padding: 4px 12px;
  border-radius: 12px;
  font-weight: 500;
}

.status.connected {
  background: #d4edda;
  color: #155724;
}

.status.disconnected {
  background: #f8d7da;
  color: #721c24;
}

.session-bar {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 20px;
  background: #f8f9fa;
  border-bottom: 1px solid #e9ecef;
  font-size: 14px;
}

.session-bar label {
  font-weight: 500;
  white-space: nowrap;
}

.session-bar select {
  flex: 1;
  padding: 6px 10px;
  border: 1px solid #ced4da;
  border-radius: 6px;
  font-size: 14px;
  background: #fff;
}

.language-info {
  font-size: 13px;
  color: #6c757d;
  white-space: nowrap;
}

.chat-area {
  flex: 1;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.transcript-panel {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.panel-header {
  padding: 10px 20px;
  font-size: 13px;
  font-weight: 600;
  color: #6c757d;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  border-bottom: 1px solid #e9ecef;
}

.messages {
  flex: 1;
  overflow-y: auto;
  padding: 16px 20px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.message {
  padding: 10px 14px;
  border-radius: 10px;
  max-width: 85%;
  line-height: 1.5;
}

.message.customer {
  background: #e3f2fd;
  align-self: flex-start;
  border-bottom-left-radius: 2px;
}

.message.customer.interim {
  background: #f5f5f5;
  font-style: italic;
}

.message.customer.interim .translated-text,
.message.customer.interim .original-text {
  color: #999;
}

.message.agent {
  background: #e8f5e9;
  align-self: flex-end;
  border-bottom-right-radius: 2px;
}

.message.agent.interim {
  background: #f5f5f5;
  font-style: italic;
}

.message.agent.interim .translated-text {
  color: #999;
}

.msg-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 4px;
}

.msg-label {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: #6c757d;
}

.msg-time {
  font-size: 10px;
  color: #adb5bd;
}

.translated-text {
  font-size: 15px;
  font-weight: 500;
  color: #1a1a1a;
}

.original-text {
  margin-top: 3px;
  font-size: 12px;
  color: #888;
  font-style: italic;
}

.message .meta {
  margin-top: 4px;
  font-size: 11px;
  color: #999;
}

.reply-bar {
  display: flex;
  gap: 10px;
  padding: 16px 20px;
  background: #f8f9fa;
  border-top: 1px solid #e9ecef;
  align-items: center;
}

.mic-btn {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: 2px solid #ced4da;
  background: #fff;
  color: #6c757d;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s;
  flex-shrink: 0;
}

.mic-btn:hover:not(:disabled) {
  border-color: #e74c3c;
  color: #e74c3c;
}

.mic-btn.active {
  background: #e74c3c;
  border-color: #e74c3c;
  color: #fff;
  animation: pulse 1.5s infinite;
}

.mic-btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

@keyframes pulse {
  0% { box-shadow: 0 0 0 0 rgba(231, 76, 60, 0.4); }
  70% { box-shadow: 0 0 0 8px rgba(231, 76, 60, 0); }
  100% { box-shadow: 0 0 0 0 rgba(231, 76, 60, 0); }
}

.mic-status {
  text-align: center;
  font-size: 12px;
  color: #e74c3c;
  padding: 0 20px 8px;
  min-height: 20px;
}

.reply-bar input {
  flex: 1;
  padding: 10px 14px;
  border: 1px solid #ced4da;
  border-radius: 8px;
  font-size: 14px;
  outline: none;
  transition: border-color 0.2s;
}

.reply-bar input:focus {
  border-color: #4a90d9;
}

.reply-bar input:disabled {
  background: #e9ecef;
  cursor: not-allowed;
}

.reply-bar button:not(.mic-btn) {
  padding: 10px 24px;
  background: #1a1a2e;
  color: #fff;
  border: none;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.2s;
}

.reply-bar button:not(.mic-btn):hover:not(:disabled) {
  background: #2d2d4e;
}

.reply-bar button:not(.mic-btn):disabled {
  background: #adb5bd;
  cursor: not-allowed;
}

.system-message {
  text-align: center;
  font-size: 12px;
  color: #6c757d;
  padding: 8px;
  font-style: italic;
}

.speaking-indicator {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 13px;
  color: #2196F3;
  padding: 8px 14px;
  align-self: flex-start;
}

.speaking-dot {
  display: inline-block;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #2196F3;
  animation: speaking-bounce 1.4s infinite ease-in-out both;
}

.speaking-dot:nth-child(1) { animation-delay: -0.32s; }
.speaking-dot:nth-child(2) { animation-delay: -0.16s; }
.speaking-dot:nth-child(3) { animation-delay: 0s; }

@keyframes speaking-bounce {
  0%, 80%, 100% { transform: scale(0.6); opacity: 0.4; }
  40% { transform: scale(1); opacity: 1; }
}
