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

body {
  font-family: -apple-system, BlinkMacSystemFont, 'PingFang SC', 'Segoe UI', Roboto, sans-serif;
  background: #EDEDED;
  color: #1a1a1a;
  min-height: 100vh;
}

.container {
  max-width: 500px;
  margin: 0 auto;
  height: 100vh;
  display: flex;
  flex-direction: column;
  background: #EDEDED;
}

header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 16px;
  background: #EDEDED;
  border-bottom: 1px solid #D9D9D9;
}

header h1 {
  font-size: 1.1rem;
  color: #191919;
  font-weight: 500;
}

.status {
  font-size: 0.75rem;
  padding: 3px 8px;
  border-radius: 10px;
  font-weight: 400;
}

.status.online {
  background: #91ED61;
  color: #1E6B00;
}

.status.offline, .status.waiting {
  background: #E5E5E5;
  color: #888;
}

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

/* 微信风格气泡 */
.message {
  max-width: 70%;
  padding: 8px 12px;
  border-radius: 4px;
  line-height: 1.5;
  word-wrap: break-word;
  font-size: 14px;
  position: relative;
}

.message.user {
  align-self: flex-end;
  background: #95EC69;
  color: #000;
  border-radius: 4px;
  margin-right: 8px;
}

.message.user::after {
  content: '';
  position: absolute;
  right: -6px;
  top: 10px;
  border: 6px solid transparent;
  border-left-color: #95EC69;
}

.message.assistant {
  align-self: flex-start;
  background: #FFFFFF;
  color: #000;
  border-radius: 4px;
  margin-left: 8px;
}

.message.assistant::after {
  content: '';
  position: absolute;
  left: -6px;
  top: 10px;
  border: 6px solid transparent;
  border-right-color: #FFFFFF;
}

.message .time {
  font-size: 11px;
  color: #999;
  margin-top: 4px;
  display: block;
  text-align: right;
}

.message.user .time {
  color: #5a8c3e;
}

.message img {
  max-width: 200px;
  max-height: 200px;
  border-radius: 4px;
  cursor: pointer;
  margin-top: 6px;
  display: block;
}

.message .file-link {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  color: #576B95;
  text-decoration: none;
  margin-top: 6px;
  font-size: 13px;
}

.message.user .file-link {
  color: #3d6b29;
}

.message .file-link:hover {
  text-decoration: underline;
}

.message .extracted-text {
  margin-top: 8px;
  padding: 8px;
  background: rgba(0,0,0,0.05);
  border-radius: 4px;
  font-size: 12px;
  max-height: 80px;
  overflow-y: auto;
}

.message .extracted-label {
  font-size: 11px;
  color: #888;
  margin-bottom: 2px;
}

/* 语音消息 */
.message .voice-msg {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 4px 0;
}

.message .voice-msg .voice-icon {
  font-size: 16px;
}

.message .voice-msg .voice-duration {
  font-size: 12px;
  color: #666;
}

.message .voice-text {
  margin-top: 6px;
  padding-top: 6px;
  border-top: 1px dashed #ddd;
  font-size: 13px;
  color: #666;
}

.input-area {
  padding: 10px 12px;
  background: #F7F7F7;
  border-top: 1px solid #D9D9D9;
}

.input-row {
  display: flex;
  gap: 8px;
  align-items: flex-end;
}

.icon-btn {
  width: 36px;
  height: 36px;
  border: none;
  background: transparent;
  color: #1a1a1a;
  border-radius: 4px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  transition: background 0.2s;
}

.icon-btn:hover {
  background: rgba(0,0,0,0.05);
}

.icon-btn.recording {
  background: #FF4D4F;
  color: white;
  animation: pulse 1s infinite;
}

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.6; }
}

#input {
  flex: 1;
  padding: 8px 12px;
  background: #FFFFFF;
  border: 1px solid #E5E5E5;
  border-radius: 4px;
  color: #000;
  font-size: 14px;
  resize: none;
  min-height: 36px;
  max-height: 100px;
  line-height: 1.4;
}

#input:focus {
  outline: none;
  border-color: #07C160;
}

#input::placeholder {
  color: #B2B2B2;
}

.send-btn {
  padding: 8px 16px;
  background: #07C160;
  border: none;
  border-radius: 4px;
  color: #FFFFFF;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.2s;
}

.send-btn:hover {
  background: #06AD56;
}

.send-btn:disabled {
  background: #A0D8B5;
  cursor: not-allowed;
}

/* 录音状态提示 */
.recording-status {
  position: fixed;
  bottom: 80px;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(0,0,0,0.7);
  color: #fff;
  padding: 8px 16px;
  border-radius: 20px;
  font-size: 13px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.recording-status.hidden {
  display: none;
}

.recording-dot {
  width: 8px;
  height: 8px;
  background: #FF4D4F;
  border-radius: 50%;
  animation: blink 1s infinite;
}

@keyframes blink {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.3; }
}

.modal {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0,0,0,0.9);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
}

.modal.hidden {
  display: none;
}

.modal-close {
  position: absolute;
  top: 16px;
  right: 20px;
  font-size: 28px;
  color: #fff;
  cursor: pointer;
  opacity: 0.8;
}

.modal-close:hover {
  opacity: 1;
}

#modalImage {
  max-width: 90%;
  max-height: 90%;
  object-fit: contain;
}

/* Scrollbar */
::-webkit-scrollbar {
  width: 4px;
}

::-webkit-scrollbar-track {
  background: transparent;
}

::-webkit-scrollbar-thumb {
  background: #C0C0C0;
  border-radius: 2px;
}

/* Mobile */
@media (max-width: 600px) {
  .container {
    max-width: 100%;
  }

  .message {
    max-width: 80%;
  }
}
