/* ============================================
  格小拉互联网心理医院 - 社群系统样式
  与主站保持一致的设计语言
  ============================================ */

/* 注意：移动端导航栏样式在 style.css 中统一处理 */

/* 复用主站变量 */
:root {
  --primary: #4A7C8F;
  --primary-dark: #3A6270;
  --primary-light: #E8F4F8;
  --accent: #7CB7C9;
  --accent-warm: #E8A87C;
  --text-dark: #2D3748;
  --text-body: #4A5568;
  --text-light: #718096;
  --bg-white: #FFFFFF;
  --bg-light: #F7FAFC;
  --bg-section: #EDF2F7;
  --border: #E2E8F0;
  --shadow-sm: 0 1px 3px rgba(0,0,0,0.08);
  --shadow-md: 0 4px 12px rgba(0,0,0,0.1);
  --shadow-lg: 0 10px 30px rgba(0,0,0,0.12);
  --radius: 12px;
  --radius-sm: 8px;
  --transition: all 0.3s ease;
  --max-width: 1200px;
}

/* Reset */
*, *::before, *::after {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
  font-size: 16px;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Helvetica Neue", Helvetica, Arial, sans-serif;
  color: var(--text-body);
  line-height: 1.7;
  background: var(--bg-light);
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
}

a {
  text-decoration: none;
  color: inherit;
  transition: var(--transition);
}

img {
  max-width: 100%;
  height: auto;
}

ul, ol {
  list-style: none;
}

/* Container */
.container {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 24px;
}

/* ============================================
  Navigation - 与主站一致（下划线动画风格）
  ============================================ */
.navbar {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  z-index: 1000;
  background: #FFFFFF !important;
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-bottom: 1px solid var(--border);
  transition: var(--transition);
}

.navbar.scrolled {
  box-shadow: var(--shadow-sm);
}

.navbar .container {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 72px;
}

.nav-logo {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--primary-dark);
  text-decoration: none;
}

.nav-logo .logo-icon {
  width: 40px;
  height: 40px;
  background: linear-gradient(135deg, var(--primary), var(--accent));
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

.nav-logo .logo-icon img {
  width: 28px;
  height: 28px;
  border-radius: 6px;
  object-fit: contain;
}

.nav-links {
  display: flex;
  align-items: center;
  gap: 36px;
  flex-shrink: 0; /* 防止被压缩 */
}

.nav-links a {
  font-size: 0.95rem;
  color: var(--text-body);
  font-weight: 500;
  position: relative;
  padding: 6px 0;
  transition: color 0.3s ease;
}

.nav-links a::after {
  content: '';
  position: absolute;
  bottom: -4px;
  left: 0;
  width: 100%;
  height: 2px;
  background: linear-gradient(90deg, var(--primary), var(--accent));
  border-radius: 2px;
  opacity: 0;
  transform: scaleX(0);
  transform-origin: left center;
  transition: opacity 0.3s ease, transform 0.4s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

.nav-links a:hover {
  color: var(--primary);
}

.nav-links a:hover::after {
  opacity: 1;
  transform: scaleX(1);
}

.nav-links a.active {
  color: var(--primary);
  font-weight: 600;
}

.nav-links a.active::after {
  opacity: 1;
  transform: scaleX(1);
}

.nav-cta {
    position: relative;
    background: transparent !important;
    color: var(--text-body) !important;
    padding: 6px 0 !important;
    border-radius: 0 !important;
    font-weight: 500 !important;
    font-size: 0.95rem !important;
    border: none !important;
    box-shadow: none !important;
    overflow: visible;
}

.nav-cta::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 50%;
    right: 50%;
    height: 2px;
    background: linear-gradient(90deg, var(--primary), var(--accent));
    border-radius: 2px;
    opacity: 0;
    transform: translateX(-50%) scaleX(0);
    transition: opacity 0.35s cubic-bezier(0.4, 0, 0.2, 1),
                transform 0.4s cubic-bezier(0.34, 1.3, 0.64, 1);
}

.nav-cta:hover {
    color: var(--primary) !important;
}

.nav-cta:hover::after {
    opacity: 1;
    transform: translateX(-50%) scaleX(1);
}

.nav-user {
  display: flex;
  align-items: center;
  gap: 12px;
}

/* nav-user中的登录按钮样式 */
.nav-user > a {
  /* 始终显示，不隐藏 */
}

/* nav-links里的登录链接 - 桌面端显示 */

.user-avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  object-fit: cover;
  border: 2px solid var(--primary-light);
}

/* Mobile Menu */
.mobile-toggle {
  display: none;
  flex-direction: column;
  gap: 5px;
  background: none;
  border: none;
  cursor: pointer;
  padding: 8px;
}

.mobile-toggle span {
  display: block;
  width: 24px;
  height: 2px;
  background: var(--text-dark);
  border-radius: 2px;
  transition: var(--transition);
}

/* ============================================
  Page Layout
  ============================================ */
.page-wrapper {
  padding-top: 72px;
  min-height: 100vh;
}

.page-header {
  background: linear-gradient(135deg, var(--primary) 0%, var(--accent) 100%);
  color: white;
  padding: 48px 0;
  text-align: center;
}

.page-header h1 {
  font-size: 2rem;
  font-weight: 700;
  margin-bottom: 8px;
}

.page-header p {
  opacity: 0.9;
  font-size: 1.1rem;
}

.main-content {
  max-width: 1200px;
  margin: 0 auto;
  padding: 32px 24px;
}

/* Sidebar Layout */
.layout-with-sidebar {
  display: grid;
  grid-template-columns: 280px 1fr;
  gap: 32px;
}

.sidebar {
  position: sticky;
  top: 104px;
  height: fit-content;
}

.sidebar-card {
  background: var(--bg-white);
  border-radius: var(--radius);
  padding: 24px;
  box-shadow: var(--shadow-sm);
  margin-bottom: 24px;
}

.sidebar-card h3 {
  font-size: 1rem;
  font-weight: 600;
  color: var(--text-dark);
  margin-bottom: 16px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.sidebar-nav {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.sidebar-nav a {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  border-radius: var(--radius-sm);
  color: var(--text-body);
  font-weight: 500;
  transition: var(--transition);
}

.sidebar-nav a:hover {
  background: var(--primary-light);
  color: var(--primary);
}

.sidebar-nav a.active {
  background: var(--primary);
  color: white;
}

.sidebar-nav a svg {
  width: 20px;
  height: 20px;
  flex-shrink: 0;
}

.badge {
  background: var(--accent-warm);
  color: white;
  font-size: 0.75rem;
  padding: 2px 8px;
  border-radius: 10px;
  margin-left: auto;
}

/* ============================================
  Cards - 与主站一致
  ============================================ */
.card {
  background: var(--bg-white);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  transition: var(--transition);
}

.card:hover {
  box-shadow: var(--shadow-md);
}

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

.card-header h2 {
  font-size: 1.25rem;
  font-weight: 600;
  color: var(--text-dark);
}

.card-body {
  padding: 24px;
}

.card-footer {
  padding: 16px 24px;
  border-top: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

/* ============================================
  Buttons - 与主站一致
  ============================================ */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 24px;
  border-radius: var(--radius-sm);
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  border: none;
  transition: var(--transition);
  white-space: nowrap;
}

.btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

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

.btn-primary:hover:not(:disabled) {
  background: var(--primary-dark);
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}

.btn-secondary {
  background: var(--bg-section);
  color: var(--text-body);
}

.btn-secondary:hover:not(:disabled) {
  background: var(--border);
}

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

.btn-accent:hover:not(:disabled) {
  background: #d4956a;
}

.btn-ghost {
  background: transparent;
  color: var(--text-body);
}

.btn-ghost:hover:not(:disabled) {
  background: var(--bg-light);
}

.btn-sm {
  padding: 8px 16px;
  font-size: 0.875rem;
}

.btn-lg {
  padding: 16px 32px;
  font-size: 1.1rem;
}

.btn-block {
  width: 100%;
}

.btn svg {
  width: 20px;
  height: 20px;
}

/* ============================================
  Forms - 与主站一致
  ============================================ */
.form-group {
  margin-bottom: 20px;
}

.form-label {
  display: block;
  font-weight: 600;
  color: var(--text-dark);
  margin-bottom: 8px;
  font-size: 0.9rem;
}

.form-input,
.form-select,
.form-textarea {
  width: 100%;
  padding: 14px 18px;
  border: 2px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 1rem;
  color: var(--text-body);
  background: var(--bg-white);
  transition: var(--transition);
}

.form-input:focus,
.form-select:focus,
.form-textarea:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 4px var(--primary-light);
}

.form-input::placeholder,
.form-textarea::placeholder {
  color: var(--text-light);
}

.form-textarea {
  min-height: 120px;
  resize: vertical;
}

.form-hint {
  font-size: 0.85rem;
  color: var(--text-light);
  margin-top: 6px;
}

.form-error {
  color: #E53E3E;
  font-size: 0.85rem;
  margin-top: 6px;
}

/* ============================================
  Auth Page - 登录注册
  ============================================ */
.auth-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, var(--primary-light) 0%, var(--bg-section) 100%);
  padding: 24px;
}

.auth-container {
  width: 100%;
  max-width: 440px;
}

.auth-card {
  background: var(--bg-white);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  overflow: hidden;
}

.auth-header {
  background: linear-gradient(135deg, var(--primary) 0%, var(--accent) 100%);
  color: white;
  padding: 40px 32px;
  text-align: center;
}

.auth-header h1 {
  font-size: 1.75rem;
  font-weight: 700;
  margin-bottom: 8px;
}

.auth-header p {
  opacity: 0.9;
}

.auth-body {
  padding: 32px;
}

.auth-tabs {
  display: flex;
  margin-bottom: 24px;
  border-bottom: 2px solid var(--border);
}

.auth-tab {
  flex: 1;
  padding: 12px;
  text-align: center;
  font-weight: 600;
  color: var(--text-light);
  cursor: pointer;
  border-bottom: 2px solid transparent;
  margin-bottom: -2px;
  transition: var(--transition);
}

.auth-tab:hover {
  color: var(--primary);
}

.auth-tab.active {
  color: var(--primary);
  border-bottom-color: var(--primary);
}

.auth-form {
  display: none;
}

.auth-form.active {
  display: block;
}

.anonymous-toggle {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 16px;
  background: var(--primary-light);
  border-radius: var(--radius-sm);
  margin-bottom: 20px;
  cursor: pointer;
}

.anonymous-toggle input {
  width: 20px;
  height: 20px;
  accent-color: var(--primary);
}

.anonymous-toggle span {
  font-weight: 500;
  color: var(--primary);
}

/* ============================================
  Post Cards - 帖子卡片
  ============================================ */
.post-card {
  background: var(--bg-white);
  border-radius: var(--radius);
  padding: 24px;
  box-shadow: var(--shadow-sm);
  margin-bottom: 16px;
  transition: var(--transition);
}

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

.post-header {
  display: flex;
  align-items: flex-start;
  gap: 16px;
  margin-bottom: 16px;
}

.post-avatar {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  object-fit: cover;
  flex-shrink: 0;
}

.post-meta {
  flex: 1;
  min-width: 0;
}

.post-author {
  font-weight: 600;
  color: var(--text-dark);
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.anonymous-badge {
  background: var(--text-light);
  color: white;
  font-size: 0.7rem;
  padding: 2px 6px;
  border-radius: 4px;
}

/* 管理员徽章 */
.admin-badge {
  background: linear-gradient(135deg, #f59e0b, #d97706);
  color: white;
  font-size: 0.7rem;
  padding: 2px 8px;
  border-radius: 12px;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  gap: 3px;
  box-shadow: 0 1px 3px rgba(245, 158, 11, 0.3);
  vertical-align: middle;
}

.admin-badge svg {
  width: 10px;
  height: 10px;
}

/* 评论中的管理员徽章 */
.comment-author .admin-badge {
  font-size: 0.65rem;
  padding: 1px 6px;
}

.post-time {
  font-size: 0.85rem;
  color: var(--text-light);
}

.post-title {
  font-size: 1.2rem;
  font-weight: 600;
  color: var(--text-dark);
  margin-bottom: 12px;
  line-height: 1.4;
}

.post-content {
  color: var(--text-body);
  margin-bottom: 16px;
  line-height: 1.8;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.post-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 16px;
}

.tag {
  display: inline-flex;
  align-items: center;
  padding: 4px 12px;
  background: var(--primary-light);
  color: var(--primary);
  border-radius: 20px;
  font-size: 0.85rem;
  font-weight: 500;
}

.tag-disease {
  background: #FED7D7;
  color: #C53030;
}

.tag-need {
  background: #FEEBC8;
  color: #C05621;
}

.post-actions {
  display: flex;
  gap: 16px;
  padding-top: 16px;
  border-top: 1px solid var(--border);
}

.post-action {
  display: flex;
  align-items: center;
  gap: 6px;
  color: var(--text-light);
  font-size: 0.9rem;
  cursor: pointer;
  transition: var(--transition);
}

.post-action:hover {
  color: var(--primary);
}

.post-action.liked {
  color: #E53E3E;
}

.post-action svg {
  width: 20px;
  height: 20px;
}

/* ============================================
  Comment Section
  ============================================ */
.comments-section {
  margin-top: 32px;
}

.comments-header {
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--text-dark);
  margin-bottom: 20px;
  padding-bottom: 12px;
  border-bottom: 2px solid var(--border);
}

.comment-form {
  margin-bottom: 24px;
}

.comment-item {
  display: flex;
  gap: 16px;
  padding: 20px 0;
  border-bottom: 1px solid var(--border);
}

.comment-avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  object-fit: cover;
  flex-shrink: 0;
}

.comment-content {
  flex: 1;
}

.comment-header {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
}

.comment-author {
  font-weight: 600;
  color: var(--text-dark);
}

.comment-time {
  font-size: 0.85rem;
  color: var(--text-light);
}

.comment-text {
  color: var(--text-body);
  line-height: 1.7;
  margin-bottom: 8px;
}

.comment-actions {
  display: flex;
  gap: 12px;
}

.comment-action {
  font-size: 0.85rem;
  color: var(--text-light);
  cursor: pointer;
  transition: var(--transition);
}

.comment-action:hover {
  color: var(--primary);
}

/* ============================================
  User Profile
  ============================================ */
.profile-header {
  background: var(--bg-white);
  border-radius: var(--radius);
  padding: 32px;
  box-shadow: var(--shadow-sm);
  display: flex;
  align-items: center;
  gap: 32px;
  margin-bottom: 24px;
}

.profile-avatar {
  width: 100px;
  height: 100px;
  border-radius: 50%;
  object-fit: cover;
  border: 4px solid var(--primary-light);
}

.profile-info h2 {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--text-dark);
  margin-bottom: 8px;
}

.profile-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 12px;
}

/* ============================================
  Friend List
  ============================================ */
.friend-item {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 16px;
  background: var(--bg-white);
  border-radius: var(--radius-sm);
  margin-bottom: 12px;
  transition: var(--transition);
}

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

.friend-avatar {
  width: 50px;
  height: 50px;
  border-radius: 50%;
  object-fit: cover;
}

.friend-info {
  flex: 1;
}

.friend-name {
  font-weight: 600;
  color: var(--text-dark);
}

.friend-status {
  font-size: 0.85rem;
  color: var(--text-light);
}

/* ============================================
  Message System
  ============================================ */
.message-list {
  background: var(--bg-white);
  border-radius: var(--radius);
  overflow: hidden;
}

.message-item {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 20px;
  border-bottom: 1px solid var(--border);
  cursor: pointer;
  transition: var(--transition);
}

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

.message-item.unread {
  background: var(--primary-light);
}

.message-avatar {
  width: 50px;
  height: 50px;
  border-radius: 50%;
  object-fit: cover;
}

.message-content {
  flex: 1;
  min-width: 0;
}

.message-name {
  font-weight: 600;
  color: var(--text-dark);
}

.message-preview {
  font-size: 0.9rem;
  color: var(--text-light);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.message-time {
  font-size: 0.8rem;
  color: var(--text-light);
}

.unread-dot {
  width: 10px;
  height: 10px;
  background: var(--accent-warm);
  border-radius: 50%;
}

/* ============================================
  Chat Box
  ============================================ */
.chat-container {
  display: grid;
  grid-template-columns: 320px 1fr;
  gap: 24px;
  height: calc(100vh - 200px);
  min-height: 500px;
}

.chat-sidebar {
  background: var(--bg-white);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.chat-header {
  padding: 20px;
  background: var(--primary);
  color: white;
  font-weight: 600;
  font-size: 1.1rem;
}

.chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 20px;
}

.chat-message {
  margin-bottom: 16px;
  display: flex;
  gap: 12px;
}

.chat-message.sent {
  flex-direction: row-reverse;
}

.chat-message.avatar img {
  width: 36px;
  height: 36px;
  border-radius: 50%;
}

.chat-message .bubble {
  max-width: 70%;
  padding: 12px 16px;
  border-radius: 16px;
  background: var(--bg-section);
  color: var(--text-dark);
}

.chat-message.sent .bubble {
  background: var(--primary);
  color: white;
}

.chat-input-area {
  padding: 16px;
  border-top: 1px solid var(--border);
  display: flex;
  gap: 12px;
}

.chat-input {
  flex: 1;
  padding: 12px 16px;
  border: 2px solid var(--border);
  border-radius: 24px;
  font-size: 0.95rem;
}

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

/* ============================================
  Groups
  ============================================ */
.group-card {
  background: var(--bg-white);
  border-radius: var(--radius);
  padding: 24px;
  box-shadow: var(--shadow-sm);
  margin-bottom: 16px;
  display: flex;
  align-items: center;
  gap: 20px;
  transition: var(--transition);
}

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

.group-avatar {
  width: 64px;
  height: 64px;
  border-radius: var(--radius-sm);
  object-fit: cover;
  background: var(--primary-light);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--primary);
}

.group-info {
  flex: 1;
}

.group-name {
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--text-dark);
  margin-bottom: 4px;
}

.group-desc {
  font-size: 0.9rem;
  color: var(--text-light);
  margin-bottom: 8px;
}

.group-meta {
  font-size: 0.85rem;
  color: var(--text-light);
}

/* ============================================
  Tag Selector
  ============================================ */
.tag-selector {
  margin-bottom: 24px;
}

.tag-selector h4 {
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text-dark);
  margin-bottom: 12px;
}

.tag-options {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.tag-option {
  padding: 6px 14px;
  border: 2px solid var(--border);
  border-radius: 20px;
  font-size: 0.85rem;
  cursor: pointer;
  transition: var(--transition);
  background: var(--bg-white);
}

.tag-option:hover {
  border-color: var(--primary);
  color: var(--primary);
}

.tag-option.selected {
  background: var(--primary);
  border-color: var(--primary);
  color: white;
}

/* ============================================
  Empty States
  ============================================ */
.empty-state {
  text-align: center;
  padding: 60px 20px;
  color: var(--text-light);
}

.empty-state svg {
  width: 80px;
  height: 80px;
  margin-bottom: 20px;
  opacity: 0.5;
}

.empty-state h3 {
  font-size: 1.2rem;
  color: var(--text-dark);
  margin-bottom: 8px;
}

.empty-state p {
  margin-bottom: 20px;
}

/* ============================================
  Loading States
  ============================================ */
.loading {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 40px;
}

.spinner {
  width: 40px;
  height: 40px;
  border: 3px solid var(--border);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* ============================================
  Toast Notifications
  ============================================ */
.toast {
  position: fixed;
  bottom: 24px;
  right: 24px;
  padding: 16px 24px;
  background: var(--text-dark);
  color: white;
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-lg);
  animation: slideIn 0.3s ease;
  z-index: 9999;
}

.toast.success {
  background: #38A169;
}

.toast.error {
  background: #E53E3E;
}

@keyframes slideIn {
  from {
    transform: translateX(100%);
    opacity: 0;
  }
  to {
    transform: translateX(0);
    opacity: 1;
  }
}

/* ============================================
  Safe Alert Modal
  ============================================ */
.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: 9999;
  padding: 24px;
}

.modal {
  background: var(--bg-white);
  border-radius: var(--radius);
  max-width: 500px;
  width: 100%;
  max-height: 90vh;
  overflow-y: auto;
}

.modal-header {
  padding: 20px 24px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 12px;
}

.modal-header.alert {
  background: #FED7D7;
  color: #C53030;
  border-bottom: none;
}

.modal-header.warning {
  background: #FEEBC8;
  color: #C05621;
  border-bottom: none;
}

.modal-header svg {
  width: 24px;
  height: 24px;
}

.modal-header h3 {
  font-size: 1.1rem;
  font-weight: 600;
}

.modal-body {
  padding: 24px;
}

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

/* ============================================
  Utilities
  ============================================ */
.text-center { text-align: center; }
.text-primary { color: var(--primary); }
.text-danger { color: #E53E3E; }
.text-success { color: #38A169; }
.mt-8 { margin-top: 8px; }
.mt-16 { margin-top: 16px; }
.mt-24 { margin-top: 24px; }
.mb-8 { margin-bottom: 8px; }
.mb-16 { margin-bottom: 16px; }
.mb-24 { margin-bottom: 24px; }

/* ============================================
  Responsive - 移动端适配
  ============================================ */
@media (max-width: 768px) {
  .layout-with-sidebar {
    grid-template-columns: 1fr;
  }

  .sidebar {
    position: static;
  }

  .chat-container {
    grid-template-columns: 1fr;
    height: calc(100vh - 140px);
  }

  .profile-header {
    flex-direction: column;
    text-align: center;
    gap: 16px;
    padding: 24px;
  }

  /* ============================================
     平板横屏响应式（768px - 1024px）
     ============================================ */
  @media (max-width: 1024px) and (min-width: 769px) {
    .navbar .container {
      height: 64px;
    }

    .nav-logo {
      font-size: 1.1rem;
      gap: 8px;
    }

    .nav-logo .logo-icon {
      width: 36px;
      height: 36px;
    }

    .nav-links {
      gap: 20px;
    }

    .nav-links a {
      font-size: 0.88rem;
    }

    .nav-user {
      flex-shrink: 0;
    }

    .nav-user .btn {
      padding: 8px 14px;
      font-size: 0.85rem;
    }

  }

  /* 移动端菜单按钮 - 由 style.css 统一处理，此处删除避免冲突 */
  /* .mobile-toggle 相关样式已移至 style.css */

  /* 移动端导航链接 - 由 style.css 统一处理，此处删除避免冲突 */
  /* .navbar .nav-links 相关样式已移至 style.css */

  /* 768px以下：移动端 */
  @media (max-width: 768px) {
    /* 移动端 nav-user 始终显示 */
    .nav-user {
      display: flex !important;
      flex-shrink: 0;
    }

    .nav-user .btn {
      padding: 8px 14px;
      font-size: 0.85rem;
    }

    .main-content {
      padding: 24px 16px;
    }



    /* 移动端菜单展开时，nav-user 显示在菜单底部 */
    .nav-links.active + .nav-user {
      display: flex !important;
      justify-content: center;
      margin-top: 16px;
      padding-top: 16px;
      border-top: 1px solid rgba(226,232,240,0.6);
    }

    .nav-links.active + .nav-user .btn {
      background: var(--primary);
      color: white;
      border: none;
      padding: 12px 32px;
      border-radius: 50px;
      font-weight: 600;
    }

    .nav-links.active + .nav-user .btn:hover {
      background: var(--primary-dark);
    }

    .main-content {
    padding: 24px 16px;
  }

  .page-wrapper {
    padding-top: 64px;
  }

  /* 弹窗底部升起模式 */
  .modal-overlay {
    align-items: flex-end;
    padding: 0;
  }

  .modal {
    width: 100%;
    max-width: 100%;
    max-height: 92vh;
    border-radius: 20px 20px 0 0;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    /* 底部安全区 */
    padding-bottom: env(safe-area-inset-bottom);
  }

  /* 帖子卡片 */
  .post-card {
    padding: 18px 16px;
    border-radius: 12px;
  }

  .post-header {
    gap: 12px;
    margin-bottom: 12px;
  }

  .post-avatar {
    width: 42px;
    height: 42px;
  }

  .post-title {
    font-size: 1.05rem;
  }

  .post-content {
    font-size: 0.95rem;
    -webkit-line-clamp: 4;
  }

  .post-actions {
    gap: 20px;
  }

  /* 标签 */
  .tag {
    font-size: 0.8rem;
    padding: 3px 10px;
  }

  /* Toast 消息 */
  .toast {
    bottom: 16px;
    right: 16px;
    left: 16px;
    text-align: center;
  }

  /* 群组卡片 */
  .group-card {
    padding: 16px;
    gap: 14px;
  }

  .group-avatar {
    width: 52px;
    height: 52px;
  }

  /* 好友列表 */
  .friend-item {
    padding: 14px;
  }

  .friend-avatar {
    width: 44px;
    height: 44px;
  }
}

/* 小屏手机（480px） */
@media (max-width: 480px) {
  .main-content {
    padding: 16px 12px;
  }
  
  .post-card {
    padding: 14px 12px;
  }
  
  .post-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 8px;
  }
  
  .post-author {
    flex-direction: column;
    align-items: flex-start;
    gap: 8px;
  }
  
  .avatar {
    width: 40px;
    height: 40px;
  }
  
  .btn {
    padding: 10px 16px;
    font-size: 0.88rem;
  }
  
  .input-group input,
  .input-group textarea {
    padding: 10px 12px;
    font-size: 0.9rem;
  }
  
  .profile-stats {
    flex-wrap: wrap;
    gap: 12px;
  }
  
  .stat-item {
    flex: 0 0 calc(50% - 6px);
    text-align: center;
  }
  
  .modal-content {
    padding: 20px 16px;
    margin: 16px;
  }
  
  .comment-list {
    padding-left: 0;
  }
  
  .comment {
    padding: 12px;
  }
}
