@import url("https://fonts.googleapis.com/css2?family=Space+Grotesk:wght@300;400;500;600;700&display=swap");

:root {
  --color-bg: #ffffff;
  --color-sidebar-bg: #f0f0f0;
  --color-sidebar-hover: #635858;
  --color-sidebar-item: #e6e6e6;
  --color-btn-new: #2b5a34;
  --color-btn-save: #4caf50;
  --color-btn-delete: #e00d0d;
  --color-text: #111;
  --color-text-light: #000;
  --border-radius: 10px;
  --padding: 15px;
  --gap: 15px;
  --font-family: "Space Grotesk", sans-serif;
  --font-size-base: 16px;
  --icon-size: 20px;
}

body.dark {
  --color-bg: #000000;
  --color-sidebar-bg: #0a160c;
  --color-sidebar-hover: #3aa24a;
  --color-sidebar-item: #1d3d22;
  --color-text: #e6ffe6;
  --color-text-light: #ffffff;
}

body {
  height: 100vh;
  background-color: var(--color-bg);
  color: var(--color-text);
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  font-family: var(--font-family);
}

.app-container {
  display: flex;
  height: 100vh;
  overflow: hidden;
  gap: var(--gap);
}

.sidebar {
  width: 280px;
  background-color: var(--color-sidebar-bg);
  color: var(--color-text-light);
  display: flex;
  flex-direction: column;
  padding: var(--padding);
  gap: var(--gap);
}

.btn-new-note {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px var(--padding);
  background-color: var(--color-btn-new);
  border: none;
  border-radius: var(--border-radius);
  cursor: pointer;
  color: white;
  font-weight: 600;
  font-size: 17px;
  transition: background 0.2s ease, transform 0.1s ease;
}

.note-list {
  flex-grow: 1;
  display: flex;
  flex-direction: column;
  gap: 10px;
  overflow-y: auto;
  padding-right: 4px;
}

.note-item {
  padding: 15px;
  background-color: var(--color-sidebar-item);
  border-radius: var(--border-radius);
  cursor: pointer;
  transition: background 0.2s ease;
  height: 120px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

.note-item.selected {
  background-color: #b7d6b8;
}

.note-title {
  font-size: 16px;
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.note-preview {
  font-size: 14px;
  color: #444;
  display: -webkit-box;
  overflow: hidden;
}

.note-time {
  font-size: 12px;
  opacity: 0.7;
}

.editor {
  flex-grow: 1;
  display: flex;
  flex-direction: column;
  padding: var(--padding);
  gap: var(--gap);
}

.editor-header {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  align-items: center;
}

#input-title {
  flex-grow: 1;
  padding: 12px var(--padding);
  font-size: 20px;
  font-weight: 600;
  border: 1px solid #ccc;
  border-radius: var(--border-radius);
  background-color: var(--color-bg);
  color: var(--color-text);
}

.editor-buttons {
  display: flex;
  gap: 12px;
}

.btn-save,
.btn-delete {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 14px 20px;
  font-size: 16px;
  border: none;
  border-radius: 12px;
  cursor: pointer;
  color: white;
}

.btn-save {
  background-color: var(--color-btn-save);
}

.btn-delete {
  background-color: var(--color-btn-delete);
}

#input-content {
  flex-grow: 1;
  padding: var(--padding);
  font-size: 17px;
  line-height: 1.6;
  border: 1px solid #ccc;
  border-radius: var(--border-radius);
  resize: none;
  background-color: var(--color-bg);
  color: var(--color-text);
}

.icon {
  width: 24px;
  height: 24px;
}

.theme-btn {
  position: fixed;
  bottom: 20px;
  left: 20px;
  width: 45px;
  height: 45px;
  background: transparent;
  border: none;
  cursor: pointer;
  display: flex;
  justify-content: center;
  align-items: center;
}

.theme-btn svg {
  width: 30px;
  height: 30px;
  stroke: #111;
}

body.dark .note-preview {
  /* new because i forgot the color of the content */
  color: #ffffff;
}

@media (max-width: 900px) {
  .app-container {
    flex-direction: column;
    gap: 0;
  }

  .sidebar {
    width: 100%;
    flex-direction: row;
    overflow-x: auto;
    align-items: center;
  }

  .note-list {
    flex-direction: row;
    flex-wrap: nowrap;
    overflow-x: auto;
    gap: 12px;
    padding-bottom: 10px;
  }

  .note-item {
    min-width: 200px;
  }

  .editor-header {
    flex-direction: row;
    justify-content: space-between;
  }

  #input-title {
    width: 65%;
  }

  .editor-buttons {
    justify-content: flex-end;
  }
}
