:root {
  --text-color: #282828;
  --light-color: #888;
  --background-color: #F5F5F5;
  --primary-color: #10B981;
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}
html {
  scroll-behavior: smooth;
}
body {
  font-family: 'Open Sans', Arial, sans-serif, 'Helvetica Neue', 'Helvetica';
  font-size: 16px;
  color: var(--text-color);
  background-color: var(--background-color);
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  max-width: 100%;
  overflow-x: hidden;
}

.btn {
  display: block;
  max-width: 100%;
  width: 100%;
  text-decoration: none;
  text-align: center;
  background: var(--text-color);
  color: var(--background-color);
  padding: .3rem;
  border-radius: 3px;
  font-size: 16px;
  border: none;
  margin-bottom: 1rem;
  cursor: pointer;
}
.btn:hover {
  filter: brightness(72%);
}
.btn.save {
  background:var(--primary-color);
}

/* HEADER */
header {
  padding: .5rem 1rem;
  width: 100%;
  max-width: 100%;
}
header h1 {
  font-size: 1.2rem;
  font-weight: 600;
}
header a {
  color: var(--text-color);
  text-decoration: none;
  display: flex;
  align-items: center;
  gap: 4px;
}

/* MAIN */
main {
  max-width: 980px;
  width: 100%;
  margin: 0 auto;
  padding: 4rem 0;
  position: relative;
  flex: 1;
  display: flex;
  gap: 1rem;
}
.alert {
  padding: 4px;
  margin: 10px 0;
  border-radius: 3px;
  font-size: 12px;
  color: var(--text-color);
  max-width: max-content;
  position: absolute;
  top: 0;
  font-style: italic;
}
.alert.success { background: #d4edda;  border: 1px solid #c3e6cb; }
.alert.error { background: #f8d7da; border: 1px solid #f5c6cb; }
#note-form {
  width: 80%;
  min-width: 400px;
  max-width: 780px;
  border-right: 1px solid #ddd;
}
textarea {
  width: 100%;
  font-family: 'Open Sans', Arial, sans-serif, 'Helvetica Neue', 'Helvetica';
  font-size: 16px;
  color: var(--text-color);
  background: var(--background-color);
  margin-top: 2.5rem;
  border: none;
  outline: none;
  resize: none;
  overflow: hidden;
}
#sidebar {
  width: 20%;
  min-width: 120px;
  max-width: 200px;
  max-height: 500px;
}
.note-item {
  margin: 10px 0;
  padding: 4px 0;
  cursor: pointer;
  border-radius: 3px;
  display: flex;
  align-items: center;
  position: relative;
}
.note-item:hover {
  background: #ddd;
}
.note-item.active {
  background: #ddd;
}
.note-item.active .star,
.note-item.favorite .star {
  display: block;
}
.star {
  display: none;
  color: var(--primary-color);
  position: absolute;
  right: 2px;
  bottom: 15%;
  cursor: pointer;
  border: none;
  background: transparent;
  font-size: 16px;
}
.note-item:hover .star {
  display: block;
}
/* NOTE PREVIEW */
.note-preview {
  flex: 1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  word-break: break-all;
  padding-right: 10px;
}

/* FOOTER */
footer{
  display: flex;
  justify-content: space-between;
  padding: 10px;
}
footer a {
  color: var(--light-color);
}
footer a:hover {
  text-decoration: none;
}
small {
  color: var(--light-color);
  display: block;
}

@media (max-width: 992px) {
  main {
    flex-direction: column;
    padding: 1rem;
  }
  #note-form {
    width: 100%;
    min-width: 100%;
    border-right: none;
  }
  #sidebar {
    width: 100%;
    max-width: 100%;
  }
}
@media (max-width: 768px) {
  footer {
    flex-direction: column;
    align-items: center;
    gap: 1rem;
  }
}
