:root {
  --main-color: #ffffff;
  --add-button-back: #f6f8fa;
  --main-border-color: #ddd;
  --white-black-color: #f6f8fa;
  --black-color: #1f2328;
  --hamburger-border: #30363d;
  --hamburger-fill: #848d97;
  --x-button-hov-back: #eef1f4;
  --x-button-hov-fill: #1f2328;
  --sidebar-background: #ffffff;
  --anchor-color: #0064ff;
}

* {
  box-sizing: border-box;
  padding: 0;
  margin: 0;
  -webkit-tap-highlight-color: transparent;
}

body {
  font-family: "Cairo", sans-serif;
  background-color: var(--main-color);
  min-height: 100vh;
  position: relative;
  padding-top: 80px;
  padding-bottom: 70px;

  &.sidebar-open {
    overflow: hidden;

    .overlay {
      opacity: 0.5;
      pointer-events: auto;
    }
  }

  @media (max-width: 240px) {
    padding-bottom: 100px;
  }

  .overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: black;
    pointer-events: none;
    opacity: 0;
    z-index: 999;
    transition: opacity 0.5s;
  }

  header {
    background-color: var(--white-black-color);
    color: var(--black-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-bottom: 1px solid var(--main-border-color);
    padding: 10px 0;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    z-index: 1;

    .hamburger {
      cursor: pointer;
      display: none;
      width: 2rem;
      height: 2rem;
      border-radius: 0.375rem;
      border: 1px solid var(--hamburger-border);
      background: transparent;
      align-items: center;
      justify-content: center;
      margin-left: 20px;

      @media (max-width: 700px) {
        display: flex;
      }

      &:hover {
        background-color: var(--x-button-hov-back);

        svg path {
          fill: var(--x-button-hov-fill);
        }
      }

      svg {
        height: 16px;
        width: 16px;

        path {
          fill: var(--hamburger-fill);
        }
      }
    }

    .titled-logo {
      display: flex;
      align-items: center;
      gap: 10px;
      margin-left: 20px;

      @media (max-width: 700px) {
        margin-left: 0;
      }

      img {
        width: 40px;
        height: 40px;

        @media (max-width: 200px) {
          width: 0;
        }
      }

      h1 {
        font-size: 20px;
        font-weight: 500;

        @media (max-width: 330px) {
          display: none;
        }
      }
    }

    .switch {
      font-size: 12px;
      position: relative;
      margin-right: 20px;
      width: 3.5em;

      input {
        opacity: 0;
        width: 0;
        height: 0;
      }

      .slider {
        position: absolute;
        cursor: pointer;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        background-color: #522ba7;
        border-radius: 30px;

        &:before {
          position: absolute;
          content: "";
          height: 1.4em;
          width: 1.4em;
          border-radius: 50%;
          right: 10%;
          bottom: 15%;
          box-shadow: inset 15px -4px 0px 15px #fff000;
          transition: 0.5s;
        }
      }

      .mode-input:checked + .slider {
        background-color: #28096b;
      }

      .mode-input:checked + .slider:before {
        transform: translateX(-100%);
        box-shadow: inset 8px -4px 0px 0px #fff000;
      }
    }
  }

  .left,
  .right,
  section {
    border: 1px solid var(--main-border-color);
    border-radius: 10px;
    padding: 20px;
    height: fit-content;
  }

  .left,
  .right {
    width: 250px;
    flex-shrink: 0;
    position: sticky;
    top: 80px;
  }

  .right {
    margin-right: 20px;

    @media (max-width: 1000px) {
      display: none;
    }
  }

  .left {
    margin-left: 20px;

    @media (max-width: 700px) {
      width: 0;
      height: 100vh;
      position: fixed;
      top: 0;
      left: 0;
      padding: 0;
      border: 0;
      transition: width 0.4s;
      z-index: 1000;
      background-color: var(--sidebar-background);
      border-radius: 0 10px 10px 0;
      margin-left: 0;
      overflow: hidden;
    }

    .sidebar-header {
      display: flex;
      justify-content: space-between;
      padding: 20px;

      img,
      .sidebar-x {
        width: 2rem;
        height: 2rem;
      }

      .sidebar-x {
        background-color: transparent;
        border: none;
        display: flex;
        align-items: center;
        justify-content: center;
        cursor: pointer;
        transition: 0.4s;
        border-radius: 0.375rem;

        &:hover {
          background-color: var(--x-button-hov-back);

          svg path {
            fill: var(--x-button-hov-fill);
          }
        }

        svg {
          height: 16px;

          path {
            fill: var(--hamburger-fill);
          }
        }
      }
    }

    .content {
      overflow: hidden auto;
      max-height: calc(100vh - 100px);
      width: 210px;

      @media (max-width: 700px) {
        width: 250px;
      }
      @media (max-width: 250px) {
        width: 100%;
      }

      &::-webkit-scrollbar {
        display: none;
      }
    }

    .picker {
      display: flex;
      flex-direction: column;
      gap: 5px;
      margin-bottom: 20px;

      @media (max-width: 700px) {
        padding: 0 20px;
      }

      .pick {
        display: flex;
        flex-wrap: wrap;
      }

      input,
      select,
      label {
        width: 70px;
        height: 27px;
        cursor: pointer;
      }

      select {
        outline: none;
      }

      label {
        color: var(--black-color);
      }
    }
  }

  .category-header {
    font-weight: bold;
    border-bottom: 1px solid var(--hamburger-border);
    margin-bottom: 5px;
    color: var(--black-color);

    @media (max-width: 250px) {
      text-align: center;
    }
  }

  .page-content {
    display: flex;
    max-width: 1700px;
    margin: 0 auto;

    & .left .sidebar-header {
      display: none;
    }

    section {
      width: 100%;
      margin: 0 20px;

      .notes {
        display: grid;
        grid-template-columns: repeat(4, minmax(0, 1fr));
        grid-column-gap: 3%;
        grid-row-gap: 24px;

        @media (max-width: 1500px) {
          grid-template-columns: repeat(3, minmax(0, 1fr));
        }

        @media (max-width: 1200px) {
          grid-template-columns: repeat(2, minmax(0, 1fr));
        }

        @media (max-width: 450px) {
          grid-template-columns: repeat(1, minmax(0, 1fr));
        }

        .note {
          padding-bottom: 20px;
        }

        .card {
          height: 250px;
          border-radius: 10px;
          overflow: hidden;
          position: relative;

          .color {
            float: left;
            height: 25px;
            width: calc(100% / 6);
            cursor: pointer;
          }

          textarea {
            width: 100%;
            height: calc(100% - 25px);
            padding: 20px;
            border: none;
            outline: none;
            resize: none;
            overflow: hidden auto;

            &::placeholder {
              color: white;
              opacity: 0.8;
              font-size: 18px;
              font-weight: normal;
              font-family: "Cairo", sans-serif;
            }

            &::-webkit-scrollbar {
              display: block;
              width: 10px;
            }

            &::-webkit-scrollbar-thumb {
              background-color: #522ba7;
            }

            &::-webkit-scrollbar-thumb:hover {
              background-color: #28096b;
              cursor: default;
            }
          }

          .del-btn {
            position: absolute;
            bottom: -50px;
            right: 0;
            z-index: 999;
            background-color: var(--black-color);
            color: var(--white-black-color);
            padding: 10px;
            border: none;
            border-radius: 10px 0 0 0;
            cursor: pointer;
            transition: 0.2s ease;
          }

          &:hover .del-btn {
            bottom: 0;
          }
        }

        .add-btn {
          --add-button-color: #9e9e9e;
          border: 3px dashed var(--add-button-color);
          background-color: var(--add-button-back);
          font-size: 100px;
          color: var(--add-button-color);
          cursor: pointer;

          @media (max-width: 180px) {
            font-size: 50px;
          }

          &:hover {
            color: grey;
          }
        }
      }

      & .category-header {
        margin-top: 30px;
      }
    }

    .notes-counter {
      div {
        color: var(--black-color);
        padding: 5px;
        font-size: 15px;
        display: flex;
        align-items: center;

        @media (max-width: 210px) {
          flex-direction: column;
          text-align: center;
        }

        span {
          height: 20px;
          width: 20px;
          margin-right: 11px;

          @media (max-width: 210px) {
            margin-right: 0;
          }
        }
      }
    }
  }

  footer {
    padding: 10px;
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    text-align: center;
    background-color: var(--white-black-color);
    color: var(--black-color);
    border-top: 1px solid var(--main-border-color);

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

      &:hover {
        text-decoration: underline;
      }
    }
  }

  &:has(.mode-input:checked) {
    --main-color: #171717;
    --add-button-back: #0d1117;
    --main-border-color: #4e4e4e;
    --white-black-color: black;
    --black-color: white;
    --hamburger-border: #d0d7de;
    --hamburger-fill: #636c76;
    --x-button-hov-back: #292e36;
    --x-button-hov-fill: #e6edf3;
    --sidebar-background: #161b22;
    --anchor-color: #1890ff;
  }
}
