* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: Arial, "Malgun Gothic", sans-serif;
  background: #f3f5f7;
  color: #222;
}

a {
  color: #222;
  text-decoration: none;
}

a:hover {
  color: #326BC9;
  text-decoration: underline;
}

.top-bar {
  background: #326BC9;
  color: white;
  padding: 16px 24px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.top-bar h1 {
  margin: 0;
  font-size: 22px;
}

.top-menu a,
.top-menu span {
  color: white;
  margin-left: 12px;
  font-size: 14px;
}

.layout {
  width: 1100px;
  margin: 20px auto;
  display: grid;
  grid-template-columns: 260px 1fr;
  gap: 20px;
}

.single-content,
.admin-layout {
  width: 1000px;
  margin: 20px auto;
}

.sidebar,
.content {
  background: white;
  border: 1px solid #ddd;
  border-radius: 4px;
}

.sidebar-title {
  padding: 14px 16px;
  border-bottom: 1px solid #ddd;
  font-weight: bold;
  background: #fafafa;
}

.tree {
  padding: 12px 16px;
  font-size: 14px;
}

.tree ul {
  list-style: none;
  padding-left: 16px;
  margin: 6px 0;
}

.tree li {
  margin: 7px 0;
}

.folder {
  cursor: pointer;
  font-weight: bold;
}

.folder:hover {
  color: #326BC9;
  text-decoration: underline;
}

.children {
  display: none;
}

.active-board {
  font-weight: bold;
  color: #326BC9;
}

.open > .children {
  display: block;
}

.folder {
  cursor: pointer;
  font-weight: bold;
}

.folder:hover {
  color: #326BC9;
  text-decoration: underline;
}

.board-link {
  color: #222;
}

.content-header {
  padding: 18px 22px;
  border-bottom: 1px solid #ddd;
}

.content-header h2 {
  margin: 0;
  font-size: 22px;
}

.content-header p {
  margin-bottom: 0;
  color: #777;
  font-size: 13px;
}

.section {
  padding: 20px 22px;
  border-bottom: 1px solid #eee;
}

.section h3 {
  margin-top: 0;
  font-size: 17px;
  border-left: 4px solid #326BC9;
  padding-left: 8px;
}

.notice-box {
  background: #f8fff8;
  border: 1px solid #cfe8cf;
  padding: 14px;
  line-height: 1.6;
  font-size: 14px;
}

.quick-menu {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.quick-menu a,
.child-board-list a {
  display: inline-block;
  padding: 10px 14px;
  border: 1px solid #ccc;
  border-radius: 4px;
  background: #fafafa;
  margin: 4px;
}

.quick-menu a:hover,
.child-board-list a:hover {
  background: #326BC9;
  color: white;
  text-decoration: none;
}

.post-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}

.post-table th,
.post-table td {
  border-bottom: 1px solid #eee;
  padding: 12px 8px;
  text-align: left;
}

.post-table th {
  background: #fafafa;
}

.search-form {
  display: flex;
  gap: 8px;
}

.search-form input {
  flex: 1;
  padding: 10px;
}

.search-form button,
.write-form button,
.admin-form button,
.comment-form button {
  padding: 10px 16px;
  border: 0;
  background: #326BC9;
  color: white;
  cursor: pointer;
  border-radius: 4px;
}

.write-form {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.write-form input,
.write-form select,
.write-form textarea,
.admin-form input,
.admin-form select,
.comment-form textarea {
  padding: 10px;
  border: 1px solid #ccc;
  border-radius: 4px;
}

.check-label {
  display: block;
  margin: 6px 0;
}

.help-text {
  color: #777;
  font-size: 13px;
}

.post-content {
  min-height: 200px;
  line-height: 1.7;
  white-space: pre-wrap;
}

.file-list,
.comment-list {
  list-style: none;
  padding-left: 0;
}

.file-list li {
  padding: 8px 0;
}

.comment-list li {
  border-bottom: 1px solid #eee;
  padding: 12px 0;
}

.comment-list span {
  color: #777;
  font-size: 12px;
  margin-left: 8px;
}

.comment-form textarea {
  width: 100%;
  height: 80px;
  margin-bottom: 8px;
}

.admin-form {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.admin-form input,
.admin-form select {
  min-width: 180px;
}

.login-body {
  display: flex;
  justify-content: center;
  align-items: center;
  height: 100vh;
  background: #eef3ef;
}

.login-box {
  width: 360px;
  background: white;
  border: 1px solid #ddd;
  padding: 30px;
  border-radius: 6px;
  text-align: center;
}

.login-box input {
  width: 100%;
  padding: 12px;
  margin: 8px 0;
  border: 1px solid #ccc;
  border-radius: 4px;
}

.login-box button {
  width: 100%;
  padding: 12px;
  margin-top: 10px;
  background: #326BC9;
  color: white;
  border: 0;
  border-radius: 4px;
  cursor: pointer;
}

.link-button {
  background: none;
  border: 0;
  color: white;
  cursor: pointer;
  font-size: 14px;
}

@media (max-width: 900px) {
  .layout,
  .single-content,
  .admin-layout {
    width: 95%;
    display: block;
  }

  .sidebar {
    margin-bottom: 16px;
  }

  .top-bar {
    flex-direction: column;
    align-items: flex-start;
    gap: 10px;
  }

.board-create-form {
  display: block;
}

.board-create-box {
  margin-bottom: 12px;
}

.board-create-box label {
  display: block;
  margin-bottom: 6px;
  font-weight: bold;
  font-size: 14px;
}

.board-create-box select,
.board-create-box input {
  width: 360px;
  max-width: 100%;
  padding: 10px;
  border: 1px solid #ccc;
  border-radius: 4px;
}

.admin-board-tree ul {
  list-style: none;
  padding-left: 22px;
  margin: 6px 0;
}

.admin-board-tree > ul {
  padding-left: 0;
}

.admin-board-tree li {
  margin: 6px 0;
}

.admin-tree-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid #eee;
  padding: 8px 0;
}

.admin-tree-row form {
  margin: 0;
}

.admin-tree-row button {
  padding: 4px 8px;
}

.admin-board-tree {
  border: 1px solid #ddd;
  border-radius: 6px;
  background: #fff;
  padding: 10px;
  max-height: 520px;
  overflow-y: auto;
}

.admin-tree-root,
.admin-tree-children {
  list-style: none;
  padding-left: 0;
  margin: 0;
}

.admin-tree-children {
  display: none;
  margin-left: 24px;
  border-left: 1px dashed #ccc;
  padding-left: 14px;
}

.admin-tree-item.tree-open > .admin-tree-children {
  display: block;
}

.admin-tree-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 10px;
  border-bottom: 1px solid #f0f0f0;
}

.admin-tree-row:hover {
  background: #f6f9ff;
}

.admin-tree-name {
  display: flex;
  align-items: center;
  gap: 8px;
}

.tree-toggle {
  width: 24px;
  height: 24px;
  border: 1px solid #bbb;
  background: #fff;
  border-radius: 4px;
  cursor: pointer;
  font-weight: bold;
}

.tree-toggle:hover {
  background: #326BC9;
  color: white;
}

.tree-space {
  width: 24px;
  display: inline-block;
}

.tree-folder {
  color: #222;
}

.tree-file {
  color: #333;
}

.tree-count {
  font-size: 12px;
  color: #777;
  background: #f1f3f5;
  padding: 2px 6px;
  border-radius: 10px;
}

.tree-delete-form {
  margin: 0;
}

.tree-delete-btn {
  padding: 4px 8px;
  border: 1px solid #ccc;
  background: white;
  border-radius: 4px;
  cursor: pointer;
}

.tree-delete-btn:hover {
  background: #ffeded;
  border-color: #ff7777;
  color: #c00000;
}

.admin-board-tree {
  border: 1px solid #ddd;
  border-radius: 6px;
  background: #fff;
  padding: 10px;
  max-height: 520px;
  overflow-y: auto;
}

.admin-tree-root,
.admin-tree-children {
  list-style: none;
  padding-left: 0;
  margin: 0;
}

.admin-tree-children {
  display: none;
  margin-left: 26px;
  border-left: 1px dashed #ccc;
  padding-left: 12px;
}

.admin-tree-item.tree-open > .admin-tree-children {
  display: block;
}

.admin-tree-row {
  padding: 7px 10px;
  border-radius: 5px;
  cursor: context-menu;
}

.admin-tree-row:hover {
  background: #f3f7ff;
}

.admin-tree-name {
  display: flex;
  align-items: center;
  gap: 7px;
}

.tree-toggle {
  width: 22px;
  height: 22px;
  border: 1px solid #aaa;
  background: white;
  border-radius: 4px;
  cursor: pointer;
  font-weight: bold;
}

.tree-toggle:hover {
  background: #326BC9;
  color: white;
}

.tree-space {
  width: 22px;
  display: inline-block;
}

.tree-count {
  font-size: 12px;
  color: #666;
  background: #eef2f7;
  padding: 2px 6px;
  border-radius: 10px;
}

.context-menu {
  display: none;
  position: absolute;
  z-index: 9999;
  width: 110px;
  background: white;
  border: 1px solid #ccc;
  border-radius: 6px;
  box-shadow: 0 4px 12px rgba(0,0,0,0.15);
  overflow: hidden;
}

.context-menu button {
  display: block;
  width: 100%;
  padding: 9px 12px;
  border: 0;
  background: white;
  text-align: left;
  cursor: pointer;
  font-size: 14px;
}

.context-menu button:hover {
  background: #f1f5ff;
}

#boardTree {
  background: white;
  border: 1px solid #ddd;
  border-radius: 8px;
  padding: 12px;
}

.tree-list {
  list-style: none;
  padding-left: 18px;
}

.tree-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 7px;
  border-radius: 6px;
}

.tree-row:hover {
  background: #f4f7ff;
}

.tree-toggle {
  width: 22px;
  height: 22px;
  border: 1px solid #bbb;
  background: white;
  border-radius: 4px;
  cursor: pointer;
}

.tree-empty {
  width: 22px;
  display: inline-block;
}

.context-menu {
  display: none;
  position: absolute;
  width: 120px;
  background: white;
  border: 1px solid #ddd;
  border-radius: 8px;
  overflow: hidden;
  z-index: 9999;
  box-shadow: 0 4px 12px rgba(0,0,0,0.15);
}

.context-menu button {
  width: 100%;
  border: 0;
  background: white;
  padding: 10px;
  text-align: left;
  cursor: pointer;
}

.context-menu button:hover {
  background: #f3f6ff;
}

@media (max-width: 900px) {
  .layout,
  .single-content,
  .admin-layout {
    width: 95%;
    display: block;
  }

  .sidebar {
    margin-bottom: 16px;
  }

  .top-bar {
    flex-direction: column;
    align-items: flex-start;
    gap: 10px;
  }
}

}