/* 山河平台 - 全局样式 */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

:root {
  --primary: #07c160;
  --primary-dark: #06ad56;
  --bg: #ededed;
  --bg-white: #ffffff;
  --text: #333333;
  --text-secondary: #999999;
  --border: #e5e5e5;
  --danger: #e64340;
  --header-height: 50px;
  --tab-height: 50px;
  --safe-bottom: env(safe-area-inset-bottom, 0px);
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 16px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  overflow: hidden;
  height: 100vh;
}

#app {
  height: 100vh;
  display: flex;
  flex-direction: column;
}

/* 页面头部 */
.header {
  height: var(--header-height);
  background: var(--primary);
  color: white;
  display: flex;
  align-items: center;
  padding: 0 15px;
  position: relative;
  flex-shrink: 0;
}

.header-title {
  flex: 1;
  text-align: center;
  font-size: 17px;
  font-weight: 500;
}

.header-back {
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 20px;
  color: white;
  background: none;
  border: none;
}

.header-action {
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 20px;
  color: white;
  background: none;
  border: none;
}

.header-placeholder {
  width: 40px;
}

/* 页面内容区 */
.page {
  flex: 1;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  display: flex;
  flex-direction: column;
}

.page-content {
  flex: 1;
}

/* 底部标签栏 */
.tab-bar {
  height: calc(var(--tab-height) + var(--safe-bottom));
  padding-bottom: var(--safe-bottom);
  background: var(--bg-white);
  border-top: 1px solid var(--border);
  display: flex;
  flex-shrink: 0;
}

.tab-item {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: var(--text-secondary);
  font-size: 10px;
  padding: 5px 0;
  transition: color 0.2s;
}

.tab-item.active {
  color: var(--primary);
}

.tab-icon {
  font-size: 24px;
  margin-bottom: 2px;
}

.tab-badge {
  position: relative;
}

.tab-badge::after {
  content: attr(data-count);
  position: absolute;
  top: -4px;
  right: -12px;
  background: var(--danger);
  color: white;
  font-size: 10px;
  padding: 1px 5px;
  border-radius: 10px;
  min-width: 16px;
  text-align: center;
}

/* 表单样式 */
.form-group {
  margin-bottom: 15px;
}

.form-label {
  display: block;
  font-size: 14px;
  color: var(--text-secondary);
  margin-bottom: 5px;
}

.form-input {
  width: 100%;
  height: 44px;
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 0 12px;
  font-size: 16px;
  outline: none;
  transition: border-color 0.2s;
}

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

.form-textarea {
  width: 100%;
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 10px 12px;
  font-size: 16px;
  outline: none;
  resize: vertical;
  min-height: 80px;
  font-family: inherit;
}

/* 按钮 */
.btn {
  display: block;
  width: 100%;
  height: 44px;
  border: none;
  border-radius: 6px;
  font-size: 16px;
  cursor: pointer;
  font-weight: 500;
  transition: opacity 0.2s;
}

.btn:active {
  opacity: 0.8;
}

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

.btn-danger {
  background: var(--danger);
  color: white;
}

.btn-outline {
  background: white;
  color: var(--primary);
  border: 1px solid var(--primary);
}

.btn-sm {
  height: 32px;
  font-size: 14px;
  padding: 0 12px;
  width: auto;
  display: inline-block;
}

.btn-block {
  margin-top: 20px;
}

/* 卡片 */
.card {
  background: var(--bg-white);
  border-radius: 8px;
  padding: 15px;
  margin-bottom: 10px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.05);
}

/* 列表项 */
.list-item {
  display: flex;
  align-items: center;
  padding: 12px 15px;
  background: var(--bg-white);
  border-bottom: 1px solid var(--border);
  cursor: pointer;
  transition: background 0.15s;
}

.list-item:active {
  background: #f5f5f5;
}

.list-avatar {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: var(--primary);
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  flex-shrink: 0;
  margin-right: 12px;
  background-size: cover;
  background-position: center;
}

.list-info {
  flex: 1;
  min-width: 0;
}

.list-title {
  font-size: 16px;
  font-weight: 400;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.list-subtitle {
  font-size: 13px;
  color: var(--text-secondary);
  margin-top: 2px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.list-time {
  font-size: 11px;
  color: var(--text-secondary);
  flex-shrink: 0;
  margin-left: 8px;
  align-self: flex-start;
  padding-top: 2px;
}

.list-badge {
  background: var(--danger);
  color: white;
  font-size: 11px;
  min-width: 18px;
  height: 18px;
  border-radius: 9px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-left: 8px;
  align-self: flex-start;
  padding: 0 5px;
}

/* 聊天界面 */
.chat-container {
  flex: 1;
  display: flex;
  flex-direction: column;
  background: var(--bg);
}

.chat-messages {
  flex: 1;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding: 10px 15px;
  padding-bottom: 10px;
}

.chat-msg {
  display: flex;
  margin-bottom: 15px;
  align-items: flex-start;
}

.chat-msg-self {
  flex-direction: row-reverse;
}

.chat-msg-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--primary);
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  flex-shrink: 0;
  background-size: cover;
  background-position: center;
}

.chat-msg-self .chat-msg-avatar {
  background: #07c160;
  margin-left: 10px;
}

.chat-msg-other .chat-msg-avatar {
  margin-right: 10px;
  background: #ff9800;
}

.chat-msg-content {
  max-width: 70%;
  padding: 10px 14px;
  border-radius: 8px;
  font-size: 15px;
  line-height: 1.5;
  word-break: break-word;
  position: relative;
}

.chat-msg-self .chat-msg-content {
  background: var(--primary);
  color: white;
  border-top-right-radius: 2px;
}

.chat-msg-other .chat-msg-content {
  background: white;
  color: var(--text);
  border-top-left-radius: 2px;
}

.chat-msg-time {
  font-size: 11px;
  color: var(--text-secondary);
  text-align: center;
  margin-bottom: 10px;
}

.chat-input-area {
  display: flex;
  align-items: center;
  padding: 6px 8px;
  background: var(--bg-white);
  border-top: 1px solid var(--border);
  padding-bottom: calc(6px + var(--safe-bottom));
}

.chat-plus-btn {
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  background:none;
  border:none;
  font-size:22px;
  cursor:pointer;
  padding:0;
}

.chat-voice-toggle {
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  background:none;
  border:none;
  font-size:20px;
  cursor:pointer;
  padding:0;
}

.chat-input {
  flex: 1;
  height: 40px;
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 0 16px;
  font-size: 15px;
  outline: none;
}

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

.chat-send-btn {
  width: 40px;
  height: 40px;
  border: none;
  background: var(--primary);
  color: white;
  border-radius: 50%;
  margin-left: 8px;
  font-size: 18px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.chat-send-btn:disabled {
  background: var(--border);
  cursor: not-allowed;
}

/* 服务号菜单 */
.service-menu {
  background: var(--bg-white);
  border-top: 1px solid var(--border);
  padding: 8px 12px;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding-bottom: calc(8px + var(--safe-bottom));
  flex-shrink: 0;
}

.service-menu-item {
  padding: 6px 14px;
  border: 1px solid var(--primary);
  border-radius: 16px;
  color: var(--primary);
  font-size: 13px;
  cursor: pointer;
  transition: background 0.2s;
  background: white;
}

.service-menu-item:active {
  background: var(--primary);
  color: white;
}

/* 登录/注册页 */
.auth-page {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  padding: 30px;
  background: white;
}

.auth-logo {
  font-size: 48px;
  margin-bottom: 8px;
}

.auth-title {
  font-size: 24px;
  font-weight: 600;
  margin-bottom: 5px;
  color: var(--text);
}

.auth-subtitle {
  font-size: 14px;
  color: var(--text-secondary);
  margin-bottom: 40px;
}

.auth-form {
  width: 100%;
  max-width: 320px;
}

.auth-link {
  text-align: center;
  margin-top: 20px;
  font-size: 14px;
  color: var(--text-secondary);
}

.auth-link a {
  color: var(--primary);
  text-decoration: none;
}

/* 注册协议勾选 */
.agree-line {
  display: flex;
  align-items: flex-start;
  gap: 6px;
  margin: -6px 0 14px;
  font-size: 13px;
  color: var(--text-secondary);
  line-height: 1.5;
  cursor: pointer;
  user-select: none;
}
.agree-check {
  flex-shrink: 0;
  width: 16px;
  height: 16px;
  margin-top: 2px;
  accent-color: var(--primary);
  cursor: pointer;
}
.agree-text {
  flex: 1;
}
.agree-text a {
  color: var(--primary);
  text-decoration: none;
}

/* 模态对话框 */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0,0,0,0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
}

.modal-content {
  background: white;
  border-radius: 12px;
  padding: 20px;
  width: 85%;
  max-width: 340px;
  max-height: 80vh;
  overflow-y: auto;
}

.modal-title {
  font-size: 17px;
  font-weight: 500;
  text-align: center;
  margin-bottom: 15px;
}

.modal-actions {
  display: flex;
  gap: 10px;
  margin-top: 20px;
}

.modal-actions .btn {
  flex: 1;
}

/* slideUp动画 */
@keyframes slideUp {
  from { transform: translateY(30px); opacity: 0; }
  to { transform: translateY(0); opacity: 1; }
}

/* 搜索栏 */
.search-bar {
  padding: 10px 15px;
  background: var(--bg-white);
  border-bottom: 1px solid var(--border);
}

.search-input {
  width: 100%;
  height: 36px;
  border: none;
  border-radius: 18px;
  background: var(--bg);
  padding: 0 15px;
  font-size: 14px;
  outline: none;
}

/* 空状态 */
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 60px 20px;
  color: var(--text-secondary);
}

.empty-icon {
  font-size: 48px;
  margin-bottom: 12px;
}

.empty-text {
  font-size: 14px;
}

/* toast 提示 */
.toast {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  background: rgba(0,0,0,0.75);
  color: white;
  padding: 12px 24px;
  border-radius: 8px;
  font-size: 14px;
  z-index: 2000;
  pointer-events: none;
  animation: toastFade 2s ease forwards;
}

@keyframes toastFade {
  0% { opacity: 0; transform: translate(-50%, -50%) scale(0.9); }
  10% { opacity: 1; transform: translate(-50%, -50%) scale(1); }
  70% { opacity: 1; }
  100% { opacity: 0; }
}

/* 工具类 */
.text-center { text-align: center; }
.text-danger { color: var(--danger); }
.mt-10 { margin-top: 10px; }
.mt-20 { margin-top: 20px; }
.mb-10 { margin-bottom: 10px; }
.hidden { display: none !important; }

/* 共建机制 · 头衔徽章 */
.tier-badge { display:inline-block; padding:2px 8px; border-radius:999px; color:#fff; }
.builder-badge { background:#f5a623; }
.core-badge { background:#8e44ad; }
.user-badge { background:#b0b0b0; }

/* 共建机制 · 空状态子提示 */
.empty-sub { font-size:13px; color:#999; margin-top:6px; }
