/* 全局重置 */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

/* 通用样式 */
.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 20px;
}

.btn {
  padding: 8px 16px;
  border: none;
  border-radius: 4px;
  cursor: pointer;
  font-size: 14px;
  transition: background-color 0.3s;
}

.primary-btn {
  background-color: #2563eb;
  color: white;
}

.primary-btn:hover {
  background-color: #1d4ed8;
}

/* 头部样式 */
.blog-header {
  background-color: #1e293b;
  color: white;
  padding: 20px 0;
  box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.header-inner {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.logo {
  font-size: 24px;
  font-weight: bold;
}

.mobile-menu-btn {
  display: none;
  background: transparent;
  border: none;
  color: white;
  font-size: 20px;
  cursor: pointer;
}

/* 主体样式 */
.blog-main {
  display: flex;
  gap: 30px;
  padding: 40px 0;
  min-height: calc(100vh - 180px);
}

/* 侧边栏 */
.blog-sidebar {
  width: 280px;
  flex-shrink: 0;
}

.sidebar-section {
  background-color: #f8fafc;
  border-radius: 8px;
  padding: 20px;
  margin-bottom: 20px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

.sidebar-section h3 {
  font-size: 18px;
  margin-bottom: 15px;
  color: #1e293b;
  padding-bottom: 8px;
  border-bottom: 2px solid #e2e8f0;
}

.category-list, .latest-posts {
  list-style: none;
}

.category-item, .latest-posts a {
  display: block;
  padding: 8px 0;
  color: #334155;
  text-decoration: none;
  border-radius: 4px;
  padding-left: 10px;
  transition: background-color 0.2s;
}

.category-item:hover, .latest-posts a:hover {
  background-color: #e2e8f0;
}

.category-item.active {
  background-color: #2563eb;
  color: white;
}

/* 文章列表 */
.posts-container {
  flex: 1;
}

.post-item {
  background-color: white;
  border-radius: 8px;
  padding: 25px;
  margin-bottom: 20px;
  box-shadow: 0 1px 4px rgba(0,0,0,0.1);
  transition: transform 0.2s, box-shadow 0.2s;
}

.post-item:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 8px rgba(0,0,0,0.1);
}

.post-title {
  font-size: 22px;
  color: #1e293b;
  margin-bottom: 10px;
  cursor: pointer;
}

.post-title:hover {
  color: #2563eb;
}

.post-meta {
  font-size: 14px;
  color: #64748b;
  margin-bottom: 15px;
}

.post-content-preview {
  color: #334155;
  line-height: 1.6;
  margin-bottom: 20px;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.post-actions {
  display: flex;
  gap: 10px;
}

.editBtn {
  background-color: #059669;
  color: white;
}

.editBtn:hover {
  background-color: #047857;
}

.deleteBtn {
  background-color: #dc2626;
  color: white;
}

.deleteBtn:hover {
  background-color: #b91c1c;
}

.empty {
  text-align: center;
  padding: 50px;
  color: #64748b;
  font-size: 16px;
}

/* 底部样式 */
.blog-footer {
  background-color: #1e293b;
  color: white;
  text-align: center;
  padding: 20px 0;
  font-size: 14px;
}

/* 弹窗样式 */
.modal {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0,0,0,0.5);
  z-index: 1000;
  overflow-y: auto;
}

.modal-content {
  background-color: white;
  margin: 50px auto;
  width: 90%;
  max-width: 700px;
  border-radius: 8px;
  box-shadow: 0 4px 20px rgba(0,0,0,0.2);
}

.detail-modal {
  max-width: 800px;
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 20px;
  border-bottom: 1px solid #e2e8f0;
}

.modal-header h2 {
  font-size: 20px;
  color: #1e293b;
}

.closeBtn {
  background: transparent;
  border: none;
  font-size: 24px;
  cursor: pointer;
  color: #64748b;
}

.closeBtn:hover {
  color: #1e293b;
}

.modal-form {
  padding: 20px;
}

.form-group {
  margin-bottom: 20px;
}

.form-group label {
  display: block;
  margin-bottom: 8px;
  font-weight: 500;
  color: #334155;
}

.form-input, .form-textarea {
  width: 100%;
  padding: 10px;
  border: 1px solid #e2e8f0;
  border-radius: 4px;
  font-size: 14px;
}

.form-textarea {
  resize: vertical;
}

.modal-body {
  padding: 20px;
}

.post-content {
  line-height: 1.8;
  color: #334155;
  margin-top: 20px;
  white-space: pre-wrap;
}

/* 响应式适配 */
@media (max-width: 900px) {
  .mobile-menu-btn {
    display: block;
  }

  .blog-main {
    flex-direction: column;
  }

  .blog-sidebar {
    width: 100%;
    display: none;
  }

  .blog-sidebar.show {
    display: block;
  }

  .header-inner {
    flex-wrap: wrap;
  }

  .main-nav {
    width: 100%;
    margin-top: 15px;
  }

  .post-item {
    padding: 20px;
  }
}

@media (max-width: 480px) {
  .logo {
    font-size: 20px;
  }

  .post-title {
    font-size: 18px;
  }

  .modal-content {
    margin: 20px auto;
  }
}