/* IMPORT FONTS */
@import url("https://fonts.googleapis.com/css2?family=Noto+Sans+KR:wght@100..900&family=Noto+Sans:ital,wght@0,100..900;1,100..900&display=swap");

/* RESET CSS */
* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  font-family: inherit;
  font-size: inherit;
}

body {
  font-family: "Noto Sans KR", "Noto Sans", sans-serif;
  font-size: var(--font-size-md);
}

button {
  background-color: transparent;
  border: none;
  cursor: pointer;
}

a {
  text-decoration: none;
  color: var(--color-primary);
}

ul {
  list-style: none;
  padding: 0;
}

input {
  border: none;
  resize: none;
  outline: none;
  overflow: hidden; /* 스크롤바 숨기기 */
  height: auto;
}

/* ROOT */
:root {
  /* color */
  --color-primary: #37352f;
  --color-secondary: #5f5e5b;
  --color-tertiary: #969692;
  --color-accent: #1d1b17;
  --color-background-primary: #f0f0ed;
  --color-background-accent: #f7f7f5;
  --color-border: #e2e2e1;

  /* font-size */
  --font-size-lg: 32px;
  --font-size-md: 14px;
  --font-size-sm: 12px;
}

/* CUSTOM SCROLL BAR */
::-webkit-scrollbar {
  width: 9px;
}
::-webkit-scrollbar-track {
  background-color: #f0f0f0;
  border-radius: 10px;
}
::-webkit-scrollbar-thumb {
  background-color: #c0c0c0;
  border-radius: 10px;
}
::-webkit-scrollbar-thumb:hover {
  background-color: #a0a0a0;
}

/* COMMON CLASS */
.icon {
  width: 18px;
  height: 18px;
  margin-right: 5px;
}

.toggle-icon {
  width: 18px;
  height: 18px;
  margin-right: 8px; /*김수현 5px에서 변경 후 애니 추가*/
  transition: transform 0.3s ease;
  transform: rotate(-90deg);
}

.toggle-icon.active {
  transform: rotate(0deg); /* 하위 페이지가 열리면 아래로 회전 */
}

.hidden {
  display: none;
}

.flex {
  display: flex;
  align-items: center;
  padding-left: 5px;
  padding-right: 5px;
  cursor: pointer; /*포인터 추가*/
}
.flex:hover {
  background-color: var(--color-border);
  border-radius: 4px;
}
.flex:active {
  background-color: var(--color-border);
  font-weight: bold;
}

.relative {
  position: relative;
}

.indent {
  padding-left: 8px; /* .flex와 정렬을 맞추기 위해 */
}

/* 페이지 삭제 할 때 */
.icon__delete {
  display: flex;
}

.icon__delete.hidden {
  display: none; /* 아이콘 숨기기 */
}

.icon__delete:hover {
  cursor: pointer; /* 포인터 추가 */
  filter: invert(40%) sepia(71%) saturate(6175%) hue-rotate(347deg)
    brightness(109%) contrast(101%);

  /* 송원 추가 : 휴지통 아이콘에 마우스 올렸을 때 색상 변경 */
}

.modal {
  display: none;
  position: fixed;
  z-index: 1000;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.5);
}

.modal-content {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  background-color: #fff;

  border-radius: 4px;
  text-align: center;
  width: 310px;
  padding: 50px 0;

  font-weight: 700;
}

.modal-btn {
  margin-top: 30px;
  padding: 10px 0;
  width: 100px;
  border: none;
  border-radius: 4px;
  cursor: pointer;
}

.confirm {
  background-color: #ff2a2a;
  color: #fff;
  margin-right: 10px;
}

.cancel {
  background-color: var(--color-border);
  color: #000;
}

.alert-modal {
  display: none;
  position: fixed;
  z-index: 1000;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.5);
}

.alert-modal-content {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  background-color: #fff;
  padding: 50px 0;
  border-radius: 4px;
  text-align: center;
  width: 310px;
  font-weight: 700;
}

.alert-close-btn {
  width: 150px;
  margin-top: 30px;
  padding: 10px;
  border: none;
  border-radius: 4px;
  cursor: pointer;
  background-color: var(--color-border);
  color: #000;
}

/* 하위 페이지가 없을 때 */
.no-sub-pages {
  margin-left: 20px;
  font-size: var(--font-size-sm);
  color: var(--color-tertiary);
  padding: 8px 0;
  width: 100%;
}

/* WRAPPER */
#wrapper {
  display: flex;
  flex-direction: row;
}

/* ASIDE */
#side-bar {
  position: sticky;
  top: 0;
  width: 248px;
  height: 100vh;
  background-color: var(--color-background-accent);
  border-right: 1px solid var(--color-border);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  padding: 0 8px;
  transition: transform 0.3s ease, width 0.3s ease;
  transform: translateX(0);
}

.side-bar__user {
  height: 44px;
  line-height: 44px;
  font-size: var(--font-size-md);
  padding: 0 13px;
}
.side-bar__wrapper {
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  position: relative;

  overflow-x: hidden;
  overflow-y: auto; /* 사이드바 내에서 스크롤 가능하도록 설정 */
  margin-bottom: 40px;
}

.side-bar__nav-list {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

/* 리스트 이름의 길이가 길어지면 말 줄임표로 대체 */
.doc-item {
  display: block;
  width: 100%;
  padding-top: 5px;
  padding-bottom: 5px;
  padding-right: 20px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.doc-item__add {
  display: flex;
  align-items: center;
  position: absolute;
  right: 0;
  top: 5px;
  opacity: 0;
  transition: all 0.1s;
}
.flex:hover .doc-item__add {
  opacity: 1;
}

.selected {
  background-color: var(--color-border);
  font-weight: bold;
  border-radius: 4px;
}

.side-bar__new-page {
  width: 174px;
  height: 40px;
  background-color: var(--color-background-accent);
  position: fixed;
  bottom: 5px;
}

#new-page__button {
  width: 100%;
  display: flex;
  align-items: center;
  height: 100%;
  padding-left: 10px;
  position: absolute;
  left: 5px;
  bottom: -1px;
}
#new-page__button::before {
  content: "";
  width: 100%;
  position: absolute;
  top: -5px;
  left: 0;
  border: 1px solid var(--color-border);
}
#new-page__button:hover {
  background-color: var(--color-border);
  border-radius: 4px;
}

/* MAIN */
#doc {
  width: 100%;
  /* 사이드바 모션 */
  transition: margin-left 0.3s ease;
  display: flex;
  flex-direction: column;
  align-items: center;
  position: relative;
}

.doc__title-box {
  display: flex;
  gap: 10px;
}
#doc__title {
  padding: 3px 6px;
  position: relative;
}
#doc__title:hover {
  background-color: var(--color-background-primary);
  border-radius: 4px;
}
#doc__title:not(:last-child):after {
  display: block;
  content: "/";
  position: absolute;
  top: 2px;
  right: -8px;
}

.doc__header {
  width: 100%;
  height: 44px;
  padding: 0 20px;
}

.doc__header > form {
  height: 44px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.doc__article {
  width: 60%;
}

.doc__article-title {
  margin-top: 70px;
  margin-bottom: 30px;
}

#doc-title__input {
  outline: none;
  width: 100%;
  font-size: var(--font-size-lg);
  font-weight: 700;
  word-wrap: break-word;
  white-space: pre-wrap;
}

#doc-contents {
  outline: none;
  width: 100%;
  margin-bottom: 200px;
}

#doc-title__input[data-placeholder]:empty::before,
#doc-contents[data-placeholder]:empty::before {
  content: attr(data-placeholder);
  color: var(--color-tertiary);
  pointer-events: none;
}

#doc-title__input.has-content[data-placeholder]:empty::before,
#doc-contents.has-content[data-placeholder]:empty::before {
  display: none; /* .has-content 클래스가 있을 때는 placeholder 숨기기 */
}

.doc__footer {
  position: absolute;
  width: 60%;
  bottom: 80px;
  left: 20%;
}

#toTop {
  font-size: 40px;
  position: fixed;
  bottom: 5%;
  right: 2%;
  cursor: pointer;
  transition: all 0.2s;
}
#toTop:hover {
  transform: scale(1.2);
}

.doc__childDocs {
  display: flex;
  flex-wrap: wrap;
  gap: 15px;
}

.doc__childDoc {
  display: flex;
  align-items: center;
  border-radius: 8px;
  box-shadow: 0px 3px 4px 1px rgba(0, 0, 0, 0.1);
  padding: 7px 15px;
  font-size: var(--font-size-md);
  cursor: pointer;
}
.doc__childDoc:hover {
  transform: translateY(2px);
  box-shadow: 0px 1px 2px rgba(0, 0, 0, 0.2);
  border-radius: 4px;
}

/* 사이드바 열고 닫기 */
.side-bar__header {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.close-btn,
.open-btn {
  cursor: pointer;
}

.open-btn {
  position: fixed;
  top: 12px;
  left: 15px;
  z-index: 1000;
}

#side-bar.closed {
  transform: translateX(-100%); /* 화면 왼쪽으로 슬라이드 */
  width: 0;
  margin-right: 15px;
}

/* 사이드바 위로 마우스를 올려야 close-sidaebar-btn이 보이도록 */
#close-sidebar-btn {
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.3s ease;
}

#side-bar:hover #close-sidebar-btn {
  opacity: 1;
  visibility: visible;
  transition: opacity 0.3s ease;
}
