/* 聊天主页面与聊天相关组件样式 */

/* ---------- 三栏布局 ---------- */
.chat-layout {
  display: flex;
  height: 100vh;
  overflow: hidden;
}

.chat-sidebar {
  width: var(--sidebar-width);
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  background: var(--bg-panel);
  border-right: 1px solid var(--border-color);
}

.chat-main {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  background: var(--bg-body);
}

.chat-members {
  width: var(--member-width);
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  background: var(--bg-panel);
  border-left: 1px solid var(--border-color);
  overflow-y: auto;
}

/* ---------- 左侧栏 ---------- */
.sidebar-user {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px;
  border-bottom: 1px solid var(--border-color);
}

.sidebar-nickname {
  font-weight: 600;
  font-size: 14px;
}

.sidebar-status {
  font-size: 12px;
  color: var(--color-success);
}

.sidebar-rooms {
  flex: 1;
  overflow-y: auto;
  padding: 8px;
}

.room-list-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 4px 8px 10px;
}

.room-list-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-secondary);
}

.room-list-actions {
  flex-shrink: 0;
}

.room-item {
  display: flex;
  align-items: center;
  gap: 10px;
}

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

.room-item-name {
  font-size: 14px;
  color: var(--text-primary);
}

.room-item-meta {
  font-size: 12px;
  color: var(--text-tertiary);
}

/* ---------- 会话头部 ---------- */
.chat-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: var(--header-height);
  padding: 0 16px;
  background: var(--bg-panel);
  border-bottom: 1px solid var(--border-color);
  flex-shrink: 0;
}

.chat-title {
  font-size: 16px;
  font-weight: 600;
}

.chat-meta {
  font-size: 12px;
  color: var(--text-tertiary);
  margin-top: 2px;
}

/* ---------- 消息区 ---------- */
.chat-messages {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: 16px;
}

.message-list {
  height: 100%;
  overflow-y: auto;
}

.msg-row {
  display: flex;
  gap: 10px;
  margin-bottom: 14px;
}

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

.msg-body {
  max-width: 68%;
  min-width: 0;
}

.msg-sender {
  font-size: 12px;
  color: var(--text-tertiary);
  margin-bottom: 4px;
}

.msg-self .msg-sender {
  text-align: right;
}

.msg-bubble {
  display: inline-block;
  max-width: 100%;
  padding: 10px 14px;
  border-radius: var(--radius-md);
  font-size: 14px;
  line-height: 1.5;
  word-break: break-word;
  background: var(--bg-panel);
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
}

.msg-self .msg-bubble {
  background: var(--color-primary);
  color: #fff;
}

.msg-meta {
  font-size: 11px;
  color: var(--text-tertiary);
  margin-top: 4px;
}

.msg-self .msg-meta {
  text-align: right;
}

.msg-image {
  max-width: 260px;
  max-height: 260px;
  border-radius: var(--radius-sm);
  display: block;
}

.msg-file {
  color: var(--color-primary);
  text-decoration: underline;
}

/* ---------- 输入区 ---------- */
.chat-input {
  flex-shrink: 0;
  background: var(--bg-panel);
  border-top: 1px solid var(--border-color);
  padding: 10px 16px;
}

.message-input {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.msg-textarea {
  width: 100%;
  min-height: 56px;
  max-height: 140px;
  resize: none;
  border: none;
  background: var(--bg-hover);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  font-size: 14px;
  line-height: 1.5;
}

.msg-textarea:focus {
  background: #fff;
  box-shadow: 0 0 0 2px var(--color-primary-light);
}

.msg-toolbar {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}

/* ---------- 成员面板 ---------- */
.member-panel {
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.member-panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-secondary);
  padding: 0 4px 8px;
}

.member-item {
  display: flex;
  align-items: center;
  gap: 10px;
}

.member-item-info {
  flex: 1;
  min-width: 0;
  font-size: 14px;
}

.member-item-meta {
  font-size: 12px;
  color: var(--text-tertiary);
}

.member-card {
  text-align: center;
  padding: 32px 0;
}

.member-card-avatar {
  margin-bottom: 12px;
}

.member-card-name {
  font-size: 16px;
  font-weight: 600;
}

.member-card-status {
  font-size: 13px;
  color: var(--text-secondary);
  margin-top: 6px;
}

/* ---------- 通知中心 ---------- */
.notification-center {
  position: relative;
}

.notification-badge {
  position: absolute;
  top: -6px;
  right: -6px;
  min-width: 16px;
  height: 16px;
  padding: 0 4px;
  border-radius: 8px;
  background: var(--color-danger);
  color: #fff;
  font-size: 11px;
  line-height: 16px;
  align-items: center;
  justify-content: center;
  display: none;
}

.notification-panel {
  position: absolute;
  top: 40px;
  right: 0;
  width: 300px;
  max-height: 400px;
  overflow-y: auto;
  background: var(--bg-panel);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
  border: 1px solid var(--border-color);
  z-index: 100;
}

.notification-panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 12px;
  border-bottom: 1px solid var(--border-color);
  font-size: 13px;
  font-weight: 600;
  position: sticky;
  top: 0;
  background: var(--bg-panel);
}

.notification-item {
  padding: 10px 12px;
  border-bottom: 1px solid var(--border-color);
  cursor: pointer;
}

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

.notification-unread {
  background: var(--bg-active);
}

.notification-title {
  font-size: 13px;
  font-weight: 600;
}

.notification-content {
  font-size: 12px;
  color: var(--text-secondary);
  margin-top: 2px;
}

.notification-time {
  font-size: 11px;
  color: var(--text-tertiary);
  margin-top: 4px;
}

/* ---------- 头像 ---------- */
.avatar {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  background: var(--color-primary-light);
  color: var(--color-primary);
  font-weight: 600;
  flex-shrink: 0;
  overflow: hidden;
}

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

/* ---------- Toast ---------- */
.toast-container {
  position: fixed;
  top: 20px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 1000;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  pointer-events: none;
}

.toast {
  padding: 10px 20px;
  border-radius: var(--radius-md);
  color: #fff;
  font-size: 14px;
  box-shadow: var(--shadow-lg);
  opacity: 0;
  transform: translateY(-8px);
  transition: opacity 0.25s, transform 0.25s;
}

.toast-show {
  opacity: 1;
  transform: translateY(0);
}

.toast-success { background: var(--color-success); }
.toast-error { background: var(--color-danger); }
.toast-warning { background: var(--color-warning); }
.toast-info { background: var(--text-secondary); }

/* ---------- Modal ---------- */
.modal-mask {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.45);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 900;
}

.modal {
  width: 420px;
  max-width: 90vw;
  background: var(--bg-panel);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  overflow: hidden;
}

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

.modal-header h3 {
  font-size: 15px;
}

.modal-close {
  font-size: 20px;
  color: var(--text-tertiary);
  line-height: 1;
}

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

.modal-body {
  padding: 16px;
  max-height: 60vh;
  overflow-y: auto;
}

.modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  padding: 12px 16px;
  border-top: 1px solid var(--border-color);
}
