body {
  font-family: "Microsoft YaHei", sans-serif;
  background-color: #f5f6fa;
  margin: 0;
}

/* 模态框 */
#modal {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.4);
  justify-content: center;
  align-items: center;
}

#modal .modal-content {
  background: white;
  border-radius: 8px;
  padding: 20px;
  width: 320px;
  text-align: center;
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.3);
}

#modal input {
  width: 90%;
  padding: 8px;
  margin-top: 10px;
  border-radius: 5px;
  border: 1px solid #ccc;
}

#tagModal {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.4);
  justify-content: center;
  align-items: center;
  z-index: 1100;
}

#tagModal .modal-content {
  background: white;
  border-radius: 8px;
  padding: 20px 30px;
  width: 400px;
  max-height: 70vh;
  overflow-y: auto;
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.2);
}

.tag-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 10px 0 15px 0;
}

.tag {
  background: linear-gradient(135deg, #8ec5fc, #e0c3fc);
  padding: 6px 12px;
  border-radius: 6px;
  font-size: 14px;
  color: #333;
  display: flex;
  align-items: center;
  gap: 6px;
  transition: all 0.3s ease;
}
.tag:hover {
  transform: scale(1.05); /* 轻微放大 */
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2); /* 阴影增强 */
  background: linear-gradient(135deg, #a1c4fd, #c2e9fb); /* 渐变颜色变化 */
}

.tag button {
  margin-top: -6px;
  background: none;
  border: none;
  color: rgba(255, 255, 255, 0);
  font-weight: bold;
  cursor: pointer;
  width: 20px;
  height: 35px;
  transition: all 0.3s ease;
}
.tag button:hover {
  background-color: inherit !important;
  color: red;
  font-size: 19px;
}

.tag-input-area {
  display: flex;
  gap: 10px;
}

.tag-input-area input {
  flex: 1;
  padding: 6px;
  border: 1px solid #ccc;
  border-radius: 6px;
}

.tag-input-area button {
  background: linear-gradient(135deg, #73c8d2, #8ec5fc);
  border: none;
  border-radius: 6px;
  color: white;
  cursor: pointer;
}

@media (min-width: 769px) {
  .workspace {
    display: flex;
    flex-direction: row;
    min-height: 100vh;
    width: 100%;
  }

  .sidebar {
    position: fixed;
    /* top: 15px; */
    left: 0;
    width: 17%;
    height: 100vh;
    background-color: #ffffff;
    border-right: 1px solid #ddd;
    box-shadow: 2px 0 8px rgba(0, 0, 0, 0.05);
    padding: 16px;
    overflow-y: auto;
    z-index: 100;
  }

  .tab-buttons {
    display: flex;
    justify-content: space-around;
    margin-bottom: 10px;
  }

  .tab-buttons button {
    flex: 1;
    margin: 0 4px;
    padding: 8px;
    background: #e9e6f5;
    border: none;
    border-radius: 4px;
    cursor: pointer;
  }

  .tab-buttons button.active {
    background: #6f42c1;
    color: white;
  }

  .article-list {
    margin-top: 10px;
    max-height: calc(100vh - 160px);
    overflow-y: auto;
  }

  .article-item {
    padding: 8px;
    border-bottom: 1px solid #eee;
    cursor: pointer;
    font-size: 15px;
  }

  .article-item:hover {
    background: #9ecfd4;
  }

  .article-item.active {
    background-color: #70b2b2;
    border-left: 2px solid #016b61;
    transition: all 0.2s ease;
  }

  #toolbar-container {
    position: fixed;
    top: 0px;
    left: 325px;
    /* 与 sidebar 保持对齐 */
    width: 1354px;
    height: 100px;
    /* 与编辑区宽度一致 */
    background: white;
    z-index: 999;
    border-bottom: 1px solid #ddd;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.08);
  }

  #editor-wrapper {
    display: none;
    position: relative;
    width: 78%;
    top: 110px;
    left: 325px;
    padding: 20px;
    background: white;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
    /* margin: 16px; */
    height: auto;
  }

  #editor-container {
    min-height: 680px;
    padding: 16px;
    border-bottom: #59309c solid 3px;
  }

  .button_list {
    display: flex;
    margin-top: 15px;
  }

  button {
    background: #6f42c1;
    color: white;
    border: none;
    border-radius: 6px;
    padding: 10px 18px;
    cursor: pointer;
    transition: background-color 0.2s ease;
  }

  button:hover {
    background-color: #59309c;
  }

  #saveBtn {
    margin-right: 15px;
  }

  #functionDiv {
    display: none;
    margin-top: 10px;
  }

  #functionDiv button {
    margin: 5px;
    background-color: #4e56c0;
    color: white;
    border: none;
    border-radius: 6px;
    padding: 8px 14px;
    cursor: pointer;
    transition: background-color 0.2s ease;
  }

  #functionDiv button:hover {
    background-color: #59309c;
  }

  /* 摘要部分 */
  #summary-container {
    height: 50px;
    background: #fafafa;
    margin-left: 12px;
    padding: 8px 12px;
    border-bottom: #4e56c0 solid 1px;
  }

  #summary-container span {
    color: #ccc;
  }

  #summaryInput {
    margin-top: 5px;
    width: 100%;
    font-size: 15px;
    font-family: "Microsoft YaHei", sans-serif;
    border: none;
    outline: none;
    background: transparent;
  }

  #summaryInput::placeholder {
    color: #aaa;
  }

  #setCoverimg {
    background-color: #70b2b2;
  }

  /* 封面模态框 */
  #coverModal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.4);
    justify-content: center;
    align-items: center;
    z-index: 9999;
  }

  #coverModal .modal-content {
    background: white;
    border-radius: 8px;
    padding: 20px;
    width: 320px;
    text-align: center;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.3);
  }

  #coverModal input {
    width: 90%;
    padding: 8px;
    margin-top: 10px;
    border-radius: 5px;
    border: 1px solid #ccc;
  }
}

@media (max-width: 768px) {
  .workspace {
    display: flex;
    flex-direction: column;
  }

  .sidebar {
    width: 100%;
    background: white;
    /* padding: 10px; */
    border-bottom: 1px solid #ddd;
    border-radius: 10px;
  }

  #drag-bar {
    display: none;
  }

  .tab-buttons {
    margin-top: 15px;
    display: flex;
    /* margin-bottom: 4px; */
  }

  .tab-buttons button {
    padding: 6px;
    width: 70px;
    margin: 0 3px;
    background: #e9e6f5;
    border: none;
    border-radius: 4px;
    cursor: pointer;
  }

  .tab-buttons button.active {
    background: #6f42c1;
    color: white;
  }

  #editor-wrapper {
    /* margin: 10px auto; */
    width: 100%;
    background: white;
    border-radius: 8px;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.08);
  }

  #editor-container {
    min-height: 380px;
    padding: 12px;
  }

  .button_list {
    display: flex;
    justify-content: center;
    margin-bottom: 20px;
  }

  .button_list button {
    flex: 1;
    margin: 0 8px;
    padding: 5px;
    background: #6f42c1;
    border: none;
    color: white;
    border-radius: 6px;
    font-size: 13px;
  }

  button {
    background: #6f42c1;
    color: white;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    transition: background-color 0.2s ease;
  }

  button:hover {
    background-color: #59309c;
  }

  #functionDiv {
    display: none;
    margin-top: 10px;
    border-bottom: #ff8f8f solid 2px;
    /* text-align: center; */
  }

  #functionDiv button {
    margin: 5px;
    background-color: #6f42c1;
    color: white;
    border: none;
    border-radius: 6px;
    width: 85px;
    height: 30px;
    cursor: pointer;
    transition: background-color 0.2s ease;
  }

  #functionDiv button:hover {
    background-color: #59309c;
  }

  #article-list {
    min-height: 50px;
    margin-left: 15px;
    border-bottom: #ddd solid 1px;
  }

  .article-item {
    padding: 5px;
    border-bottom: 1px solid #eee;
    cursor: pointer;
    font-size: 14px;
    margin-left: -15px;
  }

  .article-item:hover {
    background: #f4f0ff;
  }

  .article-item.active {
    background-color: #f0eaff;
    border-left: 2px solid #6f42c1;
    /* font-weight: bold; */
    transition: all 0.2s ease;
  }

  #addNewArticle {
    background-color: #4e56c0 !important;
    width: 70px !important;
    font-size: 12px !important;
  }

  /* 摘要部分 */
  #summary-container {
    margin-left: 15px;
    background: #fafafa;
    border: 1px solid #ddd;
    border-radius: 6px;
    padding: 8px 12px;
  }

  #summaryInput {
    width: 100%;
    font-size: 15px;
    font-family: "Microsoft YaHei", sans-serif;
    border: none;
    outline: none;
    background: transparent;
  }

  #summaryInput::placeholder {
    color: #aaa;
  }

  #summary-container span {
    color: #ccc;
  }

  /* 封面模态框 */
  #coverModal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.4);
    justify-content: center;
    align-items: center;
    z-index: 9999;
  }

  #coverModal .modal-content {
    background: white;
    border-radius: 8px;
    padding: 20px;
    width: 320px;
    text-align: center;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.3);
  }

  #coverModal input {
    width: 90%;
    padding: 8px;
    margin-top: 10px;
    border-radius: 5px;
    border: 1px solid #ccc;
  }
}
