/*
 * 微信风格完整UI系统
 * WeChat Style Complete UI System
 * 完全仿照微信的设计规范和视觉风格
 */

/* ===== 微信标准色彩系统 ===== */
:root {
  /* 主色调 */
  --wechat-green: #07C160;
  --wechat-green-dark: #06AE56;
  --wechat-green-light: #09BB07;
  
  /* 背景色 */
  --wechat-bg: #F7F7F7;
  --wechat-bg-white: #FFFFFF;
  --wechat-bg-gray: #EDEDED;
  --wechat-bg-light: #F8F8F8;
  
  /* 文字颜色 */
  --wechat-text-black: #000000;
  --wechat-text-dark: #181818;
  --wechat-text-gray: #888888;
  --wechat-text-light: #B2B2B2;
  --wechat-text-white: #FFFFFF;
  
  /* 边框颜色 */
  --wechat-border: #E7E7E7;
  --wechat-border-light: #F0F0F0;
  
  /* 功能色 */
  --wechat-red: #FA5151;
  --wechat-orange: #FF9500;
  --wechat-blue: #10AEFF;
  
  /* 尺寸 */
  --header-height: 44px;
  --tabbar-height: 50px;
  --cell-height: 44px;
  --avatar-size: 40px;
  --avatar-small: 36px;
  
  /* 间距 */
  --spacing-xs: 4px;
  --spacing-sm: 8px;
  --spacing-md: 12px;
  --spacing-lg: 16px;
  --spacing-xl: 20px;
  
  /* 字体 */
  --font-xs: 12px;
  --font-sm: 14px;
  --font-base: 16px;
  --font-lg: 17px;
  --font-xl: 18px;
  
  /* 圆角 */
  --radius-sm: 4px;
  --radius-md: 6px;
  --radius-lg: 8px;
}

/* ===== 全局重置 ===== */
* {
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}

body {
  margin: 0;
  padding: 0;
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Helvetica Neue", Helvetica, Arial, "Microsoft Yahei", sans-serif;
  font-size: var(--font-base);
  color: var(--wechat-text-dark);
  background: var(--wechat-bg);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  line-height: 1.5;
}

/* ===== 微信标准头部导航栏 ===== */
.wechat-header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: var(--header-height);
  background: var(--wechat-bg-white);
  border-bottom: 1px solid var(--wechat-border);
  z-index: 1000;
  display: flex;
  align-items: center;
  padding: 0 var(--spacing-lg);
}

.wechat-header .header-back {
  width: 44px;
  height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-left: -12px;
  cursor: pointer;
}

.wechat-header .header-back::before {
  content: '';
  width: 8px;
  height: 8px;
  border-left: 2px solid var(--wechat-text-dark);
  border-bottom: 2px solid var(--wechat-text-dark);
  transform: rotate(45deg);
}

.wechat-header .header-title {
  flex: 1;
  text-align: center;
  font-size: var(--font-lg);
  font-weight: 500;
  color: var(--wechat-text-black);
}

.wechat-header .header-action {
  width: 44px;
  height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-right: -12px;
  cursor: pointer;
  color: var(--wechat-green);
  font-size: var(--font-base);
}

/* ===== 微信标准底部导航栏 ===== */
.wechat-tabbar {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  height: var(--tabbar-height);
  background: var(--wechat-bg-white);
  border-top: 1px solid var(--wechat-border);
  display: flex;
  z-index: 1000;
}

.wechat-tabbar-item {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  color: var(--wechat-text-gray);
  font-size: var(--font-xs);
  cursor: pointer;
  position: relative;
}

.wechat-tabbar-item.active {
  color: var(--wechat-green);
}

.wechat-tabbar-item.active::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 20px;
  height: 2px;
  background: var(--wechat-green);
}

.wechat-tabbar-icon {
  width: 24px;
  height: 24px;
  margin-bottom: 2px;
  background-size: contain;
  background-repeat: no-repeat;
  background-position: center;
}

/* ===== 微信标准列表项 ===== */
.wechat-cell {
  background: var(--wechat-bg-white);
  border-bottom: 1px solid var(--wechat-border);
  padding: var(--spacing-lg);
  display: flex;
  align-items: center;
  min-height: var(--cell-height);
  transition: background-color 0.15s ease;
}

.wechat-cell:active {
  background-color: var(--wechat-bg-gray);
}

.wechat-cell:last-child {
  border-bottom: none;
}

.wechat-cell-avatar {
  width: var(--avatar-size);
  height: var(--avatar-size);
  border-radius: var(--radius-sm);
  margin-right: var(--spacing-md);
  flex-shrink: 0;
  overflow: hidden;
}

.wechat-cell-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.wechat-cell-content {
  flex: 1;
  min-width: 0;
}

.wechat-cell-title {
  font-size: var(--font-base);
  color: var(--wechat-text-black);
  font-weight: 500;
  margin-bottom: 4px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.wechat-cell-desc {
  font-size: var(--font-sm);
  color: var(--wechat-text-gray);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.wechat-cell-extra {
  font-size: var(--font-xs);
  color: var(--wechat-text-light);
  margin-left: var(--spacing-md);
  flex-shrink: 0;
}

.wechat-cell-arrow {
  width: 8px;
  height: 8px;
  margin-left: var(--spacing-sm);
  border-right: 1px solid var(--wechat-text-light);
  border-bottom: 1px solid var(--wechat-text-light);
  transform: rotate(-45deg);
  flex-shrink: 0;
}

/* ===== 微信标准按钮 ===== */
.wechat-btn {
  height: 44px;
  line-height: 44px;
  padding: 0 var(--spacing-xl);
  border-radius: var(--radius-md);
  font-size: var(--font-base);
  text-align: center;
  border: none;
  cursor: pointer;
  transition: all 0.15s ease;
}

.wechat-btn-primary {
  background: var(--wechat-green);
  color: var(--wechat-text-white);
}

.wechat-btn-primary:active {
  background: var(--wechat-green-dark);
}

.wechat-btn-default {
  background: var(--wechat-bg-white);
  color: var(--wechat-text-dark);
  border: 1px solid var(--wechat-border);
}

.wechat-btn-default:active {
  background: var(--wechat-bg-gray);
}

/* ===== 微信聊天界面 ===== */
.wechat-chat-container {
  display: flex;
  flex-direction: column;
  height: 100vh;
  background: var(--wechat-bg);
}

.wechat-chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: var(--spacing-md) 0;
  padding-top: calc(var(--header-height) + var(--spacing-md));
  padding-bottom: calc(var(--tabbar-height) + 60px);
}

.wechat-message-item {
  display: flex;
  margin-bottom: var(--spacing-lg);
  padding: 0 var(--spacing-lg);
  animation: messageSlideIn 0.3s ease-out;
}

@keyframes messageSlideIn {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.wechat-message-item.own {
  justify-content: flex-end;
}

.wechat-message-item.other {
  justify-content: flex-start;
}

.wechat-message-avatar {
  width: var(--avatar-small);
  height: var(--avatar-small);
  border-radius: var(--radius-sm);
  flex-shrink: 0;
  margin: 0 var(--spacing-sm);
}

.wechat-message-bubble {
  max-width: 70%;
  padding: var(--spacing-sm) var(--spacing-md);
  border-radius: var(--radius-lg);
  font-size: var(--font-base);
  line-height: 1.5;
  word-wrap: break-word;
  position: relative;
}

.wechat-message-item.own .wechat-message-bubble {
  background: var(--wechat-green);
  color: var(--wechat-text-white);
  border-bottom-right-radius: var(--radius-sm);
}

.wechat-message-item.own .wechat-message-bubble::after {
  content: '';
  position: absolute;
  right: -6px;
  bottom: 8px;
  width: 0;
  height: 0;
  border-left: 6px solid var(--wechat-green);
  border-top: 6px solid transparent;
  border-bottom: 6px solid transparent;
}

.wechat-message-item.other .wechat-message-bubble {
  background: var(--wechat-bg-white);
  color: var(--wechat-text-black);
  border-bottom-left-radius: var(--radius-sm);
}

.wechat-message-item.other .wechat-message-bubble::after {
  content: '';
  position: absolute;
  left: -6px;
  bottom: 8px;
  width: 0;
  height: 0;
  border-right: 6px solid var(--wechat-bg-white);
  border-top: 6px solid transparent;
  border-bottom: 6px solid transparent;
}

.wechat-message-time {
  text-align: center;
  font-size: var(--font-xs);
  color: var(--wechat-text-light);
  margin: var(--spacing-md) 0;
  clear: both;
}

/* ===== 微信输入框 ===== */
.wechat-input-area {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background: var(--wechat-bg-white);
  border-top: 1px solid var(--wechat-border);
  padding: var(--spacing-sm) var(--spacing-md);
  z-index: 1001;
}

.wechat-input-container {
  display: flex;
  align-items: flex-end;
  background: var(--wechat-bg);
  border-radius: var(--radius-md);
  padding: var(--spacing-xs) var(--spacing-md);
}

.wechat-input {
  flex: 1;
  border: none;
  outline: none;
  background: transparent;
  font-size: var(--font-base);
  padding: var(--spacing-sm) 0;
  resize: none;
  max-height: 100px;
  min-height: 20px;
}

.wechat-input::placeholder {
  color: var(--wechat-text-light);
}

.wechat-input-btn {
  width: 44px;
  height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-left: var(--spacing-sm);
  cursor: pointer;
  color: var(--wechat-green);
  font-size: var(--font-base);
  flex-shrink: 0;
}

/* ===== 微信个人中心 ===== */
.wechat-profile-header {
  background: var(--wechat-bg-white);
  padding: calc(var(--header-height) + var(--spacing-xl)) var(--spacing-lg) var(--spacing-xl);
  display: flex;
  align-items: center;
  border-bottom: 1px solid var(--wechat-border);
}

.wechat-profile-avatar {
  width: 60px;
  height: 60px;
  border-radius: var(--radius-md);
  margin-right: var(--spacing-lg);
  flex-shrink: 0;
}

.wechat-profile-info {
  flex: 1;
}

.wechat-profile-name {
  font-size: var(--font-xl);
  font-weight: 500;
  color: var(--wechat-text-black);
  margin-bottom: 4px;
}

.wechat-profile-id {
  font-size: var(--font-sm);
  color: var(--wechat-text-gray);
}

.wechat-profile-section {
  margin-top: var(--spacing-lg);
  background: var(--wechat-bg-white);
}

.wechat-profile-section-title {
  padding: var(--spacing-md) var(--spacing-lg);
  font-size: var(--font-sm);
  color: var(--wechat-text-gray);
}

/* ===== 微信搜索框 ===== */
.wechat-search {
  padding: var(--spacing-md) var(--spacing-lg);
  background: var(--wechat-bg-white);
}

.wechat-search-input {
  width: 100%;
  height: 36px;
  background: var(--wechat-bg);
  border-radius: var(--radius-md);
  border: none;
  padding: 0 var(--spacing-md);
  font-size: var(--font-sm);
}

.wechat-search-input::placeholder {
  color: var(--wechat-text-light);
}

/* ===== 微信徽章 ===== */
.wechat-badge {
  display: inline-block;
  min-width: 18px;
  height: 18px;
  line-height: 18px;
  padding: 0 6px;
  background: var(--wechat-red);
  color: var(--wechat-text-white);
  font-size: 11px;
  text-align: center;
  border-radius: 9px;
  margin-left: var(--spacing-sm);
}

.wechat-badge-dot {
  width: 8px;
  height: 8px;
  padding: 0;
  min-width: 8px;
  border-radius: 4px;
}

/* ===== 微信分组标题 ===== */
.wechat-section-title {
  padding: var(--spacing-md) var(--spacing-lg);
  font-size: var(--font-sm);
  color: var(--wechat-text-gray);
  background: var(--wechat-bg);
}

/* ===== 响应式设计 ===== */
@media (max-width: 768px) {
  .wechat-message-bubble {
    max-width: 80%;
  }
}

@media (max-width: 480px) {
  .wechat-message-bubble {
    max-width: 85%;
  }
  
  .wechat-cell {
    padding: var(--spacing-md);
  }
}

/* ===== 工具类 ===== */
.wechat-clearfix::after {
  content: '';
  display: table;
  clear: both;
}

.wechat-ellipsis {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.wechat-hide {
  display: none !important;
}

.wechat-text-center {
  text-align: center;
}

.wechat-text-right {
  text-align: right;
}

.wechat-flex {
  display: flex;
}

.wechat-flex-1 {
  flex: 1;
}

.wechat-flex-center {
  display: flex;
  align-items: center;
  justify-content: center;
}
