/* 博客发布系统样式 */

/* 整体容器样式 */
.blog-container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 20px;
  background: #fff;
  box-shadow: 0 0 10px rgba(0, 0, 0, 0.05);
  border-radius: 8px;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  line-height: 1.6;
}

.blog-editor-column {
  width: 100%;
}

/* 固定工具栏样式 */
.toolbar-fixed {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 1000;
  background-color: #fff;
  box-shadow: 0 2px 5px rgba(0,0,0,0.1);
  padding: 2px 5px;
}

.editor-padding-top {
  padding-top: 36px; /* 工具栏高度 */
}

.toolbar-fixed .w-e-bar-item button {
  padding: 3px !important;
  font-size: 13px !important;
}

.toolbar-fixed .w-e-toolbar {
  height: auto !important;
  min-height: 30px !important;
}

.toolbar-fixed .w-e-bar-divider {
  height: 18px !important;
  margin: 3px 4px !important;
}

/* 页面标题样式 */
.page-header {
  margin-bottom: 30px;
  text-align: center;
}

.page-title {
  font-size: 28px;
  color: #333;
  margin-bottom: 10px;
}

.page-subtitle {
  font-size: 16px;
  color: #666;
}

/* 表单样式 */
.blog-form {
  background: #ffffff;
  padding: 20px;
  border-radius: 8px;
}

/* 工具栏隐藏时的样式 */
.blog-form.toolbar-hidden #toolbar-container {
  display: none;
}

.form-group {
  margin-bottom: 25px;
}

.form-group label {
  display: block;
  margin-bottom: 8px;
  font-weight: 600;
  color: #333;
}

.field-hint {
  display: block;
  margin-top: 5px;
  color: #777;
  font-size: 12px;
}

.form-group input[type="text"],
.form-group select {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid #ddd;
  border-radius: 4px;
  font-size: 15px;
  transition: border-color 0.3s;
}

.form-group input[type="text"]:focus,
.form-group select:focus {
  border-color: #007bff;
  outline: none;
  box-shadow: 0 0 0 3px rgba(0, 123, 255, 0.1);
}

/* 封面上传样式 */
.cover-upload {
  position: relative;
  width: 100%;
  min-height: 150px;
  border: 2px dashed #ddd;
  border-radius: 6px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  cursor: pointer;
  transition: all 0.3s;
  overflow: hidden;
  background: #f9f9f9;
  margin-bottom: 10px;
}

.cover-upload:hover {
  border-color: #007bff;
  background: #f0f7ff;
}

.cover-upload input[type="file"] {
  position: absolute;
  width: 100%;
  height: 100%;
  opacity: 0;
  cursor: pointer;
  z-index: 2;
}

.cover-upload-icon {
  font-size: 36px;
  color: #aaa;
  margin-bottom: 10px;
}

.cover-upload-text {
  color: #777;
  font-size: 14px;
}

/* 封面预览区域样式优化 */
.cover-preview {
  display: none;
  position: relative;
  width: 100%;
  max-width: 300px; /* 减小封面预览宽度 */
  margin: 10px 0 0 0;
  border-radius: 6px;
  overflow: hidden;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
  background: #f9f9f9;
  border: 1px solid #ddd;
}

.cover-preview.active {
  display: block;
}

.cover-preview img {
  max-width: 100%;
  width: 100%;
  display: block;
  height: auto;
  object-fit: contain;
  max-height: 200px; /* 减小封面图片高度 */
}

.cover-actions {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  background: rgba(0, 0, 0, 0.5);
  padding: 10px;
  display: flex;
  justify-content: center;
  gap: 10px;
  opacity: 0;
  transition: opacity 0.3s;
}

.cover-preview:hover .cover-actions {
  opacity: 1;
}

.cover-change,
.cover-remove {
  background: transparent;
  border: 1px solid #fff;
  color: #fff;
  padding: 5px 12px;
  border-radius: 4px;
  cursor: pointer;
  font-size: 12px;
  transition: all 0.2s;
}

.cover-change:hover {
  background: #fff;
  color: #333;
}

.cover-remove:hover {
  background: #ff3333;
  border-color: #ff3333;
}

/* 编辑器样式 */
.editor-area {
  border: 1px solid #ddd;
  border-radius: 6px;
  overflow: hidden;
}

#toolbar-container {
  border-bottom: 1px solid #eee;
}

.blog-editor {
  min-height: 300px;
  padding: 15px;
  font-size: 16px;
  line-height: 1.8;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

/* Wang Editor 编辑器增强样式 */
.w-e-toolbar {
  z-index: 10 !important;
  border: none !important;
}

.w-e-text-container {
  z-index: 9 !important;
  border: none !important;
  font-size: 16px !important;
  line-height: 1.8 !important;
}

.w-e-bar-item button {
  opacity: 1 !important;
  cursor: pointer !important;
  min-width: auto !important;
}

.w-e-bar-item button.disabled {
  opacity: 0.5 !important;
  cursor: not-allowed !important;
}

.w-e-drop-list,
.w-e-panel-container {
  z-index: 100 !important; 
}

/* 标签输入样式 */
.tags-input {
  display: flex;
  flex-wrap: wrap;
  border: 1px solid #ddd;
  border-radius: 4px;
  padding: 5px;
  min-height: 42px;
  background: #fff;
}

.tags-input:focus-within {
  border-color: #007bff;
  box-shadow: 0 0 0 3px rgba(0, 123, 255, 0.1);
}

.tag {
  display: inline-flex;
  align-items: center;
  background: #e3f2fd;
  color: #0277bd;
  padding: 2px 8px;
  border-radius: 16px;
  margin: 3px;
  font-size: 13px;
}

.remove-tag {
  margin-left: 5px;
  cursor: pointer;
  font-size: 14px;
  line-height: 1;
  font-weight: bold;
}

.remove-tag:hover {
  color: #ff3333;
}

#tag-input {
  flex: 1;
  border: none;
  outline: none;
  padding: 5px;
  font-size: 14px;
  min-width: 100px;
}

/* 表单操作按钮样式 */
.form-actions {
  display: flex;
  gap: 15px;
  flex-wrap: wrap;
  margin-top: 30px;
  justify-content: flex-end;
}

.form-actions button {
  padding: 12px 24px;
  border-radius: 50px;
  cursor: pointer;
  font-size: 15px;
  font-weight: 600;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
  border: none;
  box-shadow: 0 3px 6px rgba(0, 0, 0, 0.1), 0 1px 3px rgba(0, 0, 0, 0.08);
  min-width: 130px;
  letter-spacing: 0.5px;
  position: relative;
  overflow: hidden;
}

.form-actions button:active {
  transform: translateY(1px);
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.form-actions button .iconfont {
  font-size: 18px;
  transition: transform 0.3s ease;
}

.form-actions button:hover .iconfont {
  transform: scale(1.2);
}

.btn-submit {
  background: linear-gradient(135deg, #4caf50, #2e7d32);
  color: white;
}

.btn-submit:hover {
  background: linear-gradient(135deg, #43a047, #1b5e20);
  transform: translateY(-3px);
  box-shadow: 0 6px 12px rgba(0, 0, 0, 0.15), 0 4px 6px rgba(76, 175, 80, 0.2);
}

.btn-draft {
  background: linear-gradient(135deg, #ff9800, #e65100);
  color: white;
}

.btn-draft:hover {
  background: linear-gradient(135deg, #f57c00, #d84315);
  transform: translateY(-3px);
  box-shadow: 0 6px 12px rgba(0, 0, 0, 0.15), 0 4px 6px rgba(255, 152, 0, 0.2);
}

.btn-preview {
  background: linear-gradient(135deg, #2196f3, #0d47a1);
  color: white;
}

.btn-preview:hover {
  background: linear-gradient(135deg, #1e88e5, #0a3880);
  transform: translateY(-3px);
  box-shadow: 0 6px 12px rgba(0, 0, 0, 0.15), 0 4px 6px rgba(33, 150, 243, 0.2);
}

.btn-drafts {
  background: linear-gradient(135deg, #ffffff, #f5f5f5);
  color: #444;
  border: 1px solid #e0e0e0;
}

.btn-drafts:hover {
  background: linear-gradient(135deg, #f5f5f5, #e0e0e0);
  color: #222;
  transform: translateY(-3px);
  box-shadow: 0 6px 12px rgba(0, 0, 0, 0.08), 0 4px 6px rgba(0, 0, 0, 0.05);
}

/* 消息提示样式 */
.message {
  padding: 12px 15px;
  border-radius: 4px;
  margin-bottom: 20px;
  font-size: 15px;
}

.message.success {
  background: #e8f5e9;
  color: #2e7d32;
  border-left: 4px solid #4caf50;
}

.message.error {
  background: #ffebee;
  color: #c62828;
  border-left: 4px solid #f44336;
}

/* 草稿模态框样式 */
.modal-container {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.6);
  z-index: 2000 !important;
  align-items: center;
  justify-content: center;
}

.modal-container[style*="display: block"] {
  display: flex !important;
}

.modal-content {
  background: #fff;
  width: 90%;
  max-width: 600px;
  border-radius: 8px;
  padding: 20px;
  box-shadow: 0 5px 20px rgba(0, 0, 0, 0.3);
  max-height: 90vh;
  overflow-y: auto;
}

.modal-close {
  float: right;
  font-size: 24px;
  cursor: pointer;
  color: #999;
}

.modal-close:hover {
  color: #333;
}

.drafts-list-modal {
  margin-top: 20px;
}

.draft-item {
  padding: 15px;
  border-bottom: 1px solid #eee;
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
}

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

.draft-item.active {
  background: #f0f7ff;
}

.draft-title {
  font-weight: 500;
  flex: 1;
  color: #333;
}

.draft-date {
  color: #777;
  font-size: 13px;
}

.draft-item a {
  background: #f5f5f5;
  color: #444;
  text-decoration: none;
  padding: 5px 10px;
  border-radius: 4px;
  font-size: 13px;
}

.draft-item a:hover {
  background: #e0e0e0;
}

.no-drafts {
  text-align: center;
  padding: 30px 0;
  color: #777;
}

/* 预览模态框样式 */
.preview-modal {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.8);
  z-index: 2000 !important;
  overflow-y: auto;
}

.preview-modal.active {
  display: block !important;
}

.preview-content {
  background: #fff;
  width: 90%;
  max-width: 900px;
  margin: 40px auto;
  border-radius: 8px;
  box-shadow: 0 5px 20px rgba(0, 0, 0, 0.3);
  overflow: hidden;
  position: relative;
}

.preview-close {
  position: absolute;
  top: 15px;
  right: 15px;
  background: rgba(0, 0, 0, 0.6);
  color: #fff;
  border: none;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  font-size: 20px;
  line-height: 1;
  cursor: pointer;
  z-index: 10;
}

.preview-close:hover {
  background: rgba(0, 0, 0, 0.8);
}

/* 预览模态框中的封面样式 */
.preview-cover {
  width: 100%;
  max-width: 600px;
  margin: 0 auto;
  overflow: hidden;
  text-align: center;
  background: #f9f9f9;
}

.preview-cover img {
  max-width: 100%;
  height: auto;
  display: block;
  margin: 0 auto;
  max-height: 350px;
}

.preview-header {
  padding: 20px 30px;
  border-bottom: 1px solid #eee;
}

.preview-title {
  font-size: 28px;
  margin-bottom: 10px;
  color: #333;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  line-height: 1.4;
}

.preview-meta {
  display: flex;
  gap: 15px;
  color: #777;
  font-size: 14px;
}

.preview-body {
  padding: 30px;
  line-height: 1.8;
  min-height: 200px;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  font-size: 16px;
  color: #333;
}

.preview-actions {
  padding: 15px 30px;
  background: #f9f9f9;
  text-align: center;
  border-top: 1px solid #eee;
}

.preview-edit-btn {
  background: #2196f3;
  color: white;
  border: none;
  padding: 10px 20px;
  border-radius: 4px;
  cursor: pointer;
  font-size: 15px;
  display: inline-flex;
  align-items: center;
  gap: 5px;
}

.preview-edit-btn:hover {
  background: #1e88e5;
}

.tag-preview {
  display: inline-block;
  background: #e3f2fd;
  color: #0277bd;
  padding: 2px 8px;
  border-radius: 16px;
  margin: 0 2px;
  font-size: 13px;
}

/* 富文本编辑器内容样式 */
.preview-body img,
.preview-body p img {
  max-width: 70% !important; /* 调整为更合适的大小 */
  width: auto !important;
  height: auto !important;
  max-height: 350px !important; /* 增加高度 */
  display: block !important;
  margin: 10px auto !important; /* 居中显示 */
  border: 2px solid #1e88e5 !important; /* 添加蓝色边框 */
  border-radius: 8px !important; /* 添加圆角 */
  padding: 4px !important; /* 添加内边距 */
}

.preview-body table {
  border-collapse: collapse;
  width: 100%;
  margin: 15px 0;
}

.preview-body table td,
.preview-body table th {
  border: 1px solid #ddd;
  padding: 8px;
}

.preview-body blockquote {
  background: #f9f9f9;
  border-left: 4px solid #ccc;
  margin: 15px 0;
  padding: 10px 15px;
  color: #666;
  font-style: italic;
  line-height: 1.6;
}

.preview-body pre {
  background: #f5f5f5;
  border-radius: 4px;
  padding: 15px;
  overflow: auto;
  font-family: SFMono-Regular, Consolas, "Liberation Mono", Menlo, monospace;
  font-size: 14px;
  line-height: 1.5;
}

.preview-body p {
  margin-bottom: 1.2em;
  line-height: 1.8;
}

.preview-body h1, .preview-body h2, .preview-body h3, 
.preview-body h4, .preview-body h5, .preview-body h6 {
  margin-top: 1.5em;
  margin-bottom: 0.8em;
  line-height: 1.4;
  font-weight: 600;
  color: #333;
}

.preview-body h1 { font-size: 28px; }
.preview-body h2 { font-size: 24px; }
.preview-body h3 { font-size: 20px; }
.preview-body h4 { font-size: 18px; }
.preview-body h5 { font-size: 16px; font-weight: bold; }
.preview-body h6 { font-size: 16px; font-weight: bold; color: #555; }

.preview-body ul, .preview-body ol {
  padding-left: 2em;
  margin-bottom: 1.2em;
}

.preview-body li {
  margin-bottom: 0.5em;
}

.preview-body a {
  color: #1e88e5;
  text-decoration: none;
}

.preview-body a:hover {
  text-decoration: underline;
}

.preview-body strong, .preview-body b {
  font-weight: 600;
}

.preview-body em, .preview-body i {
  font-style: italic;
}

/* 编辑器内容样式 - 应用到Wang Editor */
.w-e-text-container .w-e-text p {
  margin-bottom: 1.2em;
  line-height: 1.8;
}

.w-e-text-container .w-e-text h1,
.w-e-text-container .w-e-text h2,
.w-e-text-container .w-e-text h3,
.w-e-text-container .w-e-text h4,
.w-e-text-container .w-e-text h5,
.w-e-text-container .w-e-text h6 {
  margin-top: 1.5em;
  margin-bottom: 0.8em;
  line-height: 1.4;
  font-weight: 600;
  color: #333;
}

.w-e-text-container .w-e-text h1 { font-size: 28px; }
.w-e-text-container .w-e-text h2 { font-size: 24px; }
.w-e-text-container .w-e-text h3 { font-size: 20px; }
.w-e-text-container .w-e-text h4 { font-size: 18px; }
.w-e-text-container .w-e-text h5 { font-size: 16px; font-weight: bold; }
.w-e-text-container .w-e-text h6 { font-size: 16px; font-weight: bold; color: #555; }

.w-e-text-container .w-e-text ul,
.w-e-text-container .w-e-text ol {
  padding-left: 2em;
  margin-bottom: 1.2em;
}

.w-e-text-container .w-e-text li {
  margin-bottom: 0.5em;
}

.w-e-text-container .w-e-text blockquote {
  background: #f9f9f9;
  border-left: 4px solid #ccc;
  margin: 15px 0;
  padding: 10px 15px;
  color: #666;
  font-style: italic;
}

.w-e-text-container .w-e-text pre {
  background: #f5f5f5;
  border-radius: 4px;
  padding: 15px;
  overflow: auto;
  font-family: SFMono-Regular, Consolas, "Liberation Mono", Menlo, monospace;
  font-size: 14px;
  line-height: 1.5;
}

/* 字体和文本样式设置 */
.w-e-menu .w-e-droplist ul.w-e-list li p {
  font-size: 14px !important;
  padding: 5px 10px !important;
}

/* 字号菜单样式 */
.w-e-menu .w-e-droplist ul.w-e-list li.w-e-item-selected {
  background-color: #f1f1f1 !important;
}

/* 响应式调整字体大小 */
@media (max-width: 768px) {
  .form-actions {
    flex-direction: column;
  }
  
  .form-actions button {
    width: 100%;
    justify-content: center;
  }
  
  .draft-item {
    flex-direction: column;
    align-items: flex-start;
  }
  
  .preview-content {
    width: 95%;
    margin: 20px auto;
  }
  
  .preview-header,
  .preview-body {
    padding: 15px;
  }
  
  .preview-title {
    font-size: 24px;
  }
  
  .blog-editor {
    font-size: 15px;
  }
  
  .preview-body {
    font-size: 15px;
  }
  
  .preview-body h1 { font-size: 24px; }
  .preview-body h2 { font-size: 22px; }
  .preview-body h3 { font-size: 18px; }
  
  .w-e-text-container .w-e-text h1 { font-size: 24px; }
  .w-e-text-container .w-e-text h2 { font-size: 22px; }
  .w-e-text-container .w-e-text h3 { font-size: 18px; }
}

.upload-loading {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(255, 255, 255, 0.8);
  display: flex;
  justify-content: center;
  align-items: center;
  font-size: 16px;
  color: #333;
  z-index: 5;
}

/* 上传图片样式调整 - 增加选择器优先级和!important */
.w-e-text-container .w-e-text img,
.w-e-text-container .w-e-text p img,
.w-e-text img,
#editor-container img {
  max-width: 70% !important; /* 调整为更合适的大小 */
  width: auto !important;
  height: auto !important;
  max-height: 350px !important; /* 增加高度 */
  display: block !important;
  margin: 10px auto !important; /* 居中显示 */
  border: 2px solid #1e88e5 !important; /* 添加蓝色边框 */
  border-radius: 8px !important; /* 添加圆角 */
  padding: 4px !important; /* 添加内边距 */
}

.preview-body img,
.preview-body p img,
.blog-preview img {
  max-width: 70% !important; /* 调整为更合适的大小 */
  width: auto !important;
  height: auto !important;
  max-height: 350px !important; /* 增加高度 */
  display: block !important;
  margin: 10px auto !important; /* 居中显示 */
  border: 2px solid #1e88e5 !important; /* 添加蓝色边框 */
  border-radius: 8px !important; /* 添加圆角 */
  padding: 4px !important; /* 添加内边距 */
}
