/* ============================================
   WeChat AI Chat - Layout Styles
   布局样式：双端布局、导航栏、Tab栏、子页面
   ============================================ */

/* ---------- 移动端布局 ---------- */
.app-mobile {
  display: flex;
  flex-direction: column;
  height: 100%;
  position: relative;
}

.mobile-page {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

/* ---------- 底部Tab栏 ---------- */
.tab-bar {
  display: flex;
  background: var(--wx-bg-light);
  border-top: 1px solid var(--wx-border-light);
  padding-bottom: var(--safe-bottom);
  flex-shrink: 0;
}

.tab-item {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 6px 0 4px;
  cursor: pointer;
  color: var(--wx-text-secondary);
  position: relative;
  transition: color var(--wx-transition-fast);
}

.tab-item:active {
  background: var(--wx-bg-hover);
}

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

.tab-item svg {
  width: 26px;
  height: 26px;
  margin-bottom: 2px;
}

.tab-item span {
  font-size: 10px;
  line-height: 1.2;
}

.tab-item .badge {
  position: absolute;
  top: 4px;
  right: 50%;
  margin-right: -18px;
}

/* ---------- 导航栏 ---------- */
.nav-bar {
  display: flex;
  align-items: center;
  height: 44px;
  background: var(--wx-bg-light);
  border-bottom: 1px solid var(--wx-border-light);
  padding: 0 12px;
  padding-top: var(--safe-top);
  flex-shrink: 0;
  position: relative;
  z-index: 10;
}

.nav-left, .nav-right {
  display: flex;
  align-items: center;
  min-width: 60px;
}

.nav-right {
  justify-content: flex-end;
}

.nav-title {
  flex: 1;
  text-align: center;
  font-size: 17px;
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.nav-title-wrap {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  min-width: 0;
}

.nav-title-wrap .nav-title {
  font-size: 16px;
}

.nav-subtitle {
  font-size: 11px;
  color: var(--wx-text-secondary);
  margin-top: 1px;
}

.nav-back {
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  border-radius: 6px;
  color: var(--wx-text);
}

.nav-back:active {
  background: var(--wx-bg-hover);
}

.nav-back svg {
  width: 22px;
  height: 22px;
}

.nav-action {
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  border-radius: 6px;
  color: var(--wx-text);
  margin-left: 4px;
}

.nav-action:active {
  background: var(--wx-bg-hover);
}

.nav-action svg {
  width: 22px;
  height: 22px;
}

/* ---------- 子页面（移动端推入） ---------- */
#subPageContainer {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 100;
  pointer-events: none;
}

.sub-page {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: var(--wx-bg);
  display: flex;
  flex-direction: column;
  pointer-events: auto;
  animation: slideInRight 0.25s ease;
}

.sub-page.closing {
  animation: slideOutRight 0.25s ease forwards;
}

@keyframes slideInRight {
  from { transform: translateX(100%); }
  to { transform: translateX(0); }
}

@keyframes slideOutRight {
  from { transform: translateX(0); }
  to { transform: translateX(100%); }
}

/* ---------- 桌面端布局 ---------- */
.app-desktop {
  display: flex;
  height: 100%;
  width: 100%;
  overflow: hidden;
}

/* 左侧导航栏 */
.sidebar-nav {
  width: 60px;
  background: #2E2E2E;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 16px 0;
  flex-shrink: 0;
}

.nav-avatar {
  width: 36px;
  height: 36px;
  border-radius: 6px;
  overflow: hidden;
  cursor: pointer;
  margin-bottom: 24px;
  flex-shrink: 0;
}

.nav-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.nav-items {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
}

.nav-item {
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 8px;
  cursor: pointer;
  color: #999;
  position: relative;
  transition: all var(--wx-transition-fast);
}

.nav-item:hover {
  background: rgba(255,255,255,0.1);
  color: #ccc;
}

.nav-item.active {
  background: var(--wx-green);
  color: white;
}

.nav-item svg {
  width: 24px;
  height: 24px;
}

.nav-item .badge {
  position: absolute;
  top: 2px;
  right: 2px;
  min-width: 16px;
  height: 16px;
  font-size: 10px;
}

.nav-bottom {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
}

/* 会话列表栏 */
.sidebar-list {
  width: 280px;
  background: var(--wx-bg-white);
  border-right: 1px solid var(--wx-border-light);
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
}

.list-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px;
  border-bottom: 1px solid var(--wx-border-light);
}

.list-header h2 {
  font-size: 18px;
  font-weight: 600;
}

.header-actions {
  display: flex;
  gap: 8px;
}

.header-actions button {
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 6px;
  color: var(--wx-text-secondary);
  cursor: pointer;
  transition: background var(--wx-transition-fast);
}

.header-actions button:hover {
  background: var(--wx-bg-hover);
}

.header-actions button svg {
  width: 20px;
  height: 20px;
}

.list-search {
  padding: 8px 12px;
  background: var(--wx-bg-light);
}

.chat-list {
  flex: 1;
  overflow-y: auto;
}

/* 聊天列表项 */
.chat-list-item {
  display: flex;
  align-items: center;
  padding: 12px 14px;
  cursor: pointer;
  transition: background var(--wx-transition-fast);
  position: relative;
  gap: 12px;
}

.chat-list-item:hover {
  background: var(--wx-bg-light);
}

.chat-list-item.active {
  background: var(--wx-green-bg);
}

.chat-list-item .chat-avatar {
  position: relative;
  flex-shrink: 0;
}

.chat-list-item .chat-avatar .avatar {
  width: 42px;
  height: 42px;
}

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

.chat-list-item .chat-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 3px;
}

.chat-list-item .chat-name {
  font-size: 15px;
  font-weight: 500;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  flex: 1;
}

.chat-list-item .chat-time {
  font-size: 11px;
  color: var(--wx-text-tertiary);
  flex-shrink: 0;
  margin-left: 8px;
}

.chat-list-item .chat-preview {
  font-size: 12px;
  color: var(--wx-text-secondary);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.chat-list-item .chat-badge-wrap {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 4px;
  flex-shrink: 0;
}

.chat-list-item .mute-icon {
  width: 14px;
  height: 14px;
  color: var(--wx-text-tertiary);
}

.chat-list-item .mute-icon svg {
  width: 14px;
  height: 14px;
}

/* 主内容区 */
.main-content {
  flex: 1;
  display: flex;
  flex-direction: column;
  background: var(--wx-bg-chat);
  overflow: hidden;
  min-width: 0;
}

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

.empty-main {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  color: var(--wx-text-tertiary);
}

.empty-logo {
  width: 80px;
  height: 80px;
  margin-bottom: 16px;
  opacity: 0.2;
}

.empty-logo svg {
  width: 100%;
  height: 100%;
}

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

/* ---------- 响应式 ---------- */
@media (max-width: 768px) {
  .app-desktop {
    display: none;
  }
}

@media (min-width: 769px) {
  .app-mobile {
    display: none;
  }
}
