:root {
  --border-color: #696868;
  --link-border-color: #9e9e9e;

  font-family: monospace;
  font-size: 16px;
  color-scheme: dark;
}

h1 {
  font-weight: 700;
  font-size: 2rem;
  margin-top: 2rem;
}

a {
  cursor: pointer;
  display: block;
  padding: 1rem 0;
  &:hover,
  &.active {
    text-decoration-line: underline;
    text-decoration-color: var(--link-border-color);
    text-underline-offset: 12px;
  }
}

.logo {
  /* TODO: add animation */
  opacity: 0.6;
  font-size: 1.6rem;
  transition: all ease-in-out 4s;
  &::before {
    transition: all ease-in-out 4s;

    content: "-/";
    opacity: 0.4;
  }
  &::after {
    transition: all ease-in-out 4s;

    content: "/-";
    opacity: 0.4;
  }
}

.main-container {
  max-width: 1440px;
  width: 94%;
  margin: 0 auto;
  display: flex;
  height: 100vh;
}

.button {
  width: 80%;
  padding: 0.8rem;
  display: block;
  border: 1px solid var(--border-color);

  &:hover {
    background-color: white;
    color: black;
  }
}

.back-button {
  display: none;
  width: auto;
  min-width: max-content;
  padding: 0.45rem 0.9rem;
  font-size: 0.72rem;
  line-height: 1;
  letter-spacing: 0.12em;
  border-width: 0.2px;
  opacity: 0.88;
  transition: all 160ms ease-in-out;
}

.back-button:hover {
  background-color: white;
  color: black;
}

@media (max-width: 820px) {
  .back-button {
    display: inline-flex;
    align-items: center;
  }
}

.sidebar {
  flex: 1.5;
  overflow-y: scroll;
  border-right: 1px solid var(--border-color);
  min-height: 100vh;
  position: relative;

  .sidebar-links {
    margin-top: 6rem;
    display: flex;
    flex-direction: column;
    text-transform: uppercase;
  }

  .folder-row {
    display: flex;
    align-items: center;
    gap: 0.6rem;
  }

  .folder-row a {
    flex: 1;
    display: block;
    padding: 1rem 0;
  }

  .folder-row .delete-button,
  .folder-row .rename-button {
    display: none;
    padding: 0.22rem 0.55rem;
    font-size: 0.62rem;
    border: 1px solid var(--border-color);
    background: transparent;
    color: inherit;
    cursor: pointer;
  }

  .folder-row.delete-mode .delete-button,
  .folder-row.delete-mode .rename-button {
    display: inline-flex;
  }

  .button.primary-button {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    margin: 0 auto;
  }

  .new-folder-input {
    display: none;
    height: 2rem;
    width: 90%;
    opacity: 0.7;
  }
}
.directories {
  flex: 1.5;
  padding: 1rem;
  border-right: 1px solid var(--border-color);

  #back-button2 {
    margin-bottom: 1.2rem;
  }

  .new-note-input {
    display: none;
  }

  .directory-links {
    display: flex;
    flex-direction: column;
    margin-top: 4rem;

    .note-row {
      display: flex;
      align-items: center;
      gap: 0.5rem;
    }

    .note-row a {
      flex: 1;
      display: block;
      padding: 1rem 0;
    }

    .note-row .delete-button {
      display: none;
      padding: 0.22rem 0.55rem;
      font-size: 0.62rem;
      border: 1px solid var(--border-color);
      background: transparent;
      color: inherit;
      cursor: pointer;
    }

    .note-row.delete-mode .delete-button {
      display: inline-flex;
    }

    a::before {
      content: "./";
      opacity: 0.5;
      margin-right: 8px;
      font-size: 13px;
    }
  }

  .dirheader {
    display: flex;
    align-items: center;
    justify-content: space-between;

    .dirtitle {
      opacity: 0.4;
      font-size: 14px;
      width: 80%;
    }

    .button.secondary-button {
      width: 20%;
      padding: 0.3rem;
      font-size: 13px;
      white-space: nowrap;
      border-width: 0.2px;
    }
  }
}

.content {
  flex: 4;
  padding: 2rem;
  height: 100vh;
  overflow-y: scroll;

  #back-button {
    margin-bottom: 1rem;
  }

  * {
    outline: none;
  }

  h1 {
    margin-bottom: 4rem;
    padding-bottom: 2rem;
    border-bottom: 2px solid var(--border-color);
  }
}

/* Responsive layout */
@media (max-width: 1200px) {
  .main-container {
    width: min(100%, 1440px);
  }

  .sidebar {
    flex: 1.1;
  }

  .directories {
    flex: 1.1;
  }

  .content {
    flex: 2.8;
  }
}

@media (max-width: 820px) {
  body {
    overflow-x: hidden;
  }

  .main-container {
    width: 100%;
    min-height: auto;
    height: auto;
    display: block;
  }

  .sidebar,
  .directories,
  .content {
    width: 100%;
    min-height: auto;
    height: auto;
    flex: none;
    border-right: none;
    border-bottom: 1px solid var(--border-color);
    overflow: visible;
  }

  .sidebar {
    display: block;
    min-height: auto;
    padding: 1rem;
  }

  .directories {
    display: none;
    padding: 1rem;
  }

  .content {
    display: none;
    padding: 1.25rem;
  }

  .sidebar .sidebar-links {
    margin-top: 2rem;
  }

  .sidebar .button.primary-button {
    position: relative;
    bottom: auto;
    left: auto;
    right: auto;
    width: 100%;
    margin-top: 1rem;
  }

  .directories .directory-links {
    margin-top: 2rem;
  }

  .directories .dirheader {
    align-items: flex-start;
    gap: 1rem;
  }

  .directories .dirheader .dirtitle {
    width: auto;
    flex: 1;
  }

  .directories .dirheader .button.secondary-button {
    width: auto;
  }

  .content h1 {
    margin-bottom: 2rem;
    padding-bottom: 1rem;
  }

  .content .content-area {
    min-height: 48vh;
  }

  .button {
    width: 100%;
  }
}

@media (max-width: 560px) {
  .logo {
    font-size: 1.25rem;
  }

  .sidebar-links a,
  .directory-links a {
    font-size: 0.9rem;
    line-height: 1.55;
  }

  .dirheader {
    flex-direction: column;
  }

  .new-note-input,
  .new-folder-input {
    width: 100%;
  }
}
