/* ==================== 管理后台布局 ==================== */
.admin-layout {
  display: flex;
  min-height: 100vh;
}

/* ==================== 侧边栏 ==================== */
.sidebar {
  width: 240px;
  background: var(--bg-surface);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  z-index: 100;
}

.sidebar-brand {
  padding: 24px 20px;
  border-bottom: 1px solid var(--border);
}

.sidebar-brand h1 {
  font-size: 1.35rem;
  font-weight: 700;
  background: var(--gradient-primary);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.sidebar-brand p {
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-top: 2px;
}

.sidebar-nav {
  flex: 1;
  padding: 16px 12px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  border-radius: var(--radius-md);
  color: var(--text-secondary);
  font-size: 0.9rem;
  cursor: pointer;
  transition: var(--transition);
  border: none;
  background: none;
  width: 100%;
  text-align: left;
  font-family: inherit;
}

.nav-item:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
}

.nav-item.active {
  background: rgba(124, 58, 237, 0.15);
  color: var(--primary-light);
}

.nav-item .icon {
  font-size: 1.1rem;
  width: 24px;
  text-align: center;
}

.sidebar-footer {
  padding: 16px;
  border-top: 1px solid var(--border);
}

.sidebar-footer .btn {
  width: 100%;
}

/* ==================== 主内容区 ==================== */
.main-content {
  flex: 1;
  margin-left: 240px;
  padding: 32px;
  min-height: 100vh;
}

.page-header {
  margin-bottom: 28px;
}

.page-header h2 {
  font-size: 1.5rem;
  font-weight: 600;
}

.page-header p {
  font-size: 0.875rem;
  color: var(--text-secondary);
  margin-top: 4px;
}

/* ==================== 统计卡片 ==================== */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 20px;
  margin-bottom: 32px;
}

.stat-card {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 22px;
  transition: var(--transition);
  position: relative;
  overflow: hidden;
}

.stat-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  border-radius: var(--radius-lg) var(--radius-lg) 0 0;
}

.stat-card:nth-child(1)::before { background: var(--gradient-primary); }
.stat-card:nth-child(2)::before { background: var(--gradient-accent); }
.stat-card:nth-child(3)::before { background: linear-gradient(135deg, #10b981, #06b6d4); }
.stat-card:nth-child(4)::before { background: linear-gradient(135deg, #f59e0b, #ef4444); }

.stat-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-glow);
}

.stat-card .stat-icon {
  font-size: 1.8rem;
  margin-bottom: 12px;
}

.stat-card .stat-value {
  font-size: 2rem;
  font-weight: 700;
  line-height: 1;
}

.stat-card .stat-label {
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-top: 6px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

/* ==================== 表格 ==================== */
.card {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
}

.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 22px;
  border-bottom: 1px solid var(--border);
}

.card-header h3 {
  font-size: 1rem;
  font-weight: 600;
}

.card-body {
  padding: 0;
}

.table {
  width: 100%;
  border-collapse: collapse;
}

.table th,
.table td {
  padding: 12px 22px;
  text-align: left;
  font-size: 0.875rem;
  border-bottom: 1px solid var(--border-light);
}

.table th {
  color: var(--text-muted);
  font-weight: 500;
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  background: rgba(0, 0, 0, 0.15);
}

.table tr:hover td {
  background: var(--bg-hover);
}

.table td .actions {
  display: flex;
  gap: 6px;
}

/* 状态标签 */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 3px 10px;
  border-radius: var(--radius-full);
  font-size: 0.75rem;
  font-weight: 500;
}

.badge-active {
  background: rgba(16, 185, 129, 0.15);
  color: var(--success);
}

.badge-inactive {
  background: rgba(239, 68, 68, 0.15);
  color: var(--danger);
}

.badge-text { background: rgba(99, 102, 241, 0.15); color: var(--info); }
.badge-image { background: rgba(6, 182, 212, 0.15); color: var(--accent); }
.badge-voice { background: rgba(245, 158, 11, 0.15); color: var(--warning); }

/* 链接复制按钮 */
.copy-link {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 10px;
  background: rgba(124, 58, 237, 0.1);
  border: 1px solid rgba(124, 58, 237, 0.2);
  border-radius: var(--radius-sm);
  color: var(--primary-light);
  font-size: 0.78rem;
  cursor: pointer;
  transition: var(--transition);
}

.copy-link:hover {
  background: rgba(124, 58, 237, 0.2);
}

/* 空状态 */
.empty-state {
  text-align: center;
  padding: 48px 24px;
  color: var(--text-muted);
}

.empty-state .icon {
  font-size: 3rem;
  margin-bottom: 12px;
  opacity: 0.4;
}

.empty-state p {
  font-size: 0.9rem;
}

/* ==================== 消息查看区 ==================== */
.message-viewer {
  display: flex;
  gap: 20px;
  min-height: 500px;
}

.room-selector {
  width: 240px;
  flex-shrink: 0;
}

.room-selector .room-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 4px;
  max-height: 500px;
  overflow-y: auto;
  padding: 12px;
}

.room-selector .room-item {
  padding: 10px 14px;
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: var(--transition);
  font-size: 0.875rem;
  color: var(--text-secondary);
}

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

.room-selector .room-item.active {
  background: rgba(124, 58, 237, 0.15);
  color: var(--primary-light);
}

.message-list-panel {
  flex: 1;
}

.message-list-panel .card-body {
  padding: 16px;
  max-height: 500px;
  overflow-y: auto;
}

.msg-item {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 10px 12px;
  border-radius: var(--radius-md);
  transition: var(--transition);
  margin-bottom: 4px;
}

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

.msg-item .msg-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--gradient-primary);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.8rem;
  font-weight: 600;
  color: #fff;
  flex-shrink: 0;
}

.msg-item .msg-body {
  flex: 1;
  min-width: 0;
}

.msg-item .msg-sender {
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--primary-light);
}

.msg-item .msg-content {
  font-size: 0.875rem;
  color: var(--text-primary);
  margin-top: 2px;
  word-break: break-all;
}

.msg-item .msg-content img {
  max-width: 200px;
  max-height: 150px;
  border-radius: var(--radius-sm);
  margin-top: 4px;
  cursor: pointer;
}

.msg-item .msg-time {
  font-size: 0.7rem;
  color: var(--text-muted);
  margin-top: 4px;
}

.msg-item .msg-delete {
  opacity: 0;
  transition: var(--transition-fast);
}

.msg-item:hover .msg-delete {
  opacity: 1;
}

/* 分页 */
.pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 16px;
  border-top: 1px solid var(--border-light);
}

/* ==================== 登录页 ==================== */
.login-wrapper {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  padding: 20px;
}

.login-card {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  padding: 40px;
  width: 100%;
  max-width: 400px;
  box-shadow: var(--shadow-lg);
}

.login-card .brand {
  text-align: center;
  margin-bottom: 32px;
}

.login-card .brand h1 {
  font-size: 2rem;
  font-weight: 700;
  background: var(--gradient-primary);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.login-card .brand p {
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-top: 4px;
}

.login-card .form-group {
  margin-bottom: 18px;
}

.login-card label {
  display: block;
  font-size: 0.85rem;
  color: var(--text-secondary);
  margin-bottom: 6px;
}

.login-card .btn {
  width: 100%;
  padding: 12px;
  font-size: 1rem;
  margin-top: 8px;
}

.login-card .error-msg {
  color: var(--danger);
  font-size: 0.8rem;
  text-align: center;
  margin-top: 12px;
  min-height: 20px;
}

/* ==================== 响应式 ==================== */
@media (max-width: 768px) {
  .sidebar {
    width: 60px;
    overflow: hidden;
  }

  .sidebar-brand h1,
  .sidebar-brand p,
  .nav-item span,
  .sidebar-footer span {
    display: none;
  }

  .sidebar-brand {
    padding: 16px 10px;
    text-align: center;
  }

  .nav-item {
    justify-content: center;
    padding: 10px;
  }

  .main-content {
    margin-left: 60px;
    padding: 16px;
  }

  .message-viewer {
    flex-direction: column;
  }

  .room-selector {
    width: 100%;
  }
}
