@import url("https://fonts.googleapis.com/css2?family=Roboto:wght@700&display=swap");
@import url("https://fonts.googleapis.com/css2?family=Edu+QLD+Hand:wght@400..700&display=swap");

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: "Roboto", sans-serif;
  background-color: #34586e;
  display: flex;
  height: 100vh;
  overflow: hidden;
}

.sidebar {
  width: 280px;
  background-color: #33322e;
  padding: 20px;
  overflow-y: auto;
  border-right: 4px solid #f9f3e5;
}

.new-note-btn {
  width: 100%;
  padding: 15px;
  background-color: #f9f3e5;
  border: 3px solid #33322e;
  border-radius: 10px;
  font-family: "Roboto", sans-serif;
  font-weight: bold;
  font-size: 16px;
  color: #33322e;
  cursor: pointer;
  transition: all 0.3s ease;
  box-shadow: 3px 3px 0px #f4d799;
  margin-bottom: 20px;
}

.new-note-btn:hover {
  transform: translateY(-2px);
  box-shadow: 5px 5px 0px #f4d799;
}

.notes-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.note-item {
  padding: 12px;
  background-color: #f9f3e5;
  border: 2px solid #33322e;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.2s ease;
  position: relative;
}

.note-item:hover {
  background-color: #f4d799;
  transform: translateX(5px);
}

.note-item.active {
  background-color: #8cd4cb;
  border-width: 3px;
}

.note-item-title {
  font-weight: bold;
  color: #33322e;
  margin-bottom: 5px;
  font-size: 14px;
}

.note-item-preview {
  font-size: 12px;
  color: #33322e;
  opacity: 0.7;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.note-item-delete {
  position: absolute;
  top: 8px;
  right: 8px;
  background: none;
  border: none;
  color: #33322e;
  cursor: pointer;
  font-size: 14px;
  opacity: 0;
  transition: all 0.2s ease;
}

.note-item:hover .note-item-delete {
  opacity: 1;
}

.note-item-delete:hover {
  color: #d32f2f;
  transform: scale(1.2);
}

.main-content {
  flex: 1;
  display: flex;
  flex-direction: column;
  background-color: #fff0ee;
}

.toolbar {
  background-color: #33322e;
  padding: 10px 20px;
  display: flex;
  align-items: center;
  gap: 5px;
  border-bottom: 4px solid #f9f3e5;
  flex-wrap: wrap;
}

.tool-btn {
  width: 36px;
  height: 36px;
  background-color: #f9f3e5;
  border: 2px solid #33322e;
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.2s ease;
  color: #33322e;
  font-size: 14px;
}

.tool-btn:hover {
  background-color: #f4d799;
  transform: translateY(-2px);
}

.tool-btn.active {
  background-color: #8cd4cb;
}

.format-select {
  padding: 8px 12px;
  background-color: #f9f3e5;
  border: 2px solid #33322e;
  border-radius: 6px;
  font-family: "Roboto", sans-serif;
  font-weight: bold;
  color: #33322e;
  cursor: pointer;
  font-size: 14px;
}

.separator {
  width: 2px;
  height: 30px;
  background-color: #f9f3e5;
  margin: 0 5px;
}

.note-title {
  padding: 20px 30px;
  font-size: 28px;
  font-weight: bold;
  border: none;
  outline: none;
  background: transparent;
  color: #33322e;
  font-family: "Roboto", sans-serif;
  border-bottom: 3px solid #f6a89e;
  cursor: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" width="20" height="20"><text y="20" font-size="20" fill="black">|</text></svg>'),
    text;
  caret-color: #000;
}

.note-title::placeholder {
  color: #33322e;
  opacity: 0.5;
}

.editor {
  flex: 1;
  padding: 30px;
  overflow-y: auto;
  outline: none;
  font-family: "Edu QLD Hand", cursive;
  font-size: 18px;
  line-height: 1.8;
  color: #33322e;
  cursor: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" width="20" height="20"><text y="20" font-size="20" fill="black">|</text></svg>'),
    text;
  caret-color: #000;
}

.editor:empty:before {
  content: "Start typing your note...";
  color: #33322e;
  opacity: 0.4;
}

.editor h1,
.editor h2,
.editor h3 {
  font-family: "Roboto", sans-serif;
  margin: 15px 0;
}

.editor ul,
.editor ol {
  margin-left: 30px;
  margin-bottom: 15px;
}

.editor a {
  color: #34586e;
  text-decoration: underline;
}

.editor code {
  background-color: #d0f4f0;
  padding: 2px 6px;
  border-radius: 4px;
  font-family: "Courier New", monospace;
  border: 1px solid #8cd4cb;
}

.editor pre {
  background-color: #d0f4f0;
  padding: 15px;
  border-radius: 8px;
  border: 2px solid #8cd4cb;
  overflow-x: auto;
  margin: 15px 0;
}

.editor::-webkit-scrollbar {
  width: 10px;
}

.editor::-webkit-scrollbar-track {
  background: #f4d799;
}

.editor::-webkit-scrollbar-thumb {
  background: #33322e;
  border-radius: 5px;
}

.sidebar::-webkit-scrollbar {
  width: 8px;
}

.sidebar::-webkit-scrollbar-track {
  background: #33322e;
}

.sidebar::-webkit-scrollbar-thumb {
  background: #f9f3e5;
  border-radius: 4px;
}

.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 100%;
  color: #33322e;
  opacity: 0.5;
  font-size: 24px;
  text-align: center;
}

.empty-state i {
  font-size: 80px;
  margin-bottom: 20px;
}

.modal {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(51, 50, 46, 0.8);
  z-index: 10000;
  align-items: center;
  justify-content: center;
}

.modal.show {
  display: flex;
}

.modal-content {
  background: #f9f3e5;
  border: 4px solid #33322e;
  border-radius: 15px;
  width: 400px;
  box-shadow: 8px 8px 0px #33322e;
}

.modal-header {
  padding: 20px;
  font-size: 24px;
  font-weight: bold;
  border-bottom: 3px solid #33322e;
  color: #33322e;
}

.modal-body {
  padding: 30px 20px;
  font-size: 16px;
  color: #33322e;
}

.modal-footer {
  padding: 15px 20px;
  display: flex;
  gap: 10px;
  justify-content: flex-end;
  border-top: 3px solid #33322e;
}

.modal-btn {
  padding: 10px 20px;
  border: 2px solid #33322e;
  border-radius: 8px;
  font-family: "Roboto", sans-serif;
  font-weight: bold;
  cursor: pointer;
  transition: all 0.2s ease;
}

.modal-btn.cancel {
  background: #d0f4f0;
  color: #33322e;
}

.modal-btn.confirm {
  background: #f6a89e;
  color: #33322e;
}

.modal-btn:hover {
  transform: translateY(-2px);
  box-shadow: 3px 3px 0px #33322e;
}

.modal-input {
  width: 100%;
  padding: 12px;
  border: 2px solid #33322e;
  border-radius: 8px;
  font-family: "Roboto", sans-serif;
  font-size: 16px;
  color: #33322e;
  background: #fff;
  outline: none;
}

.modal-input:focus {
  border-color: #8cd4cb;
  box-shadow: 0 0 0 3px rgba(140, 212, 203, 0.3);
}

.modal-color {
  width: 100%;
  height: 50px;
  border: 2px solid #33322e;
  border-radius: 8px;
  cursor: pointer;
  display: none;
}

.modal-color.show {
  display: block;
}

@media (max-width: 768px) {
  body {
    flex-direction: column;
    overflow-x: hidden;
    height: 100vh;
  }

  .sidebar {
    width: 100%;
    max-height: 200px;
    border-right: none;
    border-bottom: 4px solid #f9f3e5;
    overflow-x: hidden;
    flex-shrink: 0;
  }

  .main-content {
    flex: 1;
    overflow-x: hidden;
    min-height: 0;
  }

  .toolbar {
    padding: 8px 10px;
    gap: 3px;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    white-space: nowrap;
    scrollbar-width: none;
    -ms-overflow-style: none;
  }
  
  .toolbar::-webkit-scrollbar {
    display: none;
  }

  .tool-btn {
    width: 32px;
    height: 32px;
    font-size: 12px;
  }

  .format-select {
    padding: 6px 10px;
    font-size: 12px;
  }

  .note-title {
    padding: 15px 20px;
    font-size: 24px;
  }

  .editor {
    padding: 20px;
    font-size: 16px;
  }

  .modal-content {
    width: 90%;
    max-width: 350px;
  }
}

@media (max-width: 480px) {
  body {
    height: 100vh;
    overflow: hidden;
  }
  
  .sidebar {
    padding: 15px;
    max-height: 180px;
    overflow-x: hidden;
  }

  .new-note-btn {
    padding: 12px;
    font-size: 14px;
  }

  .note-item {
    padding: 10px;
  }

  .note-item-title {
    font-size: 12px;
  }

  .note-item-preview {
    font-size: 11px;
  }

  .toolbar {
    padding: 6px 8px;
    gap: 2px;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    white-space: nowrap;
    scrollbar-width: none;
    -ms-overflow-style: none;
  }
  
  .toolbar::-webkit-scrollbar {
    display: none;
  }

  .tool-btn {
    width: 28px;
    height: 28px;
    font-size: 11px;
  }

  .format-select {
    padding: 5px 8px;
    font-size: 11px;
  }

  .separator {
    height: 25px;
    margin: 0 3px;
  }

  .note-title {
    padding: 12px 15px;
    font-size: 20px;
  }

  .editor {
    padding: 15px;
    font-size: 14px;
  }

  .empty-state {
    font-size: 18px;
  }

  .empty-state i {
    font-size: 60px;
  }

  .modal-content {
    width: 95%;
  }

  .modal-header {
    padding: 15px;
    font-size: 20px;
  }

  .modal-body {
    padding: 20px 15px;
    font-size: 14px;
  }

  .modal-footer {
    padding: 12px 15px;
  }

  .modal-btn {
    padding: 8px 15px;
    font-size: 14px;
  }
}
