/* 聊天页面导航栏 */
.chat-navbar {
  background: var(--white);
  padding: 15px 20px;
  box-shadow: 0 2px 10px rgba(0,0,0,0.1);
  position: sticky;
  top: 0;
  z-index: 100;
}

.chat-nav-content {
  display: flex;
  justify-content: space-between;
  align-items: center;
  max-width: 800px;
  margin: 0 auto;
}

.back-btn {
  color: var(--primary);
  text-decoration: none;
  font-size: 16px;
}

.chat-title {
  font-size: 18px;
  font-weight: bold;
  color: var(--primary);
}

.menu-btn {
  font-size: 24px;
  cursor: pointer;
  color: var(--text);
}

/* 侧边菜单 */
.side-menu {
  position: fixed;
  top: 0;
  right: -300px;
  width: 300px;
  height: 100%;
  background: var(--white);
  box-shadow: -2px 0 10px rgba(0,0,0,0.1);
  transition: right 0.3s;
  z-index: 1000;
  padding: 20px;
}

.side-menu.active {
  right: 0;
}

.menu-header {
  text-align: center;
  padding: 40px 0;
  border-bottom: 1px solid #eee;
  margin-bottom: 20px;
}

.menu-avatar {
  font-size: 64px;
  margin-bottom: 10px;
}

.menu-phone {
  font-size: 16px;
  color: var(--text);
}

.menu-options {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.menu-item {
  padding: 15px;
  text-decoration: none;
  color: var(--text);
  border-radius: 10px;
  transition: background 0.3s;
}

.menu-item:hover {
  background: var(--bg);
}

/* 聊天容器 */
.chat-container {
  max-width: 800px;
  margin: 0 auto;
  padding: 20px;
  padding-bottom: 150px;
}

/* 消息样式 */
.chat-messages {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.message {
  display: flex;
  gap: 12px;
  max-width: 80%;
}

.user-message {
  flex-direction: row-reverse;
  margin-left: auto;
}

.ai-message {
  margin-right: auto;
}

.message-avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 24px;
  flex-shrink: 0;
}

.user-message .message-avatar {
  background: var(--primary);
  color: white;
}

.ai-message .message-avatar {
  background: var(--bg);
}

.message-content {
  flex: 1;
}

.message-text {
  padding: 12px 16px;
  border-radius: 18px;
  line-height: 1.6;
  word-wrap: break-word;
}

.user-message .message-text {
  background: var(--primary);
  color: white;
  border-bottom-right-radius: 4px;
}

.ai-message .message-text {
  background: var(--white);
  color: var(--text);
  border-bottom-left-radius: 4px;
  box-shadow: 0 1px 2px rgba(0,0,0,0.1);
}

.message-time {
  font-size: 12px;
  color: #999;
  margin-top: 5px;
  text-align: right;
}

.ai-message .message-time {
  text-align: left;
}

/* 输入区域 */
.chat-input-area {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background: var(--white);
  padding: 15px 20px;
  box-shadow: 0 -2px 10px rgba(0,0,0,0.1);
  z-index: 99;
}

.input-wrapper {
  display: flex;
  gap: 10px;
  align-items: flex-end;
  max-width: 800px;
  margin: 0 auto;
}

#messageInput {
  flex: 1;
  padding: 12px 16px;
  border: 2px solid #eee;
  border-radius: 20px;
  font-size: 16px;
  font-family: inherit;
  resize: none;
  outline: none;
  transition: border-color 0.3s;
  max-height: 120px;
}

#messageInput:focus {
  border-color: var(--primary);
}

.send-btn {
  background: var(--primary);
  color: white;
  border: none;
  padding: 12px 24px;
  border-radius: 20px;
  font-size: 16px;
  cursor: pointer;
  transition: all 0.3s;
  flex-shrink: 0;
}

.send-btn:hover {
  background: var(--primary-light);
}

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

.input-tips {
  display: flex;
  justify-content: space-between;
  margin-top: 8px;
  font-size: 12px;
  color: #999;
  max-width: 800px;
  margin: 8px auto 0;
}

/* 登录弹窗 */
.modal {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0,0,0,0.5);
  z-index: 2000;
  align-items: center;
  justify-content: center;
}

.modal.active {
  display: flex;
}

.modal-content {
  background: var(--white);
  border-radius: 10px;
  width: 90%;
  max-width: 400px;
  overflow: hidden;
  animation: slideIn 0.3s;
}

@keyframes slideIn {
  from {
    transform: translateY(-50px);
    opacity: 0;
  }
  to {
    transform: translateY(0);
    opacity: 1;
  }
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 20px;
  border-bottom: 1px solid #eee;
}

.modal-header h3 {
  margin: 0;
  color: var(--primary);
}

.close-btn {
  font-size: 28px;
  cursor: pointer;
  color: #999;
}

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

.modal-body {
  padding: 20px;
}

.login-tabs {
  display: flex;
  gap: 10px;
  margin-bottom: 20px;
}

.tab-btn {
  flex: 1;
  padding: 10px;
  border: none;
  background: var(--light-bg);
  cursor: pointer;
  border-radius: 5px;
  font-size: 16px;
  transition: all 0.3s;
}

.tab-btn.active {
  background: var(--primary);
  color: white;
}

.form-container {
  display: flex;
  flex-direction: column;
  gap: 15px;
}

.form-container input[type="tel"],
.form-container input[type="text"] {
  padding: 12px;
  border: 2px solid #eee;
  border-radius: 5px;
  font-size: 16px;
  outline: none;
  transition: border-color 0.3s;
}

.form-container input:focus {
  border-color: var(--primary);
}

.code-input {
  display: flex;
  gap: 10px;
}

.code-input input {
  flex: 1;
}

.code-btn {
  padding: 12px 20px;
  background: var(--primary);
  color: white;
  border: none;
  border-radius: 5px;
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.3s;
}

.code-btn:hover {
  background: var(--primary-light);
}

.code-btn:disabled {
  background: #ccc;
  cursor: not-allowed;
}

.agreement {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
}

.agreement label {
  cursor: pointer;
}

.submit-btn {
  padding: 12px;
  background: var(--primary);
  color: white;
  border: none;
  border-radius: 5px;
  font-size: 18px;
  cursor: pointer;
  transition: background 0.3s;
}

.submit-btn:hover {
  background: var(--primary-light);
}

/* Typing indicator */
.typing-indicator {
  display: flex;
  gap: 4px;
  padding: 12px 16px;
  background: var(--white);
  border-radius: 18px;
  border-bottom-left-radius: 4px;
  box-shadow: 0 1px 2px rgba(0,0,0,0.1);
  width: fit-content;
}

.typing-dot {
  width: 8px;
  height: 8px;
  background: #999;
  border-radius: 50%;
  animation: typing 1.4s infinite;
}

.typing-dot:nth-child(2) {
  animation-delay: 0.2s;
}

.typing-dot:nth-child(3) {
  animation-delay: 0.4s;
}

@keyframes typing {
  0%, 60%, 100% {
    transform: translateY(0);
  }
  30% {
    transform: translateY(-10px);
  }
}

/* 响应式设计 */
@media (max-width: 768px) {
  .chat-container {
    padding: 15px;
    padding-bottom: 140px;
  }
  
  .message {
    max-width: 90%;
  }
  
  .side-menu {
    width: 250px;
  }
}
