/*
Theme Name: Social Theme
Theme URI: https://tdbeta.cn
Author: TDBeta
Description: 小红书风格的社交化博客主题
Version: 1.0.0
License: GNU General Public License v2
License URI: http://www.gnu.org/licenses/gpl-2.0.html
Text Domain: social-theme
*/

/* 基础变量 */
:root {
  --primary-color: #ff4757;
  --primary-hover: #ff6b81;
  --bg-color: #f5f5f5;
  --card-bg: #ffffff;
  --text-primary: #333333;
  --text-secondary: #666666;
  --text-muted: #999999;
  --border-color: #eee;
  --shadow: 0 2px 12px rgba(0, 0, 0, 0.08);
  --radius: 12px;
  --gap: 16px;
}

/* 暗色模式 */
[data-theme="dark"] {
  --bg-color: #1a1a1a;
  --card-bg: #2d2d2d;
  --text-primary: #ffffff;
  --text-secondary: #cccccc;
  --text-muted: #999999;
  --border-color: #404040;
  --shadow: 0 2px 12px rgba(0, 0, 0, 0.3);
}

/* 重置样式 */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  background-color: var(--bg-color);
  color: var(--text-primary);
  line-height: 1.6;
}

a {
  text-decoration: none;
  color: inherit;
}

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

/* 导航栏 */
.navbar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: 60px;
  background: var(--card-bg);
  box-shadow: var(--shadow);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 20px;
  z-index: 1000;
}

.navbar-brand {
  font-size: 20px;
  font-weight: 700;
  color: var(--primary-color);
}

.navbar-nav {
  display: flex;
  gap: 24px;
  list-style: none;
}

.navbar-nav a {
  color: var(--text-secondary);
  font-size: 15px;
  transition: color 0.2s;
}

.navbar-nav a:hover,
.navbar-nav a.active {
  color: var(--primary-color);
}

.navbar-actions {
  display: flex;
  align-items: center;
  gap: 16px;
}

/* 主容器 */
.main-container {
  margin-top: 76px;
  padding: 0 16px;
  max-width: 1400px;
  margin-left: auto;
  margin-right: auto;
}

/* 瀑布流布局 */
.masonry-grid {
  column-count: 2;
  column-gap: var(--gap);
}

@media (min-width: 768px) {
  .masonry-grid {
    column-count: 3;
  }
}

@media (min-width: 1024px) {
  .masonry-grid {
    column-count: 4;
  }
}

@media (min-width: 1280px) {
  .masonry-grid {
    column-count: 5;
  }
}

/* 内容卡片 */
.content-card {
  break-inside: avoid;
  margin-bottom: var(--gap);
  background: var(--card-bg);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow);
  transition: transform 0.2s, box-shadow 0.2s;
  cursor: pointer;
}

.content-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12);
}

.card-media {
  position: relative;
  width: 100%;
  overflow: hidden;
}

.card-media img {
  width: 100%;
  display: block;
  transition: transform 0.3s;
}

.content-card:hover .card-media img {
  transform: scale(1.05);
}

.card-content {
  padding: 12px;
}

.card-title {
  font-size: 14px;
  font-weight: 600;
  line-height: 1.4;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  margin-bottom: 8px;
}

.card-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 12px;
  color: var(--text-muted);
}

.card-author {
  display: flex;
  align-items: center;
  gap: 6px;
}

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

.card-stats {
  display: flex;
  align-items: center;
  gap: 12px;
}

.card-stats .stat-item {
  display: flex;
  align-items: center;
  gap: 4px;
}

.card-stats svg {
  width: 14px;
  height: 14px;
}

/* 按钮样式 */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 8px 16px;
  border-radius: 20px;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s;
  border: none;
  outline: none;
}

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

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

.btn-outline {
  background: transparent;
  border: 1px solid var(--primary-color);
  color: var(--primary-color);
}

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

.btn-icon {
  width: 40px;
  height: 40px;
  padding: 0;
  border-radius: 50%;
  background: var(--bg-color);
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s;
}

.btn-icon:hover {
  background: var(--border-color);
}

.btn-icon svg {
  width: 20px;
  height: 20px;
  color: var(--text-secondary);
}

/* 发布按钮 */
.publish-btn {
  position: fixed;
  bottom: 80px;
  right: 24px;
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: var(--primary-color);
  color: white;
  border: none;
  box-shadow: 0 4px 12px rgba(255, 71, 87, 0.4);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.2s, box-shadow 0.2s;
  z-index: 100;
}

.publish-btn:hover {
  transform: scale(1.1);
  box-shadow: 0 6px 16px rgba(255, 71, 87, 0.5);
}

.publish-btn svg {
  width: 24px;
  height: 24px;
}

/* 底部导航（移动端） */
.bottom-nav {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  height: 60px;
  background: var(--card-bg);
  box-shadow: 0 -2px 12px rgba(0, 0, 0, 0.08);
  display: flex;
  align-items: center;
  justify-content: space-around;
  z-index: 1000;
}

.bottom-nav a {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  color: var(--text-muted);
  font-size: 10px;
  transition: color 0.2s;
}

.bottom-nav a:hover,
.bottom-nav a.active {
  color: var(--primary-color);
}

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

/* 用户主页 */
.user-profile {
  max-width: 800px;
  margin: 0 auto;
  padding: 20px;
}

.profile-header {
  text-align: center;
  padding: 40px 20px;
  background: var(--card-bg);
  border-radius: var(--radius);
  margin-bottom: 24px;
}

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

.profile-name {
  font-size: 24px;
  font-weight: 700;
  margin-bottom: 8px;
}

.profile-bio {
  color: var(--text-secondary);
  margin-bottom: 16px;
}

.profile-stats {
  display: flex;
  justify-content: center;
  gap: 40px;
  margin-bottom: 20px;
}

.profile-stats .stat {
  text-align: center;
}

.profile-stats .stat-num {
  font-size: 20px;
  font-weight: 700;
  color: var(--text-primary);
}

.profile-stats .stat-label {
  font-size: 12px;
  color: var(--text-muted);
}

/* 文章详情页 */
.post-detail {
  max-width: 800px;
  margin: 0 auto;
  padding: 20px;
}

.post-header {
  margin-bottom: 24px;
}

.post-title {
  font-size: 28px;
  font-weight: 700;
  line-height: 1.3;
  margin-bottom: 16px;
}

.post-meta {
  display: flex;
  align-items: center;
  gap: 16px;
  color: var(--text-muted);
  font-size: 14px;
}

.post-author {
  display: flex;
  align-items: center;
  gap: 8px;
}

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

.post-content {
  background: var(--card-bg);
  border-radius: var(--radius);
  padding: 24px;
  margin-bottom: 24px;
}

.post-content img {
  border-radius: 8px;
  margin: 16px 0;
}

.post-actions {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 40px;
  padding: 20px;
  background: var(--card-bg);
  border-radius: var(--radius);
  margin-bottom: 24px;
}

.action-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  color: var(--text-secondary);
  cursor: pointer;
  transition: color 0.2s;
}

.action-btn:hover,
.action-btn.active {
  color: var(--primary-color);
}

.action-btn svg {
  width: 28px;
  height: 28px;
}

.action-btn span {
  font-size: 12px;
}

/* 评论区 */
.comments-section {
  background: var(--card-bg);
  border-radius: var(--radius);
  padding: 24px;
}

.comments-header {
  font-size: 18px;
  font-weight: 600;
  margin-bottom: 20px;
}

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

.comment-item:last-child {
  border-bottom: none;
}

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

.comment-body {
  flex: 1;
}

.comment-author {
  font-weight: 600;
  font-size: 14px;
  margin-bottom: 4px;
}

.comment-text {
  font-size: 14px;
  color: var(--text-secondary);
  margin-bottom: 8px;
}

.comment-time {
  font-size: 12px;
  color: var(--text-muted);
}

/* 评论输入框 */
.comment-form {
  display: flex;
  gap: 12px;
  margin-top: 20px;
  padding-top: 20px;
  border-top: 1px solid var(--border-color);
}

.comment-input {
  flex: 1;
  padding: 12px 16px;
  border: 1px solid var(--border-color);
  border-radius: 20px;
  font-size: 14px;
  outline: none;
  transition: border-color 0.2s;
}

.comment-input:focus {
  border-color: var(--primary-color);
}

/* 私信页面 */
.messages-page {
  max-width: 800px;
  margin: 0 auto;
  padding: 20px;
}

.message-list {
  background: var(--card-bg);
  border-radius: var(--radius);
  overflow: hidden;
}

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

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

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

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

.message-name {
  font-weight: 600;
  margin-bottom: 4px;
}

.message-preview {
  font-size: 14px;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.message-time {
  font-size: 12px;
  color: var(--text-muted);
}

.message-unread {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--primary-color);
}

/* 搜索框 */
.search-box {
  position: relative;
  max-width: 400px;
}

.search-input {
  width: 100%;
  padding: 10px 16px 10px 40px;
  border: 1px solid var(--border-color);
  border-radius: 20px;
  font-size: 14px;
  outline: none;
  background: var(--bg-color);
  transition: border-color 0.2s;
}

.search-input:focus {
  border-color: var(--primary-color);
}

.search-icon {
  position: absolute;
  left: 14px;
  top: 50%;
  transform: translateY(-50%);
  width: 18px;
  height: 18px;
  color: var(--text-muted);
}

/* 加载更多 */
.load-more {
  text-align: center;
  padding: 40px 0;
}

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

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

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

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

.empty-state p {
  font-size: 16px;
}

/* 提示框 */
.toast {
  position: fixed;
  top: 80px;
  left: 50%;
  transform: translateX(-50%);
  padding: 12px 24px;
  background: rgba(0, 0, 0, 0.8);
  color: white;
  border-radius: 8px;
  font-size: 14px;
  z-index: 2000;
  opacity: 0;
  transition: opacity 0.3s;
}

.toast.show {
  opacity: 1;
}

/* 模态框 */
.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: 1500;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.3s, visibility 0.3s;
}

.modal-overlay.show {
  opacity: 1;
  visibility: visible;
}

.modal {
  background: var(--card-bg);
  border-radius: var(--radius);
  width: 90%;
  max-width: 500px;
  max-height: 80vh;
  overflow: auto;
  transform: scale(0.9);
  transition: transform 0.3s;
}

.modal-overlay.show .modal {
  transform: scale(1);
}

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

.modal-title {
  font-size: 18px;
  font-weight: 600;
}

.modal-close {
  width: 32px;
  height: 32px;
  border: none;
  background: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  transition: background 0.2s;
}

.modal-close:hover {
  background: var(--bg-color);
}

.modal-body {
  padding: 20px;
}

/* 表单样式 */
.form-group {
  margin-bottom: 16px;
}

.form-label {
  display: block;
  font-size: 14px;
  font-weight: 500;
  margin-bottom: 8px;
}

.form-input,
.form-textarea {
  width: 100%;
  padding: 12px 16px;
  border: 1px solid var(--border-color);
  border-radius: 8px;
  font-size: 14px;
  outline: none;
  transition: border-color 0.2s;
}

.form-input:focus,
.form-textarea:focus {
  border-color: var(--primary-color);
}

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

/* 响应式调整 */
@media (max-width: 768px) {
  .navbar-nav {
    display: none;
  }

  .main-container {
    padding-bottom: 70px;
  }

  .post-title {
    font-size: 22px;
  }

  .profile-stats {
    gap: 24px;
  }
}

/* 动画效果 */
@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.content-card {
  animation: fadeIn 0.4s ease-out;
}

/* 图片上传区域 */
.upload-area {
  border: 2px dashed var(--border-color);
  border-radius: var(--radius);
  padding: 40px;
  text-align: center;
  cursor: pointer;
  transition: border-color 0.2s, background 0.2s;
}

.upload-area:hover {
  border-color: var(--primary-color);
  background: rgba(255, 71, 87, 0.05);
}

.upload-area svg {
  width: 48px;
  height: 48px;
  color: var(--text-muted);
  margin-bottom: 12px;
}

.upload-area p {
  color: var(--text-muted);
  font-size: 14px;
}

/* 标签 */
.tag {
  display: inline-block;
  padding: 4px 12px;
  background: var(--bg-color);
  border-radius: 16px;
  font-size: 12px;
  color: var(--text-secondary);
  margin-right: 8px;
  margin-bottom: 8px;
}

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

/* 通知徽章 */
.badge {
  position: absolute;
  top: -4px;
  right: -4px;
  min-width: 16px;
  height: 16px;
  padding: 0 4px;
  background: var(--primary-color);
  color: white;
  font-size: 10px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* 关注按钮状态 */
.follow-btn {
  padding: 8px 20px;
  border-radius: 20px;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s;
}

.follow-btn.following {
  background: var(--bg-color);
  color: var(--text-secondary);
  border: 1px solid var(--border-color);
}

.follow-btn:not(.following) {
  background: var(--primary-color);
  color: white;
  border: none;
}

/* 点赞动画 */
@keyframes likeAnimation {
  0% { transform: scale(1); }
  25% { transform: scale(1.2); }
  50% { transform: scale(0.95); }
  100% { transform: scale(1); }
}

.like-btn.active svg {
  animation: likeAnimation 0.4s ease-out;
  fill: var(--primary-color);
  color: var(--primary-color);
}
